Browse Source

Improved toolbar refresh.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@11 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mike Krüger 21 years ago
parent
commit
ba7dc7ca57
  1. 18
      src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs
  2. 8
      src/Main/Base/Project/Src/Project/MSBuildProject.cs
  3. 22
      src/Main/Core/Project/Src/AddInTree/AddIn/StandardErbauer/ToolBarItem/Gui/ToolBarCommand.cs

18
src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

@ -471,12 +471,24 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -471,12 +471,24 @@ namespace ICSharpCode.SharpDevelop.Gui
{
if (ToolBars != null) {
foreach (ToolStrip ToolStrip in ToolBars) {
bool doRefresh = false;
foreach (ToolStripItem item in ToolStrip.Items) {
if (item is IStatusUpdate) {
((IStatusUpdate)item).UpdateStatus();
bool wasVisible = item.Visible;
if (item is ToolBarCommand) {
ToolBarCommand toolBarCommand = (ToolBarCommand)item;
doRefresh |= toolBarCommand.LastEnabledStatus != toolBarCommand.CurrentEnableStatus;
toolBarCommand.UpdateStatus();
} else {
if (item is IStatusUpdate) {
((IStatusUpdate)item).UpdateStatus();
}
}
doRefresh |= wasVisible != item.Visible;
}
if (doRefresh) {
Console.WriteLine("Refresh TOOLBAR!!!");
ToolStrip.Refresh();
}
ToolStrip.Refresh();
}
}
}

8
src/Main/Base/Project/Src/Project/MSBuildProject.cs

@ -264,11 +264,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -264,11 +264,11 @@ namespace ICSharpCode.SharpDevelop.Project
// isDirty = TaskService.Errors != 0;
// }
//
readonly static Regex normalError = new Regex(@"(?<file>\S.*)\((?<line>\d+),(?<column>\d+)\):\s+(?<error>\w+)\s+(?<number>[\d\w]+):\s+(?<message>.*)", RegexOptions.Compiled);
readonly static Regex compilerError = new Regex(@"(?<who>[^:]*):\s+(?<error>\w+)\s+(?<number>[\d\w]+):\s+(?<message>.*)", RegexOptions.Compiled);
readonly static Regex generalError = new Regex(@"(?<error>\S.+)\s+(?<number>[\d\w]+):\s+(?<message>.*)", RegexOptions.Compiled);
readonly static Regex normalError = new Regex(@"^(?<file>\S.*)\((?<line>\d+),(?<column>\d+)\):\s+(?<error>\w+)\s+(?<number>[\d\w]+):\s+(?<message>.*)$", RegexOptions.Compiled);
readonly static Regex compilerError = new Regex(@"^(?<who>[^:]*):\s+(?<error>\w+)\s+(?<number>[\d\w]+):\s+(?<message>.*)$", RegexOptions.Compiled);
readonly static Regex generalError = new Regex(@"^(?<error>\S.+)\s+(?<number>[\d\w]+):\s+(?<message>.*)$", RegexOptions.Compiled);
readonly static Regex projectName = new Regex(@"Project\s+\""[^""]*\""[^""]*\""(?<name>[^""]*)\""", RegexOptions.Compiled);
readonly static Regex projectName = new Regex(@"^Project\s+\""[^""]*\""[^""]*\""(?<name>[^""]*)\""", RegexOptions.Compiled);
static CompilerError GetCompilerError(string line, string workingPath)

22
src/Main/Core/Project/Src/AddInTree/AddIn/StandardErbauer/ToolBarItem/Gui/ToolBarCommand.cs

@ -44,6 +44,9 @@ namespace ICSharpCode.Core @@ -44,6 +44,9 @@ namespace ICSharpCode.Core
if (Image == null && codon.Properties.Contains("icon")) {
Image = ResourceService.GetBitmap(codon.Properties["icon"]);
}
menuCommand = codon.AddIn.CreateObject(codon.Properties["class"]) as ICommand;
UpdateStatus();
}
@ -64,12 +67,9 @@ namespace ICSharpCode.Core @@ -64,12 +67,9 @@ namespace ICSharpCode.Core
// StatusBarService.SetMessage(description);
// }
public override bool Enabled {
public bool LastEnabledStatus = false;
public bool CurrentEnableStatus {
get {
if (codon == null) {
return base.Enabled;
}
ConditionFailedAction failedAction = codon.GetFailedAction(caller);
bool isEnabled = failedAction != ConditionFailedAction.Disable;
@ -77,7 +77,14 @@ namespace ICSharpCode.Core @@ -77,7 +77,14 @@ namespace ICSharpCode.Core
if (menuCommand != null && menuCommand is IMenuCommand) {
isEnabled &= ((IMenuCommand)menuCommand).IsEnabled;
}
return isEnabled;
}
}
public override bool Enabled {
get {
bool isEnabled = CurrentEnableStatus;
LastEnabledStatus = isEnabled;
return isEnabled;
}
}
@ -91,9 +98,6 @@ namespace ICSharpCode.Core @@ -91,9 +98,6 @@ namespace ICSharpCode.Core
base.Visible = isVisible;
}
}
if (menuCommand == null) {
menuCommand = codon.AddIn.CreateObject(codon.Properties["class"]) as ICommand;
}
ToolTipText = StringParser.Parse(localizedText);
}

Loading…
Cancel
Save