Mercurial > mercurial > hgweb_mover2.cgi
changeset 3:870860d435a1
auto detect done.
author | pyon@macmini |
---|---|
date | Sun, 16 Oct 2011 00:18:18 +0900 |
parents | e4ba3cc9b4b1 |
children | 964129946db6 |
files | include/myframe.h src/myframe.cpp |
diffstat | 2 files changed, 35 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/include/myframe.h Sat Oct 15 22:03:00 2011 +0900 +++ b/include/myframe.h Sun Oct 16 00:18:18 2011 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.h -// Last Change: 15-Oct-2011. +// Last Change: 16-Oct-2011. // #ifndef __myframe__ @@ -50,8 +50,8 @@ ~MyFrame(); void OnParam(wxCommandEvent& event); - void MakeDir(wxCommandEvent& event); - void ToggleSelect(wxListEvent& event); + void OnMakeDir(wxCommandEvent& event); + void GetImageInfo(wxListEvent& event); void ViewLarge(wxListEvent& event); void OnDetect(wxCommandEvent& event); void OnMove(wxCommandEvent& event);
--- a/src/myframe.cpp Sat Oct 15 22:03:00 2011 +0900 +++ b/src/myframe.cpp Sun Oct 16 00:18:18 2011 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.cpp -// Last Change: 15-Oct-2011. +// Last Change: 16-Oct-2011. // #include "main.h" @@ -142,7 +142,7 @@ this->Layout(); // ステータスバー - int widths[] = { -1, 150, 200, 120 }; + int widths[] = { 150, 250, -1, 120 }; m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP ); m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths ); m_statusBar->SetStatusText( wxEmptyString, 0 ); @@ -162,20 +162,20 @@ EVT_MENU( ID_MENUITEMPARAM, MyFrame::OnParam ) EVT_MENU( ID_MENUITEMAPPDIR, MyFrame::OnOpenAppDir ) EVT_MENU( wxID_EXIT, MyFrame::OnQuit ) + EVT_BUTTON( ID_BUTTONMKDIR, MyFrame::OnMakeDir ) EVT_BUTTON( ID_BUTTONDETECT, MyFrame::OnDetect ) EVT_BUTTON( ID_BUTTONMOVE, MyFrame::OnMove ) EVT_BUTTON( ID_BUTTONMD, MyFrame::OnMoveAndDetect ) //EVT_BUTTON( ID_BUTTONDEL, MyFrame::Delete ) //EVT_BUTTON( ID_BUTTONUNDO, MyFrame::Undo ) - //EVT_LIST_ITEM_MIDDLE_CLICK( ID_LISTCTRLVIEW, MyFrame::ToggleSelect ) - EVT_LIST_ITEM_RIGHT_CLICK( ID_LISTCTRLVIEW, MyFrame::ToggleSelect ) - EVT_LIST_ITEM_ACTIVATED( ID_LISTCTRLVIEW, MyFrame::ViewLarge ) + EVT_LIST_ITEM_SELECTED( ID_LISTCTRLVIEW, MyFrame::GetImageInfo ) + EVT_LIST_ITEM_ACTIVATED( ID_LISTCTRLVIEW, MyFrame::ViewLarge ) EVT_CLOSE( MyFrame::SaveConfig ) END_EVENT_TABLE() // Event Handlers /* 移動先フォルダ作成 */ -void MyFrame::MakeDir(wxCommandEvent& WXUNUSED(event)) +void MyFrame::OnMakeDir(wxCommandEvent& WXUNUSED(event)) { wxString to; to.Append( m_comboBoxDrive->GetValue() ); @@ -239,28 +239,27 @@ wxString first; float b; long l; while ( cout ) { - if ( i > 7 ) break; + wxString imagefile = workdir + wxFILE_SEP_PATH + filename; - wxString imagefile = workdir + wxFILE_SEP_PATH + filename; - if ( i == 0 ) { - IsMarksheet( imagefile, &b, &l ); - first = imagefile; - SetStatusText( wxString::Format(wxT("z = %f, l = %d"),b,l), 2 ); - } - if ( i > 1 && IsMarksheet( imagefile, &b, &l ) ) cout = false; - - item.SetId(i); - item.SetMask(wxLIST_MASK_STATE|wxLIST_MASK_TEXT|wxLIST_MASK_IMAGE); - item.SetStateMask(wxLIST_STATE_SELECTED); - item.SetState(wxLIST_STATE_SELECTED); - item.SetImage(i); - item.SetText(filename); - m_listCtrlView->InsertItem( item ); - m_listCtrlView->SetItem( item ); + m_listCtrlView->InsertItem( i, filename ); + m_listCtrlView->SetItem( i, 0, filename, i ); wxImage image( imagefile, wxBITMAP_TYPE_JPEG ); wxBitmap bmp( image.Scale( 189, 267, wxIMAGE_QUALITY_HIGH ) ); m_imageList->Add( bmp ); + + if ( i == 0 ) { + IsMarksheet( imagefile, &b, &l ); + first = imagefile; + SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),b,l), 1 ); + } + else { + if ( i > 7 || IsMarksheet( imagefile, &b, &l ) ) { + break; + } + } + m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); + // write log i++; cout = dir.GetNext( &filename ); @@ -304,29 +303,20 @@ } /* 画像を選択 */ -void MyFrame::ToggleSelect(wxListEvent& event) +void MyFrame::GetImageInfo(wxListEvent& event) { - SetStatusText( wxEmptyString, 1 ); + SetStatusText( wxEmptyString, 2 ); int i = event.GetIndex(); - wxListItem item; - item.SetId(i); - //item.SetMask(wxLIST_MASK_STATE); - if ( item.GetState() & wxLIST_STATE_SELECTED ) { - wxMessageBox(wxT("a")); - item.SetState(~wxLIST_STATE_SELECTED); + wxString filename = event.GetText(); + wxString workdir = m_dirPickerWork->GetPath(); + wxString imagefile = workdir + wxFILE_SEP_PATH + filename; + float b; long l; + wxString msg; + if ( IsMarksheet( imagefile, &b, &l ) ) { + msg = wxT("Success detection"); } - else { - item.SetStateMask(wxLIST_STATE_SELECTED); - wxString filename = event.GetText(); - wxString workdir = m_dirPickerWork->GetPath(); - wxString imagefile = workdir + wxFILE_SEP_PATH + filename; - float b; long l; - if ( IsMarksheet( imagefile, &b, &l ) ) { - SetStatusText( wxString::Format(wxT("z = %f, l = %d"),b,l), 1 ); - } - } - m_listCtrlView->SetItem( item ); + SetStatusText( wxString::Format(wxT("selected image : z = %f, l = %d ...")+msg, b, l ), 2 ); } /* 画像のスクリーン表示*/