changeset 34:51e522f34598 v2.4

guess ccndir.
author pyon@macmini
date Sat, 12 Nov 2011 13:18:03 +0900
parents 945864229b5a
children 405e08552527
files include/main.h src/myframe.cpp
diffstat 2 files changed, 22 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/include/main.h	Mon Nov 07 21:02:04 2011 +0900
+++ b/include/main.h	Sat Nov 12 13:18:03 2011 +0900
@@ -1,5 +1,5 @@
 // Filename   : main.h
-// Last Change: 06-Nov-2011.
+// Last Change: 12-Nov-2011.
 //
 #include "wx/wx.h"
 #include "wx/config.h"
@@ -8,8 +8,8 @@
 #define MYAPPNAME wxT("AMover2")
 
 #define VER 2
-#define REV 4
-#define BLD 20111107
+#define REV 5
+#define BLD 20111114
 
 // private classes
 // Define a new application type, each program should derive a class from wxApp
--- a/src/myframe.cpp	Mon Nov 07 21:02:04 2011 +0900
+++ b/src/myframe.cpp	Sat Nov 12 13:18:03 2011 +0900
@@ -1,5 +1,5 @@
 // Filename   : myframe.cpp
-// Last Change: 07-Nov-2011.
+// Last Change: 12-Nov-2011.
 //
 
 #include "main.h"
@@ -465,7 +465,7 @@
             m_textCtrlGuess->SetValue( hhsno );
             wxString name;
             int judge = IsHhsno( hhsno, name );
-	        if (      judge == 0 )  m_textCtrlGuess->SetBackgroundColour(*wxRED);       // not hhsno-style
+	        if (      judge == 0 )  m_textCtrlGuess->SetBackgroundColour(*wxRED);           // not hhsno-style
             else if ( judge == 1 )  m_textCtrlGuess->SetBackgroundColour(wxT("YELLOW"));    // not in DB
             m_textCtrlName->SetValue( name );
 
@@ -479,6 +479,13 @@
 
         pd.Update( i+1, wxT("画像認識中") );
     }
+    // 画像ファイル数が多ければ,おそらく申請書
+    if ( keys.GetCount() > 32 ) {
+        int n = m_comboBoxCcn->GetCurrentSelection();
+        wxString ccndir, dummy; wxArrayString array;
+        GetCCnArrayInfo( array, n, dummy, ccndir );
+        m_textCtrlGuess->SetValue( ccndir );
+    }
 
     // 選択したものは青い画像を使う
     long i = -1;
@@ -495,10 +502,13 @@
 void MyFrame::OnItemSelected(wxListEvent& event)
 {
     int i = event.GetIndex();
-    m_listCtrlView->SetItemImage( i, i+m_listCtrlView->GetItemCount() );    // 青い画像
+    int m = m_listCtrlView->GetSelectedItemCount();
+    m_listCtrlView->SetItemImage( i, i+m );    // 青い画像
 
-    if ( m_listCtrlView->GetSelectedItemCount() != 1 ) return;
-    SetStatusText( wxEmptyString, 2 );
+    if ( m != 1 ) {
+        SetStatusText( wxString::Format(wxT("%d files selected."),m), 2 );
+        return;
+    }
 
     wxString filename = event.GetText();
     CacheItem* ci = new CacheItem;
@@ -511,6 +521,7 @@
 {
     int i = event.GetIndex();
     m_listCtrlView->SetItemImage( i, i );
+    SetStatusText( wxString::Format(wxT("%d files selected."),m_listCtrlView->GetSelectedItemCount()), 2 );
 }
 
 /* 画像のスクリーン表示*/
@@ -635,7 +646,8 @@
     for ( int i=0; i<m_hhsList.GetCount(); i++ ) {
         hhsdir = distdir + wxFILE_SEP_PATH + m_hhsList[i];
         wxArrayString filenames;
-        unsigned int n = wxDir::GetAllFiles( hhsdir, &filenames, wxT("*.jpg"), wxDIR_FILES );
+        unsigned int n = 0;
+        if ( wxDirExists( hhsdir ) ) n = wxDir::GetAllFiles( hhsdir, &filenames, wxT("*.jpg"), wxDIR_FILES );
 
         m_listCtrlHhsDir->InsertItem( i, -1 );
         buf.Printf(wxT("%d"),i+1);
@@ -643,7 +655,7 @@
         m_listCtrlHhsDir->SetItem( i, 1, m_hhsList[i], -1 );
         buf.Printf(wxT("%d"),n);
         m_listCtrlHhsDir->SetItem( i, 2, buf, -1 );
-        m_listCtrlHhsDir->SetItem( i, 3, GetHhsName(m_hhsList[i]), -1 );
+        m_listCtrlHhsDir->SetItem( i, 3, GetHhsName( m_hhsList[i]), -1 );
         if ( i % 2 ) m_listCtrlHhsDir->SetItemBackgroundColour( i, wxColour(wxT("WHEAT")) );
     }
 }