Browse Source

Improved toolbar refresh.

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

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

@ -471,15 +471,27 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
if (ToolBars != null) { if (ToolBars != null) {
foreach (ToolStrip ToolStrip in ToolBars) { foreach (ToolStrip ToolStrip in ToolBars) {
bool doRefresh = false;
foreach (ToolStripItem item in ToolStrip.Items) { foreach (ToolStripItem item in ToolStrip.Items) {
bool wasVisible = item.Visible;
if (item is ToolBarCommand) {
ToolBarCommand toolBarCommand = (ToolBarCommand)item;
doRefresh |= toolBarCommand.LastEnabledStatus != toolBarCommand.CurrentEnableStatus;
toolBarCommand.UpdateStatus();
} else {
if (item is IStatusUpdate) { if (item is IStatusUpdate) {
((IStatusUpdate)item).UpdateStatus(); ((IStatusUpdate)item).UpdateStatus();
} }
} }
doRefresh |= wasVisible != item.Visible;
}
if (doRefresh) {
Console.WriteLine("Refresh TOOLBAR!!!");
ToolStrip.Refresh(); ToolStrip.Refresh();
} }
} }
} }
}
// this method simply copies over the enabled state of the toolbar, // this method simply copies over the enabled state of the toolbar,
// this assumes that no item is inserted or removed. // this assumes that no item is inserted or removed.

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

@ -264,11 +264,11 @@ namespace ICSharpCode.SharpDevelop.Project
// isDirty = TaskService.Errors != 0; // 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 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 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 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) static CompilerError GetCompilerError(string line, string workingPath)

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

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

Loading…
Cancel
Save