Changeset 3355
- Timestamp:
- 04/15/10 16:07:38 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/Controller.cs
r2801 r3355 56 56 } 57 57 } 58 59 public void RemoveTool(ITool tool) { 60 if (tool == null) 61 return; 62 tool.Controller = null; 63 registeredTools.Remove(tool); 64 65 IMouseListener mouseTool = tool as IMouseListener; 66 if (mouseTool != null) 67 mouseListeners.Remove(mouseTool); 68 IKeyboardListener keyboardTool = tool as IKeyboardListener; 69 if (keyboardTool != null) 70 keyboardListeners.Remove(keyboardTool); 71 IDragDropListener dragdropTool = tool as IDragDropListener; 72 if (dragdropTool != null) 73 dragdropListeners.Remove(dragdropTool); 74 75 tool.OnToolActivate -= new EventHandler<ToolEventArgs>(AddedTool_OnToolActivate); 76 tool.OnToolDeactivate -= new EventHandler<ToolEventArgs>(AddedTool_OnToolDeactivate); 77 } 58 78 } 59 79 } -
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Core/ControllerBase.cs
r3184 r3355 155 155 /// </summary> 156 156 private IView mView; 157 pr ivateCollectionBase<IMouseListener> mouseListeners;158 pr ivateCollectionBase<IKeyboardListener> keyboardListeners;159 pr ivateCollectionBase<IDragDropListener> dragdropListeners;160 pr ivateIDiagramControl parentControl;161 pr ivateCollectionBase<ITool> registeredTools;162 pr ivateCollectionBase<IActivity> registeredActivity;157 protected CollectionBase<IMouseListener> mouseListeners; 158 protected CollectionBase<IKeyboardListener> keyboardListeners; 159 protected CollectionBase<IDragDropListener> dragdropListeners; 160 protected IDiagramControl parentControl; 161 protected CollectionBase<ITool> registeredTools; 162 protected CollectionBase<IActivity> registeredActivity; 163 163 164 164 #endregion … … 811 811 /// <param name="e">ToolEventArgs</param> 812 812 // ------------------------------------------------------------------ 813 void AddedTool_OnToolDeactivate(object sender, ToolEventArgs e) {813 protected void AddedTool_OnToolDeactivate(object sender, ToolEventArgs e) { 814 814 ITool nextActiveToolInList = null; 815 815 if (this.activeTool == e.Properties) { … … 833 833 /// <param name="e">ToolEventArgs</param> 834 834 // ------------------------------------------------------------------ 835 void AddedTool_OnToolActivate(object sender, ToolEventArgs e) {835 protected void AddedTool_OnToolActivate(object sender, ToolEventArgs e) { 836 836 this.RaiseOnToolActivate(e); 837 837 } -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/GraphVisualizationInfoView.cs
r3186 r3355 74 74 } 75 75 76 protected override void OnReadOnlyChanged() { 77 base.OnReadOnlyChanged(); 78 this.SetEnableStateOfControls(); 79 } 80 81 private void SetEnableStateOfControls() { 82 DeleteTool deleteTool = (DeleteTool) this.Controller.Tools.Where( t => t.Name == ControllerBase.DeleteToolName).FirstOrDefault(); 83 HeuristicLab.Netron.Controller controller = this.Controller as HeuristicLab.Netron.Controller; 84 if (Content == null && deleteTool != null && controller != null) 85 controller.RemoveTool(deleteTool); 86 else { 87 if (ReadOnly && deleteTool != null && controller != null) 88 controller.RemoveTool(deleteTool); 89 else if (!ReadOnly && deleteTool == null) 90 this.Controller.AddTool(new DeleteTool(ControllerBase.DeleteToolName)); 91 } 92 } 93 76 94 private void UpdateContent() { 77 95 foreach (IOperatorShapeInfo shapeInfo in this.shapeInfoShapeMapping.FirstValues) … … 82 100 this.connectionConnectorsMapping.Clear(); 83 101 84 foreach (IOperatorShapeInfo shapeInfo in this.Content.OperatorShapeInfos) 85 if (!this.shapeInfoShapeMapping.ContainsFirst(shapeInfo)) 86 this.AddShapeInfo(shapeInfo); 87 88 foreach (KeyValuePair<KeyValuePair<IOperatorShapeInfo, string>, IOperatorShapeInfo> connection in this.Content.Connections) 89 this.AddConnection(connection.Key.Key, connection.Key.Value, connection.Value); 90 91 this.UpdateLayoutRoot(); 102 if (Content != null) { 103 foreach (IOperatorShapeInfo shapeInfo in this.Content.OperatorShapeInfos) 104 if (!this.shapeInfoShapeMapping.ContainsFirst(shapeInfo)) 105 this.AddShapeInfo(shapeInfo); 106 107 foreach (KeyValuePair<KeyValuePair<IOperatorShapeInfo, string>, IOperatorShapeInfo> connection in this.Content.Connections) 108 this.AddConnection(connection.Key.Key, connection.Key.Value, connection.Value); 109 110 this.UpdateLayoutRoot(); 111 } 112 this.SetEnableStateOfControls(); 92 113 } 93 114 -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.cs
r3176 r3355 72 72 if (createdVisualizationInfo) 73 73 this.graphVisualizationInfoView.RelayoutGraph(); 74 } 74 75 this.SetEnableStateOfControls(); 76 } 77 78 protected override void OnReadOnlyChanged() { 79 base.OnReadOnlyChanged(); 80 this.SetEnableStateOfControls(); 81 } 82 83 private void SetEnableStateOfControls() { 84 if (Content == null) { 85 selectButton.Enabled = false; 86 panButton.Enabled = false; 87 relayoutButton.Enabled = false; 88 zoomAreaButton.Enabled = false; 89 zoomInButton.Enabled = false; 90 zoomOutButton.Enabled = false; 91 screenshotButton.Enabled = false; 92 detailsViewHost.Enabled = false; 93 graphVisualizationInfoView.ReadOnly = true; 94 connectButton.Enabled = false; 95 96 } else { 97 selectButton.Enabled = true; 98 panButton.Enabled = true; 99 relayoutButton.Enabled = true; 100 zoomAreaButton.Enabled = true; 101 zoomInButton.Enabled = true; 102 zoomOutButton.Enabled = true; 103 screenshotButton.Enabled = true; 104 detailsViewHost.Enabled = true; 105 detailsViewHost.ReadOnly = ReadOnly; 106 graphVisualizationInfoView.ReadOnly = ReadOnly; 107 connectButton.Enabled = !ReadOnly; 108 } 109 } 75 110 76 111 private GraphVisualizationInfo VisualizationInfo { … … 160 195 161 196 private void initialOperatorToolStripMenuItem_Click(object sender, EventArgs e) { 162 IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo; 163 if (this.VisualizationInfo.InitialShape == shapeInfo) 164 this.VisualizationInfo.InitialShape = null; 165 else 166 this.VisualizationInfo.InitialShape = shapeInfo; 197 if (!ReadOnly) { 198 IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo; 199 if (this.VisualizationInfo.InitialShape == shapeInfo) 200 this.VisualizationInfo.InitialShape = null; 201 else 202 this.VisualizationInfo.InitialShape = shapeInfo; 203 } 167 204 } 168 205 169 206 private void breakPointToolStripMenuItem_Click(object sender, EventArgs e) { 170 IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo; 171 if (shapeInfo != null) { 172 IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo); 173 op.Breakpoint = !op.Breakpoint; 207 if (!ReadOnly) { 208 IOperatorShapeInfo shapeInfo = this.shapeContextMenu.Tag as IOperatorShapeInfo; 209 if (shapeInfo != null) { 210 IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo); 211 op.Breakpoint = !op.Breakpoint; 212 } 174 213 } 175 214 } … … 179 218 private void OperatorGraphView_DragEnter(object sender, DragEventArgs e) { 180 219 e.Effect = DragDropEffects.None; 220 if (ReadOnly) 221 return; 181 222 Type type = e.Data.GetData("Type") as Type; 182 223 if ((type != null) && (typeof(IOperator).IsAssignableFrom(type))) {
Note: See TracChangeset
for help on using the changeset viewer.