Changeset 2934 for trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.cs
- Timestamp:
- 03/05/10 12:37:59 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.cs
r2917 r2934 78 78 } 79 79 80 81 #region connector tooltips82 83 #endregion84 85 80 private void Controller_SelectionChanged(object sender, EventArgs e) { 86 81 CollectionBase<IDiagramEntity> selectedObjects = this.graphVisualizationInfoView.Controller.Model.Selection.SelectedItems; … … 89 84 IShape shape = selectedObjects[0] as IShape; 90 85 if (shape != null) { 91 I ShapeInfo shapeInfo = shape.Tag asShapeInfo;86 IOperatorShapeInfo shapeInfo = shape.Tag as IOperatorShapeInfo; 92 87 IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo); 93 88 this.detailsViewHost.Content = op; … … 104 99 } 105 100 if (shape != null) { 106 I ShapeInfo shapeInfo = shape.Tag asShapeInfo;101 IOperatorShapeInfo shapeInfo = shape.Tag as IOperatorShapeInfo; 107 102 IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo); 108 103 if (connectorName != "Predecessor") { … … 129 124 130 125 private void shapeContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e) { 131 I ShapeInfo shapeInfo = this.shapeContextMenu.Tag asShapeInfo;126 IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo; 132 127 if (shapeInfo != null) { 133 128 IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo); … … 138 133 139 134 private void openViewToolStripMenuItem_Click(object sender, EventArgs e) { 140 I ShapeInfo shapeInfo = this.shapeContextMenu.Tag asShapeInfo;135 IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo; 141 136 if (shapeInfo != null) { 142 137 IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo); … … 146 141 147 142 private void initialOperatorToolStripMenuItem_Click(object sender, EventArgs e) { 148 I ShapeInfo shapeInfo = this.shapeContextMenu.Tag asShapeInfo;143 IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo; 149 144 if (this.VisualizationInfo.InitialShape == shapeInfo) 150 145 this.VisualizationInfo.InitialShape = null; … … 154 149 155 150 private void breakPointToolStripMenuItem_Click(object sender, EventArgs e) { 156 I ShapeInfo shapeInfo = this.shapeContextMenu.Tag asShapeInfo;151 IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo; 157 152 if (shapeInfo != null) { 158 153 IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo); … … 174 169 if (e.Effect != DragDropEffects.None) { 175 170 IOperator op = e.Data.GetData("Value") as IOperator; 176 I ShapeInfo shapeInfo = Factory.CreateShapeInfo(op);171 IOperatorShapeInfo shapeInfo = Factory.CreateOperatorShapeInfo(op); 177 172 Point mouse = new Point(MousePosition.X, MousePosition.Y); 178 Point p = new Point(e.X, e.Y); 179 Point screen = this.PointToScreen(new Point(0, 0)); 180 PointF worldPoint = this.graphVisualizationInfoView.Controller.View.WorldToView(new Point(mouse.X - screen.X, mouse.Y - screen.Y)); 173 Point screen = this.graphVisualizationInfoView.PointToScreen(new Point(0, 0)); 174 Point control = new Point(mouse.X - screen.X, mouse.Y - screen.Y); 175 PointF worldPoint = this.graphVisualizationInfoView.Controller.View.ViewToWorld(control); 176 177 if (worldPoint.X < 0) 178 worldPoint.X = 0; 179 if (worldPoint.Y < 0) 180 worldPoint.Y = 0; 181 181 182 182 shapeInfo.Location = Point.Round(worldPoint); … … 184 184 } 185 185 } 186 187 186 #endregion 188 187 … … 237 236 238 237 private void zoomAreaButton_Click(object sender, EventArgs e) { 239 this.graphVisualizationInfoView.Controller. ActivateTool(ControllerBase.ZoomAreaToolName);238 this.graphVisualizationInfoView.Controller.View.ZoomFit(); 240 239 } 241 240 … … 247 246 this.graphVisualizationInfoView.Controller.ActivateTool(ControllerBase.ZoomOutToolName); 248 247 } 248 249 private void screenshotButton_Click(object sender, EventArgs e) { 250 Bitmap bitmap = ImageExporter.FromBundle(new Bundle(this.graphVisualizationInfoView.Controller.Model.Paintables),this.graphVisualizationInfoView.Controller.View.Graphics); 251 SaveFileDialog saveFileDialog = new SaveFileDialog(); 252 saveFileDialog.Title = "Save Screenshot"; 253 saveFileDialog.DefaultExt = "bmp"; 254 saveFileDialog.Filter = "Bitmap|*.bmp|All Files|*.*"; 255 saveFileDialog.FilterIndex = 1; 256 257 if (saveFileDialog.ShowDialog() == DialogResult.OK) { 258 bitmap.Save(saveFileDialog.FileName); 259 } 260 } 261 249 262 } 250 263 }
Note: See TracChangeset
for help on using the changeset viewer.