1 ///////////////////////////////////////////////////////////////////////////////
2 // Name:        steopts.cpp
3 // Purpose:     wxSTEditorOptions
4 // Author:      John Labenski, parts taken from wxGuide by Otto Wyss
5 // Modified by:
6 // Created:     11/05/2002
7 // RCS-ID:
8 // Copyright:   (c) John Labenski, Otto Wyss
9 // Licence:     wxWidgets licence
10 ///////////////////////////////////////////////////////////////////////////////
11 
12 #include "precomp.h"
13 
14 #include "wx/stedit/stedit.h"
15 
16 wxString STE_DefaultFileName( wxT("untitled.txt") );
17 wxString STE_DefaultFileExtensions(
18                                     wxT("All Files|")wxALL_FILES_PATTERN wxT("|")
19                                 #if !STE_FILEOPENEXTRA
20                                     wxT("UTF8 Text Files|")wxALL_FILES_PATTERN wxT("|")
21                                     wxT("Unicode Text Files|")wxALL_FILES_PATTERN wxT("|")
22                                 #ifdef __WXMSW__
23                                     wxT("OEM Text Files|")wxALL_FILES_PATTERN wxT("|")
24                                 #endif
25                                 #endif
26                                     wxT("Text Files (txt text)|*.txt;*.text")wxT("|")
27                                     wxT("C/C++ Files (c cpp cxx)|*.c;*.cpp;*.cxx")wxT("|")
28                                     wxT("H Files (h)|*.h")wxT("|")
29                                     wxT("Html Files (htm html)|*.htm;*.html")wxT("|")
30                                     wxT("XML Files (xml)|*.xml")wxT("|")
31                                     wxT("Lua Files (lua)|*.lua")wxT("|")
32                                     wxT("Python Files (py)|*.py")//wxT("|")
33                                     );
34 
35 //-----------------------------------------------------------------------------
36 // wxSTEditorOptions
37 //-----------------------------------------------------------------------------
38 class wxSTEditorOptions_RefData : public wxObjectRefData, public wxClientDataContainer
39 {
40 public:
wxSTEditorOptions_RefData()41     wxSTEditorOptions_RefData() :
42                                     m_steFRData(&wxSTEditorFindReplaceData::sm_findReplaceData),
43                                     m_steFRData_static(true),
44                                     m_steMM(NULL),
45                                     m_steMM_static(false),
46                                     m_fileHistory(NULL),
47                                     m_fileHistory_static(false),
48                                     m_menuBar(NULL),
49                                     m_toolBar(NULL),
50                                     m_statusBar(NULL),
51                                     m_editorPopupMenu(NULL),
52                                     m_splitterPopupMenu(NULL),
53                                     m_notebookPopupMenu(NULL),
54                                     m_editorPopupMenu_static(false),
55                                     m_splitterPopupMenu_static(false),
56                                     m_notebookPopupMenu_static(false),
57                                     m_displayPathSeparator(wxPATH_NATIVE)
58     {
59         m_optionNames.Alloc(STE_OPTION__MAX);
60         m_optionNames.Add(wxT("STE_OPTION_EDITOR"));
61         m_optionNames.Add(wxT("STE_OPTION_SPLITTER"));
62         m_optionNames.Add(wxT("STE_OPTION_NOTEBOOK"));
63         m_optionNames.Add(wxT("STE_OPTION_FRAME"));
64         m_optionNames.Add(wxT("STE_OPTION_CONFIG"));
65         m_optionNames.Add(wxT("STE_OPTION_FINDREPLACE"));
66         m_optionNames.Add(wxT("STE_OPTION_DEFAULT_FILENAME"));
67         m_optionNames.Add(wxT("STE_OPTION_DEFAULT_FILEPATH"));
68         m_optionNames.Add(wxT("STE_OPTION_DEFAULT_FILEEXTS"));
69         m_optionNames.Add(wxT("STE_OPTION_CFGPATH_BASE"));
70         m_optionNames.Add(wxT("STE_OPTION_CFGPATH_PREFS"));
71         m_optionNames.Add(wxT("STE_OPTION_CFGPATH_STYLES"));
72         m_optionNames.Add(wxT("STE_OPTION_CFGPATH_LANGS"));
73         m_optionNames.Add(wxT("STE_OPTION_CFGPATH_FRAME"));
74         m_optionNames.Add(wxT("STE_OPTION_CFGPATH_FILEHISTORY"));
75         m_optionNames.Add(wxT("STE_OPTION_CFGPATH_FINDREPLACE"));
76 
77         m_optionValues.Add(wxEmptyString, STE_OPTION__MAX);
78     }
79 
~wxSTEditorOptions_RefData()80     virtual ~wxSTEditorOptions_RefData()
81     {
82         if (m_steFRData && !m_steFRData_static)
83             delete m_steFRData;
84         if (m_steMM && !m_steMM_static)
85             delete m_steMM;
86         if (m_fileHistory && !m_fileHistory_static)
87             delete m_fileHistory;
88         if (m_editorPopupMenu && !m_editorPopupMenu_static)
89             delete m_editorPopupMenu;
90         if (m_splitterPopupMenu && !m_splitterPopupMenu_static)
91             delete m_splitterPopupMenu;
92         if (m_notebookPopupMenu && !m_notebookPopupMenu_static)
93             delete m_notebookPopupMenu;
94     }
95 
96     wxArrayString m_optionNames;
97     wxArrayString m_optionValues;
98 
99     wxSTEditorPrefs  m_prefs;
100     wxSTEditorStyles m_styles;
101     wxSTEditorLangs  m_langs;
102 
103     wxSTEditorFindReplaceData *m_steFRData;
104     bool m_steFRData_static;
105 
106     wxSTEditorMenuManager *m_steMM;
107     bool m_steMM_static;
108 
109     wxFileHistory *m_fileHistory;
110     bool m_fileHistory_static;
111 
112     wxMenuBar *m_menuBar;
113     wxToolBar *m_toolBar;
114     wxStatusBar *m_statusBar;
115     wxMenu *m_editorPopupMenu;
116     wxMenu *m_splitterPopupMenu;
117     wxMenu *m_notebookPopupMenu;
118     bool m_editorPopupMenu_static;
119     bool m_splitterPopupMenu_static;
120     bool m_notebookPopupMenu_static;
121 
122     wxPathFormat m_displayPathSeparator;
123 };
124 
125 #define STEO_REFDATA ((wxSTEditorOptions_RefData*)m_refData)
126 
wxSTEditorOptions()127 wxSTEditorOptions::wxSTEditorOptions()
128 {
129     m_refData = new wxSTEditorOptions_RefData(); // always created
130 }
131 
wxSTEditorOptions(long editor_opt,long splitter_opt,long notebook_opt,long frame_opt,long config_opt,const wxString & defaultFileName,const wxString & defaultFilePath,const wxString & defaultFileExt)132 wxSTEditorOptions::wxSTEditorOptions(long editor_opt,
133                                      long splitter_opt,
134                                      long notebook_opt,
135                                      long frame_opt,
136                                      long config_opt,
137                                      const wxString& defaultFileName,
138                                      const wxString& defaultFilePath,
139                                      const wxString& defaultFileExt )
140 {
141     m_refData = new wxSTEditorOptions_RefData();
142 
143     SetOptionInt(STE_OPTION_EDITOR,      editor_opt);
144     SetOptionInt(STE_OPTION_SPLITTER,    splitter_opt);
145     SetOptionInt(STE_OPTION_NOTEBOOK,    notebook_opt);
146     SetOptionInt(STE_OPTION_FRAME,       frame_opt);
147     SetOptionInt(STE_OPTION_CONFIG,      config_opt);
148     SetOptionInt(STE_OPTION_FINDREPLACE, STE_FR_DEFAULT_OPTIONS);
149 
150     SetOption(STE_OPTION_DEFAULT_FILENAME, defaultFileName);
151     SetOption(STE_OPTION_DEFAULT_FILEPATH, defaultFilePath);
152     SetOption(STE_OPTION_DEFAULT_FILEEXTS, defaultFileExt);
153 
154     SetOption(STE_OPTION_CFGPATH_BASE,        wxT("/wxSTEditor"));
155     SetOption(STE_OPTION_CFGPATH_PREFS,       wxT("Preferences"));
156     SetOption(STE_OPTION_CFGPATH_STYLES,      wxT("Styles"));
157     SetOption(STE_OPTION_CFGPATH_LANGS,       wxT("Languages"));
158     SetOption(STE_OPTION_CFGPATH_FRAME,       wxT("Frame"));
159     SetOption(STE_OPTION_CFGPATH_FILEHISTORY, wxT("RecentFiles"));
160     SetOption(STE_OPTION_CFGPATH_FINDREPLACE, wxT("FindReplace"));
161 
162     SetUseGlobalPrefsStylesLangs();
163 
164     SetFindReplaceData(&wxSTEditorFindReplaceData::sm_findReplaceData, true);
165     SetMenuManager(new wxSTEditorMenuManager(0), false);
166 }
167 
GetOptionCount() const168 size_t wxSTEditorOptions::GetOptionCount() const
169 {
170     return STEO_REFDATA->m_optionValues.GetCount();
171 }
172 
GetOption(size_t option_n) const173 wxString wxSTEditorOptions::GetOption(size_t option_n) const
174 {
175     return STEO_REFDATA->m_optionValues[option_n];
176 }
SetOption(size_t option_n,const wxString & value)177 void wxSTEditorOptions::SetOption(size_t option_n, const wxString& value)
178 {
179     STEO_REFDATA->m_optionValues[option_n] = value;
180 }
181 
GetOptionName(size_t option_n) const182 wxString wxSTEditorOptions::GetOptionName(size_t option_n) const
183 {
184     return STEO_REFDATA->m_optionNames[option_n];
185 }
SetOptionName(size_t option_n,const wxString & name)186 void wxSTEditorOptions::SetOptionName(size_t option_n, const wxString& name)
187 {
188     STEO_REFDATA->m_optionNames[option_n] = name;
189 }
FindOptionByName(const wxString & name) const190 int wxSTEditorOptions::FindOptionByName(const wxString& name) const
191 {
192     return STEO_REFDATA->m_optionNames.Index(name);
193 }
194 
AddOption(const wxString & name,const wxString & value)195 size_t wxSTEditorOptions::AddOption(const wxString& name, const wxString& value)
196 {
197     STEO_REFDATA->m_optionNames.Add(name);
198     STEO_REFDATA->m_optionValues.Add(value);
199     return STEO_REFDATA->m_optionValues.GetCount() - 1;
200 }
201 
GetEditorPrefs() const202 wxSTEditorPrefs&  wxSTEditorOptions::GetEditorPrefs() const             { return STEO_REFDATA->m_prefs; }
GetEditorStyles() const203 wxSTEditorStyles& wxSTEditorOptions::GetEditorStyles() const            { return STEO_REFDATA->m_styles; }
GetEditorLangs() const204 wxSTEditorLangs&  wxSTEditorOptions::GetEditorLangs() const             { return STEO_REFDATA->m_langs; }
SetEditorPrefs(const wxSTEditorPrefs & prefs)205 void wxSTEditorOptions::SetEditorPrefs(const wxSTEditorPrefs& prefs)    { STEO_REFDATA->m_prefs  = prefs; }
SetEditorStyles(const wxSTEditorStyles & styles)206 void wxSTEditorOptions::SetEditorStyles(const wxSTEditorStyles& styles) { STEO_REFDATA->m_styles = styles; }
SetEditorLangs(const wxSTEditorLangs & langs)207 void wxSTEditorOptions::SetEditorLangs(const wxSTEditorLangs& langs)    { STEO_REFDATA->m_langs  = langs; }
SetUseGlobalPrefsStylesLangs()208 void wxSTEditorOptions::SetUseGlobalPrefsStylesLangs()
209 {
210     STEO_REFDATA->m_prefs  = wxSTEditorPrefs::GetGlobalEditorPrefs();
211     STEO_REFDATA->m_styles = wxSTEditorStyles::GetGlobalEditorStyles();
212     STEO_REFDATA->m_langs  = wxSTEditorLangs::GetGlobalEditorLangs();
213 }
214 
GetFindReplaceData() const215 wxSTEditorFindReplaceData* wxSTEditorOptions::GetFindReplaceData() const
216 {
217     return STEO_REFDATA->m_steFRData;
218 }
SetFindReplaceData(wxSTEditorFindReplaceData * steFRdata,bool is_static)219 void wxSTEditorOptions::SetFindReplaceData(wxSTEditorFindReplaceData* steFRdata, bool is_static)
220 {
221     if (STEO_REFDATA->m_steFRData && !STEO_REFDATA->m_steFRData_static)
222         delete STEO_REFDATA->m_steFRData;
223 
224     STEO_REFDATA->m_steFRData        = steFRdata;
225     STEO_REFDATA->m_steFRData_static = is_static;
226 }
227 
GetMenuManager() const228 wxSTEditorMenuManager* wxSTEditorOptions::GetMenuManager() const
229 {
230     return STEO_REFDATA->m_steMM;
231 }
SetMenuManager(wxSTEditorMenuManager * steMM,bool is_static)232 void wxSTEditorOptions::SetMenuManager(wxSTEditorMenuManager* steMM, bool is_static)
233 {
234     if (STEO_REFDATA->m_steMM && !STEO_REFDATA->m_steMM_static)
235         delete STEO_REFDATA->m_steMM;
236 
237     STEO_REFDATA->m_steMM        = steMM;
238     STEO_REFDATA->m_steMM_static = is_static;
239 }
240 
GetFileHistory() const241 wxFileHistory* wxSTEditorOptions::GetFileHistory() const
242 {
243     return STEO_REFDATA->m_fileHistory;
244 }
SetFileHistory(wxFileHistory * fileHistory,bool is_static)245 void wxSTEditorOptions::SetFileHistory(wxFileHistory* fileHistory, bool is_static)
246 {
247     if (STEO_REFDATA->m_fileHistory && !STEO_REFDATA->m_fileHistory_static)
248         delete STEO_REFDATA->m_fileHistory;
249 
250     STEO_REFDATA->m_fileHistory        = fileHistory;
251     STEO_REFDATA->m_fileHistory_static = is_static;
252 }
253 
GetMenuBar() const254 wxMenuBar* wxSTEditorOptions::GetMenuBar() const        { return STEO_REFDATA->m_menuBar; }
GetToolBar() const255 wxToolBar* wxSTEditorOptions::GetToolBar() const        { return STEO_REFDATA->m_toolBar; }
GetStatusBar() const256 wxStatusBar* wxSTEditorOptions::GetStatusBar() const    { return STEO_REFDATA->m_statusBar; }
GetEditorPopupMenu() const257 wxMenu* wxSTEditorOptions::GetEditorPopupMenu() const   { return STEO_REFDATA->m_editorPopupMenu; }
GetSplitterPopupMenu() const258 wxMenu* wxSTEditorOptions::GetSplitterPopupMenu() const { return STEO_REFDATA->m_splitterPopupMenu; }
GetNotebookPopupMenu() const259 wxMenu* wxSTEditorOptions::GetNotebookPopupMenu() const { return STEO_REFDATA->m_notebookPopupMenu; }
GetDisplayPathSeparator() const260 wxPathFormat wxSTEditorOptions::GetDisplayPathSeparator() const  { return STEO_REFDATA->m_displayPathSeparator; } // maybe use GetOptionInt() instead
SetDisplayPathSeparator(wxPathFormat display_fmt)261 void wxSTEditorOptions::SetDisplayPathSeparator(wxPathFormat display_fmt) { STEO_REFDATA->m_displayPathSeparator = display_fmt; } // maybe use SetOptionInt() instead
262 
SetMenuBar(wxMenuBar * menuBar)263 void wxSTEditorOptions::SetMenuBar(wxMenuBar* menuBar)
264 {
265     if (menuBar == STEO_REFDATA->m_menuBar) return;
266     // if setting new menubar, remove filehistory from old
267     if (STEO_REFDATA->m_menuBar && STEO_REFDATA->m_fileHistory)
268     {
269         for (size_t n = 0; n < STEO_REFDATA->m_menuBar->GetMenuCount(); n++)
270             STEO_REFDATA->m_fileHistory->RemoveMenu(STEO_REFDATA->m_menuBar->GetMenu(n));
271     }
272 
273     STEO_REFDATA->m_menuBar = menuBar;
274 }
SetToolBar(wxToolBar * toolBar)275 void wxSTEditorOptions::SetToolBar(wxToolBar* toolBar)       { STEO_REFDATA->m_toolBar = toolBar; }
SetStatusBar(wxStatusBar * statusBar)276 void wxSTEditorOptions::SetStatusBar(wxStatusBar* statusBar) { STEO_REFDATA->m_statusBar = statusBar; }
SetEditorPopupMenu(wxMenu * menu,bool is_static)277 void wxSTEditorOptions::SetEditorPopupMenu(wxMenu* menu, bool is_static)
278 {
279     if (STEO_REFDATA->m_editorPopupMenu && STEO_REFDATA->m_fileHistory)
280         STEO_REFDATA->m_fileHistory->RemoveMenu(STEO_REFDATA->m_editorPopupMenu);
281     if (STEO_REFDATA->m_editorPopupMenu && !STEO_REFDATA->m_editorPopupMenu_static)
282         delete STEO_REFDATA->m_editorPopupMenu;
283 
284     STEO_REFDATA->m_editorPopupMenu = menu;
285     STEO_REFDATA->m_editorPopupMenu_static = is_static;
286 }
SetSplitterPopupMenu(wxMenu * menu,bool is_static)287 void wxSTEditorOptions::SetSplitterPopupMenu(wxMenu* menu, bool is_static)
288 {
289     if (STEO_REFDATA->m_splitterPopupMenu && STEO_REFDATA->m_fileHistory)
290         STEO_REFDATA->m_fileHistory->RemoveMenu(STEO_REFDATA->m_splitterPopupMenu);
291     if (STEO_REFDATA->m_splitterPopupMenu && !STEO_REFDATA->m_splitterPopupMenu_static)
292         delete STEO_REFDATA->m_splitterPopupMenu;
293 
294     STEO_REFDATA->m_splitterPopupMenu = menu;
295     STEO_REFDATA->m_splitterPopupMenu_static = is_static;
296 }
SetNotebookPopupMenu(wxMenu * menu,bool is_static)297 void wxSTEditorOptions::SetNotebookPopupMenu(wxMenu* menu, bool is_static)
298 {
299     if (STEO_REFDATA->m_notebookPopupMenu && STEO_REFDATA->m_fileHistory)
300         STEO_REFDATA->m_fileHistory->RemoveMenu(STEO_REFDATA->m_notebookPopupMenu);
301     if (STEO_REFDATA->m_notebookPopupMenu && !STEO_REFDATA->m_notebookPopupMenu_static)
302         delete STEO_REFDATA->m_notebookPopupMenu;
303 
304     STEO_REFDATA->m_notebookPopupMenu = menu;
305     STEO_REFDATA->m_notebookPopupMenu_static = is_static;
306 }
307 
RegisterIds()308 /*static*/ void wxSTEditorOptions::RegisterIds()
309 {
310     wxRegisterId(ID_STE__LAST); // TODO: how to do this right?
311 }
312 
SetClientObject(wxClientData * data)313 void wxSTEditorOptions::SetClientObject( wxClientData *data )
314 {
315     wxCHECK_RET(STEO_REFDATA, wxT("invalid wxSTEditorOptions"));
316     STEO_REFDATA->SetClientObject(data);
317 }
GetClientObject() const318 wxClientData *wxSTEditorOptions::GetClientObject() const
319 {
320     wxCHECK_MSG(STEO_REFDATA, NULL, wxT("invalid wxSTEditorOptions"));
321     return STEO_REFDATA->GetClientObject();
322 }
SetClientData(void * data)323 void wxSTEditorOptions::SetClientData( void *data )
324 {
325     wxCHECK_RET(STEO_REFDATA, wxT("invalid wxSTEditorOptions"));
326     STEO_REFDATA->SetClientData(data);
327 }
GetClientData() const328 void *wxSTEditorOptions::GetClientData() const
329 {
330     wxCHECK_MSG(STEO_REFDATA, NULL, wxT("invalid wxSTEditorOptions"));
331     return STEO_REFDATA->GetClientData();
332 }
333 
334 // static
GetGlobalDefaultFileName()335 wxString wxSTEditorOptions::GetGlobalDefaultFileName() { return STE_DefaultFileName; }
336 // static
SetGlobalDefaultFileName(const wxString & fileName)337 void wxSTEditorOptions::SetGlobalDefaultFileName(const wxString& fileName) { STE_DefaultFileName = fileName; }
338 
339 // static
GetGlobalDefaultExtensions()340 wxString wxSTEditorOptions::GetGlobalDefaultExtensions() { return STE_DefaultFileExtensions; }
341 // static
SetGlobalDefaultFileExtensions(const wxString & fileExt)342 void wxSTEditorOptions::SetGlobalDefaultFileExtensions(const wxString& fileExt) { STE_DefaultFileExtensions = fileExt; }
343 
GetConfigPath(size_t path_option_n) const344 wxString wxSTEditorOptions::GetConfigPath(size_t path_option_n) const
345 {
346     wxString basePath   = GetOption(STE_OPTION_CFGPATH_BASE);
347     wxString optionPath = GetOption(path_option_n);
348 
349     // the optionPath is absolute
350     if (optionPath.Length() && (optionPath[0] == wxT('/')))
351         return optionPath;
352 
353     return FixConfigPath(basePath, true) + optionPath;
354 }
355 
356 // static
FixConfigPath(const wxString & path,bool add_sep)357 wxString wxSTEditorOptions::FixConfigPath(const wxString& path, bool add_sep)
358 {
359     if (add_sep && (!path.Length() || (path.Last() != wxT('/'))))
360         return path + wxT("/");
361     if (!add_sep && path.Length() && (path.Last() == wxT('/')))
362         return path.Mid(0, path.Length()-1);
363 
364     return path;
365 }
366 
LoadConfig(wxConfigBase & config)367 void wxSTEditorOptions::LoadConfig(wxConfigBase &config)
368 {
369     if (HasConfigOption(STE_CONFIG_PREFS) && GetEditorPrefs().IsOk())
370         GetEditorPrefs().LoadConfig(config, GetConfigPath(STE_OPTION_CFGPATH_PREFS));
371     if (HasConfigOption(STE_CONFIG_STYLES) && GetEditorStyles().IsOk())
372         GetEditorStyles().LoadConfig(config, GetConfigPath(STE_OPTION_CFGPATH_STYLES));
373     if (HasConfigOption(STE_CONFIG_LANGS) && GetEditorLangs().IsOk())
374         GetEditorLangs().LoadConfig(config, GetConfigPath(STE_OPTION_CFGPATH_LANGS));
375 }
SaveConfig(wxConfigBase & config)376 void wxSTEditorOptions::SaveConfig(wxConfigBase &config)
377 {
378     if (HasConfigOption(STE_CONFIG_PREFS) && GetEditorPrefs().IsOk())
379         GetEditorPrefs().SaveConfig(config, GetConfigPath(STE_OPTION_CFGPATH_PREFS));
380     if (HasConfigOption(STE_CONFIG_STYLES) && GetEditorStyles().IsOk())
381         GetEditorStyles().SaveConfig(config, GetConfigPath(STE_OPTION_CFGPATH_STYLES));
382     if (HasConfigOption(STE_CONFIG_LANGS) && GetEditorLangs().IsOk())
383         GetEditorLangs().SaveConfig(config, GetConfigPath(STE_OPTION_CFGPATH_LANGS));
384 
385     if (GetEditorPrefs().IsOk() || GetEditorStyles().IsOk() || GetEditorLangs().IsOk())
386         config.Flush(true); // what is current only?
387 }
388 
LoadFileConfig(wxConfigBase & config)389 void wxSTEditorOptions::LoadFileConfig( wxConfigBase &config)
390 {
391     const wxString oldpath = config.GetPath();
392     wxFileHistory *fileHistory = GetFileHistory();
393     if (!fileHistory)
394         return;
395 
396     wxString configPath = FixConfigPath(GetConfigPath(STE_OPTION_CFGPATH_FILEHISTORY), false);
397     wxString value, key = configPath+wxT("/LastDir");
398     if (config.Read(key, &value) && wxDirExists(value))
399         SetDefaultFilePath(value);
400 
401     config.SetPath(configPath);
402     fileHistory->Load(config);
403     config.SetPath(oldpath);
404 }
405 
SaveFileConfig(wxConfigBase & config)406 void wxSTEditorOptions::SaveFileConfig(wxConfigBase &config)
407 {
408     const wxString oldpath = config.GetPath();
409     wxFileHistory *fileHistory = GetFileHistory();
410     if (!fileHistory)
411         return;
412 
413     wxString configPath = FixConfigPath(GetConfigPath(STE_OPTION_CFGPATH_FILEHISTORY), false);
414     config.Write(configPath+wxT("/LastDir"), GetDefaultFilePath());
415 
416     config.SetPath(configPath);
417     fileHistory->Save(config);
418     config.SetPath(oldpath);
419 }
420 
421 //-----------------------------------------------------------------------------
422 // wxSTEditorRefDataObject
423 // Derives from wxObject, to satisfy DECLARE_DYNAMIC_CLASS() and
424 // the wxWidgets RTTI system, so that an wxSTEditorRefData instance
425 // can be created like this,
426 // CLASSINFO(wxSTEditorRefDataObject)->CreateObject()
427 //-----------------------------------------------------------------------------
428 
429 class wxSTEditorRefDataObject : public wxObject, public wxSTEditorRefData
430 {
431     DECLARE_DYNAMIC_CLASS(wxSTEditorRefDataObject)
432 };
433 IMPLEMENT_DYNAMIC_CLASS(wxSTEditorRefDataObject, wxObject)
434 const wxClassInfo* STE_GlobalRefDataClassInfo = CLASSINFO(wxSTEditorRefDataObject);
435