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 @ 4068

Last change on this file since 4068 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

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 Netron.Diagramming.Core;
33
34namespace HeuristicLab.Netron {
35  public class Controller : ControllerBase {
36
37    public const string TextToolName = "Text Tool";
38    public const string TextEditorToolName = "Text Editor Tool";
39
40    public Controller(IDiagramControl surface)
41      : base(surface) {
42    }
43
44    public override bool ActivateTextEditor(ITextProvider textProvider) {
45      TextEditor.GetEditor(textProvider);
46      TextEditor.Show();
47      return true;
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.