Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/Controller.cs @ 3355

Last change on this file since 3355 was 3355, checked in by mkommend, 14 years ago

adapted OperatorGraphView to readyonly mechanism (ticket #973)

File size: 2.6 KB
Line 
1#region License Information
2//This end-user license agreement applies to the following software;
3
4//The Netron Diagramming Library
5//Cobalt.IDE
6//Xeon webserver
7//Neon UI Library
8
9//Copyright (C) 2007, Francois M.Vanderseypen, The Netron Project & The Orbifold
10
11//This program is free software; you can redistribute it and/or
12//modify it under the terms of the GNU General Public License
13//as published by the Free Software Foundation; either version 2
14//of the License, or (at your option) any later version.
15
16//This program is distributed in the hope that it will be useful,
17//but WITHOUT ANY WARRANTY; without even the implied warranty of
18//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19//GNU General Public License for more details.
20
21//You should have received a copy of the GNU General Public License
22//along with this program; if not, write to the Free Software
23//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
24
25
26//http://www.fsf.org/licensing/licenses/gpl.html
27
28//http://www.fsf.org/licensing/licenses/gpl-faq.html
29#endregion
30
31using System;
32using System.Collections.Generic;
33using System.Linq;
34using System.Text;
35using Netron.Diagramming.Core;
36
37namespace HeuristicLab.Netron {
38  public class Controller : ControllerBase {
39
40    public const string TextToolName = "Text Tool";
41    public const string TextEditorToolName = "Text Editor Tool";
42
43    public Controller(IDiagramControl surface)
44      : base(surface) {
45    }
46
47    public override bool ActivateTextEditor(ITextProvider textProvider) {
48      TextEditor.GetEditor(textProvider);
49      TextEditor.Show();
50      return true;
51    }
52
53    public ILayout StandardTreeLayout {
54      get {
55        return (ILayout)this.FindActivity("Standard TreeLayout");
56      }
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    }
78  }
79}
Note: See TracBrowser for help on using the repository browser.