comparison src/myframe.cpp @ 9:dfa5cae8c992

small fix
author pyon@macmini
date Thu, 20 Oct 2011 07:44:56 +0900
parents 550c143ab194
children 1fda3a06c39b
comparison
equal deleted inserted replaced
8:550c143ab194 9:dfa5cae8c992
1 // Filename : myframe.cpp 1 // Filename : myframe.cpp
2 // Last Change: 19-Oct-2011. 2 // Last Change: 20-Oct-2011.
3 // 3 //
4 4
5 #include "main.h" 5 #include "main.h"
6 #include "myframe.h" 6 #include "myframe.h"
7 #include "param.h" 7 #include "param.h"
8 #include "marksheet.h"
9 #include "dndfile.h" 8 #include "dndfile.h"
9 #include "myutils.h"
10 10
11 // resources 11 // resources
12 // the application icon (under Windows and OS/2 it is in resources and even 12 // the application icon (under Windows and OS/2 it is in resources and even
13 // though we could still include the XPM here it would be unused) 13 // though we could still include the XPM here it would be unused)
14 #if !defined(__WXMSW__) && !defined(__WXPM__) 14 #if !defined(__WXMSW__) && !defined(__WXPM__)
15 #include "sample.xpm" 15 #include "sample.xpm"
16 #endif 16 #endif
17
18 WX_DECLARE_HASH_MAP( wxString, Cache*, wxStringHash, wxStringEqual, CacheHash );
17 19
18 ////////////////////////////////////////////////////////////////////////// 20 //////////////////////////////////////////////////////////////////////////
19 // frame constructor 21 // frame constructor
20 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) 22 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
21 { 23 {
164 m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP ); 166 m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP );
165 m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths ); 167 m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths );
166 m_statusBar->SetStatusText( wxEmptyString, 0 ); 168 m_statusBar->SetStatusText( wxEmptyString, 0 );
167 169
168 this->Centre( wxBOTH ); 170 this->Centre( wxBOTH );
171
172 CacheHash cache;
169 } 173 }
170 174
171 // destructor 175 // destructor
172 MyFrame::~MyFrame() 176 MyFrame::~MyFrame()
173 { 177 {
312 m_imageList->RemoveAll(); 316 m_imageList->RemoveAll();
313 wxListItem item; 317 wxListItem item;
314 wxString first; 318 wxString first;
315 wxProgressDialog pd( wxT("進行状況"), wxT("処理開始..."), 7, this, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE ); 319 wxProgressDialog pd( wxT("進行状況"), wxT("処理開始..."), 7, this, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
316 pd.SetSize( wxSize(320,140) ); 320 pd.SetSize( wxSize(320,140) );
317 float b; long l; 321 float z; long l;
318 for ( int i=0; i<n; i++ ) { 322 for ( int i=0; i<n; i++ ) {
319 wxFileName f( filenames[i] ); 323 wxFileName f( filenames[i] );
320 wxString filename = f.GetFullName(); 324 wxString filename = f.GetFullName();
321 325
322 m_listCtrlView->InsertItem( i, filename ); 326 m_listCtrlView->InsertItem( i, filename );
325 wxImage image( filenames[i], wxBITMAP_TYPE_JPEG ); 329 wxImage image( filenames[i], wxBITMAP_TYPE_JPEG );
326 wxBitmap bmp( image.Scale( 160, 226, wxIMAGE_QUALITY_HIGH ) ); 330 wxBitmap bmp( image.Scale( 160, 226, wxIMAGE_QUALITY_HIGH ) );
327 m_imageList->Add( bmp ); 331 m_imageList->Add( bmp );
328 332
329 if ( i == 0 ) { 333 if ( i == 0 ) {
330 IsMarksheet( filenames[i], &b, &l ); 334 IsMarksheet( filenames[i], &z, &l );
331 first = filenames[i]; 335 first = filenames[i];
332 SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),b,l), 1 ); 336 SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),z,l), 1 );
333 337
334 wxImage marksheet( first, wxBITMAP_TYPE_JPEG ); 338 wxImage marksheet( first, wxBITMAP_TYPE_JPEG );
335 wxImage name_image; 339 wxImage name_image;
336 name_image = marksheet.GetSubImage( wxRect( wxPoint(300,550), wxSize(640,190) ) ); 340 name_image = marksheet.GetSubImage( wxRect( wxPoint(300,550), wxSize(640,190) ) );
337 wxBitmap name_bmp = ( name_image.Scale( 320, 95, wxIMAGE_QUALITY_HIGH ) ); 341 wxBitmap name_bmp = ( name_image.Scale( 320, 95, wxIMAGE_QUALITY_HIGH ) );
344 348
345 wxString hhsno = GuessHhs( first ); 349 wxString hhsno = GuessHhs( first );
346 m_textCtrlGuess->SetValue( hhsno ); 350 m_textCtrlGuess->SetValue( hhsno );
347 } 351 }
348 else { 352 else {
349 if ( IsMarksheet( filenames[i], &b, &l ) ) { 353 if ( IsMarksheet( filenames[i], &z, &l ) ) {
350 break; 354 break;
351 } 355 }
352 } 356 }
353 m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); 357 m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
354 358