Mercurial > mercurial > hgweb_searcher03.cgi
diff src/kana.cpp @ 2:c066fde99517
Added Batch Print Mode.
author | pyon@macmini |
---|---|
date | Fri, 23 Aug 2013 18:32:09 +0900 |
parents | 7b6dab24f4b8 |
children | a2ad87cad48b |
line wrap: on
line diff
--- a/src/kana.cpp Sun Aug 04 21:42:49 2013 +0900 +++ b/src/kana.cpp Fri Aug 23 18:32:09 2013 +0900 @@ -1,5 +1,5 @@ // Filename : kana.cpp -// Last Change: 04-Aug-2013. +// Last Change: 22-Aug-2013. // #include "kana.h" @@ -49,24 +49,27 @@ itemCol.SetText( wxT("住所") ); m_listCtrl->InsertColumn( 5, itemCol ); m_listCtrl->SetColumnWidth( 5, 180 ); + itemCol.SetText( wxT("認定") ); + m_listCtrl->InsertColumn( 6, itemCol ); + m_listCtrl->SetColumnWidth( 6, 40 ); - bSizerTop->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); + bSizerTop->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); // - wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerBtn->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonSet = new wxButton( this, ID_SETKANA, wxT("セット"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerBtn->Add( m_buttonSet, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizerTop->Add( bSizerBtn, 0, wxALIGN_RIGHT|wxALL, 5 ); - - this->SetSizer( bSizerTop ); - this->Layout(); - - this->Centre( wxBOTH ); + wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerBtn->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonSet = new wxButton( this, ID_SETKANA, wxT("セット"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerBtn->Add( m_buttonSet, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerTop->Add( bSizerBtn, 0, wxALIGN_RIGHT|wxALL, 5 ); + + this->SetSizer( bSizerTop ); + this->Layout(); + + this->Centre( wxBOTH ); m_searchCtrl->SetFocus(); m_searchCtrl->SetValue( wxT("全角で入力してネ! (性と名の間は全角スペースで)") ); @@ -96,9 +99,17 @@ UpdateList(); } -void KanaDialog::OnSelectItem( wxListEvent& WXUNUSED(event) ) +void KanaDialog::OnSelectItem( wxListEvent& event ) { - m_hhsno = wxT("hoge"); + int i = event.GetIndex(); + wxListItem item; + item.SetId( i ); + + item.SetColumn( 1 ); + item.SetMask( wxLIST_MASK_TEXT ); + m_listCtrl->GetItem( item ); + m_hhsno = item.GetText(); + if ( IsModal() ) EndModal( wxID_OK ); else { @@ -109,7 +120,20 @@ void KanaDialog::OnSet( wxCommandEvent& WXUNUSED(event) ) { - m_hhsno = wxT("hoge"); + long i = -1; + for ( ;; ) { + i = m_listCtrl->GetNextItem( i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); + if ( i == -1 ) break; + + wxListItem item; + item.SetId( i ); + + item.SetColumn( 1 ); + item.SetMask( wxLIST_MASK_TEXT ); + m_listCtrl->GetItem( item ); + m_hhsno = item.GetText(); + } + if ( IsModal() ) EndModal( wxID_OK ); else { @@ -137,32 +161,36 @@ */ bool fuzzy = m_checkBox->IsChecked(); - m_hhs = GetHhsInfoByKana( s, fuzzy ); + wxArrayString hhs = GetHhsInfoByKana( s, fuzzy ); - if ( m_hhs.GetCount() > 200 ) { + if ( hhs.GetCount() > 200 ) { wxMessageBox( wxT("該当件数が 200 件を超えました.\n条件を変えてみてください.") ); return; } - else if ( m_hhs.IsEmpty() ){ + else if ( hhs.IsEmpty() ){ wxMessageBox( wxT("該当なし.") ); return; } wxString buf; - for ( int i = 0; i < m_hhs.GetCount(); i++ ) { + for ( int i = 0; i < hhs.GetCount(); i++ ) { int col = 0; m_listCtrl->InsertItem( i, -1 ); buf.Printf( wxT("%02d"), i + 1 ); m_listCtrl->SetItem( i, col, buf, -1 ); // No - wxStringTokenizer tkz( m_hhs[i], wxT("_") ); + wxStringTokenizer tkz( hhs[i], wxT("_") ); // hhsno, kana, name, birth, addr while ( tkz.HasMoreTokens() ) { col++; wxString token = tkz.GetNextToken(); m_listCtrl->SetItem( i, col, token, -1 ); + if ( col == 1 ) { // ccn + if ( IsHhsJudged( token ) ) { + m_listCtrl->SetItem( i, 6, wxT("○"), -1 ); + } + } } - if ( i % 2 ) m_listCtrl->SetItemBackgroundColour( i, wxColour(wxT("WHEAT")) ); + if ( i % 2 ) m_listCtrl->SetItemBackgroundColour( i, wxColour( wxT("WHEAT") ) ); } } -