Mercurial > mercurial > hgweb_rsearcher.cgi
comparison src/rsearcher.cpp @ 3:db4813125eb8
many changes.
| author | pyon@macmini |
|---|---|
| date | Thu, 11 Oct 2018 22:11:09 +0900 |
| parents | 7fe3417cefc8 |
| children | 06342fc544e4 |
comparison
equal
deleted
inserted
replaced
| 2:7fe3417cefc8 | 3:db4813125eb8 |
|---|---|
| 1 // Filename : rsearcher.cpp | 1 // Filename : rsearcher.cpp |
| 2 // Last Change: 2018-10-02 Tue 19:43:14. | 2 // Last Change: 2018-10-11 –Ø 18:28:07. |
| 3 // | 3 // |
| 4 | 4 |
| 5 #include <wx/arrstr.h> | 5 #include <wx/arrstr.h> |
| 6 #include <wx/html/htmprint.h> | |
| 6 #include "rsearcher.h" | 7 #include "rsearcher.h" |
| 7 #include "main.h" | 8 #include "main.h" |
| 8 | 9 |
| 9 /********************/ | 10 /********************/ |
| 10 /** MySearchCtrl **/ | 11 /** MySearchCtrl **/ |
| 72 /********************/ | 73 /********************/ |
| 73 MyStaticBitmap::MyStaticBitmap( wxScrolledWindow *parent, wxWindowID id, const wxBitmap &label, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) | 74 MyStaticBitmap::MyStaticBitmap( wxScrolledWindow *parent, wxWindowID id, const wxBitmap &label, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) |
| 74 : wxStaticBitmap( parent, id, label, pos, size, style, name ) | 75 : wxStaticBitmap( parent, id, label, pos, size, style, name ) |
| 75 { | 76 { |
| 76 m_parent = parent; | 77 m_parent = parent; |
| 77 Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MyStaticBitmap::OnLeftDown ), NULL, this ); | 78 Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( OnLeftDown ), NULL, this ); |
| 78 Connect( wxEVT_LEFT_UP, wxMouseEventHandler( MyStaticBitmap::OnLeftUp ), NULL, this ); | 79 Connect( wxEVT_LEFT_UP, wxMouseEventHandler( OnLeftUp ), NULL, this ); |
| 79 Connect( wxEVT_MOTION, wxMouseEventHandler( MyStaticBitmap::OnMotion ), NULL, this ); | 80 Connect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this ); |
| 80 Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( MyStaticBitmap::OnWheel ), NULL, this ); | 81 Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this ); |
| 82 | |
| 83 Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this ); | |
| 84 Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this ); | |
| 81 } | 85 } |
| 82 | 86 |
| 83 MyStaticBitmap::~MyStaticBitmap() | 87 MyStaticBitmap::~MyStaticBitmap() |
| 84 { | 88 { |
| 85 Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MyStaticBitmap::OnLeftDown ), NULL, this ); | 89 Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( OnLeftDown ), NULL, this ); |
| 86 Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( MyStaticBitmap::OnLeftUp ), NULL, this ); | 90 Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( OnLeftUp ), NULL, this ); |
| 87 Disconnect( wxEVT_MOTION, wxMouseEventHandler( MyStaticBitmap::OnMotion ), NULL, this ); | 91 Disconnect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this ); |
| 88 Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( MyStaticBitmap::OnWheel ), NULL, this ); | 92 Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this ); |
| 93 | |
| 94 Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this ); | |
| 95 Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this ); | |
| 96 | |
| 89 } | 97 } |
| 90 | 98 |
| 91 // Event Handlers | 99 // Event Handlers |
| 92 void MyStaticBitmap::OnWheel( wxMouseEvent& event ) | 100 void MyStaticBitmap::OnWheel( wxMouseEvent& event ) |
| 93 { | 101 { |
| 136 | 144 |
| 137 m_dragx = x; m_dragy = y; | 145 m_dragx = x; m_dragy = y; |
| 138 } | 146 } |
| 139 } | 147 } |
| 140 | 148 |
| 149 /* right-gesture: start detect */ | |
| 150 void MyStaticBitmap::OnStartRGesture( wxMouseEvent& event ) | |
| 151 { | |
| 152 event.GetPosition( &cx, &cy ); | |
| 153 } | |
| 154 | |
| 155 /* right-gesture: judge */ | |
| 156 void MyStaticBitmap::OnEndRGesture( wxMouseEvent& event ) | |
| 157 { | |
| 158 int x, y; | |
| 159 event.GetPosition( &x, &y ); | |
| 160 | |
| 161 int dx = x - cx; | |
| 162 int dy = y - cy; | |
| 163 float rad = fabs( atan2( dy, dx ) ); | |
| 164 float pi = 3.14159; | |
| 165 | |
| 166 // to right | |
| 167 if ( rad < pi/8 && dx > 0 ) { | |
| 168 wxMessageBox("right"); | |
| 169 } | |
| 170 // to left | |
| 171 else if ( rad > pi/8*7 && rad < pi && dx < 0 ) { | |
| 172 wxMessageBox("left"); | |
| 173 } | |
| 174 // to up-right | |
| 175 else if ( rad > pi/8 && rad < pi/8*3 && dx > 0 ) { | |
| 176 wxMessageBox("right-up"); | |
| 177 //Close(); | |
| 178 } | |
| 179 } | |
| 180 | |
| 141 // Functions | 181 // Functions |
| 142 | 182 |
| 143 /********************/ | 183 /********************/ |
| 144 /** Main Frame **/ | 184 /** Main Frame **/ |
| 145 /********************/ | 185 /********************/ |
| 146 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) | 186 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) |
| 147 : wxFrame( parent, id, title, pos, size, style ) | 187 : wxFrame( parent, id, title, pos, size, style ) |
| 148 { | 188 { |
| 149 LoadIndex(); | |
| 150 CreateControls(); | 189 CreateControls(); |
| 190 LoadDB(); | |
| 191 LoadBitmaps( wxEmptyString ); | |
| 192 m_timer.SetOwner( this, ID_TIMER ); | |
| 151 } | 193 } |
| 152 | 194 |
| 153 MainFrame::~MainFrame() | 195 MainFrame::~MainFrame() |
| 154 { | 196 { |
| 155 RemoveFile( wxT( "auth.db" ) ); | 197 RemoveFile( wxT( "auth.db" ) ); |
| 160 // Event Table | 202 // Event Table |
| 161 BEGIN_EVENT_TABLE( MainFrame, wxFrame ) | 203 BEGIN_EVENT_TABLE( MainFrame, wxFrame ) |
| 162 EVT_DATAVIEW_SELECTION_CHANGED( ID_LIST, MainFrame::OnItemSelected ) | 204 EVT_DATAVIEW_SELECTION_CHANGED( ID_LIST, MainFrame::OnItemSelected ) |
| 163 EVT_DATAVIEW_ITEM_ACTIVATED( ID_LIST, MainFrame::OnItemDClicked ) | 205 EVT_DATAVIEW_ITEM_ACTIVATED( ID_LIST, MainFrame::OnItemDClicked ) |
| 164 EVT_NOTEBOOK_PAGE_CHANGED( ID_NBOOK, MainFrame::OnNBookChanged ) | 206 EVT_NOTEBOOK_PAGE_CHANGED( ID_NBOOK, MainFrame::OnNBookChanged ) |
| 207 EVT_BUTTON( wxID_PRINT, MainFrame::OnPrint ) | |
| 208 EVT_BUTTON( ID_LOGOUT, MainFrame::OnLogout ) | |
| 165 EVT_BUTTON( ID_TEST, MainFrame::OnTestButton ) | 209 EVT_BUTTON( ID_TEST, MainFrame::OnTestButton ) |
| 166 EVT_CLOSE( MainFrame::SaveConfig ) | 210 EVT_CLOSE( MainFrame::OnClose ) |
| 167 //EVT_IDLE( MainFrame::OnIdle ) | 211 EVT_IDLE( MainFrame::OnIdle ) |
| 212 EVT_TIMER( ID_TIMER, MainFrame::OnTimer ) | |
| 168 END_EVENT_TABLE() | 213 END_EVENT_TABLE() |
| 169 | 214 |
| 170 | 215 |
| 171 // Event Handler | 216 // Event Handler |
| 172 void MainFrame::OnItemSelected( wxDataViewEvent& WXUNUSED(event) ) | 217 void MainFrame::OnItemSelected( wxDataViewEvent& WXUNUSED(event) ) |
| 173 { | 218 { |
| 174 int r = m_dataViewListCtrl->GetSelectedRow(); | 219 int r = m_dataViewListCtrl->GetSelectedRow(); |
| 175 wxString ready = m_dataViewListCtrl->GetTextValue( r, 2 ); | 220 wxString ready = m_dataViewListCtrl->GetTextValue( r, 2 ); |
| 176 if ( ready.IsSameAs( wxT( "ok" ), true ) ) { | 221 if ( ready.IsSameAs( wxT( "OK" ), true ) ) { |
| 177 wxString buf = m_dataViewListCtrl->GetTextValue( r, 1 ); | 222 wxString date = m_dataViewListCtrl->GetTextValue( r, 1 ); |
| 178 LoadBitmaps( wxT( "00000000" ) ); | 223 date.Replace( wxT( "-" ), wxEmptyString, true ); |
| 224 LoadBitmaps( date ); | |
| 225 } else { | |
| 226 LoadBitmaps( wxEmptyString ); | |
| 179 } | 227 } |
| 180 } | 228 } |
| 181 | 229 |
| 182 void MainFrame::OnItemDClicked( wxDataViewEvent& WXUNUSED(event) ) | 230 void MainFrame::OnItemDClicked( wxDataViewEvent& WXUNUSED(event) ) |
| 183 { | 231 { |
| 184 int r = m_dataViewListCtrl->GetSelectedRow(); | 232 int r = m_dataViewListCtrl->GetSelectedRow(); |
| 233 wxString status = m_dataViewListCtrl->GetTextValue( r, 2 ); | |
| 234 if ( status.IsSameAs( wxT( "OK" ), true ) ) return; | |
| 235 | |
| 185 wxString date = m_dataViewListCtrl->GetTextValue( r, 1 ); | 236 wxString date = m_dataViewListCtrl->GetTextValue( r, 1 ); |
| 186 date.Replace( wxT( "-" ), wxEmptyString, true ); | 237 date.Replace( wxT( "-" ), wxEmptyString, true ); |
| 187 GetImages( m_hhs, date ); | 238 GetImages( m_hhs, date ); |
| 188 LoadBitmaps( wxT( "00000000" ) ); | 239 LoadBitmaps( date ); |
| 240 | |
| 241 m_dataViewListCtrl->SetTextValue( wxT( "OK" ), r, 2 ); | |
| 189 } | 242 } |
| 190 | 243 |
| 191 void MainFrame::OnNBookChanged( wxBookCtrlEvent& WXUNUSED(event) ) | 244 void MainFrame::OnNBookChanged( wxBookCtrlEvent& WXUNUSED(event) ) |
| 192 { | 245 { |
| 193 for ( int i = 0; i < m_notebook->GetPageCount(); i++ ) { | 246 for ( int i = 0; i < m_notebook->GetPageCount(); i++ ) { |
| 194 m_notebook->SetPageImage( i, 1 ); | 247 m_notebook->SetPageImage( i, 1 ); |
| 195 } | 248 } |
| 196 m_notebook->SetPageImage( m_notebook->GetSelection(), 0 ); | 249 m_notebook->SetPageImage( m_notebook->GetSelection(), 0 ); |
| 197 } | 250 } |
| 198 | 251 |
| 199 /* | 252 void MainFrame::OnClose( wxCloseEvent& WXUNUSED(event) ) // save config |
| 200 void MainFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) | |
| 201 { | |
| 202 } | |
| 203 | |
| 204 */ | |
| 205 | |
| 206 void MainFrame::SaveConfig( wxCloseEvent& WXUNUSED(event) ) | |
| 207 { | 253 { |
| 208 if ( !IsIconized() && !IsMaximized() ) { | 254 if ( !IsIconized() && !IsMaximized() ) { |
| 209 wxGetApp().rect = this->GetRect(); | 255 wxGetApp().rect = this->GetRect(); |
| 210 } | 256 } |
| 211 Destroy(); | 257 Destroy(); |
| 212 } | 258 } |
| 213 | 259 |
| 260 void MainFrame::OnPrint( wxCommandEvent& WXUNUSED(event) ) | |
| 261 { | |
| 262 PrintImages(); | |
| 263 } | |
| 264 | |
| 265 void MainFrame::OnLogout( wxCommandEvent& WXUNUSED(event) ) | |
| 266 { | |
| 267 wxMessageBox("logout"); | |
| 268 return; | |
| 269 } | |
| 270 | |
| 214 void MainFrame::OnTestButton( wxCommandEvent& WXUNUSED(event) ) | 271 void MainFrame::OnTestButton( wxCommandEvent& WXUNUSED(event) ) |
| 215 { | 272 { |
| 216 return; | 273 return; |
| 274 } | |
| 275 | |
| 276 | |
| 277 void MainFrame::OnTimer( wxTimerEvent& WXUNUSED(event) ) | |
| 278 { | |
| 279 wxMessageBox( "timer !" ); | |
| 280 // logout | |
| 281 } | |
| 282 | |
| 283 void MainFrame::OnIdle( wxIdleEvent& event ) | |
| 284 { | |
| 285 if ( !m_timer.IsRunning() ) { | |
| 286 m_timer.Start( 300 * 1000, wxTIMER_ONE_SHOT ); | |
| 287 } | |
| 288 event.RequestMore(); | |
| 289 event.Skip(); | |
| 217 } | 290 } |
| 218 | 291 |
| 219 // Functions | 292 // Functions |
| 220 void MainFrame::CreateControls( void ) | 293 void MainFrame::CreateControls( void ) |
| 221 { | 294 { |
| 288 bSizerRight->Add( m_textCtrlLog, 1, wxALL|wxEXPAND, 5 ); | 361 bSizerRight->Add( m_textCtrlLog, 1, wxALL|wxEXPAND, 5 ); |
| 289 | 362 |
| 290 m_slider = new wxSlider( this, ID_SLDR, 1, 1, 5, wxDefaultPosition, wxSize( -1, 200 ), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_LABELS|wxSL_VERTICAL ); | 363 m_slider = new wxSlider( this, ID_SLDR, 1, 1, 5, wxDefaultPosition, wxSize( -1, 200 ), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_LABELS|wxSL_VERTICAL ); |
| 291 bSizerRight->Add( m_slider, 0, wxALL, 5 ); | 364 bSizerRight->Add( m_slider, 0, wxALL, 5 ); |
| 292 | 365 |
| 293 m_buttonPrint = new wxButton( this, ID_PRINT, wxT( "Print" ), wxDefaultPosition, wxDefaultSize, 0 ); | 366 m_buttonPrint = new wxButton( this, wxID_PRINT, wxT( "Print" ), wxDefaultPosition, wxDefaultSize, 0 ); |
| 294 bSizerRight->Add( m_buttonPrint, 0, wxALL, 5 ); | 367 bSizerRight->Add( m_buttonPrint, 0, wxALL, 5 ); |
| 368 | |
| 369 m_buttonLogout = new wxButton( this, ID_LOGOUT, wxT( "Logout" ), wxDefaultPosition, wxDefaultSize, 0 ); | |
| 370 bSizerRight->Add( m_buttonLogout, 0, wxALL, 5 ); | |
| 295 | 371 |
| 296 m_buttonTest = new wxButton( this, ID_TEST, wxT( "Test" ), wxDefaultPosition, wxDefaultSize, 0 ); | 372 m_buttonTest = new wxButton( this, ID_TEST, wxT( "Test" ), wxDefaultPosition, wxDefaultSize, 0 ); |
| 297 bSizerRight->Add( m_buttonTest, 0, wxALL, 5 ); | 373 bSizerRight->Add( m_buttonTest, 0, wxALL, 5 ); |
| 298 | 374 |
| 299 bSizerTop->Add( bSizerRight, 0, wxEXPAND, 5 ); | 375 bSizerTop->Add( bSizerRight, 0, wxEXPAND, 5 ); |
| 323 if ( cmd.IsSameAs( wxT( "c" ), true ) || cmd.IsSameAs( wxT( "cmd" ), true ) ) { | 399 if ( cmd.IsSameAs( wxT( "c" ), true ) || cmd.IsSameAs( wxT( "cmd" ), true ) ) { |
| 324 Close(); | 400 Close(); |
| 325 return; | 401 return; |
| 326 } | 402 } |
| 327 | 403 |
| 328 if ( cmd.IsSameAs( wxT( "." ), true ) ) { | 404 if ( cmd.IsSameAs( wxT( "k" ), true ) ) { |
| 405 // hiragana kensaku | |
| 406 return; | |
| 407 } | |
| 408 | |
| 409 if ( cmd.IsSameAs( wxT( "." ), false ) ) { | |
| 329 wxString appdir = wxGetCwd(); | 410 wxString appdir = wxGetCwd(); |
| 330 wxString execmd = wxT( "explorer " ) + appdir; | 411 wxString execmd = wxT( "explorer " ) + appdir; |
| 331 wxExecute( execmd ); | 412 wxExecute( execmd ); |
| 332 return; | 413 return; |
| 333 } | 414 } |
| 415 | |
| 416 if ( cmd.IsSameAs( wxT( "*" ), false ) ) { | |
| 417 // cmd = clipboard // paste clipboard | |
| 418 } | |
| 419 | |
| 420 if ( cmd.IsSameAs( wxT( "+" ), false ) ) { | |
| 421 // print | |
| 422 return; | |
| 423 } | |
| 334 | 424 |
| 335 wxRegEx reHhs( wxT( "^0[1238][0-9]{8}$" ) ); | 425 wxRegEx reHhs( wxT( "^0[1238][0-9]{8}$" ) ); |
| 336 if ( reHhs.Matches( cmd ) ) { | 426 if ( reHhs.Matches( cmd ) ) { |
| 337 m_hhs = m_searchCtrl->GetValue(); | 427 m_hhs = m_searchCtrl->GetValue(); |
| 338 Search(); | 428 Search(); |
| 339 return; | 429 return; |
| 340 } | 430 } |
| 341 | 431 |
| 342 wxMessageBox( wxT( "Bad Input!!" ) ); | 432 wxMessageBox( wxT( "Bad Input !!" ) ); |
| 343 } | 433 } |
| 344 | 434 |
| 345 void MainFrame::LoadBitmap( wxScrolledWindow* sc, wxStaticBitmap* sb, wxString file ) | 435 void MainFrame::LoadBitmap( wxScrolledWindow* sc, wxStaticBitmap* sb, wxString file ) |
| 346 { | 436 { |
| 347 if ( startup ) { | 437 if ( startup ) { |
| 355 wxImage img = bmp.ConvertToImage(); | 445 wxImage img = bmp.ConvertToImage(); |
| 356 | 446 |
| 357 int ww, wh; | 447 int ww, wh; |
| 358 sc->GetSize( &ww, &wh ); | 448 sc->GetSize( &ww, &wh ); |
| 359 | 449 |
| 360 float w = ww - 50; | 450 float w = ww - 30; |
| 361 float h = w * height / width; | 451 float h = w * height / width; |
| 362 sb->SetBitmap( wxBitmap( img.Scale( w, h, wxIMAGE_QUALITY_HIGH ) ) ); | 452 sb->SetBitmap( wxBitmap( img.Scale( w, h, wxIMAGE_QUALITY_HIGH ) ) ); |
| 363 sc->SetScrollbars( 10, 10, w / 10, h / 10 ); | 453 sc->SetScrollbars( 10, 10, w / 10, h / 10 ); |
| 364 | 454 |
| 365 for ( int i = 0; i < 5; i++ ) { | 455 for ( int i = 0; i < 5; i++ ) { |
| 385 args.Add( m_server ); | 475 args.Add( m_server ); |
| 386 args.Add( hhs ); | 476 args.Add( hhs ); |
| 387 args.Add( date ); | 477 args.Add( date ); |
| 388 | 478 |
| 389 //wxMessageBox( wxJoin( args, ' ', '\\' ) ); | 479 //wxMessageBox( wxJoin( args, ' ', '\\' ) ); |
| 480 int estimate = 5; | |
| 481 wxProgressDialog pd( wxT( "Connecting Server" ), wxT( "Start..." ), estimate, NULL, wxPD_APP_MODAL|wxPD_ELAPSED_TIME|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE ); | |
| 482 pd.SetSize( wxSize( 320, 140 ) ); | |
| 483 | |
| 390 wxExecute( wxJoin( args, ' ', '\\' ), wxEXEC_ASYNC|wxEXEC_HIDE_CONSOLE ); | 484 wxExecute( wxJoin( args, ' ', '\\' ), wxEXEC_ASYNC|wxEXEC_HIDE_CONSOLE ); |
| 485 for ( int i = 0; i < estimate; i++ ) { | |
| 486 wxSleep( 1 ); | |
| 487 pd.Update( i, wxT( "Now Loading..." ) ); | |
| 488 } | |
| 391 } | 489 } |
| 392 | 490 |
| 393 void MainFrame::Search( void ) | 491 void MainFrame::Search( void ) |
| 394 { | 492 { |
| 395 wxString date; | 493 wxString date; |
| 403 data.push_back( wxEmptyString ); | 501 data.push_back( wxEmptyString ); |
| 404 m_dataViewListCtrl->AppendItem( data ); | 502 m_dataViewListCtrl->AppendItem( data ); |
| 405 data.clear(); | 503 data.clear(); |
| 406 } | 504 } |
| 407 } | 505 } |
| 408 if ( match_cnt == 0 ) wxMessageBox( wxT( "Not Matched!!" ) ); | 506 if ( match_cnt == 0 ) wxMessageBox( wxT( "Not Matched !!" ) ); |
| 409 } | 507 } |
| 410 | 508 |
| 411 void MainFrame::LoadIndex( void ) | 509 void MainFrame::LoadDB( void ) |
| 412 { | 510 { |
| 413 wxTextFile file; | 511 wxTextFile file; |
| 414 file.Open( wxT( "index.db" ) ); | 512 file.Open( wxT( "index.db" ) ); |
| 415 for ( int i = 0; i < file.GetLineCount(); i++ ) | 513 for ( int i = 0; i < file.GetLineCount(); i++ ) |
| 416 m_index.Add( file.GetLine( i ) ); | 514 m_index.Add( file.GetLine( i ) ); |
| 417 file.Close(); | 515 file.Close(); |
| 418 m_index.Sort( true ); | 516 m_index.Sort( true ); |
| 517 | |
| 518 /* | |
| 519 file.Open( wxT( "hhs.db" ) ); | |
| 520 for ( int i = 0; i < file.GetLineCount(); i++ ) { | |
| 521 // | |
| 522 } | |
| 523 file.Close(); | |
| 524 */ | |
| 525 } | |
| 526 | |
| 527 void MainFrame::PrintImages( void ) | |
| 528 { | |
| 529 int r = m_dataViewListCtrl->GetSelectedRow(); | |
| 530 wxString ready = m_dataViewListCtrl->GetTextValue( r, 2 ); | |
| 531 | |
| 532 if ( !ready.IsSameAs( wxT( "OK" ), true ) ) { | |
| 533 wxMessageBox( wxT( "Not Ready for Print !!" ) ); | |
| 534 return; | |
| 535 } | |
| 536 | |
| 537 wxDateTime now = wxDateTime::Now(); | |
| 538 wxString nowstr = now.Format( "%Y/%m/%d %H:%M", wxDateTime::GMT9 ).c_str(); | |
| 539 | |
| 540 wxString date = m_dataViewListCtrl->GetTextValue( r, 1 ); | |
| 541 date.Replace( wxT( "-" ), wxEmptyString, true ); | |
| 542 | |
| 543 wxString html, file; | |
| 544 html = wxT( "<html><body>\n" ); | |
| 545 | |
| 546 for ( int i = 1; i < 6; i++ ) { | |
| 547 file = wxString::Format( wxT( ".cache/%08s_%d" ), date, i ); | |
| 548 html = html + wxT( "<img src=\"" ) + file + wxT( "\" width=\"750\" height=\"1060\"/>\n" ); | |
| 549 html = html + wxT( "<div align=right><font size=-2><u>" ) + m_hhs + wxT( "@" ) + m_user + wxT( "#" ) + nowstr + wxT( "</u></font></div>\n\n" ); | |
| 550 } | |
| 551 html = html + wxT( "</body></html>" ); | |
| 552 | |
| 553 // start printing | |
| 554 wxHtmlPrintout hpout( wxT( "Re:Searcher" ) ); | |
| 555 hpout.SetMargins( 0, 0, 0, 0, 0 ); | |
| 556 wxPrintDialogData pd; | |
| 557 wxPrinter p( &pd ); | |
| 558 | |
| 559 hpout.SetHtmlText( html, wxEmptyString, false ); | |
| 560 p.Print( NULL, &hpout, true ); | |
| 419 } | 561 } |
| 420 | 562 |
| 421 void MainFrame::RemoveFile( wxString pattern ) | 563 void MainFrame::RemoveFile( wxString pattern ) |
| 422 { | 564 { |
| 423 wxString file = wxFindFirstFile( pattern ); | 565 wxString file = wxFindFirstFile( pattern ); |
| 428 } | 570 } |
| 429 | 571 |
| 430 void MainFrame::InDevelop( bool flag ) | 572 void MainFrame::InDevelop( bool flag ) |
| 431 { | 573 { |
| 432 if ( !flag ) return; | 574 if ( !flag ) return; |
| 433 //LoadBitmaps( wxT( "00000000" ) ); | |
| 434 LoadBitmaps( wxEmptyString ); | |
| 435 | 575 |
| 436 m_slider->Enable( false ); | 576 bool lo = false; |
| 437 m_slider->Show( false ); | 577 m_buttonLogout->Enable( lo ); |
| 438 | 578 m_buttonLogout->Show( lo ); |
| 439 bool pr = true; | 579 |
| 440 m_buttonPrint->Enable( false ); | 580 bool sl = false; |
| 441 m_buttonPrint->Show( true ); | 581 m_slider->Enable( sl ); |
| 442 | 582 m_slider->Show( sl ); |
| 443 bool tb = true; | 583 |
| 584 bool tb = false; | |
| 444 m_buttonTest->Enable( tb ); | 585 m_buttonTest->Enable( tb ); |
| 445 m_buttonTest->Show( tb ); | 586 m_buttonTest->Show( tb ); |
| 446 | 587 |
| 447 bool srch = true; | 588 // search |
| 448 m_searchCtrl->Enable( srch ); | 589 m_searchCtrl->SetValue( wxT( "0100122642" ) ); |
| 449 } | 590 } |
| 450 | 591 |
