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