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