Browse Source

SD2-378. Selected item's text in bookmark, breakpoint and search results pad now displayed using SystemColors.HighlightText.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1242 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 20 years ago
parent
commit
4808223c7b
  1. 9
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/DrawableLine.cs
  2. 12
      src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeNode.cs
  3. 8
      src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/Nodes/BookmarkNode.cs
  4. 2
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Pad/Nodes/SearchResultNode.cs

9
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/DrawableLine.cs

@ -133,7 +133,7 @@ namespace ICSharpCode.TextEditor
return spaceSize; return spaceSize;
} }
public void DrawLine(Graphics g, ref float xPos, float xOffset, float yPos) public void DrawLine(Graphics g, ref float xPos, float xOffset, float yPos, Color c)
{ {
SizeF spaceSize = GetSpaceSize(g); SizeF spaceSize = GetSpaceSize(g);
foreach (SimpleTextWord word in words) { foreach (SimpleTextWord word in words) {
@ -151,13 +151,18 @@ namespace ICSharpCode.TextEditor
word.Word, word.Word,
new PointF(xPos + xOffset, yPos), new PointF(xPos + xOffset, yPos),
word.Bold ? boldMonospacedFont : monospacedFont, word.Bold ? boldMonospacedFont : monospacedFont,
word.Color c == Color.Empty ? word.Color : c
); );
break; break;
} }
} }
} }
public void DrawLine(Graphics g, ref float xPos, float xOffset, float yPos)
{
DrawLine(g, ref xPos, xOffset, yPos, Color.Empty);
}
public float MeasureWidth(Graphics g, float xPos) public float MeasureWidth(Graphics g, float xPos)
{ {
SizeF spaceSize = GetSpaceSize(g); SizeF spaceSize = GetSpaceSize(g);

12
src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeNode.cs

@ -11,6 +11,7 @@ using System.Drawing;
using System.Diagnostics; using System.Diagnostics;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.TextEditor;
namespace ICSharpCode.SharpDevelop.Gui namespace ICSharpCode.SharpDevelop.Gui
{ {
@ -264,11 +265,22 @@ namespace ICSharpCode.SharpDevelop.Gui
protected void DrawText(Graphics g, string text, Brush brush, Font font, ref float x, int y) protected void DrawText(Graphics g, string text, Brush brush, Font font, ref float x, int y)
{ {
if (IsSelected) {
brush = BrushRegistry.GetBrush(SystemColors.HighlightText);
}
g.DrawString(text, font, brush, new PointF(x, y)); g.DrawString(text, font, brush, new PointF(x, y));
SizeF size = g.MeasureString(text, font); SizeF size = g.MeasureString(text, font);
x += size.Width; x += size.Width;
} }
protected Color GetTextColor(TreeNodeStates state, Color c)
{
if ((state & TreeNodeStates.Selected) == TreeNodeStates.Selected) {
return SystemColors.HighlightText;
}
return c;
}
#endregion #endregion
#region fonts #region fonts

8
src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/Nodes/BookmarkNode.cs

@ -91,7 +91,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
spaceSize = g.MeasureString("-", Font, new PointF(0, 0), StringFormat.GenericTypographic); spaceSize = g.MeasureString("-", Font, new PointF(0, 0), StringFormat.GenericTypographic);
if (line != null) { if (line != null) {
DrawLine(g, line, e.Bounds.Y, x); DrawLine(g, line, e.Bounds.Y, x, e.State);
} }
} }
@ -115,7 +115,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
return wordSize.Width; return wordSize.Width;
} }
void DrawLine(Graphics g, LineSegment line, float yPos, float xPos) void DrawLine(Graphics g, LineSegment line, float yPos, float xPos, TreeNodeStates state)
{ {
int logicalX = 0; int logicalX = 0;
if (line.Words != null) { if (line.Words != null) {
@ -134,7 +134,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
word.Word, word.Word,
new PointF(xPos, yPos), new PointF(xPos, yPos),
word.Font.Style == FontStyle.Bold ? BoldMonospacedFont : MonospacedFont, word.Font.Style == FontStyle.Bold ? BoldMonospacedFont : MonospacedFont,
word.Color GetTextColor(state, word.Color)
); );
logicalX += word.Word.Length; logicalX += word.Word.Length;
break; break;
@ -145,7 +145,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
bookmark.Document.GetText(line), bookmark.Document.GetText(line),
new PointF(xPos, yPos), new PointF(xPos, yPos),
MonospacedFont, MonospacedFont,
Color.Black GetTextColor(state, Color.Black)
); );
} }
} }

2
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Pad/Nodes/SearchResultNode.cs

@ -96,7 +96,7 @@ namespace SearchAndReplace
DrawText(g, specialText, Brushes.Black, Font, ref x, e.Bounds.Y); DrawText(g, specialText, Brushes.Black, Font, ref x, e.Bounds.Y);
} else { } else {
x -= e.Bounds.X; x -= e.Bounds.X;
drawableLine.DrawLine(g, ref x, e.Bounds.X, e.Bounds.Y); drawableLine.DrawLine(g, ref x, e.Bounds.X, e.Bounds.Y, GetTextColor(e.State, Color.Empty));
} }
if (ShowFileName) { if (ShowFileName) {
float tabWidth = drawableLine.GetSpaceSize(g).Width * 6; float tabWidth = drawableLine.GetSpaceSize(g).Width * 6;

Loading…
Cancel
Save