Mercurial > mercurial > hgweb_mover2.cgi
comparison src/myframe.cpp @ 3:870860d435a1
auto detect done.
author | pyon@macmini |
---|---|
date | Sun, 16 Oct 2011 00:18:18 +0900 |
parents | e4ba3cc9b4b1 |
children | 964129946db6 |
comparison
equal
deleted
inserted
replaced
2:e4ba3cc9b4b1 | 3:870860d435a1 |
---|---|
1 // Filename : myframe.cpp | 1 // Filename : myframe.cpp |
2 // Last Change: 15-Oct-2011. | 2 // Last Change: 16-Oct-2011. |
3 // | 3 // |
4 | 4 |
5 #include "main.h" | 5 #include "main.h" |
6 #include "myframe.h" | 6 #include "myframe.h" |
7 #include "marksheet.h" | 7 #include "marksheet.h" |
140 | 140 |
141 this->SetSizer( bSizerTop ); | 141 this->SetSizer( bSizerTop ); |
142 this->Layout(); | 142 this->Layout(); |
143 | 143 |
144 // ステータスバー | 144 // ステータスバー |
145 int widths[] = { -1, 150, 200, 120 }; | 145 int widths[] = { 150, 250, -1, 120 }; |
146 m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP ); | 146 m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP ); |
147 m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths ); | 147 m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths ); |
148 m_statusBar->SetStatusText( wxEmptyString, 0 ); | 148 m_statusBar->SetStatusText( wxEmptyString, 0 ); |
149 | 149 |
150 this->Centre( wxBOTH ); | 150 this->Centre( wxBOTH ); |
160 EVT_SIZE( MyFrame::OnWinSize ) | 160 EVT_SIZE( MyFrame::OnWinSize ) |
161 EVT_MOVE( MyFrame::OnWinMove ) | 161 EVT_MOVE( MyFrame::OnWinMove ) |
162 EVT_MENU( ID_MENUITEMPARAM, MyFrame::OnParam ) | 162 EVT_MENU( ID_MENUITEMPARAM, MyFrame::OnParam ) |
163 EVT_MENU( ID_MENUITEMAPPDIR, MyFrame::OnOpenAppDir ) | 163 EVT_MENU( ID_MENUITEMAPPDIR, MyFrame::OnOpenAppDir ) |
164 EVT_MENU( wxID_EXIT, MyFrame::OnQuit ) | 164 EVT_MENU( wxID_EXIT, MyFrame::OnQuit ) |
165 EVT_BUTTON( ID_BUTTONMKDIR, MyFrame::OnMakeDir ) | |
165 EVT_BUTTON( ID_BUTTONDETECT, MyFrame::OnDetect ) | 166 EVT_BUTTON( ID_BUTTONDETECT, MyFrame::OnDetect ) |
166 EVT_BUTTON( ID_BUTTONMOVE, MyFrame::OnMove ) | 167 EVT_BUTTON( ID_BUTTONMOVE, MyFrame::OnMove ) |
167 EVT_BUTTON( ID_BUTTONMD, MyFrame::OnMoveAndDetect ) | 168 EVT_BUTTON( ID_BUTTONMD, MyFrame::OnMoveAndDetect ) |
168 //EVT_BUTTON( ID_BUTTONDEL, MyFrame::Delete ) | 169 //EVT_BUTTON( ID_BUTTONDEL, MyFrame::Delete ) |
169 //EVT_BUTTON( ID_BUTTONUNDO, MyFrame::Undo ) | 170 //EVT_BUTTON( ID_BUTTONUNDO, MyFrame::Undo ) |
170 //EVT_LIST_ITEM_MIDDLE_CLICK( ID_LISTCTRLVIEW, MyFrame::ToggleSelect ) | 171 EVT_LIST_ITEM_SELECTED( ID_LISTCTRLVIEW, MyFrame::GetImageInfo ) |
171 EVT_LIST_ITEM_RIGHT_CLICK( ID_LISTCTRLVIEW, MyFrame::ToggleSelect ) | 172 EVT_LIST_ITEM_ACTIVATED( ID_LISTCTRLVIEW, MyFrame::ViewLarge ) |
172 EVT_LIST_ITEM_ACTIVATED( ID_LISTCTRLVIEW, MyFrame::ViewLarge ) | |
173 EVT_CLOSE( MyFrame::SaveConfig ) | 173 EVT_CLOSE( MyFrame::SaveConfig ) |
174 END_EVENT_TABLE() | 174 END_EVENT_TABLE() |
175 | 175 |
176 // Event Handlers | 176 // Event Handlers |
177 /* 移動先フォルダ作成 */ | 177 /* 移動先フォルダ作成 */ |
178 void MyFrame::MakeDir(wxCommandEvent& WXUNUSED(event)) | 178 void MyFrame::OnMakeDir(wxCommandEvent& WXUNUSED(event)) |
179 { | 179 { |
180 wxString to; | 180 wxString to; |
181 to.Append( m_comboBoxDrive->GetValue() ); | 181 to.Append( m_comboBoxDrive->GetValue() ); |
182 to.Append( wxFILE_SEP_PATH ); | 182 to.Append( wxFILE_SEP_PATH ); |
183 wxDateTime dt = m_datePicker->GetValue(); | 183 wxDateTime dt = m_datePicker->GetValue(); |
237 m_imageList->RemoveAll(); | 237 m_imageList->RemoveAll(); |
238 wxListItem item; | 238 wxListItem item; |
239 wxString first; | 239 wxString first; |
240 float b; long l; | 240 float b; long l; |
241 while ( cout ) { | 241 while ( cout ) { |
242 if ( i > 7 ) break; | |
243 | |
244 wxString imagefile = workdir + wxFILE_SEP_PATH + filename; | 242 wxString imagefile = workdir + wxFILE_SEP_PATH + filename; |
243 | |
244 m_listCtrlView->InsertItem( i, filename ); | |
245 m_listCtrlView->SetItem( i, 0, filename, i ); | |
246 | |
247 wxImage image( imagefile, wxBITMAP_TYPE_JPEG ); | |
248 wxBitmap bmp( image.Scale( 189, 267, wxIMAGE_QUALITY_HIGH ) ); | |
249 m_imageList->Add( bmp ); | |
250 | |
245 if ( i == 0 ) { | 251 if ( i == 0 ) { |
246 IsMarksheet( imagefile, &b, &l ); | 252 IsMarksheet( imagefile, &b, &l ); |
247 first = imagefile; | 253 first = imagefile; |
248 SetStatusText( wxString::Format(wxT("z = %f, l = %d"),b,l), 2 ); | 254 SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),b,l), 1 ); |
249 } | 255 } |
250 if ( i > 1 && IsMarksheet( imagefile, &b, &l ) ) cout = false; | 256 else { |
251 | 257 if ( i > 7 || IsMarksheet( imagefile, &b, &l ) ) { |
252 item.SetId(i); | 258 break; |
253 item.SetMask(wxLIST_MASK_STATE|wxLIST_MASK_TEXT|wxLIST_MASK_IMAGE); | 259 } |
254 item.SetStateMask(wxLIST_STATE_SELECTED); | 260 } |
255 item.SetState(wxLIST_STATE_SELECTED); | 261 m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); |
256 item.SetImage(i); | 262 |
257 item.SetText(filename); | |
258 m_listCtrlView->InsertItem( item ); | |
259 m_listCtrlView->SetItem( item ); | |
260 | |
261 wxImage image( imagefile, wxBITMAP_TYPE_JPEG ); | |
262 wxBitmap bmp( image.Scale( 189, 267, wxIMAGE_QUALITY_HIGH ) ); | |
263 m_imageList->Add( bmp ); | |
264 // write log | 263 // write log |
265 i++; | 264 i++; |
266 cout = dir.GetNext( &filename ); | 265 cout = dir.GetNext( &filename ); |
267 } | 266 } |
268 | 267 |
302 wxRenameFile( from, to, false ); | 301 wxRenameFile( from, to, false ); |
303 */ | 302 */ |
304 } | 303 } |
305 | 304 |
306 /* 画像を選択 */ | 305 /* 画像を選択 */ |
307 void MyFrame::ToggleSelect(wxListEvent& event) | 306 void MyFrame::GetImageInfo(wxListEvent& event) |
308 { | 307 { |
309 SetStatusText( wxEmptyString, 1 ); | 308 SetStatusText( wxEmptyString, 2 ); |
310 int i = event.GetIndex(); | 309 int i = event.GetIndex(); |
311 wxListItem item; | 310 |
312 item.SetId(i); | 311 wxString filename = event.GetText(); |
313 | 312 wxString workdir = m_dirPickerWork->GetPath(); |
314 //item.SetMask(wxLIST_MASK_STATE); | 313 wxString imagefile = workdir + wxFILE_SEP_PATH + filename; |
315 if ( item.GetState() & wxLIST_STATE_SELECTED ) { | 314 float b; long l; |
316 wxMessageBox(wxT("a")); | 315 wxString msg; |
317 item.SetState(~wxLIST_STATE_SELECTED); | 316 if ( IsMarksheet( imagefile, &b, &l ) ) { |
318 } | 317 msg = wxT("Success detection"); |
319 else { | 318 } |
320 item.SetStateMask(wxLIST_STATE_SELECTED); | 319 SetStatusText( wxString::Format(wxT("selected image : z = %f, l = %d ...")+msg, b, l ), 2 ); |
321 wxString filename = event.GetText(); | |
322 wxString workdir = m_dirPickerWork->GetPath(); | |
323 wxString imagefile = workdir + wxFILE_SEP_PATH + filename; | |
324 float b; long l; | |
325 if ( IsMarksheet( imagefile, &b, &l ) ) { | |
326 SetStatusText( wxString::Format(wxT("z = %f, l = %d"),b,l), 1 ); | |
327 } | |
328 } | |
329 m_listCtrlView->SetItem( item ); | |
330 } | 320 } |
331 | 321 |
332 /* 画像のスクリーン表示*/ | 322 /* 画像のスクリーン表示*/ |
333 void MyFrame::ViewLarge(wxListEvent& event) | 323 void MyFrame::ViewLarge(wxListEvent& event) |
334 { | 324 { |