private bool MouseMoveAction(int x, int y, MouseButtons b) { switch (action) { case MouseAction.Select: if (selrect != Rectangle.Empty) { parent.cview.InvalidatePage(selrect); } selrect.X = Math.Min(x, selx); selrect.Y = Math.Min(y, sely); selrect.Width = Math.Abs(x - selx); selrect.Height = Math.Abs(y - sely); parent.cview.InvalidatePage(selrect); break; case MouseAction.Move: // on first move if (first_move) { if (original_selected != null) { parent.SelectedObjects.Remove(original_selected); original_selected = null; } if (moveitem != null) { if (moveitem is IStateObject) { movestates[moveitem] = (moveitem as IStateObject).GetState(); } if (!(moveitem as GuiObject).selected) { parent.SelectedObjects.Clear(); parent.SelectedObjects.Add(moveitem as GuiObject); } } else { parent.SelectedObjects.Clear(); foreach (GuiObject t in movelist) { parent.SelectedObjects.Add(t); } foreach (GuiObject t in movelist) { if (t is IStateObject) { movestates[t] = (t as IStateObject).GetState(); } } } AddAssociatedObjects(); first_move = false; } // usual move if (moveitem != null) { moveitem.Moving(x, y, ref moveux, ref moveuy); } else { foreach (IMoveMultiple i in movelist) { i.ShiftShape(x - selx, y - sely); } selx = x; sely = y; } break; case MouseAction.Scroll: parent.cview.AdjustPageCoords(selx - x, sely - y); first_move = false; break; case MouseAction.CreateConnection: conn.Invalidate(); conn.InvalidateTemporary(); conn.second.item = parent.FindItem(x, y, out moveux, out moveuy, true) as IAcceptConnection; if (conn.second.item == null || conn.second.item == conn.first.item) { conn.second.x = x; conn.second.y = y; conn.second.item = null; } else { conn.second.item.coord_nearest(x, y, out conn.second.ux, out conn.second.uy); conn.second.UpdatePosition(true); } conn.DoCreationFixup(); conn.InvalidateTemporary(); conn.Invalidate(); break; } return(action != MouseAction.Scroll); }