comparison src/myframe.cpp @ 34:51e522f34598 v2.4

guess ccndir.
author pyon@macmini
date Sat, 12 Nov 2011 13:18:03 +0900
parents 945864229b5a
children 405e08552527
comparison
equal deleted inserted replaced
33:945864229b5a 34:51e522f34598
1 // Filename : myframe.cpp 1 // Filename : myframe.cpp
2 // Last Change: 07-Nov-2011. 2 // Last Change: 12-Nov-2011.
3 // 3 //
4 4
5 #include "main.h" 5 #include "main.h"
6 #include "myframe.h" 6 #include "myframe.h"
7 #include "param.h" 7 #include "param.h"
463 463
464 wxString hhsno = GuessHhs( ci->fullpath ); 464 wxString hhsno = GuessHhs( ci->fullpath );
465 m_textCtrlGuess->SetValue( hhsno ); 465 m_textCtrlGuess->SetValue( hhsno );
466 wxString name; 466 wxString name;
467 int judge = IsHhsno( hhsno, name ); 467 int judge = IsHhsno( hhsno, name );
468 if ( judge == 0 ) m_textCtrlGuess->SetBackgroundColour(*wxRED); // not hhsno-style 468 if ( judge == 0 ) m_textCtrlGuess->SetBackgroundColour(*wxRED); // not hhsno-style
469 else if ( judge == 1 ) m_textCtrlGuess->SetBackgroundColour(wxT("YELLOW")); // not in DB 469 else if ( judge == 1 ) m_textCtrlGuess->SetBackgroundColour(wxT("YELLOW")); // not in DB
470 m_textCtrlName->SetValue( name ); 470 m_textCtrlName->SetValue( name );
471 471
472 SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),ci->z,ci->l), 1 ); 472 SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),ci->z,ci->l), 1 );
473 m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); 473 m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
477 if ( select ) m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); 477 if ( select ) m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
478 } 478 }
479 479
480 pd.Update( i+1, wxT("画像認識中") ); 480 pd.Update( i+1, wxT("画像認識中") );
481 } 481 }
482 // 画像ファイル数が多ければ,おそらく申請書
483 if ( keys.GetCount() > 32 ) {
484 int n = m_comboBoxCcn->GetCurrentSelection();
485 wxString ccndir, dummy; wxArrayString array;
486 GetCCnArrayInfo( array, n, dummy, ccndir );
487 m_textCtrlGuess->SetValue( ccndir );
488 }
482 489
483 // 選択したものは青い画像を使う 490 // 選択したものは青い画像を使う
484 long i = -1; 491 long i = -1;
485 for ( ;; ) { 492 for ( ;; ) {
486 i = m_listCtrlView->GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); 493 i = m_listCtrlView->GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
493 500
494 /* 画像を選択したとき画像の情報をステータスバーに表示 */ 501 /* 画像を選択したとき画像の情報をステータスバーに表示 */
495 void MyFrame::OnItemSelected(wxListEvent& event) 502 void MyFrame::OnItemSelected(wxListEvent& event)
496 { 503 {
497 int i = event.GetIndex(); 504 int i = event.GetIndex();
498 m_listCtrlView->SetItemImage( i, i+m_listCtrlView->GetItemCount() ); // 青い画像 505 int m = m_listCtrlView->GetSelectedItemCount();
499 506 m_listCtrlView->SetItemImage( i, i+m ); // 青い画像
500 if ( m_listCtrlView->GetSelectedItemCount() != 1 ) return; 507
501 SetStatusText( wxEmptyString, 2 ); 508 if ( m != 1 ) {
509 SetStatusText( wxString::Format(wxT("%d files selected."),m), 2 );
510 return;
511 }
502 512
503 wxString filename = event.GetText(); 513 wxString filename = event.GetText();
504 CacheItem* ci = new CacheItem; 514 CacheItem* ci = new CacheItem;
505 ci = CH[filename]; 515 ci = CH[filename];
506 wxString msg; 516 wxString msg;
509 } 519 }
510 void MyFrame::OnItemDeselected(wxListEvent& event) 520 void MyFrame::OnItemDeselected(wxListEvent& event)
511 { 521 {
512 int i = event.GetIndex(); 522 int i = event.GetIndex();
513 m_listCtrlView->SetItemImage( i, i ); 523 m_listCtrlView->SetItemImage( i, i );
524 SetStatusText( wxString::Format(wxT("%d files selected."),m_listCtrlView->GetSelectedItemCount()), 2 );
514 } 525 }
515 526
516 /* 画像のスクリーン表示*/ 527 /* 画像のスクリーン表示*/
517 void MyFrame::ViewLarge(wxListEvent& event) 528 void MyFrame::ViewLarge(wxListEvent& event)
518 { 529 {
633 644
634 m_listCtrlHhsDir->DeleteAllItems(); 645 m_listCtrlHhsDir->DeleteAllItems();
635 for ( int i=0; i<m_hhsList.GetCount(); i++ ) { 646 for ( int i=0; i<m_hhsList.GetCount(); i++ ) {
636 hhsdir = distdir + wxFILE_SEP_PATH + m_hhsList[i]; 647 hhsdir = distdir + wxFILE_SEP_PATH + m_hhsList[i];
637 wxArrayString filenames; 648 wxArrayString filenames;
638 unsigned int n = wxDir::GetAllFiles( hhsdir, &filenames, wxT("*.jpg"), wxDIR_FILES ); 649 unsigned int n = 0;
650 if ( wxDirExists( hhsdir ) ) n = wxDir::GetAllFiles( hhsdir, &filenames, wxT("*.jpg"), wxDIR_FILES );
639 651
640 m_listCtrlHhsDir->InsertItem( i, -1 ); 652 m_listCtrlHhsDir->InsertItem( i, -1 );
641 buf.Printf(wxT("%d"),i+1); 653 buf.Printf(wxT("%d"),i+1);
642 m_listCtrlHhsDir->SetItem( i, 0, buf, -1 ); 654 m_listCtrlHhsDir->SetItem( i, 0, buf, -1 );
643 m_listCtrlHhsDir->SetItem( i, 1, m_hhsList[i], -1 ); 655 m_listCtrlHhsDir->SetItem( i, 1, m_hhsList[i], -1 );
644 buf.Printf(wxT("%d"),n); 656 buf.Printf(wxT("%d"),n);
645 m_listCtrlHhsDir->SetItem( i, 2, buf, -1 ); 657 m_listCtrlHhsDir->SetItem( i, 2, buf, -1 );
646 m_listCtrlHhsDir->SetItem( i, 3, GetHhsName(m_hhsList[i]), -1 ); 658 m_listCtrlHhsDir->SetItem( i, 3, GetHhsName( m_hhsList[i]), -1 );
647 if ( i % 2 ) m_listCtrlHhsDir->SetItemBackgroundColour( i, wxColour(wxT("WHEAT")) ); 659 if ( i % 2 ) m_listCtrlHhsDir->SetItemBackgroundColour( i, wxColour(wxT("WHEAT")) );
648 } 660 }
649 } 661 }
650 662
651 /* 被保険者フォルダを開く */ 663 /* 被保険者フォルダを開く */