# HG changeset patch # User pyon@macmini # Date 1320234438 -32400 # Node ID 5c99c6fa50dffdfca1bf2eb5535c89e76c3301d1 # Parent a2dd16b70c08f4c6025965901a5e227989edb836 fix changing selected image color diff -r a2dd16b70c08 -r 5c99c6fa50df TODO --- a/TODO Tue Nov 01 22:26:41 2011 +0900 +++ b/TODO Wed Nov 02 20:47:18 2011 +0900 @@ -2,14 +2,17 @@ TODO ====================================================================== * d&d image +* auto cache rebuild off + * ccn folder make -* error check hhsno + * hhs explore & file count * hhs name from db -* auto cache rebuild off + +* error check hhsno * color red if guess hhsno failed + * help -* building cache time * F5 detect * F7 move diff -r a2dd16b70c08 -r 5c99c6fa50df include/common.h --- a/include/common.h Tue Nov 01 22:26:41 2011 +0900 +++ b/include/common.h Wed Nov 02 20:47:18 2011 +0900 @@ -1,5 +1,5 @@ // Filename : common.h -// Last Change: 26-Oct-2011. +// Last Change: 02-Nov-2011. // #ifndef __COMMON__ #define __COMMON__ @@ -33,6 +33,8 @@ #include #include #include + #include + #include "wx/regex.h" #endif enum { diff -r a2dd16b70c08 -r 5c99c6fa50df include/marksheet.h --- a/include/marksheet.h Tue Nov 01 22:26:41 2011 +0900 +++ b/include/marksheet.h Wed Nov 02 20:47:18 2011 +0900 @@ -1,5 +1,5 @@ // Filename : marksheet.h -// Last Change: 21-Oct-2011. +// Last Change: 02-Nov-2011. // #ifndef __marksheet__ #define __marksheet__ @@ -56,7 +56,7 @@ return hhs; }; -bool IsMarksheet( wxString& file, float* brate, long* len ) +bool IsMarksheet( wxString& file, float* brate, long* len, double zmin, double zmax, long lmin, long lmax ) { wxImage img( file, wxBITMAP_TYPE_JPEG ); int black = 0; @@ -71,13 +71,9 @@ if( IsBlack( (int)r, (int)g, (int)b ) ) black++; } float z = (float)black / h; - float zmin = 0.095713; - float zmax = 0.108600; wxFile f( file ); long l = f.Length(); - float lmin = 2072393; - float lmax = 2346082; *brate = z; *len = l; @@ -89,5 +85,51 @@ return false; }; +bool _IsMarksheet( wxString& file, float* brate, long* len ) +{ + wxImage img( file, wxBITMAP_TYPE_JPEG ); + int black = 0; + int x = 2465; + int h = 3500; + unsigned char r, g, b; + + for ( int y=0; yLayout(); // ステータスバー - 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 ) ); }