diff src/myframe.cpp @ 24:5c99c6fa50df v2.2dev v2.2

fix changing selected image color
author pyon@macmini
date Wed, 02 Nov 2011 20:47:18 +0900
parents a2dd16b70c08
children 5a934c8e1b95
line wrap: on
line diff
--- a/src/myframe.cpp	Tue Nov 01 22:26:41 2011 +0900
+++ b/src/myframe.cpp	Wed Nov 02 20:47:18 2011 +0900
@@ -1,5 +1,5 @@
 // Filename   : myframe.cpp
-// Last Change: 01-Nov-2011.
+// Last Change: 02-Nov-2011.
 //
 
 #include "main.h"
@@ -177,7 +177,7 @@
 	this->Layout();
 
     // ステータスバー
-    int widths[] = { 150, 250, -1, 120 };
+    int widths[] = { 250, 250, -1, 120 };
     m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP );
     m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths );
     m_statusBar->SetStatusText( wxEmptyString, 0 );
@@ -340,6 +340,7 @@
     m_listCtrlView->DeleteAllItems();
     m_imageList->RemoveAll();
     wxListItem item;
+    m_textCtrlGuess->SetBackgroundColour(*wxWHITE);
 
     wxProgressDialog pd( wxT("進行状況"), wxT("処理開始..."), 7, this, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
     pd.SetSize( wxSize(320,140) );
@@ -383,6 +384,10 @@
 
             wxString hhsno = GuessHhs( ci->fullpath );
             m_textCtrlGuess->SetValue( hhsno );
+            wxString name;
+            int judge = IsHhsno( hhsno, name );
+	        if (      judge == 0 )  m_textCtrlGuess->SetBackgroundColour(*wxRED);       // not hhsno-style
+            //else if ( judge == 1 )  m_textCtrlGuess->SetBackgroundColour(wxT("YELLOW"));    // not in DB
             SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),ci->z,ci->l), 1 );
             m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
         }
@@ -460,9 +465,17 @@
 /* キャッシュ作成&更新 */
 void MyFrame::UpdateCache()
 {
+    double zmin, zmax; long lmin, lmax;
+    wxGetApp().zmin.ToDouble( &zmin );
+    wxGetApp().zmax.ToDouble( &zmax );
+    wxGetApp().lmin.ToLong( &lmin );
+    wxGetApp().lmax.ToLong( &lmax );
+
     m_buttonDetect->Enable(false);
     wxGetApp().WriteLog( wxT("start updating cache") );
     SetStatusText( wxT("rebuiling cache..."), 0 );
+    wxStopWatch sw;
+    sw.Start(0);
 
     /* キャッシュ存在フラグOFF */
     for ( CacheHash::iterator it=CH.begin(); it != CH.end(); ++it ) {
@@ -493,12 +506,13 @@
             continue;
         }
         /* 新しいファイルはキャッシュ */
-        float z; long l; bool m = IsMarksheet( fullpath, &z, &l );
+        //float z; long l; bool m = IsMarksheet( fullpath, &z, &l );
+        float z; long l; bool m = IsMarksheet( fullpath, &z, &l, zmin, zmax, lmin, lmax );
         wxImage image( fullpath, wxBITMAP_TYPE_JPEG );
         wxImage thumbnail = image.Scale( 160, 226, wxIMAGE_QUALITY_HIGH );
         wxBitmap bmp( thumbnail );
         unsigned char *data = thumbnail.GetData();
-        for ( int y=0; y<226; y++ ) for ( int x=0; x<160; x++ ) data[(y*226+x)*3+2] = 255;  // 文字色:黒(0,0,0)->青(0,0.255)
+        for ( int y=0; y<226; y++ ) for ( int x=0; x<160; x++ ) data[(y*160+x)*3+2] = 255;  // 文字色:黒(0,0,0)->青(0,0.255)
         wxBitmap bmp_mask( thumbnail );
 
         ci->filename     = file;
@@ -512,6 +526,7 @@
         ci->modtime      = wxEmptyString; // TODO.
 
         CH[ci->filename] = ci;  // add hash
+        SetStatusText( wxString::Format( wxT("rebuiling cache...(%.1fsec passed)"), (float)sw.Time()/1000 ), 0 );
         wxGetApp().WriteLog( file + wxT(" appended.") + wxString::Format(wxT(" ( m=%d z=%f l=%d )"), m ? 1 : 0, z, l ) );
     }