Mercurial > mercurial > hgweb_mover2.cgi
changeset 5:52697c869ce8
delete move&detect button.
author | pyon@macmini |
---|---|
date | Tue, 18 Oct 2011 07:53:48 +0900 |
parents | 964129946db6 |
children | 9c85d71cad7c |
files | TODO image/sample.xpm include/common.h include/dndfile.h include/main.h include/myframe.h include/param.h include/symbol.h makefile src/main.cpp src/myframe.cpp src/param.cpp |
diffstat | 12 files changed, 152 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TODO Tue Oct 18 07:53:48 2011 +0900 @@ -0,0 +1,3 @@ +* backgound workdir check +* cache detect result +* d&d image
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/image/sample.xpm Tue Oct 18 07:53:48 2011 +0900 @@ -0,0 +1,44 @@ +/* XPM */ +static const char *sample_xpm[] = { +/* columns rows colors chars-per-pixel */ +"32 32 6 1", +" c black", +". c navy", +"X c red", +"o c yellow", +"O c gray100", +"+ c None", +/* pixels */ +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++ ++++++++++", +"++++++++ ............ ++++++++++", +"++++++++ ............ ++++++++++", +"++++++++ .OO......... ++++++++++", +"++++++++ .OO......... ++++++++++", +"++++++++ .OO......... ++++++++++", +"++++++++ .OO...... ", +"++++++++ .OO...... oooooooooooo ", +" .OO...... oooooooooooo ", +" XXXXXXX .OO...... oOOooooooooo ", +" XXXXXXX .OO...... oOOooooooooo ", +" XOOXXXX ......... oOOooooooooo ", +" XOOXXXX ......... oOOooooooooo ", +" XOOXXXX oOOooooooooo ", +" XOOXXXXXXXXX ++++ oOOooooooooo ", +" XOOXXXXXXXXX ++++ oOOooooooooo ", +" XOOXXXXXXXXX ++++ oOOooooooooo ", +" XOOXXXXXXXXX ++++ oooooooooooo ", +" XOOXXXXXXXXX ++++ oooooooooooo ", +" XXXXXXXXXXXX ++++ ", +" XXXXXXXXXXXX ++++++++++++++++++", +" ++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++" +};
--- a/include/common.h Sun Oct 16 16:21:33 2011 +0900 +++ b/include/common.h Tue Oct 18 07:53:48 2011 +0900 @@ -1,5 +1,5 @@ // Filename : common.h -// Last Change: 15-Oct-2011. +// Last Change: 18-Oct-2011. // #ifndef __COMMON__ #define __COMMON__ @@ -50,12 +50,10 @@ ID_BUTTONDETECT, ID_BUTTONMOVE, - ID_BUTTONMD, ID_BUTTONDEL, ID_BUTTONUNDO, // param - ID_BUTTONSAVE, }; #endif // __COMMON__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/dndfile.h Tue Oct 18 07:53:48 2011 +0900 @@ -0,0 +1,23 @@ +#include "wx/wxprec.h" + +#ifndef WX_PRECOMP + #include "wx/wx.h" + #include "wx/arrstr.h" + #include "wx/textctrl.h" + #include "wx/dnd.h" +#endif + +class DnDFile : public wxFileDropTarget +{ + public: + DnDFile( wxTextCtrl *owner ) { m_owner = owner; } + virtual bool OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& finenames ) + { + m_owner->SetValue( finenames[0] ); + return true; + } + + private: + wxTextCtrl *m_owner; +}; +
--- a/include/main.h Sun Oct 16 16:21:33 2011 +0900 +++ b/include/main.h Tue Oct 18 07:53:48 2011 +0900 @@ -1,5 +1,5 @@ // Filename : main.h -// Last Change: 15-Oct-2011. +// Last Change: 17-Oct-2011. // #include "wx/wx.h" #include "wx/config.h" @@ -25,8 +25,8 @@ wxString workdir; wxString lmin; wxString lmax; - wxString bmin; - wxString bmax; + wxString zmin; + wxString zmax; }; DECLARE_APP(MyApp)
--- a/include/myframe.h Sun Oct 16 16:21:33 2011 +0900 +++ b/include/myframe.h Tue Oct 18 07:53:48 2011 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.h -// Last Change: 16-Oct-2011. +// Last Change: 17-Oct-2011. // #ifndef __myframe__ @@ -42,7 +42,7 @@ wxButton* m_buttonDetect; wxButton* m_buttonMove; - wxButton* m_buttonMD; + //wxButton* m_buttonMD; wxButton* m_buttonDel; wxButton* m_buttonUndo; @@ -60,7 +60,7 @@ void OnDelete(wxCommandEvent& event); void OnUndo(wxCommandEvent& event); void ReadyImage(void); - void MoveImage(void); + //void MoveImage(void); // $B0J2<!$Dj7?$b$N(B void OnWinSize(wxSizeEvent& event); void OnWinMove(wxMoveEvent& event);
--- a/include/param.h Sun Oct 16 16:21:33 2011 +0900 +++ b/include/param.h Tue Oct 18 07:53:48 2011 +0900 @@ -1,5 +1,5 @@ // Filename : param.h -// Last Change: 15-Oct-2011. +// Last Change: 17-Oct-2011. // #ifndef __param__ @@ -15,13 +15,13 @@ private: protected: - wxTextCtrl* m_textCtrlLenMIn; + wxTextCtrl* m_textCtrlLMin; wxStaticText* m_staticTextLen; - wxTextCtrl* m_textCtrlLenMax; + wxTextCtrl* m_textCtrlLMax; - wxTextCtrl* m_textCtrlBMin; - wxStaticText* m_staticTextBlack; - wxTextCtrl* m_textCtrlBmax; + wxTextCtrl* m_textCtrlZMin; + wxStaticText* m_staticTextZ; + wxTextCtrl* m_textCtrlZmax; wxStaticText* m_staticTextlDummy; wxButton* m_buttonCancel;
--- a/include/symbol.h Sun Oct 16 16:21:33 2011 +0900 +++ b/include/symbol.h Tue Oct 18 07:53:48 2011 +0900 @@ -1,10 +1,10 @@ // Filename : symbol.h -// Last Change: 15-Oct-2011. +// Last Change: 17-Oct-2011. // #define MYAPPNAME wxT("AMover2") #define VER 2 -#define REV 0 +#define REV 1 #define BLD 20111017
--- a/makefile Sun Oct 16 16:21:33 2011 +0900 +++ b/makefile Tue Oct 18 07:53:48 2011 +0900 @@ -1,6 +1,6 @@ # # Makefile for wxWidgets Application -# Last Change: 15-Oct-2011. +# Last Change: 18-Oct-2011. # by Takayuki Mutoh # @@ -80,7 +80,7 @@ endif # user include -CPPFLAGS = $(WXCPPFLAGS) -I./include -I./img +CPPFLAGS = $(WXCPPFLAGS) -I./include -I./image # user lib LIBS = -static-libgcc -static-libstdc++ $(WXLIBS)
--- a/src/main.cpp Sun Oct 16 16:21:33 2011 +0900 +++ b/src/main.cpp Tue Oct 18 07:53:48 2011 +0900 @@ -1,5 +1,5 @@ // Filename : main.cpp -// Last Change: 16-Oct-2011. +// Last Change: 18-Oct-2011. // #include "common.h" @@ -33,7 +33,7 @@ MyFrame *mainframe = new MyFrame( NULL, ID_MAIN, title ); mainframe->SetSize( rect ); - mainframe->SetMinSize( wxSize( 1200, 500 ) ); + mainframe->SetMinSize( wxSize( 1200, 400 ) ); mainframe->Show(true); /* TestFrame *tf = new TestFrame( NULL, ID_TEST, wxT("A Test") ); @@ -57,8 +57,8 @@ config->SetPath( wxT("/Param") ); config->Write( wxT("lmin"), lmin ); config->Write( wxT("lmax"), lmax ); - config->Write( wxT("bmin"), bmin ); - config->Write( wxT("bmax"), bmax ); + config->Write( wxT("zmin"), zmin ); + config->Write( wxT("zmax"), zmax ); delete config; @@ -80,9 +80,9 @@ config->Read( wxT("workdir"), &workdir ); config->SetPath( wxT("/Param") ); - config->Read( wxT("lmin"), lmin ); - config->Read( wxT("lmax"), lmax ); - config->Read( wxT("bmin"), bmin ); - config->Read( wxT("bmax"), bmax ); + config->Read( wxT("lmin"), &lmin ); + config->Read( wxT("lmax"), &lmax ); + config->Read( wxT("zmin"), &zmin ); + config->Read( wxT("zmax"), &zmax ); }
--- 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 ); }
--- a/src/param.cpp Sun Oct 16 16:21:33 2011 +0900 +++ b/src/param.cpp Tue Oct 18 07:53:48 2011 +0900 @@ -1,5 +1,5 @@ // Filename : param.cpp -// Last Change: 15-Oct-2011. +// Last Change: 18-Oct-2011. // #include "main.h" @@ -11,35 +11,34 @@ this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL ); - wxGridSizer* gSizer = new wxGridSizer( 2, 3, 0, 0 ); - m_textCtrlLenMIn = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - gSizer->Add( m_textCtrlLenMIn, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALIGN_RIGHT|wxALIGN_TOP, 20 ); + m_textCtrlLMin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_textCtrlLMin, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxLeft, 20 ); - m_staticTextLen = new wxStaticText( this, wxID_ANY, wxT("< レングス <"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLen = new wxStaticText( this, wxID_ANY, wxT("< レングス(l) <"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer->Add( m_staticTextLen, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_textCtrlLenMax = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - gSizer->Add( m_textCtrlLenMax, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_textCtrlLMax = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_textCtrlLMax, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT, 20 ); - m_textCtrlBMin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - gSizer->Add( m_textCtrlBMin, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + m_textCtrlZMin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_textCtrlZMin, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT, 20 ); - m_staticTextBlack = new wxStaticText( this, wxID_ANY, wxT("< 黒色比率 <"), wxDefaultPosition, wxDefaultSize, 0 ); - gSizer->Add( m_staticTextBlack, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + m_staticTextZ = new wxStaticText( this, wxID_ANY, wxT("< 黒色比率(z) <"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_staticTextZ, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - m_textCtrlBmax = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - gSizer->Add( m_textCtrlBmax, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_textCtrlZmax = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_textCtrlZmax, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 ); m_staticTextlDummy = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - gSizer->Add( m_staticTextlDummy, 0, wxALL, 5 ); + gSizer->Add( m_staticTextlDummy, 0, wxALL, 5 ); // dummy m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxDefaultSize, 0 ); - gSizer->Add( m_buttonCancel, 0, wxALL, 5 ); + gSizer->Add( m_buttonCancel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 10 ); - m_buttonSave = new wxButton( this, ID_BUTTONSAVE, wxT("設定保存"), wxDefaultPosition, wxDefaultSize, 0 ); - gSizer->Add( m_buttonSave, 0, wxALIGN_BOTTOM|wxALIGN_TOP, 10 ); + m_buttonSave = new wxButton( this, wxID_OK, wxT("設定保存"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_buttonSave, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 10 ); bSizer->Add( gSizer, 0, 0, 20 ); @@ -58,15 +57,20 @@ } // Event Table BEGIN_EVENT_TABLE( ParamDialog, wxDialog ) - EVT_BUTTON( ID_BUTTONSAVE, ParamDialog::SaveParam ) END_EVENT_TABLE() /* 現在の設定を読込み */ void ParamDialog::GetParam(void) { -} -/* 設定を保存 */ -void ParamDialog::SaveParam(wxCommandEvent& WXUNUSED(event)) -{ + float zmin = 0.095713; + float zmax = 0.108600; + + float lmin = 2072393; + float lmax = 2346082; + + m_textCtrlLMin->SetValue( wxGetApp().lmin ); + m_textCtrlLMax->SetValue( wxGetApp().lmax ); + //m_textCtrlZMin->SetValue( wxString::Format(wxT("%l"),wxGetApp().zmin) ); + //m_textCtrlZmax->SetValue( wxString::Format(wxT("%l"),wxGetApp().zmax) ); }