Mercurial > mercurial > hgweb_searcher2.cgi
comparison src/myframe.cpp @ 16:b67c74848dd0
fix bugs.
| author | pyon@macmini |
|---|---|
| date | Sat, 09 Jul 2011 08:30:00 +0900 |
| parents | 5ce7757b4350 |
| children | eb3f5c7c990f |
comparison
equal
deleted
inserted
replaced
| 15:168531d2c45f | 16:b67c74848dd0 |
|---|---|
| 1 // Filename : mainframe.cpp | 1 // Filename : mainframe.cpp |
| 2 // Last Change: 01-Jul-2011. | 2 // Last Change: 06-Jul-2011. |
| 3 // | 3 // |
| 4 #include "wx/html/htmprint.h" | 4 #include "wx/html/htmprint.h" |
| 5 #include "wx/print.h" | 5 #include "wx/print.h" |
| 6 | 6 |
| 7 #include "symbol.h" | 7 #include "symbol.h" |
| 26 MyCmdBox::MyCmdBox( wxWindow *parent, wxWindowID id, const wxString value, const wxPoint pos, const wxSize size, long style ) | 26 MyCmdBox::MyCmdBox( wxWindow *parent, wxWindowID id, const wxString value, const wxPoint pos, const wxSize size, long style ) |
| 27 : wxTextCtrl( parent, id, value, pos, size, style ) | 27 : wxTextCtrl( parent, id, value, pos, size, style ) |
| 28 { | 28 { |
| 29 // for search history | 29 // for search history |
| 30 hist = wxGetApp().searchhist; | 30 hist = wxGetApp().searchhist; |
| 31 histpos = 5; | 31 histpos = 10; |
| 32 | 32 |
| 33 // for autocomplete hhs | 33 // for autocomplete hhs |
| 34 wxString gszFile = wxGetCwd() + wxT("/db/ccn.db"); | 34 wxString gszFile = wxGetCwd() + wxT("/db/ccn.db"); |
| 35 wxSQLite3Database ccndb; | 35 wxSQLite3Database ccndb; |
| 36 ccndb.Open( gszFile ); | 36 ccndb.Open( gszFile ); |
| 311 } | 311 } |
| 312 wxString execmd = wxT("explorer ") + path[val]; | 312 wxString execmd = wxT("explorer ") + path[val]; |
| 313 wxExecute( execmd ); | 313 wxExecute( execmd ); |
| 314 mf->m_statusBar->SetStatusText( wxEmptyString, 0 ); | 314 mf->m_statusBar->SetStatusText( wxEmptyString, 0 ); |
| 315 | 315 |
| 316 // 検索履歴をログに保存 | 316 WriteLog( cmd, path[val] ); |
| 317 wxString logfn = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("log.txt"); | |
| 318 wxTextFile logFile; | |
| 319 logFile.Open( logfn ); | |
| 320 wxDateTime now = wxDateTime::Now(); | |
| 321 wxString log = now.Format() + wxT(" ") + cmd + wxT(" ") + path[val]; | |
| 322 logFile.AddLine( log ); | |
| 323 logFile.Write(); | |
| 324 logFile.Close(); | |
| 325 | |
| 326 break; | 317 break; |
| 327 } | 318 } |
| 328 // ファイル印刷 | 319 // ファイル印刷 |
| 329 case 3: { | 320 case 3: { |
| 330 this->SetSelection( 0, this->GetLastPosition() ); | 321 this->SetSelection( 0, this->GetLastPosition() ); |
| 331 if ( path.IsEmpty() ) { | 322 if ( path.IsEmpty() ) { |
| 332 mf->m_statusBar->SetStatusText( wxT("不適切な入力です.警告コード3"), 0 ); | 323 mf->m_statusBar->SetStatusText( wxT("不適切な入力です.警告コード3"), 0 ); |
| 333 break; | 324 break; |
| 334 } | 325 } |
| 335 PrintImages( path[0] ); | 326 PrintImages( path[0] ); |
| 327 WriteLog( cmd, path[0] ); | |
| 336 break; | 328 break; |
| 337 } | 329 } |
| 338 // 制御用コマンド | 330 // 制御用コマンド |
| 339 case 0: { | 331 case 0: { |
| 340 path.Clear(); | 332 path.Clear(); |
| 425 cout = dir.GetNext( &file ); | 417 cout = dir.GetNext( &file ); |
| 426 } | 418 } |
| 427 return; | 419 return; |
| 428 } | 420 } |
| 429 | 421 |
| 422 // 検索履歴をログに保存 | |
| 423 void MyCmdBox::WriteLog( wxString& cmd, wxString& path ) | |
| 424 { | |
| 425 wxString logfn = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("log.txt"); | |
| 426 wxTextFile logFile; | |
| 427 logFile.Open( logfn ); | |
| 428 wxDateTime now = wxDateTime::Now(); | |
| 429 wxString log = now.Format( wxT("%Y-%m-%d %H:%M:%S") ) + wxT(" ") + cmd + wxT(" ") + path; | |
| 430 logFile.AddLine( log ); | |
| 431 logFile.Write(); | |
| 432 logFile.Close(); | |
| 433 | |
| 434 return; | |
| 435 } | |
| 436 | |
| 430 ////////////////////////////////////////////////////////////////////////// | 437 ////////////////////////////////////////////////////////////////////////// |
| 431 // frame constructor | 438 // frame constructor |
| 432 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title ) | 439 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title ) |
| 433 : wxFrame( parent, id, title ) | 440 : wxFrame( parent, id, title ) |
| 434 { | 441 { |
