Author: alanmc
Date: 2007-06-28 20:54:02 -0400 (Thu, 28 Jun 2007)
New Revision: 81015
Modified:
trunk/lunareclipse/ChangeLog
trunk/lunareclipse/Controller/MoonlightController.cs
trunk/lunareclipse/Model/Draw/SelectionDraw.cs
Log:
Added better handling for selection. Still not done yet.
Modified: trunk/lunareclipse/ChangeLog
===================================================================
--- trunk/lunareclipse/ChangeLog 2007-06-29 00:31:35 UTC (rev 81014)
+++ trunk/lunareclipse/ChangeLog 2007-06-29 00:54:02 UTC (rev 81015)
@@ -1,5 +1,9 @@
2007-06-28 Alan McGovern <[EMAIL PROTECTED]>
+ Added better handling for selection. Still not done yet.
+
+2007-06-28 Alan McGovern <[EMAIL PROTECTED]>
+
Small fix for circle drawing
2007-06-28 Alan McGovern <[EMAIL PROTECTED]>
Modified: trunk/lunareclipse/Controller/MoonlightController.cs
===================================================================
--- trunk/lunareclipse/Controller/MoonlightController.cs 2007-06-29
00:31:35 UTC (rev 81014)
+++ trunk/lunareclipse/Controller/MoonlightController.cs 2007-06-29
00:54:02 UTC (rev 81015)
@@ -53,9 +53,6 @@
{
moonlight.Canvas.Children.Clear();
undo.Clear();
- Rectangle r = new Rectangle();
- moonlight.Canvas.Children.Add(r);
- moonlight.Canvas.Children.Remove(r);
}
bool active = false;
Modified: trunk/lunareclipse/Model/Draw/SelectionDraw.cs
===================================================================
--- trunk/lunareclipse/Model/Draw/SelectionDraw.cs 2007-06-29 00:31:35 UTC
(rev 81014)
+++ trunk/lunareclipse/Model/Draw/SelectionDraw.cs 2007-06-29 00:54:02 UTC
(rev 81015)
@@ -72,11 +72,7 @@
{
// Console.WriteLine("Hit");
if(!selectedObjects.Contains(v))
- {
- v.Stroke = new SolidColorBrush(Colors.Green);
- v.Fill = new SolidColorBrush(Colors.Black);
- shapes.Add(v);
- }
+ Select(v);
}
}
@@ -93,25 +89,50 @@
internal override void Resize (MouseEventArgs e)
{
- foreach(Shape s in this.selectedObjects)
- {
- s.Fill = new SolidColorBrush(Colors.White);
- s.Stroke = new SolidColorBrush(Colors.Red);
- }
- this.selectedObjects.Clear();
+ base.Resize(e);
+
+ if(!e.Ctrl && !e.Shift)
+ DeselectAll();
+
List<Shape> shapes = GetSelectedObjects(e);
+ foreach(Shape s in shapes)
+ if(!selectedObjects.Contains(s))
+ Select(s);
+ }
+
+ internal override void DrawEnd (MouseEventArgs e)
+ {
+ Panel.Children.Remove(Element);
-
- base.Resize(e);
+ if(clickedOnShape && !e.Ctrl && !e.Shift &&
e.GetPosition(Panel).Equals(Position))
+ {
+ this.DeselectAll();
+ List<Shape> shapes = this.GetSelectedObjects(e);
foreach(Shape s in shapes)
if(!selectedObjects.Contains(s))
- selectedObjects.Add(s);
+ Select(s);
+ }
}
-
- internal override void DrawEnd (MouseEventArgs e)
+
+ private void DeselectAll()
{
- Panel.Children.Remove(Element);
+ while(this.selectedObjects.Count > 0)
+ Deselect(this.selectedObjects[0]);
}
+
+ private void Deselect(Shape s)
+ {
+ s.Fill = new SolidColorBrush(Colors.White);
+ s.Stroke = new SolidColorBrush(Colors.Red);
+ this.selectedObjects.Remove(s);
+ }
+
+ private void Select(Shape s)
+ {
+ s.Stroke = new SolidColorBrush(Colors.Green);
+ s.Fill = new SolidColorBrush(Colors.Black);
+ this.selectedObjects.Add(s);
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches