Mercurial > mercurial > hgweb_mover2.cgi
diff src/myframe.cpp @ 6:9c85d71cad7c
implement drag&drop.
author | pyon@macmini |
---|---|
date | Tue, 18 Oct 2011 22:43:46 +0900 |
parents | 52697c869ce8 |
children | 550c143ab194 |
line wrap: on
line diff
--- a/src/myframe.cpp Tue Oct 18 07:53:48 2011 +0900 +++ b/src/myframe.cpp Tue Oct 18 22:43:46 2011 +0900 @@ -6,6 +6,7 @@ #include "myframe.h" #include "param.h" #include "marksheet.h" +#include "dndfile.h" // resources // the application icon (under Windows and OS/2 it is in resources and even @@ -131,6 +132,8 @@ bSizerManip->Add( m_listCtrlView, 1, wxALL|wxEXPAND, 5 ); m_imageList = new wxImageList( 160, 226 ); m_listCtrlView->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL ); + //m_listCtrlView->SetDropTarget( new DnDFile(m_dirPickerWork) ); + this->SetDropTarget( new DnDFile(m_dirPickerWork) ); wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL ); @@ -288,10 +291,9 @@ bmp.LoadFile( notfound, wxBITMAP_TYPE_PNG ); m_bitmapHhsno->SetBitmap( bmp ); - wxString filename; - bool cout = dir.GetFirst( &filename, wxT("*.jpg"), wxDIR_FILES ); + wxArrayString filenames; + unsigned int n = dir.GetAllFiles( workdir, &filenames, wxT("*.jpg"), wxDIR_FILES ); - int i = 0; m_listCtrlView->DeleteAllItems(); m_imageList->RemoveAll(); wxListItem item; @@ -299,19 +301,20 @@ wxProgressDialog pd( wxT("進行状況"), wxT("処理開始..."), 7, this, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE ); pd.SetSize( wxSize(320,140) ); float b; long l; - while ( cout ) { - wxString imagefile = workdir + wxFILE_SEP_PATH + filename; + for ( int i=0; i<n; i++ ) { + wxFileName f( filenames[i] ); + wxString filename = f.GetFullName(); m_listCtrlView->InsertItem( i, filename ); m_listCtrlView->SetItem( i, 0, filename, i ); - wxImage image( imagefile, wxBITMAP_TYPE_JPEG ); + wxImage image( filenames[i], wxBITMAP_TYPE_JPEG ); wxBitmap bmp( image.Scale( 160, 226, wxIMAGE_QUALITY_HIGH ) ); m_imageList->Add( bmp ); if ( i == 0 ) { - IsMarksheet( imagefile, &b, &l ); - first = imagefile; + IsMarksheet( filenames[i], &b, &l ); + first = filenames[i]; SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),b,l), 1 ); wxImage marksheet( first, wxBITMAP_TYPE_JPEG ); @@ -329,16 +332,14 @@ m_textCtrlGuess->SetValue( hhsno ); } else { - if ( i > 7 || IsMarksheet( imagefile, &b, &l ) ) { + if ( IsMarksheet( filenames[i], &b, &l ) ) { break; } } m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); // write log - i++; - pd.Update( i, wxT("画像認識中") ); - cout = dir.GetNext( &filename ); + pd.Update( i+1, wxT("画像認識中") ); } SetStatusText( wxEmptyString, 2 ); @@ -386,10 +387,7 @@ { ParamDialog* pd = new ParamDialog( NULL, wxID_ANY, wxT("Setting Parameters") ); if ( pd->ShowModal() == wxID_OK ) { - wxGetApp().lmin; - wxGetApp().lmax; - wxGetApp().zmin; - wxGetApp().zmax; + pd->NewParam( wxGetApp().lmin, wxGetApp().lmax, wxGetApp().zmin, wxGetApp().zmax ); } pd->Destroy(); }