|
4 | 4 | using ASCompletion.Settings;
|
5 | 5 | using NavigationBar.Helpers;
|
6 | 6 | using PluginCore;
|
| 7 | +using PluginCore.Controls; |
7 | 8 | using PluginCore.Helpers;
|
8 | 9 | using PluginCore.Localization;
|
9 | 10 | using ScintillaNet;
|
10 | 11 | using System;
|
11 | 12 | using System.Collections.Generic;
|
12 | 13 | using System.Drawing;
|
| 14 | +using System.Drawing.Drawing2D; |
13 | 15 | using System.Reflection;
|
14 | 16 | using System.Windows.Forms;
|
15 | 17 |
|
16 | 18 | namespace NavigationBar.Controls
|
17 | 19 | {
|
18 |
| - public partial class NavigationBar : ToolStrip, IDisposable |
| 20 | + public partial class NavigationBar : ToolStripEx, IDisposable |
19 | 21 | {
|
20 |
| - private static ImageList _icons = null; |
| 22 | + private static Bitmap[] _icons = null; |
21 | 23 | private bool _updating = false;
|
22 | 24 | private int _lastPosition = -1;
|
23 | 25 | private bool _textChanged = false;
|
@@ -91,54 +93,55 @@ private void InitializeComponent()
|
91 | 93 | _dropDownSearchTimer.Tick += new EventHandler(dropDownSearchTimer_Tick);
|
92 | 94 | _dropDownSearchKey = "";
|
93 | 95 |
|
94 |
| - // |
| 96 | + // |
95 | 97 | // importComboBox
|
96 |
| - // |
| 98 | + // |
97 | 99 | importComboBox.ComboBox.DrawMode = DrawMode.OwnerDrawFixed;
|
98 | 100 | importComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
| 101 | + importComboBox.Margin = new Padding(0, 0, 0, 0); |
99 | 102 | importComboBox.MaxDropDownItems = 25;
|
100 | 103 | importComboBox.Name = "importComboBox";
|
101 | 104 | importComboBox.ComboBox.DrawItem += new DrawItemEventHandler(comboBox_DrawItem);
|
102 | 105 | importComboBox.ComboBox.SelectionChangeCommitted += new EventHandler(comboBox_SelectionChangeCommitted);
|
103 | 106 | importComboBox.KeyPress += new KeyPressEventHandler(comboBox_KeyPress);
|
104 | 107 | importComboBox.DropDownClosed += new EventHandler(comboBox_DropDownClosed);
|
105 |
| - // |
| 108 | + // |
106 | 109 | // classComboBox
|
107 |
| - // |
| 110 | + // |
108 | 111 | classComboBox.ComboBox.DrawMode = DrawMode.OwnerDrawFixed;
|
109 | 112 | classComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
| 113 | + classComboBox.Margin = new Padding(0, 0, 0, 0); |
110 | 114 | classComboBox.MaxDropDownItems = 25;
|
111 | 115 | classComboBox.Name = "classComboBox";
|
112 | 116 | classComboBox.ComboBox.DrawItem += new DrawItemEventHandler(comboBox_DrawItem);
|
113 | 117 | classComboBox.ComboBox.SelectionChangeCommitted += new EventHandler(comboBox_SelectionChangeCommitted);
|
114 | 118 | classComboBox.KeyPress += new KeyPressEventHandler(comboBox_KeyPress);
|
115 | 119 | classComboBox.DropDownClosed += new EventHandler(comboBox_DropDownClosed);
|
116 |
| - // |
| 120 | + // |
117 | 121 | // memberComboBox
|
118 |
| - // |
| 122 | + // |
119 | 123 | memberComboBox.ComboBox.DrawMode = DrawMode.OwnerDrawFixed;
|
120 | 124 | memberComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
| 125 | + memberComboBox.Margin = new Padding(0, 0, 0, 0); |
121 | 126 | memberComboBox.MaxDropDownItems = 25;
|
122 | 127 | memberComboBox.Name = "memberComboBox";
|
123 |
| - memberComboBox.Padding = new Padding(0, 0, 0, 1); |
124 | 128 | memberComboBox.ComboBox.DrawItem += new DrawItemEventHandler(comboBox_DrawItem);
|
125 | 129 | memberComboBox.ComboBox.SelectionChangeCommitted += new EventHandler(comboBox_SelectionChangeCommitted);
|
126 | 130 | memberComboBox.KeyPress += new KeyPressEventHandler(comboBox_KeyPress);
|
127 | 131 | memberComboBox.DropDownClosed += new EventHandler(comboBox_DropDownClosed);
|
128 |
| - // |
| 132 | + // |
129 | 133 | // updateTimer
|
130 |
| - // |
| 134 | + // |
131 | 135 | updateTimer.Tick += new EventHandler(updateTimer_Tick);
|
132 |
| - // |
| 136 | + // |
133 | 137 | // NavigationBar
|
134 |
| - // |
| 138 | + // |
135 | 139 | CanOverflow = false;
|
136 | 140 | Dock = DockStyle.Top;
|
137 | 141 | GripStyle = ToolStripGripStyle.Hidden;
|
138 | 142 | Items.AddRange(new ToolStripItem[] {
|
139 | 143 | importComboBox, classComboBox, memberComboBox });
|
140 | 144 | Name = "NavigationBar";
|
141 |
| - Padding = new Padding(1, 1, 2, 2); |
142 | 145 | Stretch = true;
|
143 | 146 | Visible = false;
|
144 | 147 | ResumeLayout(false);
|
@@ -176,46 +179,43 @@ private void InitializeContextMenu()
|
176 | 179 | private void InitializeIcons()
|
177 | 180 | {
|
178 | 181 | //Pull the member icons from the resources;
|
179 |
| - _icons = new ImageList(); |
180 |
| - _icons.TransparentColor = Color.Transparent; |
181 |
| - _icons.ImageSize = ScaleHelper.Scale(new Size(16, 16)); |
182 |
| - _icons.Images.AddRange(new Bitmap[] { |
183 |
| - new Bitmap(PluginUI.GetStream("FilePlain.png")), |
184 |
| - new Bitmap(PluginUI.GetStream("FolderClosed.png")), |
185 |
| - new Bitmap(PluginUI.GetStream("FolderOpen.png")), |
186 |
| - new Bitmap(PluginUI.GetStream("CheckAS.png")), |
187 |
| - new Bitmap(PluginUI.GetStream("QuickBuild.png")), |
188 |
| - new Bitmap(PluginUI.GetStream("Package.png")), |
189 |
| - new Bitmap(PluginUI.GetStream("Interface.png")), |
190 |
| - new Bitmap(PluginUI.GetStream("Intrinsic.png")), |
191 |
| - new Bitmap(PluginUI.GetStream("Class.png")), |
192 |
| - new Bitmap(PluginUI.GetStream("Variable.png")), |
193 |
| - new Bitmap(PluginUI.GetStream("VariableProtected.png")), |
194 |
| - new Bitmap(PluginUI.GetStream("VariablePrivate.png")), |
195 |
| - new Bitmap(PluginUI.GetStream("VariableStatic.png")), |
196 |
| - new Bitmap(PluginUI.GetStream("VariableStaticProtected.png")), |
197 |
| - new Bitmap(PluginUI.GetStream("VariableStaticPrivate.png")), |
198 |
| - new Bitmap(PluginUI.GetStream("Const.png")), |
199 |
| - new Bitmap(PluginUI.GetStream("ConstProtected.png")), |
200 |
| - new Bitmap(PluginUI.GetStream("ConstPrivate.png")), |
201 |
| - new Bitmap(PluginUI.GetStream("Const.png")), |
202 |
| - new Bitmap(PluginUI.GetStream("ConstProtected.png")), |
203 |
| - new Bitmap(PluginUI.GetStream("ConstPrivate.png")), |
204 |
| - new Bitmap(PluginUI.GetStream("Method.png")), |
205 |
| - new Bitmap(PluginUI.GetStream("MethodProtected.png")), |
206 |
| - new Bitmap(PluginUI.GetStream("MethodPrivate.png")), |
207 |
| - new Bitmap(PluginUI.GetStream("MethodStatic.png")), |
208 |
| - new Bitmap(PluginUI.GetStream("MethodStaticProtected.png")), |
209 |
| - new Bitmap(PluginUI.GetStream("MethodStaticPrivate.png")), |
210 |
| - new Bitmap(PluginUI.GetStream("Property.png")), |
211 |
| - new Bitmap(PluginUI.GetStream("PropertyProtected.png")), |
212 |
| - new Bitmap(PluginUI.GetStream("PropertyPrivate.png")), |
213 |
| - new Bitmap(PluginUI.GetStream("PropertyStatic.png")), |
214 |
| - new Bitmap(PluginUI.GetStream("PropertyStaticProtected.png")), |
215 |
| - new Bitmap(PluginUI.GetStream("PropertyStaticPrivate.png")), |
216 |
| - new Bitmap(PluginUI.GetStream("Template.png")), |
217 |
| - new Bitmap(PluginUI.GetStream("Declaration.png")) |
218 |
| - }); |
| 182 | + _icons = new Bitmap[] { |
| 183 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("FilePlain.png"))), |
| 184 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("FolderClosed.png"))), |
| 185 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("FolderOpen.png"))), |
| 186 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("CheckAS.png"))), |
| 187 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("QuickBuild.png"))), |
| 188 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Package.png"))), |
| 189 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Interface.png"))), |
| 190 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Intrinsic.png"))), |
| 191 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Class.png"))), |
| 192 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Variable.png"))), |
| 193 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("VariableProtected.png"))), |
| 194 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("VariablePrivate.png"))), |
| 195 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("VariableStatic.png"))), |
| 196 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("VariableStaticProtected.png"))), |
| 197 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("VariableStaticPrivate.png"))), |
| 198 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Const.png"))), |
| 199 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("ConstProtected.png"))), |
| 200 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("ConstPrivate.png"))), |
| 201 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Const.png"))), |
| 202 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("ConstProtected.png"))), |
| 203 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("ConstPrivate.png"))), |
| 204 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Method.png"))), |
| 205 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("MethodProtected.png"))), |
| 206 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("MethodPrivate.png"))), |
| 207 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("MethodStatic.png"))), |
| 208 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("MethodStaticProtected.png"))), |
| 209 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("MethodStaticPrivate.png"))), |
| 210 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Property.png"))), |
| 211 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("PropertyProtected.png"))), |
| 212 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("PropertyPrivate.png"))), |
| 213 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("PropertyStatic.png"))), |
| 214 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("PropertyStaticProtected.png"))), |
| 215 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("PropertyStaticPrivate.png"))), |
| 216 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Template.png"))), |
| 217 | + ScaleHelper.Scale(new Bitmap(PluginUI.GetStream("Declaration.png"))) |
| 218 | + }; |
219 | 219 | }
|
220 | 220 |
|
221 | 221 | public static System.IO.Stream GetStream(string name)
|
@@ -296,7 +296,7 @@ private void UpdateSortMenu()
|
296 | 296 | _sortSortedItem.Checked = _settings.MemberSortMethod == OutlineSorting.Sorted ? true : false;
|
297 | 297 | _sortByKindItem.Checked = _settings.MemberSortMethod == OutlineSorting.SortedByKind ||
|
298 | 298 | _settings.MemberSortMethod == OutlineSorting.SortedGroup ? true : false;
|
299 |
| - _sortSmartItem.Checked = _settings.MemberSortMethod == OutlineSorting.SortedSmart ? true : false; |
| 299 | + _sortSmartItem.Checked = _settings.MemberSortMethod == OutlineSorting.SortedSmart ? true : false; |
300 | 300 | }
|
301 | 301 |
|
302 | 302 | #endregion
|
@@ -388,7 +388,7 @@ void updateTimer_Tick(object sender, EventArgs e)
|
388 | 388 |
|
389 | 389 | void _scintella_UpdateUI(ScintillaControl sender)
|
390 | 390 | {
|
391 |
| - // The caret may have moved |
| 391 | + // The caret may have moved |
392 | 392 | UpdateNavigationBar();
|
393 | 393 | }
|
394 | 394 |
|
@@ -461,23 +461,23 @@ private void comboBox_DrawItem(object sender, DrawItemEventArgs e)
|
461 | 461 | {
|
462 | 462 | MemberTreeNode node = comboBox.Items[e.Index] as MemberTreeNode;
|
463 | 463 |
|
464 |
| - int imageWidth = _icons.ImageSize.Width; |
465 |
| - int imageHeight = _icons.ImageSize.Height; |
| 464 | + int imageWidth = _icons[0].Width; |
| 465 | + int imageHeight = _icons[0].Height; |
466 | 466 |
|
467 | 467 | // Clear the old background
|
468 | 468 | if ((e.State & DrawItemState.ComboBoxEdit) == 0)
|
469 | 469 | e.Graphics.FillRectangle(new SolidBrush(comboBox.BackColor), e.Bounds.Left + imageWidth, e.Bounds.Top, e.Bounds.Width - imageWidth, e.Bounds.Height);
|
470 | 470 |
|
471 | 471 | // Draw the item image
|
472 |
| - e.Graphics.DrawImage(_icons.Images[node.ImageIndex], new Rectangle(e.Bounds.Left, e.Bounds.Top, imageWidth, imageHeight)); |
| 472 | + e.Graphics.DrawImage(_icons[node.ImageIndex], new Rectangle(e.Bounds.Left, e.Bounds.Top, imageWidth, imageHeight)); |
473 | 473 |
|
474 | 474 | // Is this item being hovered over?
|
475 | 475 | if ((e.State & DrawItemState.Focus) != 0 ||
|
476 | 476 | (e.State & DrawItemState.Selected) != 0)
|
477 | 477 | {
|
478 | 478 | // Draw a selection box and label in the selection text color
|
479 |
| - e.Graphics.FillRectangle(new SolidBrush(SystemColors.Highlight), e.Bounds.Left + imageWidth, e.Bounds.Top, e.Bounds.Width - imageWidth - 1, e.Bounds.Height - 1); |
480 |
| - e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.Black)), e.Bounds.Left + imageWidth, e.Bounds.Top, e.Bounds.Width - imageWidth - 1, e.Bounds.Height - 1); |
| 479 | + e.Graphics.FillRectangle(new SolidBrush(SystemColors.Highlight), e.Bounds.Left + imageWidth + 1, e.Bounds.Top + 1, e.Bounds.Width - imageWidth - 2, e.Bounds.Height - 2); |
| 480 | + e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.Black)), e.Bounds.Left + imageWidth + 1, e.Bounds.Top + 1, e.Bounds.Width - imageWidth - 2, e.Bounds.Height - 2); |
481 | 481 |
|
482 | 482 | e.Graphics.DrawString(node.Label, comboBox.Font, new SolidBrush(SystemColors.HighlightText), new Point(e.Bounds.Left + imageWidth + 1, e.Bounds.Top));
|
483 | 483 | }
|
|
0 commit comments