Mercurial > mercurial > hgweb_searcher03.cgi
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 1:7b6dab24f4b8 | 2:c066fde99517 |
|---|---|
| 1 // Filename : kana.cpp | 1 // Filename : kana.cpp |
| 2 // Last Change: 04-Aug-2013. | 2 // Last Change: 22-Aug-2013. |
| 3 // | 3 // |
| 4 | 4 |
| 5 #include "kana.h" | 5 #include "kana.h" |
| 6 #include "db.h" | 6 #include "db.h" |
| 7 | 7 |
| 47 m_listCtrl->InsertColumn( 4, itemCol ); | 47 m_listCtrl->InsertColumn( 4, itemCol ); |
| 48 m_listCtrl->SetColumnWidth( 4, 60 ); | 48 m_listCtrl->SetColumnWidth( 4, 60 ); |
| 49 itemCol.SetText( wxT("住所") ); | 49 itemCol.SetText( wxT("住所") ); |
| 50 m_listCtrl->InsertColumn( 5, itemCol ); | 50 m_listCtrl->InsertColumn( 5, itemCol ); |
| 51 m_listCtrl->SetColumnWidth( 5, 180 ); | 51 m_listCtrl->SetColumnWidth( 5, 180 ); |
| 52 itemCol.SetText( wxT("認定") ); | |
| 53 m_listCtrl->InsertColumn( 6, itemCol ); | |
| 54 m_listCtrl->SetColumnWidth( 6, 40 ); | |
| 52 | 55 |
| 53 bSizerTop->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); | 56 bSizerTop->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); |
| 54 | 57 |
| 55 // | 58 // |
| 56 wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); | 59 wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); |
| 57 | 60 |
| 58 m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxDefaultSize, 0 ); | 61 m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 59 bSizerBtn->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | 62 bSizerBtn->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
| 60 | 63 |
| 61 m_buttonSet = new wxButton( this, ID_SETKANA, wxT("セット"), wxDefaultPosition, wxDefaultSize, 0 ); | 64 m_buttonSet = new wxButton( this, ID_SETKANA, wxT("セット"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 62 bSizerBtn->Add( m_buttonSet, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | 65 bSizerBtn->Add( m_buttonSet, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
| 63 | 66 |
| 64 bSizerTop->Add( bSizerBtn, 0, wxALIGN_RIGHT|wxALL, 5 ); | 67 bSizerTop->Add( bSizerBtn, 0, wxALIGN_RIGHT|wxALL, 5 ); |
| 65 | 68 |
| 66 this->SetSizer( bSizerTop ); | 69 this->SetSizer( bSizerTop ); |
| 67 this->Layout(); | 70 this->Layout(); |
| 68 | 71 |
| 69 this->Centre( wxBOTH ); | 72 this->Centre( wxBOTH ); |
| 70 | 73 |
| 71 m_searchCtrl->SetFocus(); | 74 m_searchCtrl->SetFocus(); |
| 72 m_searchCtrl->SetValue( wxT("全角で入力してネ! (性と名の間は全角スペースで)") ); | 75 m_searchCtrl->SetValue( wxT("全角で入力してネ! (性と名の間は全角スペースで)") ); |
| 73 m_searchCtrl->SelectAll(); | 76 m_searchCtrl->SelectAll(); |
| 74 } | 77 } |
| 94 void KanaDialog::OnFuzzyCheck( wxCommandEvent& WXUNUSED(event) ) | 97 void KanaDialog::OnFuzzyCheck( wxCommandEvent& WXUNUSED(event) ) |
| 95 { | 98 { |
| 96 UpdateList(); | 99 UpdateList(); |
| 97 } | 100 } |
| 98 | 101 |
| 99 void KanaDialog::OnSelectItem( wxListEvent& WXUNUSED(event) ) | 102 void KanaDialog::OnSelectItem( wxListEvent& event ) |
| 100 { | 103 { |
| 101 m_hhsno = wxT("hoge"); | 104 int i = event.GetIndex(); |
| 105 wxListItem item; | |
| 106 item.SetId( i ); | |
| 107 | |
| 108 item.SetColumn( 1 ); | |
| 109 item.SetMask( wxLIST_MASK_TEXT ); | |
| 110 m_listCtrl->GetItem( item ); | |
| 111 m_hhsno = item.GetText(); | |
| 112 | |
| 102 if ( IsModal() ) | 113 if ( IsModal() ) |
| 103 EndModal( wxID_OK ); | 114 EndModal( wxID_OK ); |
| 104 else { | 115 else { |
| 105 SetReturnCode( wxID_OK ); | 116 SetReturnCode( wxID_OK ); |
| 106 Show( false ); | 117 Show( false ); |
| 107 } | 118 } |
| 108 } | 119 } |
| 109 | 120 |
| 110 void KanaDialog::OnSet( wxCommandEvent& WXUNUSED(event) ) | 121 void KanaDialog::OnSet( wxCommandEvent& WXUNUSED(event) ) |
| 111 { | 122 { |
| 112 m_hhsno = wxT("hoge"); | 123 long i = -1; |
| 124 for ( ;; ) { | |
| 125 i = m_listCtrl->GetNextItem( i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); | |
| 126 if ( i == -1 ) break; | |
| 127 | |
| 128 wxListItem item; | |
| 129 item.SetId( i ); | |
| 130 | |
| 131 item.SetColumn( 1 ); | |
| 132 item.SetMask( wxLIST_MASK_TEXT ); | |
| 133 m_listCtrl->GetItem( item ); | |
| 134 m_hhsno = item.GetText(); | |
| 135 } | |
| 136 | |
| 113 if ( IsModal() ) | 137 if ( IsModal() ) |
| 114 EndModal( wxID_OK ); | 138 EndModal( wxID_OK ); |
| 115 else { | 139 else { |
| 116 SetReturnCode( wxID_OK ); | 140 SetReturnCode( wxID_OK ); |
| 117 Show( false ); | 141 Show( false ); |
| 135 return; | 159 return; |
| 136 } | 160 } |
| 137 */ | 161 */ |
| 138 | 162 |
| 139 bool fuzzy = m_checkBox->IsChecked(); | 163 bool fuzzy = m_checkBox->IsChecked(); |
| 140 m_hhs = GetHhsInfoByKana( s, fuzzy ); | 164 wxArrayString hhs = GetHhsInfoByKana( s, fuzzy ); |
| 141 | 165 |
| 142 if ( m_hhs.GetCount() > 200 ) { | 166 if ( hhs.GetCount() > 200 ) { |
| 143 wxMessageBox( wxT("該当件数が 200 件を超えました.\n条件を変えてみてください.") ); | 167 wxMessageBox( wxT("該当件数が 200 件を超えました.\n条件を変えてみてください.") ); |
| 144 return; | 168 return; |
| 145 } | 169 } |
| 146 else if ( m_hhs.IsEmpty() ){ | 170 else if ( hhs.IsEmpty() ){ |
| 147 wxMessageBox( wxT("該当なし.") ); | 171 wxMessageBox( wxT("該当なし.") ); |
| 148 return; | 172 return; |
| 149 } | 173 } |
| 150 | 174 |
| 151 wxString buf; | 175 wxString buf; |
| 152 for ( int i = 0; i < m_hhs.GetCount(); i++ ) { | 176 for ( int i = 0; i < hhs.GetCount(); i++ ) { |
| 153 int col = 0; | 177 int col = 0; |
| 154 m_listCtrl->InsertItem( i, -1 ); | 178 m_listCtrl->InsertItem( i, -1 ); |
| 155 buf.Printf( wxT("%02d"), i + 1 ); | 179 buf.Printf( wxT("%02d"), i + 1 ); |
| 156 m_listCtrl->SetItem( i, col, buf, -1 ); // No | 180 m_listCtrl->SetItem( i, col, buf, -1 ); // No |
| 157 | 181 |
| 158 wxStringTokenizer tkz( m_hhs[i], wxT("_") ); | 182 wxStringTokenizer tkz( hhs[i], wxT("_") ); // hhsno, kana, name, birth, addr |
| 159 while ( tkz.HasMoreTokens() ) { | 183 while ( tkz.HasMoreTokens() ) { |
| 160 col++; | 184 col++; |
| 161 wxString token = tkz.GetNextToken(); | 185 wxString token = tkz.GetNextToken(); |
| 162 m_listCtrl->SetItem( i, col, token, -1 ); | 186 m_listCtrl->SetItem( i, col, token, -1 ); |
| 187 if ( col == 1 ) { // ccn | |
| 188 if ( IsHhsJudged( token ) ) { | |
| 189 m_listCtrl->SetItem( i, 6, wxT("○"), -1 ); | |
| 190 } | |
| 191 } | |
| 163 } | 192 } |
| 164 if ( i % 2 ) m_listCtrl->SetItemBackgroundColour( i, wxColour(wxT("WHEAT")) ); | 193 if ( i % 2 ) m_listCtrl->SetItemBackgroundColour( i, wxColour( wxT("WHEAT") ) ); |
| 165 } | 194 } |
| 166 } | 195 } |
| 167 | 196 |
| 168 |
