-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimingMainFrame.cpp
490 lines (433 loc) · 18.7 KB
/
TimingMainFrame.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
// Copyright 2008 Daniel Anselmi
//
// This file is part of TimingEditor.
//
// TimingEditor is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// TimingEditor is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with TimingEditor. If not, see <http://www.gnu.org/licenses/>.
//
// Contact e-mail: daniel anselmi <[email protected]>
// Program URL : http://sourceforge.net/projects/timingeditor/
//
//
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif //WX_PRECOMP
#include <wx/config.h>
//#include <wx/tipdlg.h>
#include <wx/aboutdlg.h>
#include "myTipProvider.h"
#include "TimingMainFrame.h"
#include "TimingApp.h"//GetApp
#include "enumers.h"
#include "TimingView.h"
#include "dndfile.h"
#include "TimingWindow.h"
#include "ClockSettingsPanel.h"
#include "TransitionSettingsPanel.h"
#include "AxisSettingsPanel.h"
#include "TimeCompressorSettingsPanel.h"
#include "art/new.xpm"
#include "art/open.xpm"
#include "art/save.xpm"
#include "art/cut.xpm"
#include "art/copy.xpm"
#include "art/paste.xpm"
#include "art/undo.xpm"
#include "art/redo.xpm"
#include "art/help.xpm"
#include "art/glassntool.xpm"
#include "art/glassptool.xpm"
#include "art/tri.xpm"
#include "art/ruler_cur.xpm"
#include "art/harrow_cur.xpm"
#include "art/textedit_cur.xpm"
#include "art/cross.xpm"
#include "art/risingedge.xpm"
#include "art/clockedge.xpm"
#include "art/busedge.xpm"
///////////////////////////////////////////////////////////////////////////
IMPLEMENT_CLASS(TimingMainFrame, wxDocMDIParentFrame)
BEGIN_EVENT_TABLE(TimingMainFrame, wxDocMDIParentFrame )
EVT_MENU(wxID_ABOUT, TimingMainFrame::OnAbout)
EVT_MENU(TIMING_ID_HELP, TimingMainFrame::OnHelp)
EVT_MENU(TIMING_ID_TIP, TimingMainFrame::OnTip)
EVT_MENU(TIMING_ID_MENUITEM_CLOCK_TYPE, TimingMainFrame::HandlePanel)
EVT_MENU(TIMING_ID_MENUITEM_TIME_COMPRESSOR, TimingMainFrame::HandlePanel)
EVT_MENU(TIMING_ID_MENUITEM_AXIS_TIME, TimingMainFrame::HandlePanel)
EVT_MENU(TIMING_ID_MENUITEM_TRANSITION, TimingMainFrame::HandlePanel)
EVT_MENU(TIMING_ID_MENUITEM_DEFAULT, TimingMainFrame::LoadDefaultLayout)
EVT_UPDATE_UI(wxID_COPY, TimingMainFrame::OnUpdateCopy)
EVT_UPDATE_UI(wxID_CUT, TimingMainFrame::OnUpdateCut)
EVT_UPDATE_UI(wxID_PASTE, TimingMainFrame::OnUpdatePaste)
EVT_UPDATE_UI(TIMING_ID_DELETE, TimingMainFrame::OnUpdateDelete)
EVT_UPDATE_UI(TIMING_ID_GLASS_N, TimingMainFrame::OnUpdateGlassN)
EVT_UPDATE_UI(TIMING_ID_GLASS_P, TimingMainFrame::OnUpdateGlassP)
EVT_UPDATE_UI(TIMING_ID_DISCONTINUATION, TimingMainFrame::OnUpdateDiscont)
EVT_UPDATE_UI(TIMING_ID_RULER, TimingMainFrame::OnUpdateDiscont)
EVT_UPDATE_UI(TIMING_ID_HARROW, TimingMainFrame::OnUpdateDiscont)
EVT_UPDATE_UI(TIMING_ID_EDITTEXT, TimingMainFrame::OnUpdateDiscont)
EVT_UPDATE_UI(TIMING_ID_NEUTRAL, TimingMainFrame::OnUpdateDiscont)
EVT_UPDATE_UI( TIMING_ID_MENUITEM_CLOCK_TYPE, TimingMainFrame::UpdateMenuItems)
EVT_UPDATE_UI( TIMING_ID_MENUITEM_TIME_COMPRESSOR,TimingMainFrame::UpdateMenuItems)
EVT_UPDATE_UI( TIMING_ID_MENUITEM_AXIS_TIME, TimingMainFrame::UpdateMenuItems)
EVT_UPDATE_UI( TIMING_ID_MENUITEM_TRANSITION, TimingMainFrame::UpdateMenuItems)
EVT_UPDATE_UI_RANGE(TIMING_ID_ADD_CLOCK,
TIMING_ID_ADD_BUS, TimingMainFrame::OnUpdateDiscont)
END_EVENT_TABLE()
TimingMainFrame::TimingMainFrame(wxDocManager *manager, wxFrame *frame, int id, const wxString& title, wxPoint pos, wxSize size, int style )
: wxDocMDIParentFrame(manager, frame, id, title, pos, size, style),
editMenu(NULL)
{
//// Give it an icon
#ifdef __WXMSW__
//SetIcon(wxIcon(_T("nassi")));
SetIcon(wxICON(aaaa)); // To Set App Icon
#endif
#ifdef __X__
SetIcon(wxIcon(_T("nassi.xpm")));
#endif
InitStatusBar();
InitMenuBar();
////
CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
InitToolBar(GetToolBar());
/// Accelerators
wxAcceleratorEntry entries[1];
entries[0].Set(wxACCEL_CTRL | wxACCEL_SHIFT , (int) 'Z', wxID_REDO);
wxAcceleratorTable accel(1, entries);
SetAcceleratorTable(accel);
SetDropTarget(new DnDFile(manager));
/// wxAui
/// notify wxAUI which frame to use
m_manager = new wxAuiManager(this);
clksetpanel = new ClockSettingsPanel(this);
trnssetpanel = new TransitionSettingsPanel(this);
axissetpanel = new AxisSettingsPanel(this);
tcsetpanel = new TimeCompressorSettingsPanel(this);
m_manager->AddPane(clksetpanel , wxAuiPaneInfo().MinSize(200,-1).Right().Name(_("ClockPanel")).Caption(wxT("Clock-type signal Settings")));
m_manager->AddPane(trnssetpanel, wxAuiPaneInfo().MinSize(200,-1).Right().Name(_("TransitionPanel")).Caption(wxT("Transition Settings")));
m_manager->AddPane(axissetpanel, wxAuiPaneInfo().MinSize(200,-1).Right().Name(_("AxisPanel")).Caption(wxT("Axis/Time Settings")));
m_manager->AddPane(tcsetpanel , wxAuiPaneInfo().MinSize(200,-1).Right().Name(_("TimeCompressorPanel")).Caption(wxT("Time compressor Settings")));
DefalutLayout = m_manager->SavePerspective();
//Centre(wxBOTH);
wxConfig *cfg = wxGetApp().GetConfig();
cfg->SetPath( _T("/FileHistory") );
m_docManager->FileHistoryLoad(*cfg);
cfg->SetPath(_T("/"));
LoadFramePositions(cfg);
LoadAuiPerspective(cfg);
// tell the manager to "commit" all the changes just made
m_manager->Update();
}
void TimingMainFrame::InitMenuBar()
{
/// Make a menubar
wxMenu *file_menu = new wxMenu;
wxMenu *edit_menu = (wxMenu *) NULL;
file_menu->Append(wxID_NEW, _T("&New...\tCtrl-N"), _T("Create a new file"));
file_menu->Append(wxID_OPEN, _T("&Open...\tCtrl-O"), _T("Open a existing file"));
//file_menu->Append(NASSI_ID_IMPORT_SOURCE, _T("&Import...\tCtrl-I"), _T("Import from C source file"));
file_menu->AppendSeparator();
file_menu->Append(wxID_EXIT, _T("&Quit\tAlt-F4"), _T("Quit the application") );
// A nice touch: a history of files visited. Use this menu.
m_docManager->FileHistoryUseMenu(file_menu);
//m_docManager->FileHistoryAddFilesToMenu();
wxMenu *help_menu = new wxMenu;
help_menu->Append(wxID_ABOUT, _T("&About\tF1"), _T("Show info about this application"));
help_menu->Append(TIMING_ID_TIP, _T("Tip"), _T("Tips on using TimingEditor") );
help_menu->Append(TIMING_ID_HELP, _T("Help"), _T("Open help pages"));
wxMenu *panel_menu = new wxMenu;
panel_menu->Append(TIMING_ID_MENUITEM_CLOCK_TYPE, _T("Clock-type"), wxEmptyString, wxITEM_CHECK);
panel_menu->Append(TIMING_ID_MENUITEM_TIME_COMPRESSOR, _T("Time compressor"), wxEmptyString, wxITEM_CHECK);
panel_menu->Append(TIMING_ID_MENUITEM_AXIS_TIME, _T("Axis/Time"), wxEmptyString, wxITEM_CHECK);
panel_menu->Append(TIMING_ID_MENUITEM_TRANSITION, _T("Transition"), wxEmptyString, wxITEM_CHECK);
panel_menu->AppendSeparator();
panel_menu->Append(TIMING_ID_MENUITEM_DEFAULT,_T("Default"));
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _T("&File"));
menu_bar->Append(panel_menu, _T("&View"));
if (edit_menu)
menu_bar->Append(edit_menu, _T("&Edit"));
menu_bar->Append(help_menu, _T("&Help"));
#ifdef __WXMAC__
wxMenuBar::MacSetCommonMenuBar(menu_bar);
#endif //def __WXMAC__
/// Associate the menu bar with the frame
SetMenuBar(menu_bar);
}
void TimingMainFrame::InitStatusBar()
{
CreateStatusBar(3);
wxInt32 widths[3] = { 200, -1, 40 };
SetStatusWidths(3, &widths[0]);
SetStatusBarPane(0);
SetStatusText(_T("Welcome to TimingEditor!"), 0);
}
TimingMainFrame::~TimingMainFrame()
{
wxConfig *cfg = wxGetApp().GetConfig();
SaveFramePositions(cfg);
SaveAuiPerspective(cfg);
m_manager->UnInit();
delete m_manager;
delete clksetpanel;
delete trnssetpanel;
delete axissetpanel;
delete tcsetpanel;
}
void TimingMainFrame::OnAbout(wxCommandEvent &event)
{
wxAboutDialogInfo info;
info.SetName(_("TimingEditor"));
info.SetVersion(_("0.1.1"));
info.SetDescription(_("Timing diagram editor."));
info.SetCopyright(_T("(C) 2008 2009 2010"));
info.AddDeveloper(_T("Daniel Anselmi"));
info.AddDeveloper(_T("Yves Studer"));
wxAboutBox(info);
}
void TimingMainFrame::OnHelp(wxCommandEvent &event)
{
wxLaunchDefaultBrowser(_T("http://timingeditor.wiki.sourceforge.net/"));
}
void TimingMainFrame::OnUpdateCopy(wxUpdateUIEvent& event)
{
event.Enable(IsTextSelected() || IsSignalSelected());
}
void TimingMainFrame::OnUpdateCut(wxUpdateUIEvent& event)
{
event.Enable(IsTextSelected() || IsSignalSelected());
}
void TimingMainFrame::OnUpdateDelete(wxUpdateUIEvent& event)
{
event.Enable(CanDelete());
}
wxString TimingMainFrame::DetectSourceOfEvent(const long EventId)
{
wxString ID = _T("");
if(EventId == TIMING_ID_MENUITEM_CLOCK_TYPE)
ID = _T("ClockPanel");
else if(EventId == TIMING_ID_MENUITEM_TIME_COMPRESSOR)
ID = _T("TimeCompressorPanel");
else if(EventId == TIMING_ID_MENUITEM_AXIS_TIME)
ID = _T("AxisPanel");
else if(EventId == TIMING_ID_MENUITEM_TRANSITION)
ID = _T("TransitionPanel");
return ID;
}
void TimingMainFrame::HandlePanel(wxCommandEvent& event)
{
wxString ID = DetectSourceOfEvent(event.GetId());
if(m_manager->GetPane(ID).IsShown())
m_manager->GetPane(ID).Hide().CaptionVisible();
else
m_manager->GetPane(ID).Show().CaptionVisible();
m_manager->Update();
}
void TimingMainFrame::UpdateMenuItems(wxUpdateUIEvent &event)
{
wxString ID = DetectSourceOfEvent(event.GetId());
if(m_manager->GetPane(ID).IsShown())
event.Check(true);
else
event.Check(false);
}
void TimingMainFrame::LoadDefaultLayout(wxCommandEvent& event)
{
m_manager->LoadPerspective(DefalutLayout);
}
bool TimingMainFrame::CanDelete(void)
{
TimingView *view = (TimingView *)wxGetApp().GetDocManager()->GetCurrentView();
if ( view && view->CanDelete() )
return true;
return false;
}
bool TimingMainFrame::IsSomethingSelected(void)
{
TimingView *view = (TimingView *)wxGetApp().GetDocManager()->GetCurrentView();
if ( view && view->IsSomethingSelected() )
return true;
return false;
}
bool TimingMainFrame::IsTextSelected(void)
{
TimingView *view = (TimingView *)wxGetApp().GetDocManager()->GetCurrentView();
if ( view && view->IsTextSelected() )
return true;
return false;
}
bool TimingMainFrame::IsSignalSelected(void)
{
TimingView *view = (TimingView *)wxGetApp().GetDocManager()->GetCurrentView();
if ( view && view->IsSignalSelected() )
return true;
return false;
}
void TimingMainFrame::OnUpdatePaste(wxUpdateUIEvent& event)
{
TimingView *view = (TimingView *)wxGetApp().GetDocManager()->GetCurrentView();
if ( view && view->CanPaste() )
{
event.Enable(true);
return;
}
event.Enable(false);
}
void TimingMainFrame::OnUpdateDiscont(wxUpdateUIEvent& event)
{
TimingView *view = (TimingView *)wxGetApp().GetDocManager()->GetCurrentView();
if ( view )
{
event.Enable(true);
return;
}
event.Enable(false);
}
TimingWindow *TimingMainFrame::CreateWindow(wxView *view, wxMDIChildFrame *parent)
{
return new TimingWindow(view, parent, clksetpanel, trnssetpanel, axissetpanel, tcsetpanel);
}
void TimingMainFrame::InitToolBar(wxToolBar* toolBar)
{
toolBar->AddTool(wxID_NEW, _T("New file"), wxBitmap( new_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("New file"), _T("Create a new file"));
toolBar->AddTool(wxID_OPEN, _T("Open file"), wxBitmap( open_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("Open file"), _T(""));
toolBar->AddTool(wxID_SAVE, _T("Save file"), wxBitmap( save_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("Save file"), _T(""));
toolBar->AddSeparator();
toolBar->AddTool(wxID_CUT, _T("Cut"), wxBitmap( cut_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("Cut"), _T("Cut"));
toolBar->AddTool(wxID_COPY, _T("Copy"), wxBitmap( copy_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("Copy"), _T("Copy"));
toolBar->AddTool(wxID_PASTE, _T("Paste"), wxBitmap( paste_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("Paste"), _T("Paste"));
toolBar->AddSeparator();
//toolBar->AddTool(wxID_PRINT, _T("Print"), wxBitmap( print_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("Print"), _T("Print the active file"));
//toolBar->AddSeparator();
toolBar->AddTool(wxID_UNDO, _T("Undo"), wxBitmap( undo_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("Undo"), _T("Undo last operation"));
toolBar->AddTool(wxID_REDO, _T("Redo"), wxBitmap( redo_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("Redo"), _T("Redo last operation"));
toolBar->AddSeparator();
toolBar->AddTool(TIMING_ID_GLASS_N, _T("Zoom out"), wxBitmap(glassntool_xpm) , wxNullBitmap, wxITEM_NORMAL, _T("Zoom out"), _T("Zoom out the Document"));
toolBar->AddTool(TIMING_ID_GLASS_P, _T("Zoom in"), wxBitmap(glassptool_xpm) , wxNullBitmap, wxITEM_NORMAL, _T("Zoom in"), _T("Zoom in the Document"));
toolBar->AddSeparator();
toolBar->AddTool(TIMING_ID_ADD_CLOCK, _T("Add Clock"), wxBitmap(clockedge_xpm), wxNullBitmap, wxITEM_NORMAL, _T("Add Clock"), _T("Add a clock to the Document"));
toolBar->AddTool(TIMING_ID_ADD_SIGNAL, _T("Add Signal"), wxBitmap(risingedge_xpm), wxNullBitmap, wxITEM_NORMAL, _T("Add Signal"), _T("Add a signal to the Document"));
toolBar->AddTool(TIMING_ID_ADD_BUS, _T("Add Bus"), wxBitmap(busedge_xpm), wxNullBitmap, wxITEM_NORMAL, _T("Add Bus"), _T("Add a bus to the Document"));
toolBar->AddSeparator();
toolBar->AddTool(TIMING_ID_NEUTRAL, _T("Select"), wxBitmap(cross_xpm), wxNullBitmap, wxITEM_NORMAL, _T("Select"), _T(" Select something or change signal/bus"));
toolBar->AddTool(TIMING_ID_DISCONTINUATION, _T("Edit time compressors"), wxBitmap(tri_xpm), wxNullBitmap, wxITEM_NORMAL, _T("Edit time compressors"), _T("Edit time compressors by clicking on the bottom axis"));
toolBar->AddTool(TIMING_ID_RULER, _T("Draw vertical line"), wxBitmap(ruler_cur_xpm), wxNullBitmap, wxITEM_NORMAL, _T("Draw vertical line"), _T("Draw vertical line"));
toolBar->AddTool(TIMING_ID_HARROW, _T("Draw hotizontal arrow"), wxBitmap(harrow_cur_xpm), wxNullBitmap, wxITEM_NORMAL, _T("Draw a hotizontal arrow"),_T("Draw a hotizontal arrow") );
toolBar->AddTool(TIMING_ID_EDITTEXT, _T("Edit text label"), wxBitmap(textedit_cur_xpm), wxNullBitmap, wxITEM_NORMAL, _T("Edit text labels"),_T("Edit text labels") );
toolBar->AddSeparator();
toolBar->AddTool(wxID_ABOUT, _T("Help"), wxBitmap( help_xpm ), wxNullBitmap, wxITEM_NORMAL, _T("Help"), _T("Show info about this application"));
toolBar->Realize();
SetToolBar(toolBar);
}
void TimingMainFrame::OnTip(wxCommandEvent &event)
{
ShowTip(true);
}
void TimingMainFrame::ShowTip(bool force)
{
wxConfig *config = wxGetApp().GetConfig();
bool ShowTipsAtStartup = true;
wxInt32 TipNumber = 0;
config->Read(_T("/StartupTips/ShowTipsAtStarup"), &ShowTipsAtStartup);
config->Read(_T("/StartupTips/TipNumber"), &TipNumber);
if ( ShowTipsAtStartup || force )
{
//wxTipProvider *tipProvider = wxCreateFileTipProvider(_T("tips"), TipNumber);
wxTipProvider *tipProvider = new myTipProvider(TipNumber);;
ShowTipsAtStartup = wxShowTip(this, tipProvider, ShowTipsAtStartup);
TipNumber = tipProvider->GetCurrentTip();
delete tipProvider;
config->Write(_T("/StartupTips/ShowTipsAtStarup"), ShowTipsAtStartup);
config->Write(_T("/StartupTips/TipNumber"), TipNumber);
}
}
void TimingMainFrame::OnUpdateGlassN(wxUpdateUIEvent &event)
{
TimingView *view = (TimingView *)wxGetApp().GetDocManager()->GetCurrentView();
if ( view && view->CanZoomOut() )
{
event.Enable(true);
return;
}
event.Enable(false);
}
void TimingMainFrame::OnUpdateGlassP(wxUpdateUIEvent &event)
{
TimingView *view = (TimingView *)wxGetApp().GetDocManager()->GetCurrentView();
if ( view && view->CanZoomIn() )
{
event.Enable(true);
return;
}
event.Enable(false);
}
void TimingMainFrame::SaveFramePositions(wxConfig *config)
{
// save the frame position
wxInt32 x, y, w, h, s;
GetClientSize(&w, &h);
GetPosition(&x, &y);
s = 0;
if ( IsMaximized() )
s = 1;
if ( IsIconized() )
s= -1;
if ( s == 0 )
{
config->Write(_T("/MainFrame/x"), (long) x);
config->Write(_T("/MainFrame/y"), (long) y);
config->Write(_T("/MainFrame/w"), (long) w);
config->Write(_T("/MainFrame/h"), (long) h);
}
config->Write(_T("/MainFrame/s"), (long) s);
}
void TimingMainFrame::SaveAuiPerspective(wxConfig *config)
{
wxString str = m_manager->SavePerspective();
config->Write( _T( "/MainFrame/AuiPerspective" ), str );
/// store version to let newer versions of gui a cahnce to build a new valid perspective
config->Write( _T( "/MainFrame/AuiPerspectiveVersion" ), 2);
}
void TimingMainFrame::LoadAuiPerspective(wxConfig *config)
{
wxString str;
long v;
/// if version stored is older than current do not load old perspective
config->Read(_T( "/MainFrame/AuiPerspectiveVersion" ), &v, 0);
if ( v == 2 )
{
config->Read(_T( "/MainFrame/AuiPerspective" ), &str);
m_manager->LoadPerspective(str);
}
}
void TimingMainFrame::LoadFramePositions(wxConfig *config)
{
/// restore frame position and size
wxInt32 x, y, w, h, s;
x = config->Read(_T("/MainFrame/x"), 50);
y = config->Read(_T("/MainFrame/y"), 50);
w = config->Read(_T("/MainFrame/w"), 600);
h = config->Read(_T("/MainFrame/h"), 500);
s = config->Read(_T("/MainFrame/s"), (long)0);
Move(x, y);
SetClientSize(w, h);
if ( s > 0 )
Maximize(true);
if ( s < 0)
Iconize(true);
}