diff src/myframe.cpp @ 21:a2ad87cad48b

Enhanced the convenience of Cache dialog.
author pyon@macmini
date Wed, 17 Dec 2014 00:52:43 +0900
parents 226774bf49fc
children 92188f60323d
line wrap: on
line diff
--- a/src/myframe.cpp	Mon Dec 08 19:47:42 2014 +0900
+++ b/src/myframe.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : myframe.cpp
-// Last Change: 08-Dec-2014.
+// Last Change: 16-Dec-2014.
 //
 #include "main.h"
 #include "db.h"
@@ -21,6 +21,14 @@
 MySearchBox::MySearchBox( wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style )
     : wxSearchCtrl( parent, id, value, pos, size, style )
 {
+    SetMaxLength( 10 );
+	#ifndef __WXMAC__
+	ShowSearchButton( true );
+	#endif
+	ShowCancelButton( false );
+
+    wxFont font( 12, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD );
+    SetFont( font );
 }
  
 MySearchBox::~MySearchBox()
@@ -149,6 +157,19 @@
 }
 
 // Functions
+/* 初期化 */
+void ThumbnailPanel::Initialize( void )
+{
+    wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png");
+    wxBitmap bmp = wxBitmap( thumb, wxBITMAP_TYPE_PNG );
+	
+    m_bitmap0->SetBitmap( bmp );
+    m_bitmap1->SetBitmap( bmp );
+    m_bitmap2->SetBitmap( bmp );
+    m_bitmap3->SetBitmap( bmp );
+    m_bitmap4->SetBitmap( bmp );
+    m_bitmap5->SetBitmap( bmp );
+}
 /* サムネイル表示 */
 void ThumbnailPanel::SetCacheImages( wxString dirpath )
 {
@@ -156,7 +177,10 @@
     wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png");
 
     wxDir dir( dirpath );
-    if ( !dir.IsOpened() ) return;
+    if ( !dir.IsOpened() ) {
+        Initialize();
+        return;
+    }
 
     m_imagefiles.Clear();
     wxDir::GetAllFiles( dirpath, &m_imagefiles, wxT("*.jpg"), wxDIR_FILES );
@@ -165,13 +189,7 @@
     wxString cachedir = wxT("cache") + dirpath.AfterLast( ':' );
     wxDir cdir( cachedir );
     if ( !cdir.IsOpened() ) {
-        bmp.LoadFile( thumb, wxBITMAP_TYPE_PNG );
-        m_bitmap0->SetBitmap( bmp );
-        m_bitmap1->SetBitmap( bmp );
-        m_bitmap2->SetBitmap( bmp );
-        m_bitmap3->SetBitmap( bmp );
-        m_bitmap4->SetBitmap( bmp );
-        m_bitmap5->SetBitmap( bmp );
+        Initialize();
         return;
     }
 
@@ -315,14 +333,10 @@
 	m_staticText = new wxStaticText( m_panelMain, wxID_ANY, wxT("コマンド?"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerCmd->Add( m_staticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	m_searchBox = new MySearchBox( m_panelMain, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
+	m_searchBox = new MySearchBox( m_panelMain, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxSize( -1, 24 ), wxTE_PROCESS_ENTER );
     m_searchBox->SetJudgedHhs( GetJudgedHhsNo() );
-	#ifndef __WXMAC__
-	m_searchBox->ShowSearchButton( true );
-	#endif
-	m_searchBox->ShowCancelButton( false );
     m_searchBox->SetFocus();
-	bSizerCmd->Add( m_searchBox, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
+	bSizerCmd->Add( m_searchBox, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
 	
 	m_buttonPaste = new wxButton( m_panelMain, ID_PASTE, wxT("貼付検索"), wxDefaultPosition, wxSize( 65, -1 ), 0 );
 	bSizerCmd->Add( m_buttonPaste, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 10 );
@@ -331,7 +345,7 @@
 	bSizerCmd->Add( m_buttonKana, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
 	
 	m_buttonHist = new wxButton( m_panelMain, ID_HIST, wxT("検索履歴"), wxDefaultPosition, wxSize( 65, -1 ), 0 );
-	bSizerCmd->Add( m_buttonHist, 0, wxALL, 5 );
+	bSizerCmd->Add( m_buttonHist, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
     //
 	bSizerMain->Add( bSizerCmd, 0, wxEXPAND, 5 );
@@ -596,6 +610,7 @@
 
     CacheDialog* cache = new CacheDialog( this, wxID_ANY, wxT("キャッシュ作成"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxSTAY_ON_TOP );
     cache->Setting( rootdir, THUMB_W, THUMB_H );
+    cache->Listup();
     cache->ShowModal();
 }
 /* 被保険者DB更新 */
@@ -763,7 +778,7 @@
 /* カナ検索ダイアログ */
 void MyFrame::OnKana( wxCommandEvent& WXUNUSED(event) )
 {
-    KanaDialog* kana = new KanaDialog( this, wxID_ANY, wxT("カナ氏名で被保番を検索"), wxDefaultPosition, wxSize( 640, 600 ), wxCAPTION|wxFRAME_NO_TASKBAR|wxRESIZE_BORDER|wxSTAY_ON_TOP|wxTAB_TRAVERSAL );
+    KanaDialog* kana = new KanaDialog( this, wxID_ANY, wxT("カナ氏名で被保番を検索"), wxDefaultPosition, wxSize( 680, 600 ), wxCAPTION|wxFRAME_NO_TASKBAR|wxRESIZE_BORDER|wxSTAY_ON_TOP|wxTAB_TRAVERSAL );
     kana->ShowWithEffect( wxSHOW_EFFECT_SLIDE_TO_BOTTOM );
 
     if ( kana->ShowModal() == wxID_OK ) {
@@ -815,13 +830,13 @@
         return;
     }
 
-    wxRegEx reDate(wxT("(^.*20[0-9]{2}.)(20[0-9]{2})([0-2][0-9])([0-9]{2})(.*$)"));
+    wxRegEx reDate( wxT("(^.*20[0-9]{2}.)(20[0-9]{2})([0-1][0-9])([0-3][0-9])(.*$)") );
     for ( int i = 0; i < path.GetCount(); i++ ) {
         wxString date = path[i];
         reDate.ReplaceAll( &date, wxT("\\2-\\3-\\4") );
 
         m_listCtrl->InsertItem( i, -1 );
-        m_listCtrl->SetItem( i, 0,wxString::Format( wxT("%d"), i + 1 ) , -1 ); // No
+        m_listCtrl->SetItem( i, 0, wxString::Format( wxT("%d"), i + 1 ) , -1 ); // No
         m_listCtrl->SetItem( i, 1, date, -1 );
         m_listCtrl->SetItem( i, 2, path[i], -1 );
 
@@ -908,7 +923,7 @@
 /* アバウトダイアログ */
 void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
 {
-    AboutDialog* aboutDlg = new AboutDialog( this, wxID_ANY, wxT("About this Software"), wxDefaultPosition, wxSize(320,280), wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP ); 
+    AboutDialog* aboutDlg = new AboutDialog( this, wxID_ANY, wxT("About this Software"), wxDefaultPosition, wxSize( 360, 280 ), wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP ); 
     aboutDlg->ShowModal();
 }