diff src/myframe.cpp @ 5:52697c869ce8

delete move&detect button.
author pyon@macmini
date Tue, 18 Oct 2011 07:53:48 +0900
parents 964129946db6
children 9c85d71cad7c
line wrap: on
line diff
--- a/src/myframe.cpp	Sun Oct 16 16:21:33 2011 +0900
+++ b/src/myframe.cpp	Tue Oct 18 07:53:48 2011 +0900
@@ -1,18 +1,26 @@
 // Filename   : myframe.cpp
-// Last Change: 16-Oct-2011.
+// Last Change: 18-Oct-2011.
 //
 
 #include "main.h"
 #include "myframe.h"
+#include "param.h"
 #include "marksheet.h"
 
+// resources
+// the application icon (under Windows and OS/2 it is in resources and even
+// though we could still include the XPM here it would be unused)
+#if !defined(__WXMSW__) && !defined(__WXPM__)
+    #include "sample.xpm"
+#endif
+
 //////////////////////////////////////////////////////////////////////////
 // frame constructor
 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
 {
     this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
     // set the frame icon
-    //SetIcon(wxICON(sample));
+    SetIcon(wxICON(sample));
 	
     // メニューバー
 	m_menubarFile = new wxMenuBar();
@@ -90,7 +98,6 @@
 	m_buttonMkDir = new wxButton( this, ID_BUTTONMKDIR, wxT("適用"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerDist->Add( m_buttonMkDir, 0, wxALL, 5 );
 	
-	
 	bSizerTop->Add( bSizerDist, 0, wxEXPAND, 5 );
 	
 	wxBoxSizer* bSizerManip = new wxBoxSizer( wxHORIZONTAL );
@@ -122,7 +129,7 @@
 	m_listCtrlView = new wxListCtrl( this, ID_LISTCTRLVIEW, wxDefaultPosition, wxDefaultSize, wxLC_ICON );
     m_listCtrlView->SetBackgroundColour(wxT("LIGHT GREY"));
 	bSizerManip->Add( m_listCtrlView, 1, wxALL|wxEXPAND, 5 );
-    m_imageList = new wxImageList( 189, 267 );
+    m_imageList = new wxImageList( 160, 226 );
     m_listCtrlView->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL );
 	
 	wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL );
@@ -132,9 +139,7 @@
 	m_buttonMove = new wxButton( this, ID_BUTTONMOVE, wxT("移動"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerButton->Add( m_buttonMove, 0, wxALL, 5 );
     m_buttonMove->Enable(false);
-	m_buttonMD = new wxButton( this, ID_BUTTONMD, wxT("移動&検知"), wxDefaultPosition, wxDefaultSize, 0 );
-	bSizerButton->Add( m_buttonMD, 0, wxALL, 5 );
-    m_buttonMD->Enable(false);
+
 	m_buttonDel = new wxButton( this, ID_BUTTONDEL, wxT("削除"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerButton->Add( m_buttonDel, 0, wxALL, 5 );
 	m_buttonUndo = new wxButton( this, ID_BUTTONUNDO, wxT("戻す"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -172,7 +177,6 @@
     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::OnDelete )
     EVT_BUTTON( ID_BUTTONUNDO, MyFrame::OnUndo )
     EVT_LIST_ITEM_SELECTED(  ID_LISTCTRLVIEW, MyFrame::GetImageInfo )
@@ -207,32 +211,19 @@
         if ( !wxDirExists( d ) ) wxMkdir( d );
     }
     m_buttonMove->Enable(true);
-    m_buttonMD->Enable(true);
 
     wxMessageBox(wxT("移動先フォルダ準備完了"));
     wxString cmd = wxT("explorer ") + to;
     wxExecute( cmd );
 }
-
-/* 移動 */
-void MyFrame::OnMove(wxCommandEvent& WXUNUSED(event))
-{
-    MoveImage();
-    m_buttonUndo->Enable(true);
-}
 /* 検知 */
 void MyFrame::OnDetect(wxCommandEvent& WXUNUSED(event))
 {
     ReadyImage();
 }
-/* 移動し検知 */
-void MyFrame::OnMoveAndDetect(wxCommandEvent& WXUNUSED(event))
-{
-    MoveImage();
-    ReadyImage();
-}
+
 /* 選択したファイルを移動 */
-void MyFrame::MoveImage()
+void MyFrame::OnMove(wxCommandEvent& WXUNUSED(event))
 {
     m_undo.Clear();
     wxString workdir = m_dirPickerWork->GetPath();
@@ -241,11 +232,14 @@
     for ( ;; ) {
         item = m_listCtrlView->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
         if ( item == -1 ) break;
-        wxString file = m_listCtrlView->GetItemText( item );
+        wxString hhsno = m_textCtrlGuess->GetValue();
+        if ( !wxDirExists( distdir + wxFILE_SEP_PATH + hhsno ) ) wxMkdir( distdir + wxFILE_SEP_PATH + hhsno );
+
+        wxString file  = m_listCtrlView->GetItemText( item );
         wxString from = workdir + wxFILE_SEP_PATH + file;
-        wxString to   = distdir + wxFILE_SEP_PATH + file;
+        wxString to   = distdir + wxFILE_SEP_PATH + hhsno + wxFILE_SEP_PATH + file;
         wxRenameFile( from, to, true );
-        m_undo.Insert( wxT("mv ") + to + wxT(" ") + from, 0 );
+        m_undo.Insert( wxT("move ") + to + wxT(" ") + from, 0 );
     }
     ReadyImage();
     m_buttonUndo->Enable(true);
@@ -264,7 +258,7 @@
         wxString from = workdir + wxFILE_SEP_PATH + file;
         wxString to   = trash   + wxFILE_SEP_PATH + file;
         wxRenameFile( from, to, true );
-        m_undo.Insert( wxT("mv ") + to + wxT(" ") + from, 0 );
+        m_undo.Insert( wxT("move ") + to + wxT(" ") + from, 0 );
     }
     ReadyImage();
     m_buttonUndo->Enable(true);
@@ -312,7 +306,7 @@
         m_listCtrlView->SetItem( i, 0, filename, i );
 
         wxImage image( imagefile, wxBITMAP_TYPE_JPEG );
-        wxBitmap bmp( image.Scale( 189, 267, wxIMAGE_QUALITY_HIGH ) );
+        wxBitmap bmp( image.Scale( 160, 226, wxIMAGE_QUALITY_HIGH ) );
         m_imageList->Add( bmp );
 
         if ( i == 0 ) {
@@ -390,13 +384,21 @@
 /* パラメータダイアログ */
 void MyFrame::OnParam(wxCommandEvent& WXUNUSED(event))
 {
+    ParamDialog* pd = new ParamDialog( NULL, wxID_ANY, wxT("Setting Parameters") );
+    if ( pd->ShowModal() == wxID_OK ) {
+        wxGetApp().lmin;
+        wxGetApp().lmax;
+        wxGetApp().zmin;
+        wxGetApp().zmax;
+    }
+    pd->Destroy();
 }
 
 // 以下,定型もの
 /* アプリフォルダを開く */
 void MyFrame::OnOpenAppDir(wxCommandEvent& WXUNUSED(event))
 {
-    wxString appdir = m_dirPickerWork->GetPath();
+    wxString appdir = wxGetCwd();
     wxString execmd = wxT("explorer ") + appdir;
     wxExecute( execmd );
 }