Bolding of selected line-numbers

Compacting String functions
Removed empty lines (style)
Ignore *.aps files

git-svn-id: https://lsleditor.svn.sourceforge.net/svnroot/lsleditor@69 3f4676ac-adda-40fd-8265-58d1435b1672
This commit is contained in:
thoysg 2012-01-14 23:07:01 +00:00
parent 9badf6e430
commit 04f2da6899
4 changed files with 15 additions and 14 deletions

View file

@ -171,10 +171,6 @@ namespace LSLEditor
} }
} }
} }
} }
} }
} }

View file

@ -82,13 +82,18 @@ namespace LSLEditor.Editor
int firstLine = 0; int firstLine = 0;
int lastLine = 10; int lastLine = 10;
Font font = this.Font; Font font = this.Font;
int selectedLineStart = -1, selectedLineEnd = -1;
if (this.richTextBox1 == null) if (this.richTextBox1 == null)
{ {
LineHeight = 16.0F; LineHeight = 16.0F;
} }
else else
{ {
if (richTextBox1.SelectionStart != -1)
{
selectedLineStart = richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart);
selectedLineEnd = richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart + richTextBox1.SelectionLength);
}
//we get index of first visible char and number of first visible line //we get index of first visible char and number of first visible line
Point pos = new Point(0, 0); Point pos = new Point(0, 0);
@ -123,7 +128,7 @@ namespace LSLEditor.Editor
g.SetClip(new Rectangle(0, 0, this.Width, this.richTextBox1.ClientRectangle.Height)); g.SetClip(new Rectangle(0, 0, this.Width, this.richTextBox1.ClientRectangle.Height));
for (int i = firstLine; i < lastLine; i++) for (int i = firstLine; i < lastLine; i++)
g.DrawString(string.Format("{0:0###}", i + 1), font, brush, g.DrawString(string.Format("{0:0###}", i + 1), (i>=selectedLineStart && i<= selectedLineEnd) ? new Font(font,FontStyle.Bold) : font, brush,
new PointF(0F, delta + (i - firstLine) * LineHeight) ); new PointF(0F, delta + (i - firstLine) * LineHeight) );
//g.DrawLine(new Pen(brush), backBuffer.Width - 1, 0, backBuffer.Width - 1, backBuffer.Height); //g.DrawLine(new Pen(brush), backBuffer.Width - 1, 0, backBuffer.Width - 1, backBuffer.Height);
} }

View file

@ -57,8 +57,14 @@ namespace NumberedTextBox
this.numbered1.richTextBox1 = this.syntaxRichTextBox1; this.numbered1.richTextBox1 = this.syntaxRichTextBox1;
this.syntaxRichTextBox1.OnPaintNumbers += new EventHandler(syntaxRichTextBox1_OnPaintNumbers); this.syntaxRichTextBox1.OnPaintNumbers += new EventHandler(syntaxRichTextBox1_OnPaintNumbers);
this.FontChanged += new EventHandler(NumberedTextBoxUC_FontChanged); this.FontChanged += new EventHandler(NumberedTextBoxUC_FontChanged);
this.syntaxRichTextBox1.OnCursorPositionChanged += new LSLEditor.SyntaxRichTextBox.CursorPositionChangedHandler(syntaxRichTextBox1_OnCursorPositionChanged);
} }
void syntaxRichTextBox1_OnCursorPositionChanged(object sender, LSLEditor.SyntaxRichTextBox.CursorPositionEventArgs e)
{
this.numbered1.Invalidate();
}
void NumberedTextBoxUC_FontChanged(object sender, EventArgs e) void NumberedTextBoxUC_FontChanged(object sender, EventArgs e)
{ {
this.numbered1.LineHeight = 0.0F; // reset!! this.numbered1.LineHeight = 0.0F; // reset!!

View file

@ -64,10 +64,7 @@ namespace LSLEditor
// 3 oct 2007 // 3 oct 2007
public static explicit operator String(bool a) public static explicit operator String(bool a)
{ {
if (a) return a ? "1" : "0";
return "1";
else
return "0";
} }
// 24 augustus 2007 // 24 augustus 2007
@ -93,10 +90,7 @@ namespace LSLEditor
public static implicit operator bool(String s) public static implicit operator bool(String s)
{ {
if (s.value == null) return (s.value == null) ? false : (s.value.Length != 0);
return false;
else
return (s.value.Length != 0);
} }
public static bool operator ==(String x, String y) public static bool operator ==(String x, String y)