diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-07 02:40:26 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-07 02:40:26 +0200 |
| commit | d45cf90cb417222aef6e9a7e0de5c2d2f874ac91 (patch) | |
| tree | 82d65899cbc72e94cb5f902aed8b853a15e8137a /src | |
| parent | ffed25a1ea22392f4fb832b15a91f7d2738ffdfa (diff) | |
* Label.cs:
no cursor drawn if not selectable
* IMLStream.cs:
invariant culture loading
Diffstat (limited to 'src')
| -rw-r--r-- | src/GraphicObjects/Label.cs | 52 | ||||
| -rw-r--r-- | src/IMLStream.cs | 9 |
2 files changed, 33 insertions, 28 deletions
diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index 95892314..e9568c5d 100644 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -489,28 +489,35 @@ namespace Crow fe = gr.FontExtents; #region draw text cursor - if (mouseLocalPos >= 0) + if (HasFocus && Selectable) { - computeTextCursor(gr); - - if (SelectionInProgress) + if (mouseLocalPos >= 0) { - if (SelBegin < 0){ - SelBegin = new Point(CurrentColumn, CurrentLine); - SelStartCursorPos = textCursorPos; - SelRelease = -1; - }else{ - SelRelease = new Point(CurrentColumn, CurrentLine); - if (SelRelease == SelBegin) - SelRelease = -1; - else - SelEndCursorPos = textCursorPos; - } - } - }else - computeTextCursorPosition(gr); + computeTextCursor(gr); + if (SelectionInProgress) + { + if (SelBegin < 0){ + SelBegin = new Point(CurrentColumn, CurrentLine); + SelStartCursorPos = textCursorPos; + SelRelease = -1; + }else{ + SelRelease = new Point(CurrentColumn, CurrentLine); + if (SelRelease == SelBegin) + SelRelease = -1; + else + SelEndCursorPos = textCursorPos; + } + } + }else + computeTextCursorPosition(gr); + Foreground.SetAsSource (gr); + gr.LineWidth = 1.5; + gr.MoveTo(new PointD(textCursorPos + rText.X, rText.Y + CurrentLine * fe.Height)); + gr.LineTo(new PointD(textCursorPos + rText.X, rText.Y + (CurrentLine + 1) * fe.Height)); + gr.Stroke(); + } #endregion //****** debug selection ************* @@ -536,15 +543,6 @@ namespace Crow // } //******************* - if (HasFocus ) - { - Foreground.SetAsSource (gr); - gr.LineWidth = 1.5; - gr.MoveTo(new PointD(textCursorPos + rText.X, rText.Y + CurrentLine * fe.Height)); - gr.LineTo(new PointD(textCursorPos + rText.X, rText.Y + (CurrentLine + 1) * fe.Height)); - gr.Stroke(); - } - for (int i = 0; i < lines.Count; i++) { string l = lines [i].Replace ("\t", new String (' ', Interface.TabSize)); int lineLength = (int)gr.TextExtents (l).XAdvance; diff --git a/src/IMLStream.cs b/src/IMLStream.cs index d4dc6496..542797a1 100644 --- a/src/IMLStream.cs +++ b/src/IMLStream.cs @@ -22,6 +22,7 @@ using System; using System.IO; using System.Reflection; using System.Reflection.Emit; +using System.Threading; namespace Crow { @@ -42,8 +43,14 @@ namespace Crow /// </summary> public GraphicObject Instance { get { + System.Globalization.CultureInfo savedCulture = Thread.CurrentThread.CurrentCulture; + Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + Seek (0, SeekOrigin.Begin); - return Interface.Load (this, this.RootType); + GraphicObject tmp = Interface.Load (this, this.RootType); + + Thread.CurrentThread.CurrentCulture = savedCulture; + return tmp; } } /// <summary> |