Mercurial > mercurial > hgweb_dw.cgi
changeset 3:eea479fc2a28 default tip
redesign form.
author | pyon@macmini |
---|---|
date | Sun, 25 Nov 2012 12:59:11 +0900 |
parents | deaf3f2d54b2 |
children | |
files | Changes include/common.h include/myframe.h src/myframe.cpp |
diffstat | 4 files changed, 240 insertions(+), 156 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Thu Nov 08 20:17:12 2012 +0900 +++ b/Changes Sun Nov 25 12:59:11 2012 +0900 @@ -1,3 +1,13 @@ +version 0.4 +2012-11-26 + Beta4 Release. +---- + +version 0.3 +2012-11-08 + Beta3 Release. +---- + version 0.2 2012-10-31 Beta2 Release.
--- a/include/common.h Thu Nov 08 20:17:12 2012 +0900 +++ b/include/common.h Sun Nov 25 12:59:11 2012 +0900 @@ -1,5 +1,5 @@ // Filename : common.h -// Last Change: 12-Oct-2012. +// Last Change: 25-Nov-2012. // #ifndef __COMMON_H__ #define __COMMON_H__ @@ -36,6 +36,8 @@ #include <wx/config.h> #include <wx/fileconf.h> #include <wx/filepicker.h> +#include <wx/srchctrl.h> +#include <wx/gbsizer.h> #include <wx/window.h> #endif
--- a/include/myframe.h Thu Nov 08 20:17:12 2012 +0900 +++ b/include/myframe.h Sun Nov 25 12:59:11 2012 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.h -// Last Change: 20-Oct-2012. +// Last Change: 25-Nov-2012. // #ifndef __MYFRAME_H__ #define __MYFRAME_H__ @@ -10,66 +10,66 @@ { DECLARE_EVENT_TABLE() private: + wxFileSystemWatcher* m_watcher; protected: - wxMenuBar* m_menubar; - wxMenu* m_menuFile; + wxMenuBar* m_menubar; + wxMenu* m_menuFile; + + wxSearchCtrl* m_searchCtrlFile; + wxDirPickerCtrl* m_dirPickerWatchDir; + wxListCtrl* m_listCtrlWatchDir; + wxChoice* m_choiceMove; + wxStaticText* m_staticText0; + wxChoice* m_choiceSuffix; + wxDirPickerCtrl* m_dirPickerMoveTo; + wxListCtrl* m_listCtrlMove; - wxStaticText* m_staticText1; - wxDirPickerCtrl* m_dirPickerWatch; - wxStaticText* m_staticText2; - wxTextCtrl* m_textCtrlFile; - wxStaticText* m_staticText3; - wxTextCtrl* m_textCtrlCommand; - wxStaticText* m_staticText4; - wxTextCtrl* m_textCtrlWait; - wxStaticText* m_staticText5; - wxDirPickerCtrl* m_dirPickerMove; - wxStaticText* m_staticText6; - wxCheckBox* m_checkBoxCopy; - wxStaticText* m_staticText7; - wxComboBox* m_comboSuffix; - wxStaticText* m_staticTextDummy1; - wxStaticText* m_staticTextDummy2; - wxStaticText* m_staticTextDummy3; - wxStaticText* m_staticText8; - wxCheckBox* m_checkBoxExit; - wxToggleButton* m_toggleBtn; + wxStaticText* m_staticTextCmd0; + wxTextCtrl* m_textCtrlCmd0; + wxChoice* m_choiceCmd0; + wxStaticText* m_staticTextCmd1; + wxTextCtrl* m_textCtrlCmd1; + wxChoice* m_choiceCmd1; + wxStaticText* m_staticTextCmd2; + wxTextCtrl* m_textCtrlCmd2; + wxChoice* m_choiceCmd2; - wxFileSystemWatcher* m_watcher; + wxChoice* m_choiceFound; + wxTextCtrl* m_textCtrlWait; + wxStaticText* m_staticText1; + wxChoice* m_choiceNotFound; + wxToggleButton* m_toggleBtn; + public: - MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ); + + MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ); ~MyFrame(); - + void OnFileSystemEvent( wxFileSystemWatcherEvent& event ); void OnWatch( wxCommandEvent& WXUNUSED(event) ); + void OnSetup( wxCommandEvent& WXUNUSED(event) ); + void OnSaveParams( wxCommandEvent& WXUNUSED(event) ); void OnWinSize( wxSizeEvent& event ); void OnWinMove( wxMoveEvent& WXUNUSED(event) ); void TellLocation( void ); void OnQuit( wxCommandEvent& WXUNUSED(event) ); void OnAbout( wxCommandEvent& WXUNUSED(event) ); - void OnSetup( wxCommandEvent& WXUNUSED(event) ); - void OnSaveParams( wxCommandEvent& WXUNUSED(event) ); void SaveConfig( wxCloseEvent& WXUNUSED(event) ); }; -enum { +enum +{ ID_MNAPPDIR = wxID_HIGHEST + 10, ID_MNSETUP, ID_MNSAVE, ID_MNABOUT, - ID_WATCHDIR, - ID_FILENAME, - ID_COMMAND, - ID_WAIT, - ID_MOVEDIR, - ID_COPY, - ID_SUFFIX, - ID_EXIT, - ID_TOGGLEWATCH, + ID_TGLWATCH, }; + #endif //__MYFRAME_H__ +
--- a/src/myframe.cpp Thu Nov 08 20:17:12 2012 +0900 +++ b/src/myframe.cpp Sun Nov 25 12:59:11 2012 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.cpp -// Last Change: 20-Oct-2012. +// Last Change: 25-Nov-2012. // #include "main.h" @@ -11,123 +11,183 @@ #include "sample.xpm" #endif -MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) +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->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); // set the frame icon SetIcon(wxICON(sample)); - - // メニューバー Menu - m_menubar = new wxMenuBar(); + + // Menubar here + m_menubar = new wxMenuBar( 0 ); m_menuFile = new wxMenu(); - wxMenuItem* m_menuItemSetup = new wxMenuItem( m_menuFile, ID_MNSETUP, wxString( wxT("&Setup...") ) , wxT("Setup parameters"), wxITEM_NORMAL ); + wxMenuItem* m_menuItemSetup = new wxMenuItem( m_menuFile, ID_MNSETUP, wxString( wxT("Setup") ) , wxEmptyString, wxITEM_NORMAL ); m_menuFile->Append( m_menuItemSetup ); - - wxMenuItem* m_menuItemSave = new wxMenuItem( m_menuFile, ID_MNSAVE, wxString( wxT("Save setting...") ) , wxT("Save parameters"), wxITEM_NORMAL ); + + wxMenuItem* m_menuItemSave = new wxMenuItem( m_menuFile, ID_MNSAVE, wxString( wxT("Save") ) , wxEmptyString, wxITEM_NORMAL ); m_menuFile->Append( m_menuItemSave ); - + wxMenuItem* m_menuItemAbout = new wxMenuItem( m_menuFile, ID_MNABOUT, wxString( wxT("&About...\tF1") ) , wxT("Show about dialog"), wxITEM_NORMAL ); m_menuFile->Append( m_menuItemAbout ); - m_menubar->Append( m_menuFile, wxT("File(&F)") ); + m_menubar->Append( m_menuFile, wxT("File") ); this->SetMenuBar( m_menubar ); - // - wxFlexGridSizer* fgSizer = new wxFlexGridSizer( 0, 4, 0, 0 ); - fgSizer->SetFlexibleDirection( wxBOTH ); - fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + // Controls here + wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL ); + + wxGridBagSizer* gbSizerWatchDir = new wxGridBagSizer( 0, 0 ); + gbSizerWatchDir->SetFlexibleDirection( wxBOTH ); + gbSizerWatchDir->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("Folder"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + m_searchCtrlFile = new wxSearchCtrl( this, wxID_ANY, wxT("Input Filename"), wxDefaultPosition, wxDefaultSize, 0 ); + #ifndef __WXMAC__ + m_searchCtrlFile->ShowSearchButton( true ); + #endif + m_searchCtrlFile->ShowCancelButton( false ); + gbSizerWatchDir->Add( m_searchCtrlFile, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 ); - m_dirPickerWatch = new wxDirPickerCtrl( this, ID_WATCHDIR, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE ); - fgSizer->Add( m_dirPickerWatch, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_dirPickerWatchDir = new wxDirPickerCtrl( this, wxID_ANY, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE ); + gbSizerWatchDir->Add( m_dirPickerWatchDir, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 ); + + m_listCtrlWatchDir = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT ); + gbSizerWatchDir->Add( m_listCtrlWatchDir, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxALL, 5 ); - m_staticText2 = new wxStaticText( this, wxID_ANY, wxT("Filename"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticText2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + bSizerTop->Add( gbSizerWatchDir, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizerFound = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("If Find File") ), wxVERTICAL ); - m_textCtrlFile = new wxTextCtrl( this, ID_FILENAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_textCtrlFile, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + wxStaticBoxSizer* sbSizerMove = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Move/Copy") ), wxVERTICAL ); + + wxBoxSizer* bSizerMove = new wxBoxSizer( wxHORIZONTAL ); - m_staticText3 = new wxStaticText( this, wxID_ANY, wxT("Command"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticText3, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + wxString m_choiceMoveChoices[] = { wxT("Nop"), wxT("Move"), wxT("Copy") }; + int m_choiceMoveNChoices = sizeof( m_choiceMoveChoices ) / sizeof( wxString ); + m_choiceMove = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceMoveNChoices, m_choiceMoveChoices, 0 ); + m_choiceMove->SetSelection( 0 ); + bSizerMove->Add( m_choiceMove, 0, wxALL, 5 ); + + m_staticText0 = new wxStaticText( this, wxID_ANY, wxT("Suffix"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerMove->Add( m_staticText0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - m_textCtrlCommand = new wxTextCtrl( this, ID_COMMAND, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_textCtrlCommand, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + wxString m_choiceSuffixChoices[] = { wxT("NoChange"), wxT("Date & Time"), wxT("Date"), wxT("Time") }; + int m_choiceSuffixNChoices = sizeof( m_choiceSuffixChoices ) / sizeof( wxString ); + m_choiceSuffix = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceSuffixNChoices, m_choiceSuffixChoices, 0 ); + m_choiceSuffix->SetSelection( 0 ); + bSizerMove->Add( m_choiceSuffix, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerMoveTo = new wxDirPickerCtrl( this, wxID_ANY, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE ); + bSizerMove->Add( m_dirPickerMoveTo, 0, wxALL|wxEXPAND, 5 ); - m_staticText4 = new wxStaticText( this, wxID_ANY, wxT("wait [sec]"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticText4, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - m_textCtrlWait = new wxTextCtrl( this, ID_WAIT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_textCtrlWait, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_staticText5 = new wxStaticText( this, wxID_ANY, wxT("MoveTo"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticText5, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + sbSizerMove->Add( bSizerMove, 1, wxEXPAND, 5 ); + + m_listCtrlMove = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT ); + sbSizerMove->Add( m_listCtrlMove, 0, wxALL|wxEXPAND, 5 ); + + sbSizerFound->Add( sbSizerMove, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizerCmd = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Command") ), wxVERTICAL ); - m_dirPickerMove = new wxDirPickerCtrl( this, ID_MOVEDIR, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE ); - fgSizer->Add( m_dirPickerMove, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + wxFlexGridSizer* fgSizerCmd = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizerCmd->SetFlexibleDirection( wxBOTH ); + fgSizerCmd->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextCmd0 = new wxStaticText( this, wxID_ANY, wxT("Command 0"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerCmd->Add( m_staticTextCmd0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlCmd0 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerCmd->Add( m_textCtrlCmd0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - m_staticText6 = new wxStaticText( this, wxID_ANY, wxT("copy"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticText6, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - m_checkBoxCopy = new wxCheckBox( this, ID_COPY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_checkBoxCopy, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticText7 = new wxStaticText( this, wxID_ANY, wxT("suffix"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticText7, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - wxArrayString suffix; - suffix.Add( wxT("Date & Time") ); - m_comboSuffix = new wxComboBox( this, ID_SUFFIX, wxEmptyString, wxDefaultPosition, wxDefaultSize, suffix, 0 ); - fgSizer->Add( m_comboSuffix, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextDummy1 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticTextDummy1, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + wxString m_choiceCmd0Choices[] = { wxT("After"), wxT("Before") }; + int m_choiceCmd0NChoices = sizeof( m_choiceCmd0Choices ) / sizeof( wxString ); + m_choiceCmd0 = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceCmd0NChoices, m_choiceCmd0Choices, 0 ); + m_choiceCmd0->SetSelection( 0 ); + fgSizerCmd->Add( m_choiceCmd0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextCmd1 = new wxStaticText( this, wxID_ANY, wxT("Command 1"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerCmd->Add( m_staticTextCmd1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlCmd1 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerCmd->Add( m_textCtrlCmd1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_choiceCmd1Choices[] = { wxT("After"), wxT("Before") }; + int m_choiceCmd1NChoices = sizeof( m_choiceCmd1Choices ) / sizeof( wxString ); + m_choiceCmd1 = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceCmd1NChoices, m_choiceCmd1Choices, 0 ); + m_choiceCmd1->SetSelection( 0 ); + fgSizerCmd->Add( m_choiceCmd1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextCmd2 = new wxStaticText( this, wxID_ANY, wxT("Command 2"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerCmd->Add( m_staticTextCmd2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlCmd2 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerCmd->Add( m_textCtrlCmd2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_choiceCmd2Choices[] = { wxT("After"), wxT("Before") }; + int m_choiceCmd2NChoices = sizeof( m_choiceCmd2Choices ) / sizeof( wxString ); + m_choiceCmd2 = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceCmd2NChoices, m_choiceCmd2Choices, 0 ); + m_choiceCmd2->SetSelection( 0 ); + fgSizerCmd->Add( m_choiceCmd2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizerCmd->Add( fgSizerCmd, 1, wxEXPAND, 5 ); + + sbSizerFound->Add( sbSizerCmd, 0, wxEXPAND, 5 ); + + wxString m_choiceFoundChoices[] = { wxT("Continue"), wxT("Stop Watching"), wxT("Exit Program") }; + int m_choiceFoundNChoices = sizeof( m_choiceFoundChoices ) / sizeof( wxString ); + m_choiceFound = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceFoundNChoices, m_choiceFoundChoices, 0 ); + m_choiceFound->SetSelection( 0 ); + sbSizerFound->Add( m_choiceFound, 0, wxALL|wxALIGN_RIGHT, 5 ); + + bSizerTop->Add( sbSizerFound, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizerNotFound = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Else") ), wxHORIZONTAL ); + + m_textCtrlWait = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerNotFound->Add( m_textCtrlWait, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("[sec] after"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerNotFound->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_choiceNotFoundChoices[] = { wxT("Stop Watching"), wxT("Exit Program") }; + int m_choiceNotFoundNChoices = sizeof( m_choiceNotFoundChoices ) / sizeof( wxString ); + m_choiceNotFound = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceNotFoundNChoices, m_choiceNotFoundChoices, 0 ); + m_choiceNotFound->SetSelection( 0 ); + sbSizerNotFound->Add( m_choiceNotFound, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerTop->Add( sbSizerNotFound, 0, wxEXPAND, 5 ); + + m_toggleBtn = new wxToggleButton( this, ID_TGLWATCH, wxT("Start Watching"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtn->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + bSizerTop->Add( m_toggleBtn, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + this->SetSizer( bSizerTop ); + this->Layout(); - m_staticTextDummy2 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticTextDummy2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - m_staticText8 = new wxStaticText( this, wxID_ANY, wxT("Exit"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticText8, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - m_checkBoxExit = new wxCheckBox( this, ID_EXIT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_checkBoxExit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextDummy3 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_staticTextDummy3, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - m_toggleBtn = new wxToggleButton( this, ID_TOGGLEWATCH, wxT("Start Watching"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer->Add( m_toggleBtn, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - this->SetSizer( fgSizer ); - this->Layout(); - this->Centre( wxBOTH ); } MyFrame::~MyFrame() { - delete m_watcher; } // Event Table BEGIN_EVENT_TABLE( MyFrame, wxFrame ) - EVT_SIZE( MyFrame::OnWinSize ) - EVT_MOVE( MyFrame::OnWinMove ) EVT_MENU( ID_MNSETUP, MyFrame::OnSetup ) EVT_MENU( ID_MNSAVE, MyFrame::OnSaveParams ) EVT_MENU( ID_MNABOUT, MyFrame::OnAbout ) - //EVT_MENU( wxID_EXIT, MyFrame::OnQuit ) - EVT_TOGGLEBUTTON( ID_TOGGLEWATCH, MyFrame::OnWatch ) +// EVT_MENU( wxID_EXIT, MyFrame::OnQuit ) + EVT_TOGGLEBUTTON( ID_TGLWATCH, MyFrame::OnWatch ) + EVT_SIZE( MyFrame::OnWinSize ) + EVT_MOVE( MyFrame::OnWinMove ) EVT_CLOSE( MyFrame::SaveConfig ) END_EVENT_TABLE() // Event Handlers & Functions -/* フォルダ監視開始/停止スイッチ */ +/* $B%U%)%k%@4F;k3+;O(B/$BDd;_%9%$%C%A(B */ void MyFrame::OnWatch( wxCommandEvent& WXUNUSED(event) ) { Connect( wxEVT_FSWATCHER, wxFileSystemWatcherEventHandler( MyFrame::OnFileSystemEvent ) ); @@ -140,7 +200,7 @@ m_watcher = new wxFileSystemWatcher(); m_watcher->SetOwner( this ); - m_watcher->Add( m_dirPickerWatch->GetPath(), wxFSW_EVENT_CREATE ); + m_watcher->Add( m_dirPickerWatchDir->GetPath(), wxFSW_EVENT_CREATE ); } else { m_toggleBtn->SetLabelText( wxT("Start Watching") ); @@ -148,15 +208,17 @@ } } -/* フォルダ監視 */ +/* $B%U%)%k%@4F;k(B */ void MyFrame::OnFileSystemEvent( wxFileSystemWatcherEvent& event ) { wxMilliSleep( 1500 ); - wxString watchdir = m_dirPickerWatch->GetPath(); - wxString filename = m_textCtrlFile->GetValue(); - wxString command = m_textCtrlCommand->GetValue(); - wxString movedir = m_dirPickerMove->GetPath(); + wxString watchdir = m_dirPickerWatchDir->GetPath(); + wxString filename = m_searchCtrlFile->GetValue(); + wxString command0 = m_textCtrlCmd0->GetValue(); + wxString command1 = m_textCtrlCmd1->GetValue(); + wxString command2 = m_textCtrlCmd2->GetValue(); + wxString movedir = m_dirPickerMoveTo->GetPath(); wxString from; wxString to; @@ -166,6 +228,7 @@ bool cont = dir.GetFirst( &file, filename, wxDIR_FILES ); while ( cont ) { + /* if ( !command.IsEmpty() ) { wxExecute( command ); wxSleep( 2 ); @@ -175,7 +238,7 @@ from = watchdir + wxFILE_SEP_PATH + filename; wxFileName f( from ); - // ファイル名をどうするか + // $B%U%!%$%kL>$r$I$&$9$k$+(B if ( m_comboSuffix->GetCurrentSelection() == 0 ) { wxDateTime now = wxDateTime::Now(); to = movedir + wxFILE_SEP_PATH + f.GetName() + wxT("_") + now.Format(wxT("%Y%m%d%H%M%S")) + wxT(".") + f.GetExt(); @@ -184,7 +247,7 @@ to = movedir + wxFILE_SEP_PATH + filename; } - // オリジナルを残すか + // $B%*%j%8%J%k$r;D$9$+(B if ( m_checkBoxCopy->IsChecked() ) wxCopyFile( from, to, false ); else @@ -192,11 +255,12 @@ } cont = dir.GetNext( &file ); + */ } - if ( m_checkBoxExit->IsChecked() ) Close( true ); + //if ( m_checkBoxExit->IsChecked() ) Close( true ); } -/* セットアップ */ +/* $B%;%C%H%"%C%W(B */ void MyFrame::OnSetup( wxCommandEvent& WXUNUSED(event) ) { wxString dws_dir = wxGetCwd() + wxFILE_SEP_PATH + wxT("dws"); @@ -205,31 +269,36 @@ wxFileConfig* config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), fd.GetPath(), wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); - wxString p_folder, p_filename, p_command, p_wait, p_moveto; - bool p_copy, p_exit; - long p_suffix; + wxString p_watchdir, p_filename, p_moveto, p_command0, p_command1, p_command2, p_wait; + long p_move, p_suffix, p_found, p_notfound; config->SetPath( wxT("/Parameter") ); - config->Read( wxT("Folder"), &p_folder ); config->Read( wxT("Filename"), &p_filename ); - config->Read( wxT("Command"), &p_command ); - config->Read( wxT("Wait"), &p_wait ); - config->Read( wxT("MoveTo"), &p_moveto ); - config->Read( wxT("Copy"), p_copy ); + config->Read( wxT("Watchdir"), &p_watchdir ); + config->Read( wxT("Move"), &p_move ); config->Read( wxT("Suffix"), &p_suffix ); - config->Read( wxT("Exit"), p_exit ); + config->Read( wxT("MoveTo"), &p_moveto ); + config->Read( wxT("Command0"), &p_command0 ); + config->Read( wxT("Command1"), &p_command1 ); + config->Read( wxT("Command2"), &p_command2 ); + config->Read( wxT("Found"), &p_found ); + config->Read( wxT("Wait"), &p_wait ); + config->Read( wxT("Notfound"), &p_notfound ); - m_dirPickerWatch->SetPath( p_folder ); - m_textCtrlFile->SetValue( p_filename ); - m_textCtrlCommand->SetValue( p_command ); + m_dirPickerWatchDir->SetPath( p_watchdir ); + m_searchCtrlFile->SetValue( p_filename ); + m_choiceMove->SetSelection( p_move ); + m_choiceSuffix->SetSelection( p_suffix ); + m_dirPickerMoveTo->SetPath( p_moveto ); + m_textCtrlCmd0->SetValue( p_command0 ); + m_textCtrlCmd1->SetValue( p_command1 ); + m_textCtrlCmd2->SetValue( p_command2 ); + m_choiceFound->SetSelection( p_found ); m_textCtrlWait->SetValue( p_wait ); - m_dirPickerMove->SetPath( p_moveto ); - m_checkBoxCopy->SetValue( p_copy ); - m_comboSuffix->SetSelection( (int)p_suffix ); - m_checkBoxExit->SetValue( p_exit ); + m_choiceNotFound->SetSelection( p_notfound ); delete config; } -/* パラーメータを保存 */ +/* $B%Q%i!<%a!<%?$rJ]B8(B */ void MyFrame::OnSaveParams( wxCommandEvent& WXUNUSED(event) ) { wxString dws_dir = wxGetCwd() + wxFILE_SEP_PATH + wxT("dws"); @@ -239,32 +308,35 @@ wxFileConfig* config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), fd.GetPath(), wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); config->SetPath( wxT("/Parameter") ); - config->Write( wxT("Folder"), m_dirPickerWatch->GetPath() ); - config->Write( wxT("Filename"), m_textCtrlFile->GetValue() ); - config->Write( wxT("Command"), m_textCtrlCommand->GetValue() ); - config->Write( wxT("Wait"), m_textCtrlWait->GetValue() ); - config->Write( wxT("MoveTo"), m_dirPickerMove->GetPath() ); - config->Write( wxT("Copy"), m_checkBoxCopy->GetValue() ); - config->Write( wxT("Suffix"), m_comboSuffix->GetSelection() ); - config->Write( wxT("Exit"), m_checkBoxExit->GetValue() ); + config->Write( wxT("Filename"), m_searchCtrlFile->GetValue() ); + config->Write( wxT("Watchdir"), m_dirPickerWatchDir->GetPath() ); + config->Write( wxT("Move"), m_choiceMove->GetSelection() ); + config->Write( wxT("Suffix"), m_choiceSuffix->GetSelection() ); + config->Write( wxT("MoveTo"), m_dirPickerMoveTo->GetPath() ); + config->Write( wxT("Command0"), m_textCtrlCmd0->GetValue() ); + config->Write( wxT("Command1"), m_textCtrlCmd1->GetValue() ); + config->Write( wxT("Command2"), m_textCtrlCmd2->GetValue() ); + config->Write( wxT("Found"), m_choiceFound->GetSelection() ); + config->Write( wxT("Wait"), m_textCtrlWait->GetValue() ); + config->Write( wxT("Notfound"), m_choiceNotFound->GetSelection() ); delete config; } -/* サイズ変更 */ +/* $B%5%$%:JQ99(B */ void MyFrame::OnWinSize( wxSizeEvent& event ) { this->Refresh( true, NULL ); TellLocation(); event.Skip(); } -/* ウィンドウ移動 */ +/* $B%&%#%s%I%&0\F0(B */ void MyFrame::OnWinMove( wxMoveEvent& WXUNUSED(event) ) { TellLocation(); return; } -/* ウィンドウ位置とサイズを表示 */ +/* $B%&%#%s%I%&0LCV$H%5%$%:$rI=<((B */ void MyFrame::TellLocation( void ) { wxRect r = this->GetRect(); @@ -274,12 +346,12 @@ int h = r.GetHeight(); //SetStatusText( wxString::Format(wxT("(%d,%d) %dx%d"),x,y,w,h), 3 ); } -/* 終了 */ +/* $B=*N;(B */ void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) ) { Close( true ); } -/* 設定を保存 */ +/* $B@_Dj$rJ]B8(B */ void MyFrame::SaveConfig( wxCloseEvent& WXUNUSED(event) ) { if ( !IsIconized() && !IsMaximized() ) { @@ -287,7 +359,7 @@ } Destroy(); } -/* アバウトダイアログ */ +/* $B%"%P%&%H%@%$%"%m%0(B */ void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) ) { AboutDialog* aboutDlg = new AboutDialog( this, wxID_ANY, wxT("About this Software"), wxDefaultPosition, wxSize(320,280), wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP );