]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxGUIScriptingInterface.h
adb07731110be6b505884940aace96aed7662a3f
[bbtk.git] / kernel / src / bbtkWxGUIScriptingInterface.h
1 /*=========================================================================                                                                               
2   Program:   bbtk
3   Module:    $RCSfile: bbtkWxGUIScriptingInterface.h,v $
4   Language:  C++
5   Date:      $Date: 2008/10/17 08:18:15 $
6   Version:   $Revision: 1.14 $
7 =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13 *
14 *  This software is governed by the CeCILL-B license under French law and 
15 *  abiding by the rules of distribution of free software. You can  use, 
16 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
17 *  license as circulated by CEA, CNRS and INRIA at the following URL 
18 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
19 *  or in the file LICENSE.txt.
20 *
21 *  As a counterpart to the access to the source code and  rights to copy,
22 *  modify and redistribute granted by the license, users are provided only
23 *  with a limited warranty  and the software's author,  the holder of the
24 *  economic rights,  and the successive licensors  have only  limited
25 *  liability. 
26 *
27 *  The fact that you are presently reading this means that you have had
28 *  knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */                                                                         
30
31
32 /**
33  * \brief Short description in one line
34  * 
35  * Long description which 
36  * can span multiple lines
37  */
38 /**
39  * \file 
40  * \brief 
41  */
42 /**
43  * \class bbtk::
44  * \brief 
45  */
46
47
48 #ifdef _USE_WXWIDGETS_
49
50         
51 #ifndef __bbtkWxGUIScriptingInterface_h__
52 #define __bbtkWxGUIScriptingInterface_h__
53
54 #include <wx/aui/aui.h>
55 #include "bbtkWx.h"
56 #include <wx/notebook.h>
57 #include <wx/html/htmlwin.h>
58
59
60 #include "bbtkInterpreter.h"
61
62 #include "bbtkWxGUITextEditor.h"
63 #include "bbtkWxGUICommand.h"
64 #include "bbtkWxGUIOutputMessages.h"
65 #include "bbtkWxGUIHtmlBrowser.h"
66 #include "bbtkWxGUIPackageBrowser2.h" 
67
68 namespace bbtk
69 {
70
71   /// A scripting interface window
72   class BBTK_EXPORT WxGUIScriptingInterface : public wxFrame, 
73                                               public InterpreterUser,
74                                               public WxGUICommandUser,
75                                               public WxGUITextEditorUser,
76                                               public WxGUIHtmlBrowserUser
77   {
78   public:
79     WxGUIScriptingInterface( wxWindow *parent );
80     ~WxGUIScriptingInterface();
81
82     /// Returns the Interpreter used 
83     /// ONLY ONE FOR THE MOMENT BUT IN THE FUTURE CAN BE DIFFERENT 
84     /// (DIFFERENT WORKSPACES)
85     Interpreter::Pointer GetInterpreter() const { return mInterpreter; }
86
87     /// Sets the inputs of the workspace : 
88     /// the map is passed as is to the Executer
89     void SetInputs(const std::map<std::string,std::string>& m)
90     { mInterpreter->SetInputs(m); }
91     
92     /// Puts the executer in "no exec" mode, 
93     /// which creates but does not execute pipelines.
94     void SetNoExecMode(bool b) { mInterpreter->SetNoExecMode(b); }
95
96     void SetDialogMode(Interpreter::DialogModeType t) 
97     { mInterpreter->SetDialogMode(t); }
98     
99     /// Runs the interpretation of a file
100     /// Returns false on error
101     bool InterpretFile( const std::string& filename);
102
103     void Open(const std::string& filename);
104
105
106     void OnMenuQuit(wxCommandEvent& event);
107     void OnMenuAbout(wxCommandEvent& event);
108     void OnMenuEditConfig(wxCommandEvent& WXUNUSED(event));
109     void OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event));
110     void OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event));
111     void OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event));
112     void OnMenuRegeneratePackageDoc(wxCommandEvent& WXUNUSED(event));
113     void OnMenuRegenerateBoxesLists(wxCommandEvent& WXUNUSED(event));
114     void OnMenuRegenerateAll(wxCommandEvent& WXUNUSED(event));
115     void OnMenuPlugPackage(wxCommandEvent& WXUNUSED(event));
116     void OnMenuWindowsFiles(wxCommandEvent& event);
117     void OnMenuWindowsHelp(wxCommandEvent& event);
118     void OnMenuWindowsPackageBrowser(wxCommandEvent& event);
119     void OnMenuWindowsMessages(wxCommandEvent& event);
120     void OnMenuWindowsCommand(wxCommandEvent& event);
121     void OnMenuWindowsSave( wxCommandEvent& WXUNUSED(event));
122     void OnMenuWindowsCheck( wxCommandEvent& event, 
123                              wxWindow* w);
124     void OnPaneClose(wxAuiManagerEvent& evt);
125    
126     void SavePerspective();
127     void LoadPerspective();
128     // void OnButtonRun(wxCommandEvent& WXUNUSED(event));
129
130     // Interpreter callbacks
131     bool InterpreterUserHasOwnHtmlPageViewer() { return true; }
132     void InterpreterUserViewHtmlPage(const std::string&);
133
134     // WxGUICommand callbacks
135     void WxGUICommandEnter(const std::string&);
136
137     // WxGUITextEditor callbacks
138     void WxGUITextEditorRun();
139     
140     // WxGUIHtmlBrowser callbacks
141     bool WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target);
142
143
144         void DoRegeneratePackageDoc(const std::string& pack);
145         void DoRegenerateBoxesLists();
146   private:
147     wxAuiManager m_mgr;
148     Interpreter::Pointer mInterpreter;
149  
150     wxAuiNotebook* mwxNotebook;
151
152     
153 //EED    wxNotebook* mwxNotebook;
154 //    wxAuiNotebook* mwxNotebook;
155 //    wxPanel *mwxPageCommand, *mwxPageHelp;
156
157     WxGUICommand                 *mWxGUICommand;
158     WxGUIOutputMessages  *mWxGUIOutputMessages;
159     WxGUIHtmlBrowser     *mWxGUIHtmlBrowser;
160     WxGUITextEditor              *mWxGUITextEditor;
161         WxGUIPackageBrowser2 *mWxGUIPackageBrowser2;
162
163     wxMenuItem* mwxMenuItemReset;
164     //    wxButton* mwxButtonRun;
165
166   public:
167           
168  
169     DECLARE_EVENT_TABLE()
170         
171   };
172
173   
174 } // namespace bbtk
175
176
177 #endif // __bbtkWxGUIScriptingInterface_h__
178
179 #endif //_USE_WXWIDGETS_