comparison src/myframe.cpp @ 8:b59dfcc84d7a default tip

v0.4b
author pyon@macmini
date Thu, 13 Oct 2011 20:13:41 +0900
parents bfa0800f1176
children
comparison
equal deleted inserted replaced
7:bfa0800f1176 8:b59dfcc84d7a
1 // Filename : mainframe.cpp 1 // Filename : mainframe.cpp
2 // Last Change: 08-Oct-2011. 2 // Last Change: 13-Oct-2011.
3 // 3 //
4 #include "symbol.h" 4 #include "symbol.h"
5 #include "common.h" 5 #include "common.h"
6 #include "myframe.h" 6 #include "myframe.h"
7 #include "delwhite.h" 7 #include "delwhite.h"
219 219
220 /* 白紙検知 */ 220 /* 白紙検知 */
221 void MyFrame::OnDetectWhite(wxCommandEvent& WXUNUSED(event)) 221 void MyFrame::OnDetectWhite(wxCommandEvent& WXUNUSED(event))
222 { 222 {
223 FrameDelWhite* dw = new FrameDelWhite( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxCAPTION|wxFRAME_NO_TASKBAR|wxMAXIMIZE_BOX|wxRESIZE_BORDER ); 223 FrameDelWhite* dw = new FrameDelWhite( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxCAPTION|wxFRAME_NO_TASKBAR|wxMAXIMIZE_BOX|wxRESIZE_BORDER );
224 dw->SetMinSize( wxSize( 580, 680 ) ); 224 dw->SetMinSize( wxSize( 580, 380 ) );
225 225
226 dw->m_dir = m_dirPickerWork->GetPath(); 226 dw->m_dir = m_dirPickerWork->GetPath();
227 dw->SetTitle( wxT("Delete White Sheet - ") + dw->m_dir ); 227 dw->SetTitle( wxT("Delete White Sheet - ") + dw->m_dir );
228 dw->LoadImages(); 228 dw->LoadImages();
229 229
279 } 279 }
280 280
281 wxString workdir = m_dirPickerWork->GetPath(); 281 wxString workdir = m_dirPickerWork->GetPath();
282 wxDir dir( workdir ); 282 wxDir dir( workdir );
283 if ( !dir.IsOpened() ) return; 283 if ( !dir.IsOpened() ) return;
284
285 wxProgressDialog pd( wxT("進行状況"), wxT("処理開始..."), 200, this, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
286 pd.SetSize( wxSize(320,140) );
287 int p=0;
284 288
285 wxString filename; 289 wxString filename;
286 bool cout = dir.GetFirst( &filename, wxT("*.jpg"), wxDIR_FILES ); 290 bool cout = dir.GetFirst( &filename, wxT("*.jpg"), wxDIR_FILES );
287 291
288 int cnt=0, r=0; 292 int cnt=0, r=0;
293 if ( IsMarksheet( from ) ) { 297 if ( IsMarksheet( from ) ) {
294 hhs = GuessHhs( from ); 298 hhs = GuessHhs( from );
295 wxString d = dirname + hhs; 299 wxString d = dirname + hhs;
296 wxMkdir( d ); 300 wxMkdir( d );
297 m_listCtrl->InsertItem( r, wxString::Format(wxT("%d"),r+1) ); 301 m_listCtrl->InsertItem( r, wxString::Format(wxT("%d"),r+1) );
298 m_listCtrl->SetItem( r, 1, hhs, -1 ); // 被保険者番号 302 m_listCtrl->SetItem( r, 1, hhs, -1 ); // 被保険者番号
299 if ( r % 2 ) m_listCtrl->SetItemBackgroundColour( r, wxColour(wxT("WHEAT")) ); 303 if ( r % 2 ) m_listCtrl->SetItemBackgroundColour( r, wxColour(wxT("WHEAT")) );
300 r++; 304 r++;
301 cnt=1; 305 cnt=1;
302 } 306 }
303 if ( hhs.IsEmpty() ) { 307 if ( hhs.IsEmpty() ) {
305 return; 309 return;
306 } 310 }
307 wxString to = dirname + wxFILE_SEP_PATH + hhs + wxFILE_SEP_PATH + filename; 311 wxString to = dirname + wxFILE_SEP_PATH + hhs + wxFILE_SEP_PATH + filename;
308 wxRenameFile( from, to, false ); 312 wxRenameFile( from, to, false );
309 m_listCtrl->SetItem( r-1, 2, wxString::Format(wxT("%d"),cnt), -1 ); // ファイル数 313 m_listCtrl->SetItem( r-1, 2, wxString::Format(wxT("%d"),cnt), -1 ); // ファイル数
310 if ( cnt < 5 ) m_listCtrl->SetItemTextColour( r, *wxRED ); 314 if ( cnt < 5 ) m_listCtrl->SetItemTextColour( r, wxColour(wxT("RED")) );
311 if ( cnt > 5 ) m_listCtrl->SetItemTextColour( r, *wxBLUE ); 315 if ( cnt > 5 ) m_listCtrl->SetItemTextColour( r, wxColour(wxT("BLUE")) );
312 cnt++; 316 cnt++;
313 // write log 317 // write log
318 pd.Update( p++, wxEmptyString );
314 cout = dir.GetNext( &filename ); 319 cout = dir.GetNext( &filename );
315 } 320 }
316 321
317 wxString cmd = wxT("explorer ") + dirname; 322 wxString cmd = wxT("explorer ") + dirname;
318 wxExecute( cmd ); 323 wxExecute( cmd );
327 wxListItem item = event.GetItem(); 332 wxListItem item = event.GetItem();
328 item.SetColumn(1); 333 item.SetColumn(1);
329 item.SetMask(wxLIST_MASK_TEXT); 334 item.SetMask(wxLIST_MASK_TEXT);
330 m_listCtrl->GetItem( item ); 335 m_listCtrl->GetItem( item );
331 hhsdir.Append( item.GetText() ); 336 hhsdir.Append( item.GetText() );
332 wxMessageBox(hhsdir); 337 //wxMessageBox(hhsdir);
333 //wxString execmd = wxT("explorer ") + hhsdir; 338 wxString execmd = wxT("explorer ") + hhsdir;
339 wxExecute( execmd );
334 } 340 }
335 341
336 /* 作業フォルダを開く */ 342 /* 作業フォルダを開く */
337 void MyFrame::OnOpenWorkDir(wxCommandEvent& WXUNUSED(event)) 343 void MyFrame::OnOpenWorkDir(wxCommandEvent& WXUNUSED(event))
338 { 344 {