]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/configtool/standalone/wxwin/configtool.h
Cleanup CVS ipmorted branch
[karo-tx-redboot.git] / tools / src / tools / configtool / standalone / wxwin / configtool.h
1 //####COPYRIGHTBEGIN####
2 //
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
11 // any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16 // more details.
17 //
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 //
22 // ----------------------------------------------------------------------------
23 //
24 //####COPYRIGHTEND####
25 // configtool.h :
26 //
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
29 //
30 // Author(s):   julians
31 // Contact(s):  julians
32 // Date:        2000/08/24
33 // Version:     $Id: configtool.h,v 1.27 2001/10/11 12:31:42 julians Exp $
34 // Purpose:
35 // Description: main header file for the ConfigTool application
36 // Requires:
37 // Provides:
38 // See also:
39 // Known bugs:
40 // Usage:
41 //
42 //####DESCRIPTIONEND####
43 //
44 //===========================================================================
45
46 #ifndef _ECOS_CONFIGTOOL_H_
47 #define _ECOS_CONFIGTOOL_H_
48
49 #ifdef __GNUG__
50 #pragma interface "configtool.h"
51 #endif
52
53 #include "wx/wx.h"
54 #include "wx/help.h"
55 #include "wx/docview.h"
56 #include "wx/process.h"
57 #include "wx/timer.h"
58 #include "splittree.h"
59
60 #include "appsettings.h"
61
62 class ecValueWindow;
63 class ecMainFrame;
64 class ecConfigTreeCtrl;
65 class ecMemoryLayoutWindow;
66 class ecConfigToolDoc;
67 class ecSplashScreen;
68 class ecPipedProcess;
69
70 /*
71 #ifdef __WXMSW__
72 #include "wx/msw/helpchm.h"
73 #undef wxHelpController
74 #define wxHelpController wxCHMHelpController
75 #endif
76 */
77
78 #if defined(__WXGTK__) || defined(__WXMSW__)
79 #include "wx/html/helpctrl.h"
80 #undef wxHelpController
81 #define wxHelpController wxHtmlHelpController
82 #endif
83
84 #ifdef __VISUALC__
85 #pragma warning(disable:4786)
86 #endif
87
88 #if defined(__WXMSW__) && defined(__WXDEBUG__)
89 // MLT code does not build yet so ecUSE_MLT is always 0
90 #define ecUSE_MLT   0
91 #else
92 #define ecUSE_MLT   0
93 #endif
94
95 // If 1, can optionally use non-standard wxHTML extension to set the base doc path
96 // If 0, NEVER uses relative paths.
97 #define ecDOCSYSTEM_USE_RELATIVE_URLS 1
98
99 #if defined(__WXMSW__) && defined(__WXDEBUG__)
100 #define ecUSE_EXPERIMENTAL_CODE 1
101 #endif
102
103 class WXDLLEXPORT wxZipFSHandler;
104 class WXDLLEXPORT wxFileSystem;
105
106 // Define a new application type, each program should derive a class from wxApp
107 class ecApp : public wxApp
108 {
109     friend class ecMainFrame;
110 public:
111 //// Ctor & dtor
112     ecApp();
113     ~ecApp();
114
115 //// Operations
116     virtual bool OnInit();
117     virtual int OnExit();
118
119     // Log to output window
120     void Log(const wxString& msg);
121
122     // Launch strFileName with the given viewer, or find a viewer if strViewer s empty
123     bool Launch(const wxString & strFileName,const wxString &strViewer);
124
125     // Under Unix, (*cmdLine) is set to the command string appropriate to setting up the variables
126     // Under Windows, cmdLine isn't used
127     bool PrepareEnvironment(bool bWithBuildTools = TRUE, wxString* cmdLine = NULL);
128
129     // Fire off a subprocess to build the library or tests
130     void Build(const wxString& strWhat = wxEmptyString) ;
131
132     // Mount drive e.g. /c
133     static void CygMount(wxChar c);
134     // Mount in text mode e.g. /ecos-c
135     static void CygMountText(wxChar c);
136
137     bool InitializeHelpController();
138
139     void SetStatusText(const wxString& text, bool clearFailingRulesPane = TRUE);
140
141 //// Helpers
142     // Check if there is a (unique) .ecc file in dir
143     bool FindSaveFileInDir(const wxString& dir, wxString& saveFile);
144
145     // Initialize window settings object
146     bool InitializeWindowSettings(bool beforeWindowConstruction);
147
148     // Load resources from disk
149     bool LoadResources();
150
151     // Load a bitmap resource from resource.bin
152     bool LoadBitmapResource(wxBitmap& bitmap, const wxString& filename, int bitmapType, bool addToMemoryFS);
153
154     // Load a text resource from resource.bin
155     bool LoadTextResource(wxString& text, const wxString& filename, bool addToMemoryFS);
156
157     // Get a text resource from the memory filesystem
158     bool GetMemoryTextResource(const wxString& filename, wxString& text);
159
160     // Version-stamp the splash screen
161     bool VersionStampSplashScreen();
162
163 //// Accessors
164
165     // Get settings
166     ecSettings& GetSettings() { return m_settings; }
167
168     // Get help controller
169     wxHelpController& GetHelpController() { return * m_helpController; }
170     bool HasHelpController() const { return (m_helpController != NULL); }
171     void DestroyHelpController() { if (m_helpController) delete m_helpController; m_helpController = NULL; }
172
173     // Get app dir
174     wxString GetAppDir() const { return m_appDir; }
175
176     // Prepend the current app program directory to the name
177     wxString GetFullAppPath(const wxString& filename) const;
178
179     // Are we running in 32K colours or more?
180     bool GetHiColour() const;
181
182     // Get main icon
183     const wxIcon& GetMainIcon() const { return m_mainIcon; }
184     void SetMainIcon(const wxIcon& icon) { m_mainIcon = icon; }
185
186     // What's This? menu with single item
187     wxMenu* GetWhatsThisMenu() const { return m_whatsThisMenu; }
188
189     // Main frame
190     ecMainFrame* GetMainFrame() const { return m_mainFrame; }
191
192     // Config tree control
193     ecConfigTreeCtrl* GetTreeCtrl() const ;
194
195     // MLT window
196     ecMemoryLayoutWindow* GetMLTWindow() const ;
197
198     // Document manager
199     wxDocManager* GetDocManager() const { return m_docManager; }
200
201     // Get active document
202     ecConfigToolDoc* GetConfigToolDoc() const;
203
204     wxString GetHelpFile() const { return m_helpFile; }
205     void SetHelpFile(const wxString& file) { m_helpFile = file; }
206
207     wxFileSystem* GetFileSystem() const { return m_fileSystem; }
208
209     // Lock out value changes while conflicts are being resolved, for example
210     bool GetValuesLocked() { return (m_valuesLocked > 0); }
211     void LockValues() { m_valuesLocked ++; }
212     void UnlockValues() { m_valuesLocked --; wxASSERT( m_valuesLocked >= 0); }
213
214 //// Events
215     void OnWhatsThis(wxCommandEvent& event);
216     void OnProcessTerminated(wxProcess* process);
217
218
219 //// Data members
220     ecSettings          m_settings;
221     wxString            m_appDir;
222     wxHelpController*   m_helpController;
223     wxIcon              m_mainIcon; // Reuse in dialogs
224     wxMenu*             m_whatsThisMenu;
225     wxDocManager*       m_docManager;
226     ecMainFrame*        m_mainFrame;
227     static bool         sm_arMounted[26];
228     int                 m_valuesLocked; // Lock values from being changed
229
230 public:
231
232     ecSplashScreen*     m_splashScreen;
233     wxString            m_strOriginalPath;
234     ecConfigToolDoc*    m_currentDoc;
235     wxString            m_helpFile;
236     ecPipedProcess*     m_pipedProcess;
237     wxBitmap            m_splashScreenBitmap;
238     wxZipFSHandler*     m_zipHandler;
239     wxFileSystem*       m_fileSystem;
240
241 DECLARE_EVENT_TABLE()
242 };
243
244 DECLARE_APP(ecApp);
245
246 /*
247  * ecPingTimer
248  * Just to force idle processing now and again while
249  * the library or tests are building
250  */
251
252 class ecPingTimer: public wxTimer
253 {
254 public:
255     ecPingTimer() {}
256
257     virtual void Notify() ;
258 };
259
260 /*
261  * ecPipedProcess
262  * For running builds and capturing the output
263  */
264
265 class ecPipedProcess : public wxProcess
266 {
267 public:
268     ecPipedProcess()
269     {
270         Redirect();
271         m_pingTimer.Start(100);
272         m_pid = 0;
273     }
274     ~ecPipedProcess()
275     {
276         m_pingTimer.Stop();
277     }
278
279 //// Overrides
280     virtual void OnTerminate(int pid, int status);
281
282 //// Operations
283     virtual bool HasInput();
284
285 //// Accessors
286     void SetPid(long pid) { m_pid = pid; }
287     long GetPid() const { return m_pid; }
288
289 protected:
290     ecPingTimer m_pingTimer;
291     long        m_pid;
292 };
293
294 // IDs for the controls and the menu commands
295
296 //// Menus & tools
297 #define ecID_NEW_REGION                 2102
298 #define ecID_NEW_SECTION                2103
299 #define ecID_DELETE                     2104
300 #define ecID_PROPERTIES                 2105
301
302 // File menu
303 #define ecID_IMPORT                     2150
304 #define ecID_EXPORT                     2151
305
306 // Edit menu
307 #define ecID_SAVE_OUTPUT                2152
308 #define ecID_FIND_NEXT                  2153
309
310 // View menu
311 #define ecID_SETTINGS                   2162
312 #define ecID_TOOLBARS                   2163
313 #define ecID_TOOLBARS_STANDARD          2164
314 #define ecID_TOOLBARS_MEMORY            2165
315 #define ecID_VIEW_NEXT                  2166
316 #define ecID_VIEW_PREVIOUS              2167
317 #define ecID_TOGGLE_CONFLICTS           2168
318 #define ecID_TOGGLE_PROPERTIES          2169
319 #define ecID_TOGGLE_MEMORY              2170
320 #define ecID_TOGGLE_SHORT_DESCR         2171
321 #define ecID_TOGGLE_OUTPUT              2172
322
323 // Build menu
324 #define ecID_STOP_BUILD                 2180
325 #define ecID_BUILD_LIBRARY              2181
326 #define ecID_BUILD_TESTS                2182
327 #define ecID_CLEAN                      2183
328 #define ecID_BUILD_OPTIONS              2184
329 #define ecID_BUILD_REPOSITORY           2185
330 #define ecID_BUILD_TEMPLATES            2186
331 #define ecID_BUILD_PACKAGES             2187
332 #define ecID_GENERATE_BUILD_TREE        2188
333
334 // Tools menu
335 #define ecID_PATHS                      2200
336 #define ecID_PATHS_BUILD_TOOLS          2201
337 #define ecID_PATHS_USER_TOOLS           2202
338 #define ecID_SHELL                      2203
339 #define ecID_RUN_TESTS                  2204
340 #define ecID_PLATFORMS                  2205
341 #define ecID_RESOLVE_CONFLICTS          2206
342 #define ecID_ADMINISTRATION             2207
343 #define ecID_TOOLS_OPTIONS              2208
344 #define ecID_INDEX_DOCS                 2209
345
346 // Help menu
347 #define ecID_CONFIGTOOL_HELP            2220
348 #define ecID_ECOS_HELP                  2221
349 #define ecID_REDHAT_WEB                 2222
350 #define ecID_REDHAT_WEB_HOME            2223
351 #define ecID_REDHAT_WEB_ECOS            2224
352 #define ecID_REDHAT_WEB_NET_RELEASE     2225
353 #define ecID_REDHAT_WEB_UITRON          2226
354 #define ecID_CONTEXT_HELP               2227
355 #define ecID_REPOSITORY_INFO            2228
356
357 // Tree right-click menu
358 #define ecID_WHATS_THIS            2250
359 #define ecID_TREE_PROPERTIES            2251
360 #define ecID_TREE_RESTORE_DEFAULTS      2252
361 #define ecID_TREE_VISIT_DOC             2253
362 #define ecID_TREE_VIEW_HEADER           2254
363 #define ecID_TREE_UNLOAD_PACKAGE        2255
364
365 // Conflict window right-click menu
366 #define ecID_LOCATE_ITEM                2256
367 #define ecID_RESOLVE_ITEM               2257
368
369 //// Controls & windows
370
371 #define ecID_TREE_CTRL                  2000
372 #define ecID_SPLITTER_WINDOW            2001
373 #define ecID_VALUE_WINDOW               2002
374 #define ecID_MAIN_FRAME                 2003
375 #define ecID_SCROLLED_WINDOW            2004
376 #define ecID_TOOLBAR                    2005
377
378 #define ecID_CONFLICTS_WINDOW           2006
379 #define ecID_PROPERTIES_WINDOW          2007
380 #define ecID_MEMORY_WINDOW              2008
381 #define ecID_SHORT_DESCR_WINDOW         2009
382 #define ecID_OUTPUT_WINDOW              2010
383
384 #define ecID_CONFIG_SASH_WINDOW         2020
385 #define ecID_CONFLICTS_SASH_WINDOW      2021
386 #define ecID_PROPERTIES_SASH_WINDOW     2022
387 #define ecID_MEMORY_SASH_WINDOW         2023
388 #define ecID_SHORT_DESCR_SASH_WINDOW    2024
389 #define ecID_OUTPUT_SASH_WINDOW         2025
390 #define ecID_ABOUT_DIALOG               2026
391 #define ecID_ABOUT_DIALOG_HTML_WINDOW   2027
392 #define ecID_FIND_DIALOG                2028
393
394 // The control used to edit a config item value
395 #define ecID_ITEM_EDIT_WINDOW           2030
396
397 #define ecID_SETTINGS_DIALOG            2031
398 #define ecID_SETTINGS_NOTEBOOK          2032
399 #define ecID_SETTINGS_DISPLAY           2033
400 #define ecID_SETTINGS_VIEWER            2034
401 #define ecID_SETTINGS_PATH              2035
402 #define ecID_SETTINGS_CONFLICT_RESOLUTION 2036
403 #define ecID_SETTINGS_RUN               2037
404
405 #define ecID_SECTION_DIALOG             2040
406 #define ecID_SECTION_NOTEBOOK           2041
407 #define ecID_SECTION_GENERAL            2042
408 #define ecID_SECTION_RELOCATION         2043
409 #define ecID_SECTION_NOTE               2044
410
411 #define ecID_PLATFORM_EDITOR_DIALOG     2050
412 #define ecID_BUILD_OPTIONS_DIALOG       2051
413 #define ecID_PLATFORMS_DIALOG           2052
414 #define ecID_TEMPLATES_DIALOG           2053
415 #define ecID_ADMIN_DIALOG               2054
416 #define ecID_PACKAGES_DIALOG            2055
417
418 #define ecID_RUN_TESTS_DIALOG           2056
419 #define ecID_RUN_TESTS_NOTEBOOK         2057
420 #define ecID_RUN_TESTS_EXECUTABLES      2058
421 #define ecID_RUN_TESTS_OUTPUT           2059
422 #define ecID_RUN_TESTS_SUMMARY          2060
423
424 #define ecID_RUN_TESTS_RUN              2061
425 #define ecID_RUN_TESTS_PROPERTIES       2062
426
427 //#define ecID_RUN_TESTS_TEST_LIST        2062
428 //#define ecID_RUN_TESTS_SUMMARY_LIST     2063
429 //#define ecID_CONFIG_PROPERTIES_LIST     2064
430
431 #define ecID_CHOOSE_REPOSITORY_DIALOG   2070
432 #define ecID_CONFIG_PROPERTIES_DIALOG   2071
433
434 #define ecID_LICENSE_DIALOG             2080
435 #define ecID_LICENSE_TEXT               2081
436
437 #define ecID_FOLDER_DIALOG              2090
438 #define ecID_FOLDER_DIALOG_MSG          2091
439 #define ecID_FOLDER_DIALOG_BROWSE       2092
440 #define ecID_FOLDER_DIALOG_PATHS        2093
441
442 #define ecID_REPOS_DIALOG_HTML_WINDOW   2094
443 #define ecID_REPOS_DIALOG               2095
444
445 #define ecID_BUILD_TOOLS_DIALOG         2300
446 #define ecID_USER_TOOLS_DIALOG          2301
447 #define ecID_EDIT_STRING_DIALOG         2302
448 #define ecID_STRING_EDIT_TEXTCTRL       2303
449
450 #endif
451         // _ECOS_CONFIGTOOL_H_