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

Last change on this file since 9181 was 9181, checked in by mkommend, 9 years ago

#2006: Changed GhostFactory to not hold a reference to the View object and completely removed the TextEditor tool as it was not in use.

File size: 2.5 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 HeuristicLab.Netron.CustomTools;
33using Netron.Diagramming.Core;
34
35namespace HeuristicLab.Netron {
36  public class Controller : ControllerBase {
37
38    public const string TextToolName = "Text Tool";
39    public const string TextEditorToolName = "Text Editor Tool";
40
41    public Controller(IDiagramControl surface)
42      : base(surface) {
43      base.AddTool(new CustomPanTool());
44    }
45
46    public override bool ActivateTextEditor(ITextProvider textProvider) {
47      return false;
48    }
49
50    public ILayout StandardTreeLayout {
51      get {
52        return (ILayout)this.FindActivity("Standard TreeLayout");
53      }
54    }
55
56    public void RemoveTool(ITool tool) {
57      if (tool == null)
58        return;
59      tool.Controller = null;
60      registeredTools.Remove(tool);
61
62      IMouseListener mouseTool = tool as IMouseListener;
63      if (mouseTool != null)
64        mouseListeners.Remove(mouseTool);
65      IKeyboardListener keyboardTool = tool as IKeyboardListener;
66      if (keyboardTool != null)
67        keyboardListeners.Remove(keyboardTool);
68      IDragDropListener dragdropTool = tool as IDragDropListener;
69      if (dragdropTool != null)
70        dragdropListeners.Remove(dragdropTool);
71
72      tool.OnToolActivate -= new EventHandler<ToolEventArgs>(AddedTool_OnToolActivate);
73      tool.OnToolDeactivate -= new EventHandler<ToolEventArgs>(AddedTool_OnToolDeactivate);
74    }
75  }
76}
Note: See TracBrowser for help on using the repository browser.