Browse Source

Added workaround for TreeView bug when drawing selected nodes when the treeview does not have focus.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@803 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
88aee1b29e
  1. 15
      src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs
  2. 12
      src/Main/Core/Project/Src/AddInTree/AddInTree.cs
  3. 2
      src/Main/Core/Project/Src/AddInTree/CoreStartup.cs

15
src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs

@ -278,9 +278,24 @@ namespace ICSharpCode.SharpDevelop.Gui
if (node != null && !node.DrawDefault) { if (node != null && !node.DrawDefault) {
node.Draw(e); node.Draw(e);
e.DrawDefault = false; e.DrawDefault = false;
} else {
if ((e.State & (TreeNodeStates.Selected | TreeNodeStates.Focused)) == TreeNodeStates.Selected) {
// node is selected, but not focussed:
// HACK: work around TreeView bug in OwnerDrawText mode:
// overpaint blue selection with the correct gray selection
e.Graphics.FillRectangle(SystemBrushes.Control, e.Bounds);
if (e.Node.ForeColor.IsEmpty) {
e.Graphics.DrawString(e.Node.Text, this.Font, SystemBrushes.ControlText, e.Bounds.Location);
} else {
using (Brush brush = new SolidBrush(e.Node.ForeColor)) {
e.Graphics.DrawString(e.Node.Text, this.Font, brush, e.Bounds.Location);
}
}
e.DrawDefault = false;
} else { } else {
e.DrawDefault = true; e.DrawDefault = true;
} }
}
} else { } else {
e.DrawDefault = false; e.DrawDefault = false;
} }

12
src/Main/Core/Project/Src/AddInTree/AddInTree.cs

@ -212,13 +212,22 @@ namespace ICSharpCode.Core
} }
} }
public static void Load(List<string> addInFiles) public static void Load(List<string> addInFiles, List<string> disabledAddIns)
{ {
List<AddIn> list = new List<AddIn>(); List<AddIn> list = new List<AddIn>();
Dictionary<string, Version> dict = new Dictionary<string, Version>(); Dictionary<string, Version> dict = new Dictionary<string, Version>();
Dictionary<string, AddIn> addInDict = new Dictionary<string, AddIn>(); Dictionary<string, AddIn> addInDict = new Dictionary<string, AddIn>();
foreach (string fileName in addInFiles) { foreach (string fileName in addInFiles) {
AddIn addIn = AddIn.Load(fileName); AddIn addIn = AddIn.Load(fileName);
if (disabledAddIns != null && disabledAddIns.Count > 0) {
foreach (string name in addIn.Manifest.Identities.Keys) {
if (disabledAddIns.Contains(name)) {
addIn.enabled = false;
break;
}
}
}
if (addIn.Enabled) {
foreach (KeyValuePair<string, Version> pair in addIn.Manifest.Identities) { foreach (KeyValuePair<string, Version> pair in addIn.Manifest.Identities) {
if (dict.ContainsKey(pair.Key)) { if (dict.ContainsKey(pair.Key)) {
MessageService.ShowError("Name '" + pair.Key + "' is used by " + MessageService.ShowError("Name '" + pair.Key + "' is used by " +
@ -230,6 +239,7 @@ namespace ICSharpCode.Core
addInDict.Add(pair.Key, addIn); addInDict.Add(pair.Key, addIn);
} }
} }
}
list.Add(addIn); list.Add(addIn);
} }
checkDependencies: checkDependencies:

2
src/Main/Core/Project/Src/AddInTree/CoreStartup.cs

@ -138,7 +138,7 @@ namespace ICSharpCode.Core
public void RunInitialization() public void RunInitialization()
{ {
AddInTree.Load(addInFiles); AddInTree.Load(addInFiles, disabledAddIns);
// run workspace autostart commands // run workspace autostart commands
LoggingService.Info("Running autostart commands..."); LoggingService.Info("Running autostart commands...");

Loading…
Cancel
Save