Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/10 12:37:59 (14 years ago)
Author:
mkommend
Message:

added parameters, corrected drag and drop position (ticket #867)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.cs

    r2917 r2934  
    7878    }
    7979
    80 
    81     #region connector tooltips
    82 
    83     #endregion
    84 
    8580    private void Controller_SelectionChanged(object sender, EventArgs e) {
    8681      CollectionBase<IDiagramEntity> selectedObjects = this.graphVisualizationInfoView.Controller.Model.Selection.SelectedItems;
     
    8984        IShape shape = selectedObjects[0] as IShape;
    9085        if (shape != null) {
    91           IShapeInfo shapeInfo = shape.Tag as ShapeInfo;
     86          IOperatorShapeInfo shapeInfo = shape.Tag as IOperatorShapeInfo;
    9287          IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo);
    9388          this.detailsViewHost.Content = op;
     
    10499        }
    105100        if (shape != null) {
    106           IShapeInfo shapeInfo = shape.Tag as ShapeInfo;
     101          IOperatorShapeInfo shapeInfo = shape.Tag as IOperatorShapeInfo;
    107102          IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo);
    108103          if (connectorName != "Predecessor") {
     
    129124
    130125    private void shapeContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e) {
    131       IShapeInfo shapeInfo = this.shapeContextMenu.Tag as ShapeInfo;
     126      IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo;
    132127      if (shapeInfo != null) {
    133128        IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo);
     
    138133
    139134    private void openViewToolStripMenuItem_Click(object sender, EventArgs e) {
    140       IShapeInfo shapeInfo = this.shapeContextMenu.Tag as ShapeInfo;
     135      IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo;
    141136      if (shapeInfo != null) {
    142137        IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo);
     
    146141
    147142    private void initialOperatorToolStripMenuItem_Click(object sender, EventArgs e) {
    148       IShapeInfo shapeInfo = this.shapeContextMenu.Tag as ShapeInfo;
     143      IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo;
    149144      if (this.VisualizationInfo.InitialShape == shapeInfo)
    150145        this.VisualizationInfo.InitialShape = null;
     
    154149
    155150    private void breakPointToolStripMenuItem_Click(object sender, EventArgs e) {
    156       IShapeInfo shapeInfo = this.shapeContextMenu.Tag as ShapeInfo;
     151      IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo;
    157152      if (shapeInfo != null) {
    158153        IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo);
     
    174169      if (e.Effect != DragDropEffects.None) {
    175170        IOperator op = e.Data.GetData("Value") as IOperator;
    176         IShapeInfo shapeInfo = Factory.CreateShapeInfo(op);
     171        IOperatorShapeInfo shapeInfo = Factory.CreateOperatorShapeInfo(op);
    177172        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;
    181181
    182182        shapeInfo.Location = Point.Round(worldPoint);
     
    184184      }
    185185    }
    186 
    187186    #endregion
    188187
     
    237236
    238237    private void zoomAreaButton_Click(object sender, EventArgs e) {
    239       this.graphVisualizationInfoView.Controller.ActivateTool(ControllerBase.ZoomAreaToolName);
     238      this.graphVisualizationInfoView.Controller.View.ZoomFit();
    240239    }
    241240
     
    247246      this.graphVisualizationInfoView.Controller.ActivateTool(ControllerBase.ZoomOutToolName);
    248247    }
     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
    249262  }
    250263}
Note: See TracChangeset for help on using the changeset viewer.