0
|
1 // Filename : myframe.cpp
|
3
|
2 // Last Change: 25-Nov-2012.
|
0
|
3 //
|
|
4
|
|
5 #include "main.h"
|
|
6 #include "myframe.h"
|
|
7 #include "about.h"
|
|
8
|
|
9 // resources
|
|
10 #if !defined(__WXMSW__) && !defined(__WXPM__)
|
|
11 #include "sample.xpm"
|
|
12 #endif
|
|
13
|
3
|
14 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
|
0
|
15 : wxFrame( parent, id, title, pos, size, style )
|
|
16 {
|
|
17 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
|
18 this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
|
|
19 // set the frame icon
|
|
20 SetIcon(wxICON(sample));
|
3
|
21
|
|
22 // Menubar here
|
|
23 m_menubar = new wxMenuBar( 0 );
|
0
|
24 m_menuFile = new wxMenu();
|
|
25
|
3
|
26 wxMenuItem* m_menuItemSetup = new wxMenuItem( m_menuFile, ID_MNSETUP, wxString( wxT("Setup") ) , wxEmptyString, wxITEM_NORMAL );
|
2
|
27 m_menuFile->Append( m_menuItemSetup );
|
3
|
28
|
|
29 wxMenuItem* m_menuItemSave = new wxMenuItem( m_menuFile, ID_MNSAVE, wxString( wxT("Save") ) , wxEmptyString, wxITEM_NORMAL );
|
2
|
30 m_menuFile->Append( m_menuItemSave );
|
3
|
31
|
0
|
32 wxMenuItem* m_menuItemAbout = new wxMenuItem( m_menuFile, ID_MNABOUT, wxString( wxT("&About...\tF1") ) , wxT("Show about dialog"), wxITEM_NORMAL );
|
|
33 m_menuFile->Append( m_menuItemAbout );
|
|
34
|
3
|
35 m_menubar->Append( m_menuFile, wxT("File") );
|
0
|
36
|
|
37 this->SetMenuBar( m_menubar );
|
|
38
|
3
|
39 // Controls here
|
|
40 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
|
|
41
|
|
42 wxGridBagSizer* gbSizerWatchDir = new wxGridBagSizer( 0, 0 );
|
|
43 gbSizerWatchDir->SetFlexibleDirection( wxBOTH );
|
|
44 gbSizerWatchDir->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
0
|
45
|
3
|
46 m_searchCtrlFile = new wxSearchCtrl( this, wxID_ANY, wxT("Input Filename"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
47 #ifndef __WXMAC__
|
|
48 m_searchCtrlFile->ShowSearchButton( true );
|
|
49 #endif
|
|
50 m_searchCtrlFile->ShowCancelButton( false );
|
|
51 gbSizerWatchDir->Add( m_searchCtrlFile, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
0
|
52
|
3
|
53 m_dirPickerWatchDir = new wxDirPickerCtrl( this, wxID_ANY, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE );
|
|
54 gbSizerWatchDir->Add( m_dirPickerWatchDir, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
|
55
|
|
56 m_listCtrlWatchDir = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
|
|
57 gbSizerWatchDir->Add( m_listCtrlWatchDir, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxALL, 5 );
|
0
|
58
|
3
|
59 bSizerTop->Add( gbSizerWatchDir, 0, wxEXPAND, 5 );
|
|
60
|
|
61 wxStaticBoxSizer* sbSizerFound = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("If Find File") ), wxVERTICAL );
|
0
|
62
|
3
|
63 wxStaticBoxSizer* sbSizerMove = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Move/Copy") ), wxVERTICAL );
|
|
64
|
|
65 wxBoxSizer* bSizerMove = new wxBoxSizer( wxHORIZONTAL );
|
0
|
66
|
3
|
67 wxString m_choiceMoveChoices[] = { wxT("Nop"), wxT("Move"), wxT("Copy") };
|
|
68 int m_choiceMoveNChoices = sizeof( m_choiceMoveChoices ) / sizeof( wxString );
|
|
69 m_choiceMove = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceMoveNChoices, m_choiceMoveChoices, 0 );
|
|
70 m_choiceMove->SetSelection( 0 );
|
|
71 bSizerMove->Add( m_choiceMove, 0, wxALL, 5 );
|
|
72
|
|
73 m_staticText0 = new wxStaticText( this, wxID_ANY, wxT("Suffix"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
74 bSizerMove->Add( m_staticText0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
75
|
3
|
76 wxString m_choiceSuffixChoices[] = { wxT("NoChange"), wxT("Date & Time"), wxT("Date"), wxT("Time") };
|
|
77 int m_choiceSuffixNChoices = sizeof( m_choiceSuffixChoices ) / sizeof( wxString );
|
|
78 m_choiceSuffix = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceSuffixNChoices, m_choiceSuffixChoices, 0 );
|
|
79 m_choiceSuffix->SetSelection( 0 );
|
|
80 bSizerMove->Add( m_choiceSuffix, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
81
|
|
82 m_dirPickerMoveTo = new wxDirPickerCtrl( this, wxID_ANY, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE );
|
|
83 bSizerMove->Add( m_dirPickerMoveTo, 0, wxALL|wxEXPAND, 5 );
|
0
|
84
|
3
|
85 sbSizerMove->Add( bSizerMove, 1, wxEXPAND, 5 );
|
|
86
|
|
87 m_listCtrlMove = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
|
|
88 sbSizerMove->Add( m_listCtrlMove, 0, wxALL|wxEXPAND, 5 );
|
|
89
|
|
90 sbSizerFound->Add( sbSizerMove, 1, wxEXPAND, 5 );
|
|
91
|
|
92 wxStaticBoxSizer* sbSizerCmd = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Command") ), wxVERTICAL );
|
0
|
93
|
3
|
94 wxFlexGridSizer* fgSizerCmd = new wxFlexGridSizer( 3, 3, 0, 0 );
|
|
95 fgSizerCmd->SetFlexibleDirection( wxBOTH );
|
|
96 fgSizerCmd->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
|
97
|
|
98 m_staticTextCmd0 = new wxStaticText( this, wxID_ANY, wxT("Command 0"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
99 fgSizerCmd->Add( m_staticTextCmd0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
100
|
|
101 m_textCtrlCmd0 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
102 fgSizerCmd->Add( m_textCtrlCmd0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
103
|
3
|
104 wxString m_choiceCmd0Choices[] = { wxT("After"), wxT("Before") };
|
|
105 int m_choiceCmd0NChoices = sizeof( m_choiceCmd0Choices ) / sizeof( wxString );
|
|
106 m_choiceCmd0 = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceCmd0NChoices, m_choiceCmd0Choices, 0 );
|
|
107 m_choiceCmd0->SetSelection( 0 );
|
|
108 fgSizerCmd->Add( m_choiceCmd0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
109
|
|
110 m_staticTextCmd1 = new wxStaticText( this, wxID_ANY, wxT("Command 1"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
111 fgSizerCmd->Add( m_staticTextCmd1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
112
|
|
113 m_textCtrlCmd1 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
114 fgSizerCmd->Add( m_textCtrlCmd1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
115
|
|
116 wxString m_choiceCmd1Choices[] = { wxT("After"), wxT("Before") };
|
|
117 int m_choiceCmd1NChoices = sizeof( m_choiceCmd1Choices ) / sizeof( wxString );
|
|
118 m_choiceCmd1 = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceCmd1NChoices, m_choiceCmd1Choices, 0 );
|
|
119 m_choiceCmd1->SetSelection( 0 );
|
|
120 fgSizerCmd->Add( m_choiceCmd1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
121
|
|
122 m_staticTextCmd2 = new wxStaticText( this, wxID_ANY, wxT("Command 2"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
123 fgSizerCmd->Add( m_staticTextCmd2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
124
|
|
125 m_textCtrlCmd2 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
126 fgSizerCmd->Add( m_textCtrlCmd2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
127
|
|
128 wxString m_choiceCmd2Choices[] = { wxT("After"), wxT("Before") };
|
|
129 int m_choiceCmd2NChoices = sizeof( m_choiceCmd2Choices ) / sizeof( wxString );
|
|
130 m_choiceCmd2 = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceCmd2NChoices, m_choiceCmd2Choices, 0 );
|
|
131 m_choiceCmd2->SetSelection( 0 );
|
|
132 fgSizerCmd->Add( m_choiceCmd2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
133
|
|
134 sbSizerCmd->Add( fgSizerCmd, 1, wxEXPAND, 5 );
|
|
135
|
|
136 sbSizerFound->Add( sbSizerCmd, 0, wxEXPAND, 5 );
|
|
137
|
|
138 wxString m_choiceFoundChoices[] = { wxT("Continue"), wxT("Stop Watching"), wxT("Exit Program") };
|
|
139 int m_choiceFoundNChoices = sizeof( m_choiceFoundChoices ) / sizeof( wxString );
|
|
140 m_choiceFound = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceFoundNChoices, m_choiceFoundChoices, 0 );
|
|
141 m_choiceFound->SetSelection( 0 );
|
|
142 sbSizerFound->Add( m_choiceFound, 0, wxALL|wxALIGN_RIGHT, 5 );
|
|
143
|
|
144 bSizerTop->Add( sbSizerFound, 0, wxEXPAND, 5 );
|
|
145
|
|
146 wxStaticBoxSizer* sbSizerNotFound = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Else") ), wxHORIZONTAL );
|
|
147
|
|
148 m_textCtrlWait = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
149 sbSizerNotFound->Add( m_textCtrlWait, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
150
|
|
151 m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("[sec] after"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
152 sbSizerNotFound->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
153
|
|
154 wxString m_choiceNotFoundChoices[] = { wxT("Stop Watching"), wxT("Exit Program") };
|
|
155 int m_choiceNotFoundNChoices = sizeof( m_choiceNotFoundChoices ) / sizeof( wxString );
|
|
156 m_choiceNotFound = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceNotFoundNChoices, m_choiceNotFoundChoices, 0 );
|
|
157 m_choiceNotFound->SetSelection( 0 );
|
|
158 sbSizerNotFound->Add( m_choiceNotFound, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
159
|
|
160 bSizerTop->Add( sbSizerNotFound, 0, wxEXPAND, 5 );
|
|
161
|
|
162 m_toggleBtn = new wxToggleButton( this, ID_TGLWATCH, wxT("Start Watching"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
163 m_toggleBtn->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
|
|
164
|
|
165 bSizerTop->Add( m_toggleBtn, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
|
166
|
|
167 this->SetSizer( bSizerTop );
|
|
168 this->Layout();
|
1
|
169
|
0
|
170 this->Centre( wxBOTH );
|
|
171 }
|
|
172
|
|
173 MyFrame::~MyFrame()
|
|
174 {
|
|
175 }
|
|
176
|
|
177 // Event Table
|
|
178 BEGIN_EVENT_TABLE( MyFrame, wxFrame )
|
2
|
179 EVT_MENU( ID_MNSETUP, MyFrame::OnSetup )
|
|
180 EVT_MENU( ID_MNSAVE, MyFrame::OnSaveParams )
|
0
|
181 EVT_MENU( ID_MNABOUT, MyFrame::OnAbout )
|
3
|
182 // EVT_MENU( wxID_EXIT, MyFrame::OnQuit )
|
|
183 EVT_TOGGLEBUTTON( ID_TGLWATCH, MyFrame::OnWatch )
|
|
184 EVT_SIZE( MyFrame::OnWinSize )
|
|
185 EVT_MOVE( MyFrame::OnWinMove )
|
0
|
186 EVT_CLOSE( MyFrame::SaveConfig )
|
|
187 END_EVENT_TABLE()
|
|
188
|
|
189 // Event Handlers & Functions
|
3
|
190 /* $B%U%)%k%@4F;k3+;O(B/$BDd;_%9%$%C%A(B */
|
0
|
191 void MyFrame::OnWatch( wxCommandEvent& WXUNUSED(event) )
|
|
192 {
|
|
193 Connect( wxEVT_FSWATCHER, wxFileSystemWatcherEventHandler( MyFrame::OnFileSystemEvent ) );
|
|
194
|
|
195 static bool enabled = false;
|
|
196 enabled = !enabled;
|
|
197
|
|
198 if ( enabled ) {
|
|
199 m_toggleBtn->SetLabelText( wxT("Stop Watching") );
|
|
200 m_watcher = new wxFileSystemWatcher();
|
|
201 m_watcher->SetOwner( this );
|
|
202
|
3
|
203 m_watcher->Add( m_dirPickerWatchDir->GetPath(), wxFSW_EVENT_CREATE );
|
0
|
204 }
|
|
205 else {
|
|
206 m_toggleBtn->SetLabelText( wxT("Start Watching") );
|
|
207 wxDELETE( m_watcher );
|
|
208 }
|
|
209 }
|
|
210
|
3
|
211 /* $B%U%)%k%@4F;k(B */
|
0
|
212 void MyFrame::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
|
|
213 {
|
1
|
214 wxMilliSleep( 1500 );
|
|
215
|
3
|
216 wxString watchdir = m_dirPickerWatchDir->GetPath();
|
|
217 wxString filename = m_searchCtrlFile->GetValue();
|
|
218 wxString command0 = m_textCtrlCmd0->GetValue();
|
|
219 wxString command1 = m_textCtrlCmd1->GetValue();
|
|
220 wxString command2 = m_textCtrlCmd2->GetValue();
|
|
221 wxString movedir = m_dirPickerMoveTo->GetPath();
|
0
|
222
|
|
223 wxString from;
|
|
224 wxString to;
|
|
225
|
|
226 wxString file;
|
|
227 wxDir dir( watchdir );
|
|
228 bool cont = dir.GetFirst( &file, filename, wxDIR_FILES );
|
|
229 while ( cont ) {
|
|
230
|
3
|
231 /*
|
0
|
232 if ( !command.IsEmpty() ) {
|
2
|
233 wxExecute( command );
|
1
|
234 wxSleep( 2 );
|
0
|
235 }
|
|
236
|
|
237 if ( !movedir.IsEmpty() ) {
|
|
238 from = watchdir + wxFILE_SEP_PATH + filename;
|
|
239 wxFileName f( from );
|
2
|
240
|
3
|
241 // $B%U%!%$%kL>$r$I$&$9$k$+(B
|
2
|
242 if ( m_comboSuffix->GetCurrentSelection() == 0 ) {
|
|
243 wxDateTime now = wxDateTime::Now();
|
|
244 to = movedir + wxFILE_SEP_PATH + f.GetName() + wxT("_") + now.Format(wxT("%Y%m%d%H%M%S")) + wxT(".") + f.GetExt();
|
1
|
245 }
|
|
246 else {
|
2
|
247 to = movedir + wxFILE_SEP_PATH + filename;
|
|
248 }
|
|
249
|
3
|
250 // $B%*%j%8%J%k$r;D$9$+(B
|
2
|
251 if ( m_checkBoxCopy->IsChecked() )
|
|
252 wxCopyFile( from, to, false );
|
|
253 else
|
1
|
254 wxRenameFile( from, to, false );
|
0
|
255 }
|
|
256
|
|
257 cont = dir.GetNext( &file );
|
3
|
258 */
|
0
|
259 }
|
3
|
260 //if ( m_checkBoxExit->IsChecked() ) Close( true );
|
2
|
261 }
|
|
262
|
3
|
263 /* $B%;%C%H%"%C%W(B */
|
2
|
264 void MyFrame::OnSetup( wxCommandEvent& WXUNUSED(event) )
|
|
265 {
|
|
266 wxString dws_dir = wxGetCwd() + wxFILE_SEP_PATH + wxT("dws");
|
|
267 wxFileDialog fd( this, wxT("Open Setup file"), dws_dir , wxEmptyString, wxT("Setup files (*.dws)|*.dws"), wxFD_OPEN|wxFD_FILE_MUST_EXIST );
|
|
268 if ( fd.ShowModal() == wxID_CANCEL ) return; // the user changed idea...
|
|
269
|
|
270 wxFileConfig* config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), fd.GetPath(), wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
|
|
271
|
3
|
272 wxString p_watchdir, p_filename, p_moveto, p_command0, p_command1, p_command2, p_wait;
|
|
273 long p_move, p_suffix, p_found, p_notfound;
|
2
|
274 config->SetPath( wxT("/Parameter") );
|
|
275 config->Read( wxT("Filename"), &p_filename );
|
3
|
276 config->Read( wxT("Watchdir"), &p_watchdir );
|
|
277 config->Read( wxT("Move"), &p_move );
|
2
|
278 config->Read( wxT("Suffix"), &p_suffix );
|
3
|
279 config->Read( wxT("MoveTo"), &p_moveto );
|
|
280 config->Read( wxT("Command0"), &p_command0 );
|
|
281 config->Read( wxT("Command1"), &p_command1 );
|
|
282 config->Read( wxT("Command2"), &p_command2 );
|
|
283 config->Read( wxT("Found"), &p_found );
|
|
284 config->Read( wxT("Wait"), &p_wait );
|
|
285 config->Read( wxT("Notfound"), &p_notfound );
|
2
|
286
|
3
|
287 m_dirPickerWatchDir->SetPath( p_watchdir );
|
|
288 m_searchCtrlFile->SetValue( p_filename );
|
|
289 m_choiceMove->SetSelection( p_move );
|
|
290 m_choiceSuffix->SetSelection( p_suffix );
|
|
291 m_dirPickerMoveTo->SetPath( p_moveto );
|
|
292 m_textCtrlCmd0->SetValue( p_command0 );
|
|
293 m_textCtrlCmd1->SetValue( p_command1 );
|
|
294 m_textCtrlCmd2->SetValue( p_command2 );
|
|
295 m_choiceFound->SetSelection( p_found );
|
2
|
296 m_textCtrlWait->SetValue( p_wait );
|
3
|
297 m_choiceNotFound->SetSelection( p_notfound );
|
2
|
298
|
|
299 delete config;
|
|
300 }
|
3
|
301 /* $B%Q%i!<%a!<%?$rJ]B8(B */
|
2
|
302 void MyFrame::OnSaveParams( wxCommandEvent& WXUNUSED(event) )
|
|
303 {
|
|
304 wxString dws_dir = wxGetCwd() + wxFILE_SEP_PATH + wxT("dws");
|
|
305 wxFileDialog fd( this, wxT("Save Setup file"), dws_dir , wxEmptyString, wxT("Setup files (*.dws)|*.dws"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT );
|
|
306 if ( fd.ShowModal() == wxID_CANCEL ) return; // the user changed idea...
|
|
307
|
|
308 wxFileConfig* config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), fd.GetPath(), wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
|
|
309
|
|
310 config->SetPath( wxT("/Parameter") );
|
3
|
311 config->Write( wxT("Filename"), m_searchCtrlFile->GetValue() );
|
|
312 config->Write( wxT("Watchdir"), m_dirPickerWatchDir->GetPath() );
|
|
313 config->Write( wxT("Move"), m_choiceMove->GetSelection() );
|
|
314 config->Write( wxT("Suffix"), m_choiceSuffix->GetSelection() );
|
|
315 config->Write( wxT("MoveTo"), m_dirPickerMoveTo->GetPath() );
|
|
316 config->Write( wxT("Command0"), m_textCtrlCmd0->GetValue() );
|
|
317 config->Write( wxT("Command1"), m_textCtrlCmd1->GetValue() );
|
|
318 config->Write( wxT("Command2"), m_textCtrlCmd2->GetValue() );
|
|
319 config->Write( wxT("Found"), m_choiceFound->GetSelection() );
|
|
320 config->Write( wxT("Wait"), m_textCtrlWait->GetValue() );
|
|
321 config->Write( wxT("Notfound"), m_choiceNotFound->GetSelection() );
|
2
|
322
|
|
323 delete config;
|
0
|
324 }
|
|
325
|
3
|
326 /* $B%5%$%:JQ99(B */
|
0
|
327 void MyFrame::OnWinSize( wxSizeEvent& event )
|
|
328 {
|
|
329 this->Refresh( true, NULL );
|
|
330 TellLocation();
|
|
331 event.Skip();
|
|
332 }
|
3
|
333 /* $B%&%#%s%I%&0\F0(B */
|
0
|
334 void MyFrame::OnWinMove( wxMoveEvent& WXUNUSED(event) )
|
|
335 {
|
|
336 TellLocation();
|
|
337 return;
|
|
338 }
|
3
|
339 /* $B%&%#%s%I%&0LCV$H%5%$%:$rI=<((B */
|
0
|
340 void MyFrame::TellLocation( void )
|
|
341 {
|
|
342 wxRect r = this->GetRect();
|
|
343 int x = r.GetX();
|
|
344 int y = r.GetY();
|
|
345 int w = r.GetWidth();
|
|
346 int h = r.GetHeight();
|
|
347 //SetStatusText( wxString::Format(wxT("(%d,%d) %dx%d"),x,y,w,h), 3 );
|
|
348 }
|
3
|
349 /* $B=*N;(B */
|
0
|
350 void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
|
|
351 {
|
2
|
352 Close( true );
|
0
|
353 }
|
3
|
354 /* $B@_Dj$rJ]B8(B */
|
0
|
355 void MyFrame::SaveConfig( wxCloseEvent& WXUNUSED(event) )
|
|
356 {
|
|
357 if ( !IsIconized() && !IsMaximized() ) {
|
|
358 wxGetApp().rect = this->GetRect();
|
|
359 }
|
|
360 Destroy();
|
|
361 }
|
3
|
362 /* $B%"%P%&%H%@%$%"%m%0(B */
|
0
|
363 void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
|
|
364 {
|
|
365 AboutDialog* aboutDlg = new AboutDialog( this, wxID_ANY, wxT("About this Software"), wxDefaultPosition, wxSize(320,280), wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP );
|
|
366 aboutDlg->ShowModal();
|
|
367 }
|
|
368
|