Browse Source

At "Caret Line" to text editor (disabled by default) - based on patch by Troy Simpson.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3440 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
0ab5c4b55e
  1. 16
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultTextEditorProperties.cs
  2. 3
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs
  3. 6
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/ITextEditorProperties.cs
  4. 35
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/Caret.cs
  5. 9
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs

16
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultTextEditorProperties.cs

@ -36,6 +36,8 @@ namespace ICSharpCode.TextEditor.Document @@ -36,6 +36,8 @@ namespace ICSharpCode.TextEditor.Document
}
bool allowCaretBeyondEOL = false;
bool caretLine = false;
bool showMatchingBracket = true;
bool showLineNumbers = true;
@ -72,7 +74,7 @@ namespace ICSharpCode.TextEditor.Document @@ -72,7 +74,7 @@ namespace ICSharpCode.TextEditor.Document
tabIndent = value;
}
}
public int IndentationSize {
get { return indentationSize; }
set { indentationSize = value; }
@ -86,6 +88,18 @@ namespace ICSharpCode.TextEditor.Document @@ -86,6 +88,18 @@ namespace ICSharpCode.TextEditor.Document
indentStyle = value;
}
}
public bool CaretLine {
get
{
return caretLine;
}
set
{
caretLine = value;
}
}
public DocumentSelectionMode DocumentSelectionMode {
get {
return documentSelectionMode;

3
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs

@ -71,7 +71,8 @@ namespace ICSharpCode.TextEditor.Document @@ -71,7 +71,8 @@ namespace ICSharpCode.TextEditor.Document
environmentColors["VRuler"] = new HighlightColor("ControlLight", "Window", false, false);
environmentColors["InvalidLines"] = new HighlightColor(Color.Red, false, false);
environmentColors["CaretMarker"] = new HighlightColor(Color.Yellow, false, false);
environmentColors["LineNumbers"] = new HighlightBackground("ControlDark", "Window", false, false);
environmentColors["CaretLine"] = new HighlightBackground("ControlLight", "Window", false, false);
environmentColors["LineNumbers"] = new HighlightBackground("ControlDark", "Window", false, false);
environmentColors["FoldLine"] = new HighlightColor(Color.FromArgb(0x80, 0x80, 0x80), Color.Black, false, false);
environmentColors["FoldMarker"] = new HighlightColor(Color.FromArgb(0x80, 0x80, 0x80), Color.White, false, false);

6
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/ITextEditorProperties.cs

@ -13,6 +13,12 @@ namespace ICSharpCode.TextEditor.Document @@ -13,6 +13,12 @@ namespace ICSharpCode.TextEditor.Document
{
public interface ITextEditorProperties
{
bool CaretLine
{
get;
set;
}
bool AutoInsertCurlyBracket { // is wrapped in text editor control
get;
set;

35
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/Caret.cs

@ -234,19 +234,37 @@ namespace ICSharpCode.TextEditor @@ -234,19 +234,37 @@ namespace ICSharpCode.TextEditor
if (outstandingUpdate)
UpdateCaretPosition();
}
void PaintCaretLine(Graphics g)
{
if (!textArea.Document.TextEditorProperties.CaretLine)
return;
HighlightColor caretLineColor = textArea.Document.HighlightingStrategy.GetColorFor("CaretLine");
g.DrawLine(BrushRegistry.GetDotPen(caretLineColor.Color, caretLineColor.BackgroundColor),
currentPos.X,
0,
currentPos.X,
textArea.DisplayRectangle.Height);
}
public void UpdateCaretPosition()
{
Log("UpdateCaretPosition");
if (caretImplementation.RequireRedrawOnPositionChange) {
textArea.UpdateLine(oldLine);
if (line != oldLine)
textArea.UpdateLine(line);
if (textArea.TextEditorProperties.CaretLine) {
textArea.Invalidate();
} else {
if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line) {
if (caretImplementation.RequireRedrawOnPositionChange) {
textArea.UpdateLine(oldLine);
textArea.UpdateLine(line);
if (line != oldLine)
textArea.UpdateLine(line);
} else {
if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line) {
textArea.UpdateLine(oldLine);
textArea.UpdateLine(line);
}
}
}
oldLine = line;
@ -286,7 +304,7 @@ namespace ICSharpCode.TextEditor @@ -286,7 +304,7 @@ namespace ICSharpCode.TextEditor
currentPos = pos;
}
[Conditional("DEBUG")]
static void Log(string text)
{
@ -297,6 +315,7 @@ namespace ICSharpCode.TextEditor @@ -297,6 +315,7 @@ namespace ICSharpCode.TextEditor
internal void PaintCaret(Graphics g)
{
caretImplementation.PaintCaret(g);
PaintCaretLine(g);
}
abstract class CaretImplementation : IDisposable

9
src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs

@ -99,6 +99,15 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -99,6 +99,15 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
}
}
public bool CaretLine {
get {
return properties.Get("CaretLine", false);
}
set {
properties.Set("CaretLine", value);
}
}
public bool ShowQuickClassBrowserPanel {
get {
return properties.Get("ShowQuickClassBrowserPanel", true);

Loading…
Cancel
Save