Mercurial > mercurial > hgweb_searcher03.cgi
comparison src/myframe.cpp @ 15:de222bc84e48
Implement Mouse Gesture in Preview Dialog.
author | pyon@macmini |
---|---|
date | Sun, 15 Jun 2014 16:45:52 +0900 |
parents | bbd65edf71d4 |
children | 1ba97995f642 |
comparison
equal
deleted
inserted
replaced
14:ac17a73e39b3 | 15:de222bc84e48 |
---|---|
1 // Filename : myframe.cpp | 1 // Filename : myframe.cpp |
2 // Last Change: 23-May-2014. | 2 // Last Change: 05-Jun-2014. |
3 // | 3 // |
4 #include "main.h" | 4 #include "main.h" |
5 #include "db.h" | 5 #include "db.h" |
6 #include "about.h" | 6 #include "about.h" |
7 #include "kana.h" | 7 #include "kana.h" |
149 | 149 |
150 // Functions | 150 // Functions |
151 /* サムネイル表示 */ | 151 /* サムネイル表示 */ |
152 void ThumbnailPanel::SetCacheImages( wxString dirpath ) | 152 void ThumbnailPanel::SetCacheImages( wxString dirpath ) |
153 { | 153 { |
154 wxBitmap bmp; | |
155 wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png"); | |
156 | |
154 wxDir dir( dirpath ); | 157 wxDir dir( dirpath ); |
155 if ( !dir.IsOpened() ) return; | 158 if ( !dir.IsOpened() ) return; |
156 | 159 |
157 m_imagefiles.Clear(); | 160 m_imagefiles.Clear(); |
158 wxDir::GetAllFiles( dirpath, &m_imagefiles, wxT("*.jpg"), wxDIR_FILES ); | 161 wxDir::GetAllFiles( dirpath, &m_imagefiles, wxT("*.jpg"), wxDIR_FILES ); |
159 | 162 |
163 m_cachefiles.Clear(); | |
160 wxString cachedir = wxT("cache") + dirpath.AfterLast( ':' ); | 164 wxString cachedir = wxT("cache") + dirpath.AfterLast( ':' ); |
161 wxDir cdir( cachedir ); | 165 wxDir cdir( cachedir ); |
162 if ( !cdir.IsOpened() ) return; | 166 if ( !cdir.IsOpened() ) { |
163 | 167 bmp.LoadFile( thumb, wxBITMAP_TYPE_PNG ); |
164 m_cachefiles.Clear(); | 168 m_bitmap0->SetBitmap( bmp ); |
169 m_bitmap1->SetBitmap( bmp ); | |
170 m_bitmap2->SetBitmap( bmp ); | |
171 m_bitmap3->SetBitmap( bmp ); | |
172 m_bitmap4->SetBitmap( bmp ); | |
173 m_bitmap5->SetBitmap( bmp ); | |
174 return; | |
175 } | |
176 | |
165 wxDir::GetAllFiles( cachedir, &m_cachefiles, wxT("*.png"), wxDIR_FILES ); | 177 wxDir::GetAllFiles( cachedir, &m_cachefiles, wxT("*.png"), wxDIR_FILES ); |
166 | 178 |
167 wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png"); | |
168 int n = m_cachefiles.GetCount(); | 179 int n = m_cachefiles.GetCount(); |
169 if ( n < 6 ) { | 180 if ( n < 6 ) { |
170 while ( n < 6 ) { | 181 while ( n < 6 ) { |
171 m_cachefiles.Add( thumb ); | 182 m_cachefiles.Add( thumb ); |
172 n++; | 183 n++; |
173 } | 184 } |
174 } | 185 } |
175 | 186 |
176 wxBitmap bmp; | |
177 bmp.LoadFile( m_cachefiles[0], wxBITMAP_TYPE_PNG ); m_bitmap0->SetBitmap( bmp ); | 187 bmp.LoadFile( m_cachefiles[0], wxBITMAP_TYPE_PNG ); m_bitmap0->SetBitmap( bmp ); |
178 bmp.LoadFile( m_cachefiles[1], wxBITMAP_TYPE_PNG ); m_bitmap1->SetBitmap( bmp ); | 188 bmp.LoadFile( m_cachefiles[1], wxBITMAP_TYPE_PNG ); m_bitmap1->SetBitmap( bmp ); |
179 bmp.LoadFile( m_cachefiles[2], wxBITMAP_TYPE_PNG ); m_bitmap2->SetBitmap( bmp ); | 189 bmp.LoadFile( m_cachefiles[2], wxBITMAP_TYPE_PNG ); m_bitmap2->SetBitmap( bmp ); |
180 bmp.LoadFile( m_cachefiles[3], wxBITMAP_TYPE_PNG ); m_bitmap3->SetBitmap( bmp ); | 190 bmp.LoadFile( m_cachefiles[3], wxBITMAP_TYPE_PNG ); m_bitmap3->SetBitmap( bmp ); |
181 bmp.LoadFile( m_cachefiles[4], wxBITMAP_TYPE_PNG ); m_bitmap4->SetBitmap( bmp ); | 191 bmp.LoadFile( m_cachefiles[4], wxBITMAP_TYPE_PNG ); m_bitmap4->SetBitmap( bmp ); |
311 #endif | 321 #endif |
312 m_searchBox->ShowCancelButton( false ); | 322 m_searchBox->ShowCancelButton( false ); |
313 m_searchBox->SetFocus(); | 323 m_searchBox->SetFocus(); |
314 bSizerCmd->Add( m_searchBox, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); | 324 bSizerCmd->Add( m_searchBox, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); |
315 | 325 |
326 m_buttonPaste = new wxButton( m_panelMain, ID_PASTE, wxT("貼付検索"), wxDefaultPosition, wxSize( 65, -1 ), 0 ); | |
327 bSizerCmd->Add( m_buttonPaste, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 10 ); | |
328 | |
316 m_buttonKana = new wxButton( m_panelMain, ID_KANA, wxT("カナ検索"), wxDefaultPosition, wxSize( 65, -1 ), 0 ); | 329 m_buttonKana = new wxButton( m_panelMain, ID_KANA, wxT("カナ検索"), wxDefaultPosition, wxSize( 65, -1 ), 0 ); |
317 bSizerCmd->Add( m_buttonKana, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 20 ); | 330 bSizerCmd->Add( m_buttonKana, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); |
318 | 331 |
319 m_buttonHist = new wxButton( m_panelMain, ID_HIST, wxT("検索履歴"), wxDefaultPosition, wxSize( 65, -1 ), 0 ); | 332 m_buttonHist = new wxButton( m_panelMain, ID_HIST, wxT("検索履歴"), wxDefaultPosition, wxSize( 65, -1 ), 0 ); |
320 bSizerCmd->Add( m_buttonHist, 0, wxALL, 5 ); | 333 bSizerCmd->Add( m_buttonHist, 0, wxALL, 5 ); |
321 | 334 |
322 // | 335 // |
358 EVT_MENU( ID_MNMASKPARAM, MyFrame::OnMaskParam ) | 371 EVT_MENU( ID_MNMASKPARAM, MyFrame::OnMaskParam ) |
359 EVT_MENU( ID_MNMARKPARAM, MyFrame::OnMarkParam ) | 372 EVT_MENU( ID_MNMARKPARAM, MyFrame::OnMarkParam ) |
360 EVT_MENU( ID_MNAPPDIR, MyFrame::OnOpenAppDir ) | 373 EVT_MENU( ID_MNAPPDIR, MyFrame::OnOpenAppDir ) |
361 EVT_LIST_ITEM_SELECTED( ID_LIST, MyFrame::OnSelectItem ) | 374 EVT_LIST_ITEM_SELECTED( ID_LIST, MyFrame::OnSelectItem ) |
362 EVT_LIST_ITEM_ACTIVATED( ID_LIST, MyFrame::OnDClickItem ) | 375 EVT_LIST_ITEM_ACTIVATED( ID_LIST, MyFrame::OnDClickItem ) |
363 EVT_BUTTON( ID_KANA, MyFrame::OnKana ) | 376 EVT_BUTTON( ID_PASTE, MyFrame::OnPaste ) |
364 EVT_BUTTON( ID_HIST, MyFrame::OnHistory ) | 377 EVT_BUTTON( ID_KANA, MyFrame::OnKana ) |
378 EVT_BUTTON( ID_HIST, MyFrame::OnHistory ) | |
365 EVT_TEXT_ENTER( ID_SEARCH, MyFrame::OnCommand ) | 379 EVT_TEXT_ENTER( ID_SEARCH, MyFrame::OnCommand ) |
366 EVT_SIZE( MyFrame::OnWinSize ) | 380 EVT_SIZE( MyFrame::OnWinSize ) |
367 EVT_MOVE( MyFrame::OnWinMove ) | 381 EVT_MOVE( MyFrame::OnWinMove ) |
368 EVT_CLOSE( MyFrame::SaveConfig ) | 382 EVT_CLOSE( MyFrame::SaveConfig ) |
369 END_EVENT_TABLE() | 383 END_EVENT_TABLE() |
709 wxString dir = item.GetText(); | 723 wxString dir = item.GetText(); |
710 wxString execmd = wxT("explorer ") + dir; | 724 wxString execmd = wxT("explorer ") + dir; |
711 wxExecute( execmd ); | 725 wxExecute( execmd ); |
712 } | 726 } |
713 | 727 |
728 /* 貼付検索 */ | |
729 void MyFrame::OnPaste( wxCommandEvent& WXUNUSED(event) ) | |
730 { | |
731 wxString s; | |
732 if ( wxTheClipboard->Open() ) { | |
733 if ( wxTheClipboard->IsSupported( wxDF_TEXT ) ) { | |
734 wxTextDataObject data; | |
735 wxTheClipboard->GetData( data ); | |
736 s = data.GetText(); | |
737 } | |
738 wxTheClipboard->Close(); | |
739 } | |
740 | |
741 wxRegEx reHhs( wxT("^0[1238][0-9]{8}$") ); | |
742 if ( reHhs.Matches( s ) ) { | |
743 m_hhsno = s; | |
744 UpdateList( m_hhsno ); | |
745 UpdateThumbmail( 0 ); | |
746 return; | |
747 } | |
748 else { | |
749 wxMessageBox( wxT("被保険者番号ではありません.") ); | |
750 } | |
751 } | |
752 | |
714 /* カナ検索ダイアログ */ | 753 /* カナ検索ダイアログ */ |
715 void MyFrame::OnKana( wxCommandEvent& WXUNUSED(event) ) | 754 void MyFrame::OnKana( wxCommandEvent& WXUNUSED(event) ) |
716 { | 755 { |
717 KanaDialog* kana = new KanaDialog( this, wxID_ANY, wxT("カナ氏名で被保番を検索"), wxDefaultPosition, wxSize( 640, 600 ), wxCAPTION|wxFRAME_NO_TASKBAR|wxRESIZE_BORDER|wxSTAY_ON_TOP|wxTAB_TRAVERSAL ); | 756 KanaDialog* kana = new KanaDialog( this, wxID_ANY, wxT("カナ氏名で被保番を検索"), wxDefaultPosition, wxSize( 640, 600 ), wxCAPTION|wxFRAME_NO_TASKBAR|wxRESIZE_BORDER|wxSTAY_ON_TOP|wxTAB_TRAVERSAL ); |
718 kana->ShowWithEffect( wxSHOW_EFFECT_SLIDE_TO_BOTTOM ); | 757 kana->ShowWithEffect( wxSHOW_EFFECT_SLIDE_TO_BOTTOM ); |