aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-14 03:45:57 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-08-14 03:45:57 +0200
commit854f2f732acc4c1d9fa4126962149cae14f4d4e9 (patch)
treeb9ed25c54bf261b6e22c755db86811a6ee12836f /src/GraphicObjects
parent4f1128a8001b90e1d163056ef66763bc3b7b8576 (diff)
* 0.crow, 1.crow, 2.crow, 5.crow, 7.crow:
tests * GraphicObject.cs: enabled, code clean and naming conventions * Label.cs, TextBox.cs: debug * Interface.cs: keyboard repeat
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/GraphicObject.cs297
-rw-r--r--src/GraphicObjects/Label.cs60
-rw-r--r--src/GraphicObjects/TextBox.cs41
3 files changed, 237 insertions, 161 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index aef23cc2..f8a1e508 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -61,24 +61,25 @@ namespace Crow
#region private fields
LayoutingType registeredLayoutings = LayoutingType.All;
ILayoutable logicalParent;
- ILayoutable _parent;
- string _name = "unamed";
- Fill _background = Color.Transparent;
- Fill _foreground = Color.White;
- Font _font = "droid, 10";
- Measure _width, _height;
- int _left, _top;
- double _cornerRadius = 0;
- int _margin = 0;
- bool _focusable = false;
- bool _hasFocus = false;
- bool _isActive = false;
- bool _mouseRepeat;
- protected bool _isVisible = true;
- VerticalAlignment _verticalAlignment = VerticalAlignment.Center;
- HorizontalAlignment _horizontalAlignment = HorizontalAlignment.Center;
- Size _maximumSize = "0,0";
- Size _minimumSize = "0,0";
+ ILayoutable parent;
+ string name = "unamed";
+ Fill background = Color.Transparent;
+ Fill foreground = Color.White;
+ Font font = "droid, 10";
+ Measure width, height;
+ int left, top;
+ double cornerRadius = 0;
+ int margin = 0;
+ bool focusable = false;
+ bool hasFocus = false;
+ bool isActive = false;
+ bool mouseRepeat;
+ protected bool isVisible = true;
+ bool isEnabled = true;
+ VerticalAlignment verticalAlignment = VerticalAlignment.Center;
+ HorizontalAlignment horizontalAlignment = HorizontalAlignment.Center;
+ Size maximumSize = "0,0";
+ Size minimumSize = "0,0";
bool cacheEnabled = false;
object dataSource;
string style;
@@ -124,8 +125,8 @@ namespace Crow
/// Parent in the graphic tree, used for rendering and layouting
/// </summary>
[XmlIgnore]public virtual ILayoutable Parent {
- get { return _parent; }
- set { _parent = value; }
+ get { return parent; }
+ set { parent = value; }
}
[XmlIgnore]public ILayoutable LogicalParent {
get { return logicalParent == null ? Parent : logicalParent; }
@@ -167,6 +168,8 @@ namespace Crow
public event EventHandler<KeyPressEventArgs> KeyPress;
public event EventHandler Focused;
public event EventHandler Unfocused;
+ public event EventHandler Enabled;
+ public event EventHandler Disabled;
public event EventHandler<LayoutingEventArgs> LayoutChanged;
#endregion
@@ -183,85 +186,85 @@ namespace Crow
}
[XmlAttributeAttribute()][DefaultValue("unamed")]
public virtual string Name {
- get { return _name; }
+ get { return name; }
set {
- if (_name == value)
+ if (name == value)
return;
- _name = value;
- NotifyValueChanged("Name", _verticalAlignment);
+ name = value;
+ NotifyValueChanged("Name", verticalAlignment);
}
}
[XmlAttributeAttribute ()][DefaultValue(VerticalAlignment.Center)]
public virtual VerticalAlignment VerticalAlignment {
- get { return _verticalAlignment; }
+ get { return verticalAlignment; }
set {
- if (_verticalAlignment == value)
+ if (verticalAlignment == value)
return;
- _verticalAlignment = value;
- NotifyValueChanged("VerticalAlignment", _verticalAlignment);
+ verticalAlignment = value;
+ NotifyValueChanged("VerticalAlignment", verticalAlignment);
}
}
[XmlAttributeAttribute()][DefaultValue(HorizontalAlignment.Center)]
public virtual HorizontalAlignment HorizontalAlignment {
- get { return _horizontalAlignment; }
+ get { return horizontalAlignment; }
set {
- if (_horizontalAlignment == value)
+ if (horizontalAlignment == value)
return;
- _horizontalAlignment = value;
- NotifyValueChanged("HorizontalAlignment", _horizontalAlignment);
+ horizontalAlignment = value;
+ NotifyValueChanged("HorizontalAlignment", horizontalAlignment);
}
}
[XmlAttributeAttribute()][DefaultValue(0)]
public virtual int Left {
- get { return _left; }
+ get { return left; }
set {
- if (_left == value)
+ if (left == value)
return;
- _left = value;
- NotifyValueChanged ("Left", _left);
+ left = value;
+ NotifyValueChanged ("Left", left);
this.RegisterForLayouting (LayoutingType.X);
}
}
[XmlAttributeAttribute()][DefaultValue(0)]
public virtual int Top {
- get { return _top; }
+ get { return top; }
set {
- if (_top == value)
+ if (top == value)
return;
- _top = value;
- NotifyValueChanged ("Top", _top);
+ top = value;
+ NotifyValueChanged ("Top", top);
this.RegisterForLayouting (LayoutingType.Y);
}
}
[XmlAttributeAttribute()][DefaultValue("Stretched")]
public virtual Measure Width {
- get { return _width; }
+ get { return width; }
set {
- if (_width == value)
+ if (width == value)
return;
if (value.IsFixed) {
if (value < MinimumSize.Width || (value > MaximumSize.Width && MaximumSize.Width > 0))
return;
}
Measure lastWP = WidthPolicy;
- _width = value;
- NotifyValueChanged ("Width", _width);
+ width = value;
+ NotifyValueChanged ("Width", width);
if (WidthPolicy != lastWP) {
NotifyValueChanged ("WidthPolicy", WidthPolicy);
//contentSize in Stacks are only update on childLayoutChange, and the single stretched
//child of the stack is not counted in contentSize, so when changing size policy of a child
//we should adapt contentSize
//TODO:check case when child become stretched, and another stretched item already exists.
- if (_parent is GenericStack) {//TODO:check if I should test Group instead
- if ((_parent as GenericStack).Orientation == Orientation.Horizontal) {
+ if (parent is GenericStack) {//TODO:check if I should test Group instead
+ if ((parent as GenericStack).Orientation == Orientation.Horizontal) {
if (lastWP == Measure.Fit)
- (_parent as GenericStack).contentSize.Width -= this.LastSlots.Width;
+ (parent as GenericStack).contentSize.Width -= this.LastSlots.Width;
else
- (_parent as GenericStack).contentSize.Width += this.LastSlots.Width;
+ (parent as GenericStack).contentSize.Width += this.LastSlots.Width;
}
}
}
@@ -271,25 +274,25 @@ namespace Crow
}
[XmlAttributeAttribute()][DefaultValue("Stretched")]
public virtual Measure Height {
- get { return _height; }
+ get { return height; }
set {
- if (_height == value)
+ if (height == value)
return;
if (value.IsFixed) {
if (value < MinimumSize.Height || (value > MaximumSize.Height && MaximumSize.Height > 0))
return;
}
Measure lastHP = HeightPolicy;
- _height = value;
- NotifyValueChanged ("Height", _height);
+ height = value;
+ NotifyValueChanged ("Height", height);
if (HeightPolicy != lastHP) {
NotifyValueChanged ("HeightPolicy", HeightPolicy);
- if (_parent is GenericStack) {
- if ((_parent as GenericStack).Orientation == Orientation.Vertical) {
+ if (parent is GenericStack) {
+ if ((parent as GenericStack).Orientation == Orientation.Vertical) {
if (lastHP == Measure.Fit)
- (_parent as GenericStack).contentSize.Height -= this.LastSlots.Height;
+ (parent as GenericStack).contentSize.Height -= this.LastSlots.Height;
else
- (_parent as GenericStack).contentSize.Height += this.LastSlots.Height;
+ (parent as GenericStack).contentSize.Height += this.LastSlots.Height;
}
}
}
@@ -326,113 +329,113 @@ namespace Crow
}
[XmlAttributeAttribute()][DefaultValue(false)]
public virtual bool Focusable {
- get { return _focusable; }
+ get { return focusable; }
set {
- if (_focusable == value)
+ if (focusable == value)
return;
- _focusable = value;
- NotifyValueChanged ("Focusable", _focusable);
+ focusable = value;
+ NotifyValueChanged ("Focusable", focusable);
}
}
[XmlIgnore]public virtual bool HasFocus {
- get { return _hasFocus; }
+ get { return hasFocus; }
set {
- if (value == _hasFocus)
+ if (value == hasFocus)
return;
- _hasFocus = value;
- NotifyValueChanged ("HasFocus", _hasFocus);
+ hasFocus = value;
+ NotifyValueChanged ("HasFocus", hasFocus);
}
}
[XmlIgnore]public virtual bool IsActive {
- get { return _isActive; }
+ get { return isActive; }
set {
- if (value == _isActive)
+ if (value == isActive)
return;
- _isActive = value;
- NotifyValueChanged ("IsActive", _isActive);
+ isActive = value;
+ NotifyValueChanged ("IsActive", isActive);
}
}
[XmlAttributeAttribute()][DefaultValue(false)]
public virtual bool MouseRepeat {
- get { return _mouseRepeat; }
+ get { return mouseRepeat; }
set {
- if (_mouseRepeat == value)
+ if (mouseRepeat == value)
return;
- _mouseRepeat = value;
- NotifyValueChanged ("MouseRepeat", _mouseRepeat);
+ mouseRepeat = value;
+ NotifyValueChanged ("MouseRepeat", mouseRepeat);
}
}
[XmlAttributeAttribute()][DefaultValue("Transparent")]
public virtual Fill Background {
- get { return _background; }
+ get { return background; }
set {
- if (_background == value)
+ if (background == value)
return;
- _background = value;
- NotifyValueChanged ("Background", _background);
+ background = value;
+ NotifyValueChanged ("Background", background);
RegisterForRedraw ();
}
}
[XmlAttributeAttribute()][DefaultValue("White")]
public virtual Fill Foreground {
- get { return _foreground; }
+ get { return foreground; }
set {
- if (_foreground == value)
+ if (foreground == value)
return;
- _foreground = value;
- NotifyValueChanged ("Foreground", _foreground);
+ foreground = value;
+ NotifyValueChanged ("Foreground", foreground);
RegisterForRedraw ();
}
}
[XmlAttributeAttribute()][DefaultValue("sans,10")]
public virtual Font Font {
- get { return _font; }
+ get { return font; }
set {
- if (value == _font)
+ if (value == font)
return;
- _font = value;
- NotifyValueChanged ("Font", _font);
+ font = value;
+ NotifyValueChanged ("Font", font);
RegisterForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue(0.0)]
public virtual double CornerRadius {
- get { return _cornerRadius; }
+ get { return cornerRadius; }
set {
- if (value == _cornerRadius)
+ if (value == cornerRadius)
return;
- _cornerRadius = value;
- NotifyValueChanged ("CornerRadius", _cornerRadius);
+ cornerRadius = value;
+ NotifyValueChanged ("CornerRadius", cornerRadius);
RegisterForRedraw ();
}
}
[XmlAttributeAttribute()][DefaultValue(0)]
public virtual int Margin {
- get { return _margin; }
+ get { return margin; }
set {
- if (value == _margin)
+ if (value == margin)
return;
- _margin = value;
- NotifyValueChanged ("Margin", _margin);
+ margin = value;
+ NotifyValueChanged ("Margin", margin);
RegisterForGraphicUpdate ();
}
}
- [XmlAttributeAttribute()][DefaultValue(true)]
+ [XmlAttributeAttribute][DefaultValue(true)]
public virtual bool Visible {
- get { return _isVisible; }
+ get { return isVisible; }
set {
- if (value == _isVisible)
+ if (value == isVisible)
return;
- _isVisible = value;
+ isVisible = value;
if (Interface.CurrentInterface == null)
return;
//ensure main win doesn't keep hidden childrens ref
- if (!_isVisible && this.Contains (Interface.CurrentInterface.HoverWidget))
+ if (!isVisible && this.Contains (Interface.CurrentInterface.HoverWidget))
Interface.CurrentInterface.HoverWidget = null;
if (Parent is GraphicObject)
@@ -440,36 +443,53 @@ namespace Crow
if (Parent is GenericStack)
(Parent as GraphicObject).RegisterForLayouting (LayoutingType.ArrangeChildren);
- if (_isVisible)
+ if (isVisible)
RegisterForLayouting (LayoutingType.Sizing);
Interface.CurrentInterface.EnqueueForRepaint (this);
- NotifyValueChanged ("Visible", _isVisible);
+ NotifyValueChanged ("Visible", isVisible);
+ }
+ }
+ [XmlAttributeAttribute][DefaultValue(true)]
+ public virtual bool IsEnabled {
+ get { return isEnabled; }
+ set {
+ if (value == isEnabled)
+ return;
+
+ isEnabled = value;
+
+ if (isEnabled)
+ onEnable (this, null);
+ else
+ onDisable (this, null);
+
+ NotifyValueChanged ("IsEnabled", isEnabled);
}
}
[XmlAttributeAttribute()][DefaultValue("1,1")]
public virtual Size MinimumSize {
- get { return _minimumSize; }
+ get { return minimumSize; }
set {
- if (value == _minimumSize)
+ if (value == minimumSize)
return;
- _minimumSize = value;
+ minimumSize = value;
- NotifyValueChanged ("MinimumSize", _minimumSize);
+ NotifyValueChanged ("MinimumSize", minimumSize);
RegisterForLayouting (LayoutingType.Sizing);
}
}
[XmlAttributeAttribute()][DefaultValue("0,0")]
public virtual Size MaximumSize {
- get { return _maximumSize; }
+ get { return maximumSize; }
set {
- if (value == _maximumSize)
+ if (value == maximumSize)
return;
- _maximumSize = value;
+ maximumSize = value;
- NotifyValueChanged ("MaximumSize", _maximumSize);
+ NotifyValueChanged ("MaximumSize", maximumSize);
RegisterForLayouting (LayoutingType.Sizing);
}
}
@@ -669,11 +689,13 @@ namespace Crow
#endregion
public virtual GraphicObject FindByName(string nameToFind){
- return string.Equals(nameToFind, _name, StringComparison.Ordinal) ? this : null;
+ return string.Equals(nameToFind, name, StringComparison.Ordinal) ? this : null;
}
public virtual bool Contains(GraphicObject goToFind){
return false;
}
+
+ #region Queuing
public virtual void RegisterClip(Rectangle clip){
if (CacheEnabled && bmp != null)
Clipping.AddRectangle (clip + ClientRectangle.Position);
@@ -698,17 +720,18 @@ namespace Crow
if (RegisteredLayoutings == LayoutingType.None)
Interface.CurrentInterface.EnqueueForRepaint (this);
}
-// public Interface CurrentInterface {
-// get {
-// ILayoutable tmp = this.Parent;
-// while (tmp != null) {
-// if (tmp is Interface)
-// return tmp as Interface;
-// tmp = tmp.Parent;
-// }
-// return null;
-// }
-// }
+ // public Interface CurrentInterface {
+ // get {
+ // ILayoutable tmp = this.Parent;
+ // while (tmp != null) {
+ // if (tmp is Interface)
+ // return tmp as Interface;
+ // tmp = tmp.Parent;
+ // }
+ // return null;
+ // }
+ // }
+ #endregion
#region Layouting
@@ -941,7 +964,7 @@ namespace Crow
Rectangle rBack = new Rectangle (Slot.Size);
Background.SetAsSource (gr, rBack);
- CairoHelpers.CairoRectangle(gr,rBack,_cornerRadius);
+ CairoHelpers.CairoRectangle(gr,rBack,cornerRadius);
gr.Fill ();
}
@@ -1128,6 +1151,22 @@ namespace Crow
MouseWheelChanged.Raise (this, e);
}
+ public virtual void onMouseEnter(object sender, MouseMoveEventArgs e)
+ {
+ #if DEBUG_FOCUS
+ Debug.WriteLine("MouseEnter => " + this.ToString());
+ #endif
+ MouseEnter.Raise (this, e);
+ }
+ public virtual void onMouseLeave(object sender, MouseMoveEventArgs e)
+ {
+ #if DEBUG_FOCUS
+ Debug.WriteLine("MouseLeave => " + this.ToString());
+ #endif
+ MouseLeave.Raise (this, e);
+ }
+ #endregion
+
public virtual void onFocused(object sender, EventArgs e){
#if DEBUG_FOCUS
Debug.WriteLine("Focused => " + this.ToString());
@@ -1143,22 +1182,12 @@ namespace Crow
Unfocused.Raise (this, e);
this.HasFocus = false;
}
- public virtual void onMouseEnter(object sender, MouseMoveEventArgs e)
- {
- #if DEBUG_FOCUS
- Debug.WriteLine("MouseEnter => " + this.ToString());
- #endif
- MouseEnter.Raise (this, e);
+ public virtual void onEnable(object sender, EventArgs e){
+ Enabled.Raise (this, e);
}
- public virtual void onMouseLeave(object sender, MouseMoveEventArgs e)
- {
- #if DEBUG_FOCUS
- Debug.WriteLine("MouseLeave => " + this.ToString());
- #endif
- MouseLeave.Raise (this, e);
+ public virtual void onDisable(object sender, EventArgs e){
+ Disabled.Raise (this, e);
}
- #endregion
-
public override string ToString ()
{
string tmp ="";
diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs
index 21c6b2cd..3cc0f916 100644
--- a/src/GraphicObjects/Label.cs
+++ b/src/GraphicObjects/Label.cs
@@ -298,11 +298,40 @@ namespace Crow
List<string> getLines {
get {
return _multiline ?
- Regex.Split (_text, "\r\n|\r|\n|" + @"\\n").ToList() :
+ Regex.Split (_text, "\r\n|\r|\n|\\\\n").ToList() :
new List<string>(new string[] { _text });
}
}
-
+ /// <summary>
+ /// Moves cursor one char to the left.
+ /// </summary>
+ /// <returns><c>true</c> if move succeed</returns>
+ public bool MoveLeft(){
+ int tmp = _currentCol - 1;
+ if (tmp < 0) {
+ if (_currentLine == 0)
+ return false;
+ CurrentLine--;
+ CurrentColumn = int.MaxValue;
+ } else
+ CurrentColumn = tmp;
+ return true;
+ }
+ /// <summary>
+ /// Moves cursor one char to the right.
+ /// </summary>
+ /// <returns><c>true</c> if move succeed</returns>
+ public bool MoveRight(){
+ int tmp = _currentCol + 1;
+ if (tmp > lines [_currentLine].Length){
+ if (CurrentLine == lines.Count - 1)
+ return false;
+ CurrentLine++;
+ CurrentColumn = 0;
+ } else
+ CurrentColumn = tmp;
+ return true;
+ }
public void GotoWordStart(){
CurrentColumn--;
//skip white spaces
@@ -315,6 +344,8 @@ namespace Crow
}
public void GotoWordEnd(){
//skip white spaces
+ if (CurrentColumn >= lines [CurrentLine].Length - 1)
+ return;
while (char.IsWhiteSpace (this.CurrentChar) && CurrentColumn < lines [CurrentLine].Length-1)
CurrentColumn++;
while (!char.IsWhiteSpace (this.CurrentChar) && CurrentColumn < lines [CurrentLine].Length-1)
@@ -328,8 +359,8 @@ namespace Crow
if (CurrentColumn == 0) {
if (CurrentLine == 0 && lines.Count == 1)
return;
- //CurrentLine--;
- CurrentColumn = 0;//lines [CurrentLine].Length;
+ CurrentLine--;
+ CurrentColumn = lines [CurrentLine].Length;
lines [CurrentLine] += lines [CurrentLine + 1];
lines.RemoveAt (CurrentLine + 1);
NotifyValueChanged ("Text", Text);
@@ -338,7 +369,7 @@ namespace Crow
CurrentColumn--;
lines [CurrentLine] = lines [CurrentLine].Remove (CurrentColumn, 1);
} else {
- int linesToRemove = selectionEnd.Y - selectionStart.Y;
+ int linesToRemove = selectionEnd.Y - selectionStart.Y + 1;
int l = selectionStart.Y;
if (linesToRemove > 0) {
@@ -347,8 +378,8 @@ namespace Crow
l++;
for (int c = 0; c < linesToRemove-1; c++)
lines.RemoveAt (l);
- CurrentColumn = selectionStart.X;
CurrentLine = selectionStart.Y;
+ CurrentColumn = selectionStart.X;
} else
lines [l] = lines [l].Remove (selectionStart.X, selectionEnd.X - selectionStart.X);
CurrentColumn = selectionStart.X;
@@ -363,8 +394,21 @@ namespace Crow
/// <param name="str">String.</param>
protected void Insert(string str)
{
- lines [CurrentLine] = lines [CurrentLine].Insert (CurrentColumn, str);
- CurrentColumn += str.Length;
+ if (!selectionIsEmpty)
+ this.DeleteChar ();
+ if (_multiline) {
+ string[] strLines = Regex.Split (str, "\r\n|\r|\n|" + @"\\n").ToArray();
+ lines [CurrentLine] = lines [CurrentLine].Insert (CurrentColumn, strLines[0]);
+ CurrentColumn += strLines[0].Length;
+ for (int i = 1; i < strLines.Length; i++) {
+ InsertLineBreak ();
+ lines [CurrentLine] = lines [CurrentLine].Insert (CurrentColumn, strLines[i]);
+ CurrentColumn += strLines[i].Length;
+ }
+ } else {
+ lines [CurrentLine] = lines [CurrentLine].Insert (CurrentColumn, str);
+ CurrentColumn += str.Length;
+ }
NotifyValueChanged ("Text", Text);
}
/// <summary>
diff --git a/src/GraphicObjects/TextBox.cs b/src/GraphicObjects/TextBox.cs
index 81fce3e2..2be9585a 100644
--- a/src/GraphicObjects/TextBox.cs
+++ b/src/GraphicObjects/TextBox.cs
@@ -76,14 +76,17 @@ namespace Crow
switch (key)
{
case Key.Back:
+ if (CurrentPosition == 0)
+ return;
this.DeleteChar();
break;
case Key.Clear:
break;
case Key.Delete:
- if (selectionIsEmpty)
- CurrentColumn++;
- else if (e.Shift)
+ if (selectionIsEmpty) {
+ if (!MoveRight ())
+ return;
+ }else if (e.Shift)
Interface.CurrentInterface.Clipboard = this.SelectedText;
this.DeleteChar ();
break;
@@ -119,11 +122,11 @@ namespace Crow
case Key.End:
if (e.Shift) {
if (selectionIsEmpty)
- SelBegin = new Point (CurrentColumn, CurrentLine);
+ SelBegin = CurrentPosition;
if (e.Control)
CurrentLine = int.MaxValue;
CurrentColumn = int.MaxValue;
- SelRelease = new Point (CurrentColumn, CurrentLine);
+ SelRelease = CurrentPosition;
break;
}
SelRelease = -1;
@@ -134,7 +137,7 @@ namespace Crow
case Key.Insert:
if (e.Shift)
this.Insert (Interface.CurrentInterface.Clipboard);
- else if (e.Control)
+ else if (e.Control && !selectionIsEmpty)
Interface.CurrentInterface.Clipboard = this.SelectedText;
break;
case Key.Left:
@@ -143,40 +146,40 @@ namespace Crow
SelBegin = new Point(CurrentColumn, CurrentLine);
if (e.Control)
GotoWordStart ();
- else
- CurrentColumn--;
- SelRelease = new Point(CurrentColumn, CurrentLine);
+ else if (!MoveLeft ())
+ return;
+ SelRelease = CurrentPosition;
break;
}
SelRelease = -1;
if (e.Control)
GotoWordStart ();
else
- CurrentColumn--;
+ MoveLeft();
break;
case Key.Right:
if (e.Shift) {
if (selectionIsEmpty)
- SelBegin = new Point(CurrentColumn, CurrentLine);
+ SelBegin = CurrentPosition;
if (e.Control)
GotoWordEnd ();
- else
- CurrentColumn++;
- SelRelease = new Point(CurrentColumn, CurrentLine);
+ else if (!MoveRight ())
+ return;
+ SelRelease = CurrentPosition;
break;
}
SelRelease = -1;
if (e.Control)
GotoWordEnd ();
else
- CurrentColumn++;
+ MoveRight ();
break;
case Key.Up:
if (e.Shift) {
if (selectionIsEmpty)
- SelBegin = new Point(CurrentColumn, CurrentLine);
+ SelBegin = CurrentPosition;
CurrentLine--;
- SelRelease = new Point(CurrentColumn, CurrentLine);
+ SelRelease = CurrentPosition;
break;
}
SelRelease = -1;
@@ -185,9 +188,9 @@ namespace Crow
case Key.Down:
if (e.Shift) {
if (selectionIsEmpty)
- SelBegin = new Point(CurrentColumn, CurrentLine);
+ SelBegin = CurrentPosition;
CurrentLine++;
- SelRelease = new Point(CurrentColumn, CurrentLine);
+ SelRelease = CurrentPosition;
break;
}
SelRelease = -1;