Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/Controller.cs @ 8614

Last change on this file since 8614 was 8000, checked in by jkarder, 13 years ago

#1747:

  • added support to pan with the middle mouse button
  • removed pan button
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 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      TextEditor.GetEditor(textProvider);
48      TextEditor.Show();
49      return true;
50    }
51
52    public ILayout StandardTreeLayout {
53      get {
54        return (ILayout)this.FindActivity("Standard TreeLayout");
55      }
56    }
57
58    public void RemoveTool(ITool tool) {
59      if (tool == null)
60        return;
61      tool.Controller = null;
62      registeredTools.Remove(tool);
63
64      IMouseListener mouseTool = tool as IMouseListener;
65      if (mouseTool != null)
66        mouseListeners.Remove(mouseTool);
67      IKeyboardListener keyboardTool = tool as IKeyboardListener;
68      if (keyboardTool != null)
69        keyboardListeners.Remove(keyboardTool);
70      IDragDropListener dragdropTool = tool as IDragDropListener;
71      if (dragdropTool != null)
72        dragdropListeners.Remove(dragdropTool);
73
74      tool.OnToolActivate -= new EventHandler<ToolEventArgs>(AddedTool_OnToolActivate);
75      tool.OnToolDeactivate -= new EventHandler<ToolEventArgs>(AddedTool_OnToolDeactivate);
76    }
77  }
78}
Note: See TracBrowser for help on using the repository browser.