1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
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)
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
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.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
31 // Contact(s): julians
33 // Version: $Id: configtool.h,v 1.27 2001/10/11 12:31:42 julians Exp $
35 // Description: main header file for the ConfigTool application
42 //####DESCRIPTIONEND####
44 //===========================================================================
46 #ifndef _ECOS_CONFIGTOOL_H_
47 #define _ECOS_CONFIGTOOL_H_
50 #pragma interface "configtool.h"
55 #include "wx/docview.h"
56 #include "wx/process.h"
58 #include "splittree.h"
60 #include "appsettings.h"
64 class ecConfigTreeCtrl;
65 class ecMemoryLayoutWindow;
66 class ecConfigToolDoc;
72 #include "wx/msw/helpchm.h"
73 #undef wxHelpController
74 #define wxHelpController wxCHMHelpController
78 #if defined(__WXGTK__) || defined(__WXMSW__)
79 #include "wx/html/helpctrl.h"
80 #undef wxHelpController
81 #define wxHelpController wxHtmlHelpController
85 #pragma warning(disable:4786)
88 #if defined(__WXMSW__) && defined(__WXDEBUG__)
89 // MLT code does not build yet so ecUSE_MLT is always 0
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
99 #if defined(__WXMSW__) && defined(__WXDEBUG__)
100 #define ecUSE_EXPERIMENTAL_CODE 1
103 class WXDLLEXPORT wxZipFSHandler;
104 class WXDLLEXPORT wxFileSystem;
106 // Define a new application type, each program should derive a class from wxApp
107 class ecApp : public wxApp
109 friend class ecMainFrame;
116 virtual bool OnInit();
117 virtual int OnExit();
119 // Log to output window
120 void Log(const wxString& msg);
122 // Launch strFileName with the given viewer, or find a viewer if strViewer s empty
123 bool Launch(const wxString & strFileName,const wxString &strViewer);
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);
129 // Fire off a subprocess to build the library or tests
130 void Build(const wxString& strWhat = wxEmptyString) ;
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);
137 bool InitializeHelpController();
139 void SetStatusText(const wxString& text, bool clearFailingRulesPane = TRUE);
142 // Check if there is a (unique) .ecc file in dir
143 bool FindSaveFileInDir(const wxString& dir, wxString& saveFile);
145 // Initialize window settings object
146 bool InitializeWindowSettings(bool beforeWindowConstruction);
148 // Load resources from disk
149 bool LoadResources();
151 // Load a bitmap resource from resource.bin
152 bool LoadBitmapResource(wxBitmap& bitmap, const wxString& filename, int bitmapType, bool addToMemoryFS);
154 // Load a text resource from resource.bin
155 bool LoadTextResource(wxString& text, const wxString& filename, bool addToMemoryFS);
157 // Get a text resource from the memory filesystem
158 bool GetMemoryTextResource(const wxString& filename, wxString& text);
160 // Version-stamp the splash screen
161 bool VersionStampSplashScreen();
166 ecSettings& GetSettings() { return m_settings; }
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; }
174 wxString GetAppDir() const { return m_appDir; }
176 // Prepend the current app program directory to the name
177 wxString GetFullAppPath(const wxString& filename) const;
179 // Are we running in 32K colours or more?
180 bool GetHiColour() const;
183 const wxIcon& GetMainIcon() const { return m_mainIcon; }
184 void SetMainIcon(const wxIcon& icon) { m_mainIcon = icon; }
186 // What's This? menu with single item
187 wxMenu* GetWhatsThisMenu() const { return m_whatsThisMenu; }
190 ecMainFrame* GetMainFrame() const { return m_mainFrame; }
192 // Config tree control
193 ecConfigTreeCtrl* GetTreeCtrl() const ;
196 ecMemoryLayoutWindow* GetMLTWindow() const ;
199 wxDocManager* GetDocManager() const { return m_docManager; }
201 // Get active document
202 ecConfigToolDoc* GetConfigToolDoc() const;
204 wxString GetHelpFile() const { return m_helpFile; }
205 void SetHelpFile(const wxString& file) { m_helpFile = file; }
207 wxFileSystem* GetFileSystem() const { return m_fileSystem; }
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); }
215 void OnWhatsThis(wxCommandEvent& event);
216 void OnProcessTerminated(wxProcess* process);
220 ecSettings m_settings;
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
232 ecSplashScreen* m_splashScreen;
233 wxString m_strOriginalPath;
234 ecConfigToolDoc* m_currentDoc;
236 ecPipedProcess* m_pipedProcess;
237 wxBitmap m_splashScreenBitmap;
238 wxZipFSHandler* m_zipHandler;
239 wxFileSystem* m_fileSystem;
241 DECLARE_EVENT_TABLE()
248 * Just to force idle processing now and again while
249 * the library or tests are building
252 class ecPingTimer: public wxTimer
257 virtual void Notify() ;
262 * For running builds and capturing the output
265 class ecPipedProcess : public wxProcess
271 m_pingTimer.Start(100);
280 virtual void OnTerminate(int pid, int status);
283 virtual bool HasInput();
286 void SetPid(long pid) { m_pid = pid; }
287 long GetPid() const { return m_pid; }
290 ecPingTimer m_pingTimer;
294 // IDs for the controls and the menu commands
297 #define ecID_NEW_REGION 2102
298 #define ecID_NEW_SECTION 2103
299 #define ecID_DELETE 2104
300 #define ecID_PROPERTIES 2105
303 #define ecID_IMPORT 2150
304 #define ecID_EXPORT 2151
307 #define ecID_SAVE_OUTPUT 2152
308 #define ecID_FIND_NEXT 2153
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
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
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
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
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
365 // Conflict window right-click menu
366 #define ecID_LOCATE_ITEM 2256
367 #define ecID_RESOLVE_ITEM 2257
369 //// Controls & windows
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
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
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
394 // The control used to edit a config item value
395 #define ecID_ITEM_EDIT_WINDOW 2030
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
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
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
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
424 #define ecID_RUN_TESTS_RUN 2061
425 #define ecID_RUN_TESTS_PROPERTIES 2062
427 //#define ecID_RUN_TESTS_TEST_LIST 2062
428 //#define ecID_RUN_TESTS_SUMMARY_LIST 2063
429 //#define ecID_CONFIG_PROPERTIES_LIST 2064
431 #define ecID_CHOOSE_REPOSITORY_DIALOG 2070
432 #define ecID_CONFIG_PROPERTIES_DIALOG 2071
434 #define ecID_LICENSE_DIALOG 2080
435 #define ecID_LICENSE_TEXT 2081
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
442 #define ecID_REPOS_DIALOG_HTML_WINDOW 2094
443 #define ecID_REPOS_DIALOG 2095
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
451 // _ECOS_CONFIGTOOL_H_