]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/configtool/standalone/wxwin/appsettings.h
Initial revision
[karo-tx-redboot.git] / tools / src / tools / configtool / standalone / wxwin / appsettings.h
1 //####COPYRIGHTBEGIN####
2 //
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 // Copyright (C) 2003 John Dallaway
6 //
7 // This program is part of the eCos host tools.
8 //
9 // This program is free software; you can redistribute it and/or modify it
10 // under the terms of the GNU General Public License as published by the Free
11 // Software Foundation; either version 2 of the License, or (at your option)
12 // any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but WITHOUT
15 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17 // more details.
18 //
19 // You should have received a copy of the GNU General Public License along with
20 // this program; if not, write to the Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 //
23 // ----------------------------------------------------------------------------
24 //
25 //####COPYRIGHTEND####
26 // appsettings.h :
27 //
28 //===========================================================================
29 //#####DESCRIPTIONBEGIN####
30 //
31 // Author(s):   julians, jld
32 // Contact(s):  julians
33 // Date:        2000/08/29
34 // Version:     $Id$
35 // Purpose:
36 // Description: Header file for the ConfigTool application settings
37 // Requires:
38 // Provides:
39 // See also:
40 // Known bugs:
41 // Usage:
42 //
43 //####DESCRIPTIONEND####
44 //
45 //===========================================================================
46
47 #ifndef _ECOS_APPSETTINGS_H_
48 #define _ECOS_APPSETTINGS_H_
49
50 #include "wx/config.h"
51 #include "filename.h"
52 #include "ecutils.h"
53 #include "eCosTest.h"
54
55 #ifdef __WXMSW__
56 #include "wx/msw/winundef.h"
57 #endif
58
59 // Frame status
60 #define ecSHOW_STATUS_NORMAL        0x01
61 #define ecSHOW_STATUS_MINIMIZED     0x02
62 #define ecSHOW_STATUS_MAXIMIZED     0x03
63
64 // What kind of browser (wxHtmlHelpController, default browser, custom browser)
65 enum ecBrowserType { ecInternal, ecAssociatedExternal, ecCustomExternal };
66
67 /*
68  * ecRunTestSettings
69  * Settings relating to running tests
70  */
71 enum ResetType   {RESET_NONE,  RESET_X10, RESET_MANUAL};
72 enum TimeoutType {TIMEOUT_NONE,TIMEOUT_SPECIFIED, TIMEOUT_AUTOMATIC};
73
74 class ecRunTestsSettings: public wxObject
75 {
76 DECLARE_DYNAMIC_CLASS(ecRunTestsSettings)
77 public:
78     ecRunTestsSettings();
79     ecRunTestsSettings(const ecRunTestsSettings& settings);
80
81 //// Operations
82     void Copy(const ecRunTestsSettings& settings);
83
84     bool SaveConfig(wxConfig& config);
85     bool LoadConfig(wxConfig& config);
86
87 //// Data members
88     CeCosTest::ExecutionParameters  m_ep;
89     int         m_nTimeout;
90     int         m_nDownloadTimeout;
91     int         m_nTimeoutType;
92     int         m_nDownloadTimeoutType;
93     bool        m_bRemote;
94     bool        m_bSerial;
95     int         m_nBaud;
96     int         m_nLocalTCPIPPort;
97     int         m_nReset;
98     int         m_nResourcePort;
99     int         m_nRemotePort;
100     bool        m_bFarmed;
101     wxString    m_strPort; // Serial port
102     wxString    m_strTarget;
103
104     wxString    m_strRemoteHost;
105     wxString    m_strResourceHost;
106     wxString    m_strLocalTCPIPHost;
107     wxString    m_strReset;
108 };
109
110 /*
111  * ecSettings
112  * Various application settings
113  */
114
115 class ecSettings: public wxObject
116 {
117 DECLARE_DYNAMIC_CLASS(ecSettings)
118 public:
119     ecSettings();
120     ecSettings(const ecSettings& settings);
121     ~ecSettings();
122
123 //// Operations
124     // Copy from settings to 'this'
125     void Copy(const ecSettings& settings);
126
127     // Load config info
128     bool LoadConfig();
129
130     // Save config info
131     bool SaveConfig();
132
133     // Load and save font descriptions
134     bool LoadFont(wxConfig& config, const wxString& windowName, wxFont& font);
135     bool SaveFont(wxConfig& config, const wxString& windowName, const wxFont& font);
136     bool LoadFonts(wxConfig& config);
137     bool SaveFonts(wxConfig& config);
138     bool ApplyFontsToWindows();
139
140     // Do some initialisation within ecApp::OnInit
141     bool Init();
142
143     // Show settings dialog
144     void ShowSettingsDialog(const wxString& page = wxEmptyString);
145
146     // Create new filename
147     wxString GenerateFilename(const wxString& rootName);
148
149     // Go looking for potential candidates in SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
150     int GetRepositoryRegistryClues(wxArrayString& arstr, const wxString& pszPrefix);
151
152     // Finds the path of the latest installed eCos (Unix only)
153     wxString FindLatestVersion();
154
155     // Find the subkey of the latest installed eCos, e.g. "1.4.9"
156     wxString GetInstallVersionKey ();
157     
158 #ifdef __WXMSW__
159     // Find the location of the Cygwin installation
160     wxString GetCygwinInstallPath ();
161 #endif
162
163 //// Accessors
164
165     wxString GetAppName() const { return m_appName; }
166
167     // Get a name suitable for the configuration file on all platforms:
168     // e.g. eCos Configuration Tool on Windows, .eCosConfigTool on Unix
169     wxString GetConfigAppName() const ;
170
171     wxString& GetLastFilename() { return m_lastFilename; }
172
173     const ecFileName& DefaultExternalBrowser() ;
174
175     const wxString& GetUserToolsDir() const { return m_userToolsDir; }
176     const wxString& GetBuildToolsDir() const { return m_buildToolsDir; }  /* Only used if no other clues */
177
178     wxStringToStringMap& GetBinDirs() { return m_arstrBinDirs; }
179
180     ecRunTestsSettings& GetRunTestsSettings() { return m_runTestsSettings; }
181
182     wxWindowSettings& GetWindowSettings() { return m_windowSettings; }
183
184 public:
185     bool                    m_showToolBar;
186     wxRect                  m_frameSize;
187     wxString                m_appName;     // The current name of the app...
188     bool                    m_showSplashScreen; // Show the splash screen
189     wxString                m_userName;
190     int                     m_serialNumber;
191     wxString                m_lastFilename; // So we can auto-generate sensible filenames
192     int                     m_frameStatus;
193
194         // Sash window sizes
195         wxSize                                  m_treeSashSize;
196         wxSize                                  m_conflictsSashSize;
197         wxSize                                  m_propertiesSashSize;
198         wxSize                                  m_shortDescrSashSize;
199         wxSize                                  m_memorySashSize;
200         wxSize                                  m_outputSashSize;
201     int                     m_configPaneWidth; // The sash to the right of the tree
202     bool                    m_showConflictsWindow;
203     bool                    m_showPropertiesWindow;
204     bool                    m_showShortDescrWindow;
205     bool                    m_showMemoryWindow;
206     bool                    m_showOutputWindow;
207
208     // Are we showing macro names, or ordinary names?
209     bool                    m_showMacroNames ;
210
211     // Are we merely editing the .ecc file and not saving build trees?
212     // This option is specified on the command line and not saved.
213     bool                    m_editSaveFileOnly;
214
215     // Viewers & browsers
216     bool                    m_bUseCustomViewer;
217     bool                    m_bUseExternalBrowser;
218     wxString                m_strBrowser;
219     ecFileName              m_strViewer;
220     ecBrowserType           m_eUseCustomBrowser;
221     static ecFileName       m_strDefaultExternalBrowser;
222     bool                    m_bHex;
223
224     ecFileName              m_userToolsDir;
225     ecFileName              m_buildToolsDir; /* Only used if no other clues */
226
227     wxString                m_strMakeOptions;
228
229     wxStringToStringMap     m_arstrBinDirs;  // Not saved
230     wxArrayString           m_userToolPaths; // Not saved
231
232     ecFileName              m_strRepository; // This is saved/loaded via ecSettings, and
233                                              // copied to/from ecConfigToolDoc on doc creation/deletion.
234                                              // This is because the doc doesn't have its own profile loading/saving.
235
236     enum {Never=0, Immediate=1, Deferred=2, SuggestFixes=4};
237     int                     m_nRuleChecking; // OR of above values
238
239     // Find dialog settings
240     wxString                m_findText;
241     bool                    m_findMatchWholeWord;
242     bool                    m_findMatchCase;
243     bool                    m_findDirection; // Down is TRUE, Up is FALSE
244     wxString                m_findSearchWhat; // Macro names, item names etc.
245     wxPoint                 m_findDialogPos; // Position of dialog
246
247     // Run tests settings
248     ecRunTestsSettings      m_runTestsSettings;
249
250     // Font settings
251     wxWindowSettings        m_windowSettings;
252
253     // Packages dialog settings
254     bool                    m_omitHardwarePackages;
255     bool                    m_matchPackageNamesExactly;
256 };
257
258 #endif
259         // _ECOS_APPSETTINGS_H_