]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxGUIScriptingInterface.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkWxGUIScriptingInterface.h
1 /*=========================================================================                                                                               
2   Program:   bbtk
3   Module:    $RCSfile: bbtkWxGUIScriptingInterface.h,v $
4   Language:  C++
5   Date:      $Date: 2008/12/15 09:04:47 $
6   Version:   $Revision: 1.15 $
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     //    void InterpreterUserOnBreak();
134
135     // WxGUICommand callbacks
136     void WxGUICommandEnter(const std::string&);
137
138     // WxGUITextEditor callbacks
139     void WxGUITextEditorRun();
140     
141     // WxGUIHtmlBrowser callbacks
142     bool WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target);
143
144
145         void DoRegeneratePackageDoc(const std::string& pack);
146         void DoRegenerateBoxesLists();
147   private:
148     wxAuiManager m_mgr;
149     Interpreter::Pointer mInterpreter;
150  
151     wxAuiNotebook* mwxNotebook;
152
153     
154 //EED    wxNotebook* mwxNotebook;
155 //    wxAuiNotebook* mwxNotebook;
156 //    wxPanel *mwxPageCommand, *mwxPageHelp;
157
158     WxGUICommand                 *mWxGUICommand;
159     WxGUIOutputMessages  *mWxGUIOutputMessages;
160     WxGUIHtmlBrowser     *mWxGUIHtmlBrowser;
161     WxGUITextEditor              *mWxGUITextEditor;
162         WxGUIPackageBrowser2 *mWxGUIPackageBrowser2;
163
164     wxMenuItem* mwxMenuItemReset;
165     //    wxButton* mwxButtonRun;
166
167     bool mBreaked;
168
169   public:
170           
171  
172     DECLARE_EVENT_TABLE()
173         
174   };
175
176   
177 } // namespace bbtk
178
179
180 #endif // __bbtkWxGUIScriptingInterface_h__
181
182 #endif //_USE_WXWIDGETS_