Changeset 2868 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Tools/MoveTool.cs
- Timestamp:
- 02/25/10 17:28:31 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Tools/MoveTool.cs
r2768 r2868 79 79 if(e.Button == MouseButtons.Left && Enabled && !IsSuspended && !Blocked) 80 80 { 81 if(Selection.SelectedItems.Count > 0)81 if (this.Controller.Model.Selection.SelectedItems.Count > 0) 82 82 { 83 83 initialPoint = e.Location; … … 94 94 // does its thing when the mouse is moved. 95 95 //return true; 96 } 97 else if(Selection.Connector != null && Selection.Connector.Parent is IConnection) 98 { 99 if(!typeof(IShape).IsInstanceOfType(Selection.Connector.Parent)) //note that there is a separate tool to move shape-connectors! 96 } else if (this.Controller.Model.Selection.Connector != null && this.Controller.Model.Selection.Connector.Parent is IConnection) 97 { 98 if (!typeof(IShape).IsInstanceOfType(this.Controller.Model.Selection.Connector.Parent)) //note that there is a separate tool to move shape-connectors! 100 99 { 101 100 initialPoint = e.Location; … … 123 122 { 124 123 //can be a connector 125 if(Selection.Connector != null)126 { 127 124 if (this.Controller.Model.Selection.Connector != null) 125 { 126 this.Controller.Model.Selection.Connector.MoveBy(new Point(point.X - lastPoint.X, point.Y - lastPoint.Y)); 128 127 #region Do we hit something meaningful? 129 128 130 129 if (hoveredConnector != null) 131 hoveredConnector.Hovered = false; 132 133 hoveredConnector = Selection.FindConnectorAt(e.Location);130 hoveredConnector.Hovered = false; 131 132 hoveredConnector = this.Controller.Model.Selection.FindConnectorAt(e.Location); 134 133 if(hoveredConnector!=null) 135 134 hoveredConnector.Hovered = true; 136 if (hoveredConnector != null && hoveredConnector!=Selection.Connector)135 if (hoveredConnector != null && hoveredConnector != this.Controller.Model.Selection.Connector) 137 136 { 138 137 Controller.View.CurrentCursor = CursorPalette.Grip; … … 145 144 else //can be a selection 146 145 { 147 foreach(IDiagramEntity entity inSelection.SelectedItems)146 foreach (IDiagramEntity entity in this.Controller.Model.Selection.SelectedItems) 148 147 { 149 148 if (entity.AllowMove) … … 204 203 #region Is the connector attached? 205 204 //detach only if there is a parent different than a connection; the join of a chained connection is allowed to move 206 if( Selection.Connector.AttachedTo != null && !typeof(IConnection).IsInstanceOfType(Selection.Connector.AttachedTo))207 { 208 DetachConnectorCommand detach = new DetachConnectorCommand(this.Controller, Selection.Connector.AttachedTo,Selection.Connector);205 if (this.Controller.Model.Selection.Connector.AttachedTo != null && !typeof(IConnection).IsInstanceOfType(this.Controller.Model.Selection.Connector.AttachedTo)) 206 { 207 DetachConnectorCommand detach = new DetachConnectorCommand(this.Controller, this.Controller.Model.Selection.Connector.AttachedTo, this.Controller.Model.Selection.Connector); 209 208 detach.Redo(); 210 209 package.Commands.Add(detach); … … 216 215 //a bundle might look like overkill here but it makes the coding model uniform 217 216 Bundle bundle = new Bundle(Controller.Model); 218 bundle.Entities.Add( Selection.Connector);217 bundle.Entities.Add(this.Controller.Model.Selection.Connector); 219 218 MoveCommand move = new MoveCommand(this.Controller, bundle, new Point(lastPoint.X - initialPoint.X, lastPoint.Y - initialPoint.Y)); 220 219 //no Redo() necessary here! … … 231 230 //whatever, except itself and any children of the moved connector 232 231 //since this would entail a child becoming a parent! 233 if(conn.Hit(e.Location) && conn != Selection.Connector && !Selection.Connector.AttachedConnectors.Contains(conn))232 if (conn.Hit(e.Location) && conn != this.Controller.Model.Selection.Connector && !this.Controller.Model.Selection.Connector.AttachedConnectors.Contains(conn)) 234 233 return true; 235 234 return false; 236 235 }; 237 236 //find it! 238 IConnector parentConnector = Selection.FindConnector(predicate);237 IConnector parentConnector = this.Controller.Model.Selection.FindConnector(predicate); 239 238 240 239 if(parentConnector != null) //aha, there's an attachment 241 240 { 242 BindConnectorsCommand binder = new BindConnectorsCommand(this.Controller, parentConnector, Selection.Connector);241 BindConnectorsCommand binder = new BindConnectorsCommand(this.Controller, parentConnector, this.Controller.Model.Selection.Connector); 243 242 package.Commands.Add(binder); 244 243 binder.Redo(); //this one is necessary since the redo cannot be performed on the whole compound command … … 253 252 #region We are moving entities other than a connector 254 253 Bundle bundle = new Bundle(Controller.Model); 255 bundle.Entities.AddRange( Selection.SelectedItems);254 bundle.Entities.AddRange(this.Controller.Model.Selection.SelectedItems); 256 255 MoveCommand cmd = new MoveCommand(this.Controller, bundle, new Point(lastPoint.X - initialPoint.X, lastPoint.Y - initialPoint.Y)); 257 256 package.Commands.Add(cmd);
Note: See TracChangeset
for help on using the changeset viewer.