Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2901


Ignore:
Timestamp:
03/01/10 17:34:36 (15 years ago)
Author:
mkommend
Message:

enable disable action buttons (ticket #867)

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Tools/ConnectionTool.cs

    r2868 r2901  
    8484    public void MouseUp(MouseEventArgs e) {
    8585      if (IsActive) {
    86         DeactivateTool();
    87 
    8886        // First, make sure the initial point is far enough away from
    8987        // the final point to make a connection.
     
    137135        //drop the painted ghost
    138136        Controller.View.ResetGhost();
    139         //release other tools
    140         this.UnsuspendTools();
     137        this.doDraw = false;
    141138      }
    142139    }
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Tools/ZoomAreaTool.cs

    r2768 r2901  
    124124            if (IsActive)
    125125            {
    126                 DeactivateTool();
    127126                IView view = Controller.View;
    128127                if (view.Ghost != null)
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.cs

    r2899 r2901  
    4646      this.graphVisualizationInfoView.Controller.OnShowContextMenu += new EventHandler<EntityMenuEventArgs>(Controller_OnShowContextMenu);
    4747      this.graphVisualizationInfoView.Controller.Model.Selection.OnNewSelection += new EventHandler(Controller_SelectionChanged);
     48      foreach (ITool tool in this.graphVisualizationInfoView.Controller.Tools) {
     49        tool.OnToolActivate += new EventHandler<ToolEventArgs>(tool_OnToolActivate);
     50        tool.OnToolDeactivate += new EventHandler<ToolEventArgs>(tool_OnToolDeactivate);
     51      }
    4852    }
    4953
     
    183187    #endregion
    184188
     189    private void tool_OnToolActivate(object sender, ToolEventArgs e) {
     190      Button button = GetButtonForTool(e.Properties.Name);
     191      if (button != null)
     192        button.Enabled = false;
     193    }
     194
     195    private void tool_OnToolDeactivate(object sender, ToolEventArgs e) {
     196      Button button = GetButtonForTool(e.Properties.Name);
     197      if (button != null)
     198        button.Enabled = true;
     199    }
     200
     201    private Button GetButtonForTool(string toolName) {
     202      Button button = null;
     203      switch (toolName) {
     204        case ControllerBase.SelectionToolName:
     205          button = this.selectButton;
     206          break;
     207        case ControllerBase.PanToolName:
     208          button = this.panButton;
     209          break;
     210        case ControllerBase.ConnectionToolName:
     211          button = this.connectButton;
     212          break;
     213        case ControllerBase.ZoomAreaToolName:
     214          button = this.zoomAreaButton;
     215          break;
     216      }
     217      return button;
     218    }
     219
    185220    private void selectButton_Click(object sender, EventArgs e) {
    186221      ITool tool = this.graphVisualizationInfoView.Controller.Tools.Where(t => t.Name == ControllerBase.SelectionToolName).First();
    187222      tool.IsSuspended = false;
    188       tool = this.graphVisualizationInfoView.Controller.Tools.Where(t => t.Name == ControllerBase.PanToolName).First();
    189       this.graphVisualizationInfoView.Controller.DeactivateTool(tool);
     223      this.graphVisualizationInfoView.Controller.DeactivateAllTools();
    190224    }
    191225
    192226    private void panButton_Click(object sender, EventArgs e) {
    193       ITool tool = this.graphVisualizationInfoView.Controller.Tools.Where(t => t.Name == ControllerBase.SelectionToolName).First();
    194       tool.IsSuspended = true;
    195227      this.graphVisualizationInfoView.Controller.ActivateTool(ControllerBase.PanToolName);
    196228    }
Note: See TracChangeset for help on using the changeset viewer.