Mercurial > mercurial > hgweb_rsearcher.cgi
comparison src/rsearcher.cpp @ 10:36811fd22bd2
v1.4
| author | pyon@macmini |
|---|---|
| date | Thu, 08 Nov 2018 19:15:43 +0900 |
| parents | ae89ce4793d8 |
| children | 799b6008db8e |
comparison
equal
deleted
inserted
replaced
| 9:ae89ce4793d8 | 10:36811fd22bd2 |
|---|---|
| 1 // Filename : rsearcher.cpp | 1 // Filename : rsearcher.cpp |
| 2 // Last Change: 2018-10-31 水 16:39:35. | 2 // Last Change: 2018-11-08 木 14:47:21. |
| 3 // | 3 // |
| 4 | 4 |
| 5 #include <wx/arrstr.h> | 5 #include <wx/arrstr.h> |
| 6 #include <wx/html/htmprint.h> | 6 #include <wx/html/htmprint.h> |
| 7 #include <wx/clipbrd.h> | 7 #include <wx/clipbrd.h> |
| 270 { | 270 { |
| 271 } | 271 } |
| 272 | 272 |
| 273 // Event Table | 273 // Event Table |
| 274 BEGIN_EVENT_TABLE( MainFrame, wxFrame ) | 274 BEGIN_EVENT_TABLE( MainFrame, wxFrame ) |
| 275 EVT_SPLITTER_DCLICK( ID_SPLIT, MainFrame::OnSplitWin ) | |
| 275 EVT_DATAVIEW_SELECTION_CHANGED( ID_LIST, MainFrame::OnItemSelected ) | 276 EVT_DATAVIEW_SELECTION_CHANGED( ID_LIST, MainFrame::OnItemSelected ) |
| 276 EVT_DATAVIEW_ITEM_ACTIVATED( ID_LIST, MainFrame::OnItemDClicked ) | 277 EVT_DATAVIEW_ITEM_ACTIVATED( ID_LIST, MainFrame::OnItemDClicked ) |
| 278 EVT_DATAVIEW_SELECTION_CHANGED( ID_LISTKANA, MainFrame::OnKanaItemSelected ) | |
| 279 EVT_DATAVIEW_ITEM_ACTIVATED( ID_LISTKANA, MainFrame::OnKanaItemDClicked ) | |
| 277 EVT_NOTEBOOK_PAGE_CHANGED( ID_NBOOK, MainFrame::OnNBookChanged ) | 280 EVT_NOTEBOOK_PAGE_CHANGED( ID_NBOOK, MainFrame::OnNBookChanged ) |
| 278 EVT_BUTTON( ID_PSEARCH, MainFrame::OnPasteSearch ) | 281 EVT_BUTTON( ID_PSEARCH, MainFrame::OnPasteSearch ) |
| 279 EVT_BUTTON( wxID_PRINT, MainFrame::OnPrint ) | 282 EVT_BUTTON( wxID_PRINT, MainFrame::OnPrint ) |
| 280 EVT_CLOSE( MainFrame::OnClose ) | 283 EVT_CLOSE( MainFrame::OnClose ) |
| 281 EVT_IDLE( MainFrame::OnIdle ) | 284 EVT_IDLE( MainFrame::OnIdle ) |
| 291 EVT_BUTTON( ID_LOGOUT, MainFrame::OnLogout ) | 294 EVT_BUTTON( ID_LOGOUT, MainFrame::OnLogout ) |
| 292 END_EVENT_TABLE() | 295 END_EVENT_TABLE() |
| 293 | 296 |
| 294 | 297 |
| 295 // Event Handler | 298 // Event Handler |
| 299 void MainFrame::OnSplitWin( wxSplitterEvent& WXUNUSED(event) ) | |
| 300 { | |
| 301 int w, h; | |
| 302 this->GetSize( &w, &h ); | |
| 303 m_splitter->SetSashPosition( w - 200, true ); | |
| 304 } | |
| 305 | |
| 296 void MainFrame::OnItemSelected( wxDataViewEvent& WXUNUSED(event) ) | 306 void MainFrame::OnItemSelected( wxDataViewEvent& WXUNUSED(event) ) |
| 297 { | 307 { |
| 298 int r = m_dataViewListCtrl->GetSelectedRow(); | 308 int r = m_dataViewListCtrl->GetSelectedRow(); |
| 299 if ( r == wxNOT_FOUND ) return; | 309 if ( r == wxNOT_FOUND ) return; |
| 300 | 310 |
| 317 wxString date = m_dataViewListCtrl->GetTextValue( r, 1 ); | 327 wxString date = m_dataViewListCtrl->GetTextValue( r, 1 ); |
| 318 date.Replace( wxT( "-" ), wxEmptyString, true ); | 328 date.Replace( wxT( "-" ), wxEmptyString, true ); |
| 319 GetImages( m_hhs, date ); | 329 GetImages( m_hhs, date ); |
| 320 if ( LoadBitmaps( date, true ) ) | 330 if ( LoadBitmaps( date, true ) ) |
| 321 m_dataViewListCtrl->SetTextValue( wxT( "OK" ), r, 2 ); | 331 m_dataViewListCtrl->SetTextValue( wxT( "OK" ), r, 2 ); |
| 332 } | |
| 333 | |
| 334 void MainFrame::OnKanaItemSelected( wxDataViewEvent& WXUNUSED(event) ) | |
| 335 { | |
| 336 int r = m_dataViewListKana->GetSelectedRow(); | |
| 337 if ( r == wxNOT_FOUND ) return; | |
| 338 } | |
| 339 | |
| 340 void MainFrame::OnKanaItemDClicked( wxDataViewEvent& WXUNUSED(event) ) | |
| 341 { | |
| 342 m_dataViewListCtrl->DeleteAllItems(); | |
| 343 wxGetApp().RemoveFile( wxT( ".cache/*" ) ); | |
| 344 LoadBitmaps( wxEmptyString, false ); | |
| 345 | |
| 346 int r = m_dataViewListKana->GetSelectedRow(); | |
| 347 m_searchCtrl->SetValue( m_dataViewListKana->GetTextValue( r, 0 ) ); | |
| 348 m_textCtrlName->SetValue( m_dataViewListKana->GetTextValue( r, 1 ) ); | |
| 349 m_textCtrlAddr->SetValue( m_dataViewListKana->GetTextValue( r, 2 ) ); | |
| 350 m_hhs = m_searchCtrl->GetValue(); | |
| 351 Search(); | |
| 322 } | 352 } |
| 323 | 353 |
| 324 void MainFrame::OnNBookChanged( wxBookCtrlEvent& WXUNUSED(event) ) | 354 void MainFrame::OnNBookChanged( wxBookCtrlEvent& WXUNUSED(event) ) |
| 325 { | 355 { |
| 326 for ( int i = 0; i < m_notebook->GetPageCount(); i++ ) { | 356 for ( int i = 0; i < m_notebook->GetPageCount(); i++ ) { |
| 397 } | 427 } |
| 398 | 428 |
| 399 void MainFrame::OnHelp( wxCommandEvent& WXUNUSED(event) ) | 429 void MainFrame::OnHelp( wxCommandEvent& WXUNUSED(event) ) |
| 400 { | 430 { |
| 401 wxString version, build; | 431 wxString version, build; |
| 402 version = wxString::Format( wxT( "Re:Searcher-- version %s / %s\n\n" ), RSVER, RSRELEASE ); | 432 version = wxString::Format( wxT( "Re:Searcher -- version %s / %s\n\n" ), RSVER, RSRELEASE ); |
| 403 build = wxString::Format( wxT( "build with %s\nrunning under %s." ), wxVERSION_STRING, wxGetOsDescription() ); | 433 build = wxString::Format( wxT( "build with %s\nrunning under %s." ), wxVERSION_STRING, wxGetOsDescription() ); |
| 404 | 434 |
| 405 wxMessageBox( version + build, wxT( "Help" ) ); | 435 wxMessageBox( version + build, wxT( "Help" ) ); |
| 406 return; | 436 return; |
| 407 } | 437 } |
| 429 | 459 |
| 430 // Functions | 460 // Functions |
| 431 void MainFrame::CreateControls( void ) | 461 void MainFrame::CreateControls( void ) |
| 432 { | 462 { |
| 433 this->SetIcon( wxIcon( wxT( "sample" ) ) ); | 463 this->SetIcon( wxIcon( wxT( "sample" ) ) ); |
| 434 this->SetSizeHints( wxDefaultSize, wxDefaultSize ); | 464 this->SetSizeHints( wxSize( 400, 300 ), wxDefaultSize ); |
| 435 this->SetBackgroundColour( wxColour( 30, 80, 40 ) ); | 465 this->SetBackgroundColour( wxColour( 30, 80, 40 ) ); |
| 436 //this->SetBackgroundColour( wxColour( 153, 153, 153 ) ); | 466 //this->SetBackgroundColour( wxColour( 153, 153, 153 ) ); |
| 437 | 467 |
| 438 wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL ); | 468 wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL ); |
| 469 | |
| 470 m_splitter = new wxSplitterWindow( this, ID_SPLIT, wxDefaultPosition, wxDefaultSize, wxSP_THIN_SASH ); | |
| 471 m_splitter->SetMinimumPaneSize( 20 ); | |
| 472 m_panelLeft = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); | |
| 473 m_panelLeft->SetBackgroundColour( wxColour( 30, 80, 40 ) ); | |
| 474 m_panelRight = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); | |
| 475 m_panelRight->SetBackgroundColour( wxColour( 30, 80, 40 ) ); | |
| 476 | |
| 477 int w, h; | |
| 478 this->GetSize( &w, &h ); | |
| 479 m_splitter->SplitVertically( m_panelLeft, m_panelRight, w - 200 ); | |
| 439 | 480 |
| 440 // Left | 481 // Left |
| 482 wxBoxSizer* bSizerLeft = new wxBoxSizer( wxVERTICAL ); | |
| 483 | |
| 441 wxImageList* imgList = new wxImageList( 16, 16, false, 1 ); | 484 wxImageList* imgList = new wxImageList( 16, 16, false, 1 ); |
| 442 wxBitmap bmp( wxT( "image/blue.png" ), wxBITMAP_TYPE_PNG ); | 485 wxBitmap bmp( wxT( "image/blue.png" ), wxBITMAP_TYPE_PNG ); |
| 443 imgList->Add( bmp, wxNullBitmap ); | 486 imgList->Add( bmp, wxNullBitmap ); |
| 444 bmp.LoadFile( wxT( "image/water.png" ), wxBITMAP_TYPE_PNG ); | 487 bmp.LoadFile( wxT( "image/water.png" ), wxBITMAP_TYPE_PNG ); |
| 445 imgList->Add( bmp, wxNullBitmap ); | 488 imgList->Add( bmp, wxNullBitmap ); |
| 446 | 489 |
| 447 m_notebook = new wxNotebook( this, ID_NBOOK, wxDefaultPosition, wxDefaultSize, 0 ); | 490 m_notebook = new wxNotebook( m_panelLeft, ID_NBOOK, wxDefaultPosition, wxDefaultSize, 0 ); |
| 448 m_notebook->SetImageList( imgList ); | 491 m_notebook->SetImageList( imgList ); |
| 449 | 492 |
| 450 m_scrolledWindow1 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); | 493 m_scrolledWindow1 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); |
| 451 m_scrolledWindow1->SetScrollRate( 5, 5 ); | 494 m_scrolledWindow1->SetScrollRate( 5, 5 ); |
| 452 m_notebook->AddPage( m_scrolledWindow1, wxT( "Image-01" ), false, 0 ); | 495 m_notebook->AddPage( m_scrolledWindow1, wxT( "Image-01" ), false, 0 ); |
| 469 | 512 |
| 470 m_scrolledWindow6 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); | 513 m_scrolledWindow6 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); |
| 471 m_scrolledWindow6->SetScrollRate( 5, 5 ); | 514 m_scrolledWindow6->SetScrollRate( 5, 5 ); |
| 472 m_notebook->AddPage( m_scrolledWindow6, wxT( "Image-06" ), false, 0 ); | 515 m_notebook->AddPage( m_scrolledWindow6, wxT( "Image-06" ), false, 0 ); |
| 473 | 516 |
| 474 bSizerTop->Add( m_notebook, 1, wxEXPAND|wxALL, 5 ); | 517 bSizerLeft->Add( m_notebook, 1, wxEXPAND|wxALL, 5 ); |
| 518 m_panelLeft->SetSizer( bSizerLeft ); | |
| 475 | 519 |
| 476 // Right | 520 // Right |
| 477 wxBoxSizer* bSizerRight = new wxBoxSizer( wxVERTICAL ); | 521 wxBoxSizer* bSizerRight = new wxBoxSizer( wxVERTICAL ); |
| 478 | 522 |
| 479 m_searchCtrl = new MySearchCtrl( this, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxSize( -1, 24 ), wxTE_PROCESS_ENTER ); | 523 m_searchCtrl = new MySearchCtrl( m_panelRight, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxSize( -1, 24 ), wxTE_PROCESS_ENTER ); |
| 480 bSizerRight->Add( m_searchCtrl, 0, wxALL, 5 ); | 524 bSizerRight->Add( m_searchCtrl, 0, wxALL, 5 ); |
| 481 m_searchCtrl->SetFocus(); | 525 m_searchCtrl->SetFocus(); |
| 482 | 526 |
| 483 m_textCtrlName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, -1 ), wxTE_READONLY ); | 527 m_textCtrlName = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, -1 ), wxTE_READONLY ); |
| 484 m_textCtrlName->SetBackgroundColour( wxColour( 180, 210, 240 ) ); | 528 m_textCtrlName->SetBackgroundColour( wxColour( 180, 210, 240 ) ); |
| 485 bSizerRight->Add( m_textCtrlName, 0, wxALL, 5 ); | 529 bSizerRight->Add( m_textCtrlName, 0, wxALL, 5 ); |
| 486 | 530 |
| 487 m_textCtrlAddr = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 160, -1 ), wxTE_READONLY ); | 531 m_textCtrlAddr = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 160, -1 ), wxTE_READONLY ); |
| 488 m_textCtrlAddr->SetBackgroundColour( wxColour( 180, 210, 240 ) ); | 532 m_textCtrlAddr->SetBackgroundColour( wxColour( 180, 210, 240 ) ); |
| 489 bSizerRight->Add( m_textCtrlAddr, 0, wxALL|wxEXPAND, 5 ); | 533 bSizerRight->Add( m_textCtrlAddr, 0, wxALL|wxEXPAND, 5 ); |
| 490 | 534 |
| 491 m_dataViewListCtrl = new wxDataViewListCtrl( this, ID_LIST, wxDefaultPosition, wxDefaultSize, wxDV_ROW_LINES|wxDV_SINGLE ); | 535 m_dataViewListCtrl = new wxDataViewListCtrl( m_panelRight, ID_LIST, wxDefaultPosition, wxDefaultSize, wxDV_ROW_LINES|wxDV_SINGLE ); |
| 492 m_dataViewListColumnNo = m_dataViewListCtrl->AppendTextColumn( wxT( "No" ), wxDATAVIEW_CELL_INERT, 30, wxALIGN_RIGHT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); | 536 m_dataViewListColumnNo = m_dataViewListCtrl->AppendTextColumn( wxT( "No" ), wxDATAVIEW_CELL_INERT, 30, wxALIGN_RIGHT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); |
| 493 m_dataViewListColumnDate = m_dataViewListCtrl->AppendTextColumn( wxT( "Date" ), wxDATAVIEW_CELL_INERT, 80, wxALIGN_CENTER, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); | 537 m_dataViewListColumnDate = m_dataViewListCtrl->AppendTextColumn( wxT( " Date" ), wxDATAVIEW_CELL_INERT, 80, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); |
| 494 m_dataViewListColumnDate = m_dataViewListCtrl->AppendTextColumn( wxT( "Ready" ), wxDATAVIEW_CELL_INERT, 60, wxALIGN_CENTER, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); | 538 m_dataViewListColumnReady = m_dataViewListCtrl->AppendTextColumn( wxT( "Ready" ), wxDATAVIEW_CELL_INERT, 60, wxALIGN_CENTER, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); |
| 495 | |
| 496 bSizerRight->Add( m_dataViewListCtrl, 1, wxALL|wxEXPAND, 5 ); | 539 bSizerRight->Add( m_dataViewListCtrl, 1, wxALL|wxEXPAND, 5 ); |
| 497 | 540 |
| 498 m_textCtrlLog = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); | 541 m_dataViewListKana = new wxDataViewListCtrl( m_panelRight, ID_LISTKANA, wxDefaultPosition, wxDefaultSize, wxDV_ROW_LINES|wxDV_SINGLE ); |
| 499 bSizerRight->Add( m_textCtrlLog, 1, wxALL|wxEXPAND, 5 ); | 542 m_dataViewListColumnKNo = m_dataViewListKana->AppendTextColumn( wxT( " No" ), wxDATAVIEW_CELL_INERT, 70, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); |
| 500 | 543 m_dataViewListColumnName = m_dataViewListKana->AppendTextColumn( wxT( " Name" ), wxDATAVIEW_CELL_INERT, 80, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); |
| 501 m_slider = new wxSlider( this, ID_SLDR, 1, 1, 5, wxDefaultPosition, wxSize( -1, 200 ), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_LABELS|wxSL_VERTICAL ); | 544 m_dataViewListColumnAddr = m_dataViewListKana->AppendTextColumn( wxT( " Address" ), wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); |
| 502 bSizerRight->Add( m_slider, 0, wxALL, 5 ); | 545 bSizerRight->Add( m_dataViewListKana, 1, wxALL|wxEXPAND, 5 ); |
| 503 | 546 |
| 504 m_buttonPsearch = new wxButton( this, ID_PSEARCH, wxT( "Paste-Search" ), wxDefaultPosition, wxDefaultSize, 0 ); | 547 m_textCtrlLog = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1, 40 ), 0 ); |
| 548 bSizerRight->Add( m_textCtrlLog, 0, wxALL|wxEXPAND, 5 ); | |
| 549 | |
| 550 m_buttonPsearch = new wxButton( m_panelRight, ID_PSEARCH, wxT( "Paste-Search" ), wxDefaultPosition, wxDefaultSize, 0 ); | |
| 505 bSizerRight->Add( m_buttonPsearch, 0, wxALL, 5 ); | 551 bSizerRight->Add( m_buttonPsearch, 0, wxALL, 5 ); |
| 506 | 552 |
| 507 m_buttonPrint = new wxButton( this, wxID_PRINT, wxT( "Print" ), wxDefaultPosition, wxDefaultSize, 0 ); | 553 m_buttonPrint = new wxButton( m_panelRight, wxID_PRINT, wxT( "Print" ), wxDefaultPosition, wxDefaultSize, 0 ); |
| 508 bSizerRight->Add( m_buttonPrint, 0, wxALL, 5 ); | 554 bSizerRight->Add( m_buttonPrint, 0, wxALL, 5 ); |
| 509 | 555 |
| 510 m_buttonLogout = new wxButton( this, ID_LOGOUT, wxT( "Logout" ), wxDefaultPosition, wxDefaultSize, 0 ); | 556 // now building... |
| 511 bSizerRight->Add( m_buttonLogout, 0, wxALL, 5 ); | 557 m_slider = new wxSlider( m_panelRight, ID_SLDR, 1, 1, 5, wxDefaultPosition, wxSize( -1, 200 ), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_LABELS|wxSL_VERTICAL ); |
| 558 //bSizerRight->Add( m_slider, 0, wxALL, 5 ); | |
| 559 | |
| 560 m_buttonLogout = new wxButton( m_panelRight, ID_LOGOUT, wxT( "Logout" ), wxDefaultPosition, wxDefaultSize, 0 ); | |
| 561 //bSizerRight->Add( m_buttonLogout, 0, wxALL, 5 ); | |
| 512 | 562 |
| 513 // invisible buttons for shortcut-key | 563 // invisible buttons for shortcut-key |
| 514 m_buttonFocus = new wxButton( this, ID_FOCUS, wxT( "Focus" ), wxDefaultPosition, wxDefaultSize, 0 ); | 564 m_buttonFocus = new wxButton( this, ID_FOCUS, wxT( "Focus" ), wxDefaultPosition, wxDefaultSize, 0 ); |
| 515 m_buttonFocus->Hide(); | 565 m_buttonFocus->Hide(); |
| 516 m_buttonPzoom = new wxButton( this, ID_PZOOM, wxT( "ZOOM" ), wxDefaultPosition, wxDefaultSize, 0 ); | 566 m_buttonPzoom = new wxButton( this, ID_PZOOM, wxT( "ZOOM" ), wxDefaultPosition, wxDefaultSize, 0 ); |
| 519 m_buttonMzoom->Hide(); | 569 m_buttonMzoom->Hide(); |
| 520 m_buttonDark = new wxButton( this, ID_DARK, wxT( "Dark" ), wxDefaultPosition, wxDefaultSize, 0 ); | 570 m_buttonDark = new wxButton( this, ID_DARK, wxT( "Dark" ), wxDefaultPosition, wxDefaultSize, 0 ); |
| 521 m_buttonDark->Hide(); | 571 m_buttonDark->Hide(); |
| 522 m_buttonSatellite = new wxButton( this, ID_SWIN, wxT( "Satellite" ), wxDefaultPosition, wxDefaultSize, 0 ); | 572 m_buttonSatellite = new wxButton( this, ID_SWIN, wxT( "Satellite" ), wxDefaultPosition, wxDefaultSize, 0 ); |
| 523 m_buttonSatellite->Hide(); | 573 m_buttonSatellite->Hide(); |
| 524 m_buttonClose = new wxButton( this, wxID_CLOSE, wxT( "Close" ), wxDefaultPosition, wxDefaultSize, 0 ); | 574 m_buttonClose = new wxButton( this, wxID_CLOSE, wxT( "Close" ), wxDefaultPosition, wxDefaultSize, 0 ); |
| 525 m_buttonClose->Hide(); | 575 m_buttonClose->Hide(); |
| 526 m_buttonHelp = new wxButton( this, wxID_HELP, wxT( "Help" ), wxDefaultPosition, wxDefaultSize, 0 ); | 576 m_buttonHelp = new wxButton( this, wxID_HELP, wxT( "Help" ), wxDefaultPosition, wxDefaultSize, 0 ); |
| 527 m_buttonHelp->Hide(); | 577 m_buttonHelp->Hide(); |
| 528 | 578 |
| 529 bSizerTop->Add( bSizerRight, 0, wxEXPAND, 5 ); | 579 m_panelRight->SetSizer( bSizerRight ); |
| 530 | 580 |
| 581 // | |
| 582 bSizerTop->Add( m_splitter, 1, wxEXPAND, 0 ); | |
| 583 | |
| 531 this->SetSizer( bSizerTop ); | 584 this->SetSizer( bSizerTop ); |
| 532 this->Layout(); | 585 this->Layout(); |
| 533 | 586 |
| 534 //this->Centre( wxBOTH ); | 587 //this->Centre( wxBOTH ); |
| 535 | |
| 536 m_staticBitmap1 = new MyStaticBitmap( m_scrolledWindow1, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); | 588 m_staticBitmap1 = new MyStaticBitmap( m_scrolledWindow1, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); |
| 537 m_staticBitmap2 = new MyStaticBitmap( m_scrolledWindow2, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); | 589 m_staticBitmap2 = new MyStaticBitmap( m_scrolledWindow2, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); |
| 538 m_staticBitmap3 = new MyStaticBitmap( m_scrolledWindow3, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); | 590 m_staticBitmap3 = new MyStaticBitmap( m_scrolledWindow3, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); |
| 539 m_staticBitmap4 = new MyStaticBitmap( m_scrolledWindow4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); | 591 m_staticBitmap4 = new MyStaticBitmap( m_scrolledWindow4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); |
| 540 m_staticBitmap5 = new MyStaticBitmap( m_scrolledWindow5, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); | 592 m_staticBitmap5 = new MyStaticBitmap( m_scrolledWindow5, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); |
| 559 void MainFrame::Cmd( wxString cmd ) | 611 void MainFrame::Cmd( wxString cmd ) |
| 560 { | 612 { |
| 561 m_textCtrlName->SetValue( wxEmptyString ); | 613 m_textCtrlName->SetValue( wxEmptyString ); |
| 562 m_textCtrlAddr->SetValue( wxEmptyString ); | 614 m_textCtrlAddr->SetValue( wxEmptyString ); |
| 563 m_dataViewListCtrl->DeleteAllItems(); | 615 m_dataViewListCtrl->DeleteAllItems(); |
| 616 m_dataViewListKana->DeleteAllItems(); | |
| 564 wxGetApp().RemoveFile( wxT( ".cache/*" ) ); | 617 wxGetApp().RemoveFile( wxT( ".cache/*" ) ); |
| 565 LoadBitmaps( wxEmptyString, false ); | 618 LoadBitmaps( wxEmptyString, false ); |
| 566 | 619 |
| 567 wxRegEx reHhs( wxT( "^0[1238][0-9]{8}$" ) ); | 620 wxRegEx reHhs( wxT( "^0[1238][0-9]{8}$" ) ); |
| 568 | 621 |
| 598 } | 651 } |
| 599 | 652 |
| 600 if ( reHhs.Matches( cmd ) ) { | 653 if ( reHhs.Matches( cmd ) ) { |
| 601 m_hhs = m_searchCtrl->GetValue(); | 654 m_hhs = m_searchCtrl->GetValue(); |
| 602 Search(); | 655 Search(); |
| 656 return; | |
| 657 } | |
| 658 | |
| 659 wxString hiragana = wxT( "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをんがぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽぁぃぅぇぉゃゅょっ " ); | |
| 660 wxString katakana = wxT( "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンガギグゲコザジズゼゾダヂヅデドバビブベボパピプペポァィゥェォャュョッ " ); | |
| 661 wxRegEx reHiraGana( wxT( "^[" ) + hiragana + wxT( "]+$" ) ); | |
| 662 wxRegEx reKataKana( wxT( "^[" ) + katakana + wxT( "]+$" ) ); | |
| 663 | |
| 664 bool fuzzy = false; | |
| 665 if ( cmd.Right( 1 ).IsSameAs( wxT( "%" ) ) ) { | |
| 666 cmd.Replace( wxT( "%" ), wxEmptyString, true ); | |
| 667 fuzzy = true; | |
| 668 } | |
| 669 | |
| 670 if ( reHiraGana.Matches( cmd ) || reKataKana.Matches( cmd ) ) { | |
| 671 if ( cmd.Len() < 5 ) { | |
| 672 wxMessageBox( wxT( "too short !" ) ); | |
| 673 return; | |
| 674 } | |
| 675 if ( reHiraGana.Matches( cmd ) ) { | |
| 676 for ( int i = 0; i < hiragana.Len(); i++ ) | |
| 677 cmd.Replace( hiragana[i], katakana[i], true ); | |
| 678 } | |
| 679 | |
| 680 int match_cnt = 0; | |
| 681 HhsHash::iterator it; | |
| 682 for( it = hhash.begin(); it != hhash.end(); ++it ){ | |
| 683 wxString key = it->first, value = it->second->kana; | |
| 684 value.Replace( wxT( " " ), wxEmptyString, true ); | |
| 685 if ( value.IsSameAs( cmd ) || ( fuzzy && value.StartsWith( cmd ) ) ) { | |
| 686 wxVector<wxVariant> data; | |
| 687 data.push_back( key ); | |
| 688 data.push_back( it->second->name ); | |
| 689 data.push_back( it->second->addr ); | |
| 690 m_dataViewListKana->AppendItem( data ); | |
| 691 data.clear(); | |
| 692 m_dataViewListKana->ToggleWindowStyle( wxHSCROLL ); | |
| 693 match_cnt++; | |
| 694 } | |
| 695 } | |
| 696 | |
| 697 if ( match_cnt == 1 ) { | |
| 698 m_searchCtrl->SetValue( m_dataViewListKana->GetTextValue( 0, 0 ) ); | |
| 699 m_textCtrlName->SetValue( m_dataViewListKana->GetTextValue( 0, 1 ) ); | |
| 700 m_textCtrlAddr->SetValue( m_dataViewListKana->GetTextValue( 0, 2 ) ); | |
| 701 m_hhs = m_searchCtrl->GetValue(); | |
| 702 Search(); | |
| 703 } | |
| 704 | |
| 705 if ( match_cnt == 0 ) { | |
| 706 wxMessageBox( wxT( "No name matched." ) ); | |
| 707 } | |
| 603 return; | 708 return; |
| 604 } | 709 } |
| 605 | 710 |
| 606 wxMessageBox( wxT( "Bad Input !!" ) ); | 711 wxMessageBox( wxT( "Bad Input !!" ) ); |
| 607 } | 712 } |
| 816 m_searchCtrl->SetValue( s ); | 921 m_searchCtrl->SetValue( s ); |
| 817 m_hhs = m_searchCtrl->GetValue(); | 922 m_hhs = m_searchCtrl->GetValue(); |
| 818 Search(); | 923 Search(); |
| 819 return; | 924 return; |
| 820 } | 925 } |
| 821 wxMessageBox( wxT( "Bad Input !!" ) ); | 926 wxMessageBox( wxT( "Bad clipboard data !!" ) ); |
| 822 } | 927 } |
| 823 | 928 |
| 824 void MainFrame::PrintImages( void ) | 929 void MainFrame::PrintImages( void ) |
| 825 { | 930 { |
| 826 int r = m_dataViewListCtrl->GetSelectedRow(); | 931 int r = m_dataViewListCtrl->GetSelectedRow(); |
