annotate src/myframe.cpp @ 3:a5bddd859104

implement delwhtie
author pyon@macmini
date Tue, 04 Oct 2011 07:43:08 +0900
parents 1ea4f7981ff5
children a505f7417742
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
1 // Filename : mainframe.cpp
3
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
2 // Last Change: 03-Oct-2011.
2
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
3 //
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
4 #include "symbol.h"
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
5 #include "common.h"
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
6 #include "myframe.h"
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
7 #include "delwhite.h"
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
8 #include "main.h"
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
9
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
10 // resources
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
11 // the application icon (under Windows and OS/2 it is in resources and even
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
12 // though we could still include the XPM here it would be unused)
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
13 #if !defined(__WXMSW__) && !defined(__WXPM__)
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
14 #include "sample.xpm"
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
15 #endif
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
16
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
17 //////////////////////////////////////////////////////////////////////////
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
18 // control constructor
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
19
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
20 // 検索履歴をログに保存
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
21 /*
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
22 void MyCmdBox::WriteLog( wxString& cmd, wxString& path )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
23 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
24 wxString logfn = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("log.txt");
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
25 wxTextFile logFile;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
26 logFile.Open( logfn );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
27 wxDateTime now = wxDateTime::Now();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
28 wxString log = now.Format( wxT("%Y-%m-%d %H:%M:%S") ) + wxT(" ") + cmd + wxT(" ") + path;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
29 logFile.AddLine( log );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
30 logFile.Write();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
31 logFile.Close();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
32
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
33 return;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
34 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
35 */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
36
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
37 //////////////////////////////////////////////////////////////////////////
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
38 // frame constructor
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
39 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
40 : wxFrame( parent, id, title )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
41 {
3
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
42 this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
2
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
43 // set the frame icon
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
44 SetIcon(wxICON(sample));
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
45
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
46 // メニューバー
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
47 m_menubar = new wxMenuBar();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
48
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
49 m_menuFile = new wxMenu();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
50 m_menuFile->Append( wxID_ABOUT, wxT("&About...\tF1"), wxT("Show about dialog") );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
51 //m_menuFile->AppendSeparator(); //----
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
52 m_menuFile->Append( wxID_EXIT, wxT("終了(&X)\tAlt-X"), wxT("Quit this program") );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
53
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
54 m_menubar->Append( m_menuFile, wxT("ファイル(&F)") );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
55
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
56 this->SetMenuBar( m_menubar );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
57
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
58 // ステータスバー
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
59 int widths[] = { -1, 150, 120 };
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
60 m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
61 m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
62 m_statusBar->SetStatusText( wxEmptyString, 0 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
63
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
64 // コントロール
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
65 wxBoxSizer* bSizerTop;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
66 bSizerTop = new wxBoxSizer( wxVERTICAL );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
67
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
68 wxBoxSizer* bSizerWork;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
69 bSizerWork = new wxBoxSizer( wxHORIZONTAL );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
70
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
71 m_staticTextWork = new wxStaticText( this, wxID_ANY, wxT("作業用フォルダ"), wxDefaultPosition, wxDefaultSize, 0 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
72 bSizerWork->Add( m_staticTextWork, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
73
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
74 m_dirPickerWork = new wxDirPickerCtrl( this, ID_WORKDIR, wxGetApp().dir, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
75 bSizerWork->Add( m_dirPickerWork, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
76
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
77 m_buttonDetWhite = new wxButton( this, ID_DTWHITE, wxT("白紙検知"), wxDefaultPosition, wxDefaultSize, 0 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
78 bSizerWork->Add( m_buttonDetWhite, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
79
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
80 bSizerTop->Add( bSizerWork, 0, wxEXPAND, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
81
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
82 wxBoxSizer* bSizerMoveTo;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
83 bSizerMoveTo = new wxBoxSizer( wxHORIZONTAL );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
84
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
85 m_staticTextMoveTo = new wxStaticText( this, wxID_ANY, wxT("移動先フォルダ"), wxDefaultPosition, wxDefaultSize, 0 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
86 bSizerMoveTo->Add( m_staticTextMoveTo, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
87
3
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
88 wxArrayString drives;
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
89 drives.Add(wxT("C:"));
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
90 drives.Add(wxT("Y:"));
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
91 drives.Add(wxT("Z:"));
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
92 m_comboBoxMoveDrive = new wxComboBox( this, ID_DRIVE, wxT("C:"), wxDefaultPosition, wxSize( 50,-1 ), drives, 0 );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
93 bSizerMoveTo->Add( m_comboBoxMoveDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
2
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
94
3
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
95 m_datePickerCcn = new wxDatePickerCtrl( this, ID_DATE, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
2
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
96 bSizerMoveTo->Add( m_datePickerCcn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
97
3
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
98 wxArrayString ccns;
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
99 ccns.Add(wxT("角館1")); ccns.Add(wxT("角館2")); ccns.Add(wxT("角館3")); ccns.Add(wxT("角館4"));
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
100 ccns.Add(wxT("西仙1")); ccns.Add(wxT("西仙2")); ccns.Add(wxT("西仙3"));
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
101 ccns.Add(wxT("千畑1")); ccns.Add(wxT("千畑2")); ccns.Add(wxT("千畑3"));
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
102 ccns.Add(wxT("大曲1")); ccns.Add(wxT("大曲2")); ccns.Add(wxT("大曲3")); ccns.Add(wxT("大曲4")); ccns.Add(wxT("大曲5")); ccns.Add(wxT("大曲6"));
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
103 ccns.Add(wxT("六郷1")); ccns.Add(wxT("六郷2")); ccns.Add(wxT("六郷3"));
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
104 m_comboBoxCcn = new wxComboBox( this, ID_CCN, wxEmptyString, wxDefaultPosition, wxSize( 100,-1 ), ccns, 0 );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
105 bSizerMoveTo->Add( m_comboBoxCcn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
2
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
106
3
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
107 m_buttonSetDir = new wxButton( this, ID_STDIR, wxT("フォルダ指定"), wxDefaultPosition, wxDefaultSize, 0 );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
108 bSizerMoveTo->Add( m_buttonSetDir, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
109
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
110 m_buttonMkDir = new wxButton( this, ID_MKDIR, wxT("フォルダ作成"), wxDefaultPosition, wxDefaultSize, 0 );
2
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
111 bSizerMoveTo->Add( m_buttonMkDir, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
112
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
113 bSizerTop->Add( bSizerMoveTo, 0, 0, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
114
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
115 wxBoxSizer* bSizerDoMove;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
116 bSizerDoMove = new wxBoxSizer( wxHORIZONTAL );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
117
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
118 m_staticTextDummy = new wxStaticText( this, wxID_ANY, wxT("移動先ふぉるだ"), wxDefaultPosition, wxDefaultSize, 0 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
119 m_staticTextDummy->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
120
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
121 bSizerDoMove->Add( m_staticTextDummy, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
122
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
123 m_textCtrlMoveDir = new wxTextCtrl( this, ID_DIR, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
124 m_textCtrlMoveDir->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVEBORDER ) );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
125
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
126 bSizerDoMove->Add( m_textCtrlMoveDir, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
127
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
128 m_buttonDoMove = new wxButton( this, ID_DOMOVE, wxT("画像移動"), wxDefaultPosition, wxDefaultSize, 0 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
129 m_buttonDoMove->Enable( false );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
130
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
131 bSizerDoMove->Add( m_buttonDoMove, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
132
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
133 bSizerTop->Add( bSizerDoMove, 0, wxEXPAND, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
134
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
135 m_listCtrl = new wxListCtrl( this, ID_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
136 bSizerTop->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
137
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
138 this->SetSizer( bSizerTop );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
139 this->Layout();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
140
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
141 this->Centre( wxBOTH );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
142 //this->SetDefaultItem(m_buttonDetWhite);
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
143 m_buttonDetWhite->SetFocus();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
144 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
145
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
146 // destructor
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
147 MyFrame::~MyFrame()
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
148 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
149 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
150
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
151 // Event Table
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
152 BEGIN_EVENT_TABLE( MyFrame, wxFrame )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
153 EVT_SIZE( MyFrame::OnSize )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
154 EVT_MOVE( MyFrame::OnMove )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
155 EVT_MENU( wxID_EXIT, MyFrame::OnQuit )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
156 EVT_MENU( wxID_ABOUT, MyFrame::OnAbout )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
157 EVT_BUTTON( ID_DTWHITE, MyFrame::OnDetectWhite )
3
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
158 EVT_BUTTON( ID_STDIR, MyFrame::SetDir )
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
159 EVT_BUTTON( ID_MKDIR, MyFrame::MakeDir )
2
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
160 EVT_CLOSE( MyFrame::SaveConfig )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
161 END_EVENT_TABLE()
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
162
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
163 // Event Handlers
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
164 /* サイズ変更 */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
165 void MyFrame::OnSize(wxSizeEvent& event)
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
166 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
167 this->Refresh( true, NULL );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
168 TellLocation();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
169 event.Skip();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
170 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
171 /* ウィンドウ移動 */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
172 void MyFrame::OnMove(wxMoveEvent& WXUNUSED(event))
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
173 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
174 TellLocation();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
175 return;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
176 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
177 /* ウィンドウ位置とサイズを表示 */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
178 void MyFrame::TellLocation( void )
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
179 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
180 wxRect r = this->GetRect();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
181 int x = r.GetX();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
182 int y = r.GetY();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
183 int w = r.GetWidth();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
184 int h = r.GetHeight();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
185 SetStatusText( wxString::Format(wxT("(%d,%d) %dx%d"),x,y,w,h), 2 );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
186 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
187 /* 終了 */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
188 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
189 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
190 Close(true);
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
191 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
192
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
193 /* バージョン情報 */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
194 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
195 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
196 wxMessageBox(
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
197 wxString::Format(
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
198 wxT("Version %d.%d ( build %d ) by %s\n")
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
199 wxT("running under %s."),
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
200 VER, REV, BLD, wxVERSION_STRING,
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
201 wxGetOsDescription().c_str()
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
202 ),
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
203 wxT("About this program"), wxOK | wxICON_INFORMATION, this );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
204 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
205
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
206 /* 白紙検知 */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
207 void MyFrame::OnDetectWhite(wxCommandEvent& WXUNUSED(event))
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
208 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
209 FrameDelWhite* dw = new FrameDelWhite( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxCAPTION|wxFRAME_NO_TASKBAR|wxMAXIMIZE_BOX|wxRESIZE_BORDER );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
210 dw->SetMinSize( wxSize( 580, 680 ) );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
211
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
212 dw->m_dir = m_dirPickerWork->GetPath();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
213 dw->SetTitle( wxT("Delete White Sheet - ") + dw->m_dir );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
214 dw->LoadImages();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
215
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
216 dw->Show(true);
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
217 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
218
3
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
219 /* 移動先フォルダセット */
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
220 void MyFrame::SetDir(wxCommandEvent& WXUNUSED(event))
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
221 {
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
222 wxString dir;
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
223 dir.Append( m_comboBoxMoveDrive->GetValue() );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
224 dir.Append( wxFILE_SEP_PATH );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
225 wxDateTime dt = m_datePickerCcn->GetValue();
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
226 dir.Append( dt.Format(wxT("%Y%m%d")) );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
227 dir.Append( wxFILE_SEP_PATH );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
228 dir.Append( m_comboBoxCcn->GetValue() );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
229 m_textCtrlMoveDir->SetValue( dir );
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
230 }
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
231
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
232 void MyFrame::MakeDir(wxCommandEvent& WXUNUSED(event))
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
233 {
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
234 }
a5bddd859104 implement delwhtie
pyon@macmini
parents: 2
diff changeset
235
2
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
236 /* アプリケーションフォルダを開く */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
237 /*
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
238 void MyFrame::OnOpenAppDir(wxCommandEvent& WXUNUSED(event))
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
239 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
240 wxStandardPaths appdir;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
241 wxString execmd = wxT("explorer ") + appdir.GetDataDir();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
242 wxExecute( execmd );
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
243 return;
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
244 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
245 */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
246
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
247
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
248 /* 設定を保存 */
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
249 void MyFrame::SaveConfig(wxCloseEvent& WXUNUSED(event))
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
250 {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
251 if ( !IsIconized() && !IsMaximized() ) {
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
252 wxGetApp().rect = this->GetRect();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
253 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
254 wxGetApp().dir = m_dirPickerWork->GetPath();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
255
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
256 Destroy();
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
257 }
1ea4f7981ff5 create window.
pyon@macmini
parents:
diff changeset
258