public override void MouseUp(MouseButtons b) { if( scroll_active ) { StopScrolling(); } parent.SetDefaultDrawingMode(); original_selected = null; switch( action ) { case MouseAction.Scroll: Cursor.Current = Cursors.Arrow; if( first_move ) { System.Windows.Forms.ContextMenu m = new ContextMenu(); parent.AddMenuItems( m ); if( m.MenuItems.Count > 0 ) m.Show( parent.cview, new Point( menurealx, menurealy ) ); } break; case MouseAction.CreateConnection: if( conn.second.item == null ) conn.Invalidate(); else { conn.ConnectionCreated( parent, null, null, null, null ); parent.Undo.Push( new CreateOperation( conn ), false ); } conn = null; break; case MouseAction.Move: ArrayList movedobjects = new ArrayList(); foreach( GuiObject o in movestates.Keys ) if( o is IAroundObject ) movedobjects.Add( o ); if( movedobjects.Count > 0 ) parent.AroundObjectsMoved( movedobjects, movestates ); foreach( IMoveable o in movestates.Keys ) o.Moved(); if( movestates.Count == 1 ) { foreach( IStateObject t in movestates.Keys ) parent.Undo.Push( new StateOperation( t, movestates[t] as ObjectState, t.GetState() ), false ); } else if( movestates.Count > 1 ) { MultipleOperation p = new MultipleOperation(); foreach( IStateObject t in movestates.Keys ) p.l.Add( new StateOperation( t, movestates[t] as ObjectState, t.GetState() ) ); parent.Undo.Push( p, false ); } movestates.Clear(); moveitem = null; movelist = null; break; case MouseAction.Select: parent.SelectedObjects.Clear(); parent.SelectInRectangle( selrect ); parent.cview.InvalidatePage( selrect ); selrect = Rectangle.Empty; break; } action = MouseAction.None; }
public override void MouseUp(MouseButtons b) { if (scroll_active) { StopScrolling(); } parent.SetDefaultDrawingMode(); original_selected = null; switch (action) { case MouseAction.Scroll: Cursor.Current = Cursors.Arrow; if (first_move) { System.Windows.Forms.ContextMenu m = new ContextMenu(); parent.AddMenuItems(m); if (m.MenuItems.Count > 0) { m.Show(parent.cview, new Point(menurealx, menurealy)); } } break; case MouseAction.CreateConnection: if (conn.second.item == null) { conn.Invalidate(); } else { conn.ConnectionCreated(parent, null, null, null, null); parent.Undo.Push(new CreateOperation(conn), false); } conn = null; break; case MouseAction.Move: ArrayList movedobjects = new ArrayList(); foreach (GuiObject o in movestates.Keys) { if (o is IAroundObject) { movedobjects.Add(o); } } if (movedobjects.Count > 0) { parent.AroundObjectsMoved(movedobjects, movestates); } foreach (IMoveable o in movestates.Keys) { o.Moved(); } if (movestates.Count == 1) { foreach (IStateObject t in movestates.Keys) { parent.Undo.Push(new StateOperation(t, movestates[t] as ObjectState, t.GetState()), false); } } else if (movestates.Count > 1) { MultipleOperation p = new MultipleOperation(); foreach (IStateObject t in movestates.Keys) { p.l.Add(new StateOperation(t, movestates[t] as ObjectState, t.GetState())); } parent.Undo.Push(p, false); } movestates.Clear(); moveitem = null; movelist = null; break; case MouseAction.Select: parent.SelectedObjects.Clear(); parent.SelectInRectangle(selrect); parent.cview.InvalidatePage(selrect); selrect = Rectangle.Empty; break; } action = MouseAction.None; }