Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8000 for trunk/sources


Ignore:
Timestamp:
06/13/12 19:08:05 (12 years ago)
Author:
jkarder
Message:

#1747:

  • added support to pan with the middle mouse button
  • removed pan button
Location:
trunk/sources
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/Controller.cs

    r4068 r8000  
    3030
    3131using System;
     32using HeuristicLab.Netron.CustomTools;
    3233using Netron.Diagramming.Core;
    3334
     
    4041    public Controller(IDiagramControl surface)
    4142      : base(surface) {
     43      base.AddTool(new CustomPanTool());
    4244    }
    4345
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446.csproj

    r7649 r8000  
    109109  </ItemGroup>
    110110  <ItemGroup>
     111    <Compile Include="CustomTools\CustomPanTool.cs" />
    111112    <Compile Include="ExpandableIconMaterial.cs" />
    112113    <Compile Include="NetronVisualization.cs">
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.Designer.cs

    r7967 r8000  
    5959      this.relayoutButton = new System.Windows.Forms.Button();
    6060      this.connectButton = new System.Windows.Forms.Button();
    61       this.panButton = new System.Windows.Forms.Button();
    6261      this.selectButton = new System.Windows.Forms.Button();
    6362      this.detailsGroupBox = new System.Windows.Forms.GroupBox();
     
    130129      this.splitContainer.Panel1.Controls.Add(this.relayoutButton);
    131130      this.splitContainer.Panel1.Controls.Add(this.connectButton);
    132       this.splitContainer.Panel1.Controls.Add(this.panButton);
    133131      this.splitContainer.Panel1.Controls.Add(this.selectButton);
    134132      this.splitContainer.Panel1.Controls.Add(this.graphVisualizationInfoView);
     
    144142      //
    145143      this.screenshotButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Image;
    146       this.screenshotButton.Location = new System.Drawing.Point(243, 3);
     144      this.screenshotButton.Location = new System.Drawing.Point(213, 3);
    147145      this.screenshotButton.Name = "screenshotButton";
    148146      this.screenshotButton.Size = new System.Drawing.Size(24, 24);
    149       this.screenshotButton.TabIndex = 8;
     147      this.screenshotButton.TabIndex = 7;
    150148      this.buttonToolTip.SetToolTip(this.screenshotButton, "Screenshot");
    151149      this.screenshotButton.UseVisualStyleBackColor = true;
     
    155153      //
    156154      this.zoomOutButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.ZoomOut;
    157       this.zoomOutButton.Location = new System.Drawing.Point(213, 3);
     155      this.zoomOutButton.Location = new System.Drawing.Point(183, 3);
    158156      this.zoomOutButton.Name = "zoomOutButton";
    159157      this.zoomOutButton.Size = new System.Drawing.Size(24, 24);
    160       this.zoomOutButton.TabIndex = 7;
     158      this.zoomOutButton.TabIndex = 6;
    161159      this.buttonToolTip.SetToolTip(this.zoomOutButton, "Zoom Out");
    162160      this.zoomOutButton.UseVisualStyleBackColor = true;
     
    166164      //
    167165      this.zoomInButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.ZoomIn;
    168       this.zoomInButton.Location = new System.Drawing.Point(183, 3);
     166      this.zoomInButton.Location = new System.Drawing.Point(153, 3);
    169167      this.zoomInButton.Name = "zoomInButton";
    170168      this.zoomInButton.Size = new System.Drawing.Size(24, 24);
    171       this.zoomInButton.TabIndex = 6;
     169      this.zoomInButton.TabIndex = 5;
    172170      this.buttonToolTip.SetToolTip(this.zoomInButton, "Zoom In");
    173171      this.zoomInButton.UseVisualStyleBackColor = true;
     
    177175      //
    178176      this.zoomToFitButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.ActualSize;
    179       this.zoomToFitButton.Location = new System.Drawing.Point(153, 3);
     177      this.zoomToFitButton.Location = new System.Drawing.Point(123, 3);
    180178      this.zoomToFitButton.Name = "zoomAreaButton";
    181179      this.zoomToFitButton.Size = new System.Drawing.Size(24, 24);
    182       this.zoomToFitButton.TabIndex = 5;
     180      this.zoomToFitButton.TabIndex = 4;
    183181      this.buttonToolTip.SetToolTip(this.zoomToFitButton, "Zoom to Fit");
    184182      this.zoomToFitButton.UseVisualStyleBackColor = true;
     
    188186      //
    189187      this.relayoutButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.RefreshDocument;
    190       this.relayoutButton.Location = new System.Drawing.Point(123, 3);
     188      this.relayoutButton.Location = new System.Drawing.Point(93, 3);
    191189      this.relayoutButton.Name = "relayoutButton";
    192190      this.relayoutButton.Size = new System.Drawing.Size(24, 24);
    193       this.relayoutButton.TabIndex = 4;
     191      this.relayoutButton.TabIndex = 3;
    194192      this.buttonToolTip.SetToolTip(this.relayoutButton, "Relayout Graph");
    195193      this.relayoutButton.UseVisualStyleBackColor = true;
     
    199197      //
    200198      this.connectButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Interface;
    201       this.connectButton.Location = new System.Drawing.Point(63, 3);
     199      this.connectButton.Location = new System.Drawing.Point(33, 3);
    202200      this.connectButton.Name = "connectButton";
    203201      this.connectButton.Size = new System.Drawing.Size(24, 24);
    204       this.connectButton.TabIndex = 3;
     202      this.connectButton.TabIndex = 2;
    205203      this.buttonToolTip.SetToolTip(this.connectButton, "Connection Tool");
    206204      this.connectButton.UseVisualStyleBackColor = true;
    207205      this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
    208       //
    209       // panButton
    210       //
    211       this.panButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Breakpoint;
    212       this.panButton.Location = new System.Drawing.Point(33, 3);
    213       this.panButton.Name = "panButton";
    214       this.panButton.Size = new System.Drawing.Size(24, 24);
    215       this.panButton.TabIndex = 2;
    216       this.buttonToolTip.SetToolTip(this.panButton, "Pan Tool");
    217       this.panButton.UseVisualStyleBackColor = true;
    218       this.panButton.Click += new System.EventHandler(this.panButton_Click);
    219206      //
    220207      // selectButton
     
    290277    private System.Windows.Forms.Button relayoutButton;
    291278    private System.Windows.Forms.Button connectButton;
    292     private System.Windows.Forms.Button panButton;
    293279    private System.Windows.Forms.Button screenshotButton;
    294280    private System.Windows.Forms.ToolTip buttonToolTip;
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.cs

    r7259 r8000  
    2727using HeuristicLab.MainForm;
    2828using HeuristicLab.MainForm.WindowsForms;
     29using HeuristicLab.Netron.CustomTools;
    2930using Netron.Diagramming.Core;
    3031
     
    3334  [Content(typeof(OperatorGraph), true)]
    3435  public partial class OperatorGraphView : AsynchronousContentView {
     36    private ITool lastActiveTool;
     37
    3538    public OperatorGraphView() {
    3639      InitializeComponent();
     
    3942      this.graphVisualizationInfoView.Controller.Model.Selection.OnNewSelection += new EventHandler(Controller_SelectionChanged);
    4043      this.graphVisualizationInfoView.Controller.OnMouseDown += new EventHandler<MouseEventArgs>(Controller_OnMouseDown);
     44      this.graphVisualizationInfoView.Controller.ParentControl.MouseDown += new MouseEventHandler(ParentControl_MouseDown);
     45      this.graphVisualizationInfoView.Controller.ParentControl.MouseUp += new MouseEventHandler(ParentControl_MouseUp);
    4146      foreach (ITool tool in this.graphVisualizationInfoView.Controller.Tools) {
    4247        tool.OnToolActivate += new EventHandler<ToolEventArgs>(tool_OnToolActivate);
     
    6974      if (Content == null) {
    7075        selectButton.Enabled = false;
    71         panButton.Enabled = false;
    7276        relayoutButton.Enabled = false;
    7377        zoomToFitButton.Enabled = false;
     
    7983      } else {
    8084        selectButton.Enabled = true;
    81         panButton.Enabled = true;
    8285        relayoutButton.Enabled = true;
    8386        zoomToFitButton.Enabled = true;
     
    150153    }
    151154
     155    void ParentControl_MouseDown(object sender, MouseEventArgs e) {
     156      lastActiveTool = this.graphVisualizationInfoView.Controller.ActiveTool;
     157      if (e.Button == MouseButtons.Middle) {
     158        if (!(lastActiveTool is CustomPanTool)) this.graphVisualizationInfoView.Controller.ActivateTool(CustomPanTool.ToolName);
     159      }
     160    }
     161
     162    void ParentControl_MouseUp(object sender, MouseEventArgs e) {
     163      if (e.Button == MouseButtons.Middle) {
     164        if (lastActiveTool != null) this.graphVisualizationInfoView.Controller.ActivateTool(lastActiveTool.Name);
     165        else this.graphVisualizationInfoView.Controller.DeactivateAllTools();
     166      }
     167    }
     168
    152169    #region context menu
    153170    private void Controller_OnShowContextMenu(object sender, EntityMenuEventArgs e) {
     
    252269          button = this.selectButton;
    253270          break;
    254         case ControllerBase.PanToolName:
    255           button = this.panButton;
    256           break;
    257271        case ControllerBase.ConnectionToolName:
    258272          button = this.connectButton;
     
    268282      ITool tool = this.graphVisualizationInfoView.Controller.Tools.Where(t => t.Name == ControllerBase.SelectionToolName).First();
    269283      this.graphVisualizationInfoView.Controller.DeactivateAllTools();
    270     }
    271 
    272     private void panButton_Click(object sender, EventArgs e) {
    273       this.graphVisualizationInfoView.Controller.ActivateTool(ControllerBase.PanToolName);
    274284    }
    275285
Note: See TracChangeset for help on using the changeset viewer.