0
|
1 // Filename : myframe.cpp
|
40
|
2 // Last Change: 25-Nov-2011.
|
0
|
3 //
|
|
4
|
|
5 #include "main.h"
|
|
6 #include "myframe.h"
|
5
|
7 #include "param.h"
|
6
|
8 #include "dndfile.h"
|
10
|
9 #include "marksheet.h"
|
38
|
10 #include "dirview.h"
|
0
|
11
|
27
|
12 #define LOGO_W 288
|
|
13 #define LOGO_H 86
|
|
14 #define HHSN_W 288
|
|
15 #define HHSN_H 49
|
|
16 #define THUMB_W 160
|
|
17 #define THUMB_H 226
|
|
18
|
35
|
19
|
5
|
20 // resources
|
|
21 // the application icon (under Windows and OS/2 it is in resources and even
|
|
22 // though we could still include the XPM here it would be unused)
|
|
23 #if !defined(__WXMSW__) && !defined(__WXPM__)
|
|
24 #include "sample.xpm"
|
|
25 #endif
|
|
26
|
0
|
27 //////////////////////////////////////////////////////////////////////////
|
|
28 // frame constructor
|
|
29 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
|
|
30 {
|
|
31 this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
|
|
32 // set the frame icon
|
5
|
33 SetIcon(wxICON(sample));
|
0
|
34
|
|
35 // メニューバー
|
|
36 m_menubarFile = new wxMenuBar();
|
|
37 m_menuFile = new wxMenu();
|
29
|
38
|
|
39 wxMenuItem* m_menuItemDetect;
|
|
40 m_menuItemDetect = new wxMenuItem( m_menuFile, ID_MENUITEMDETECT, wxString( wxT("検知\tF5") ) , wxEmptyString, wxITEM_NORMAL );
|
|
41 m_menuFile->Append( m_menuItemDetect );
|
|
42
|
|
43 wxMenuItem* m_menuItemMove;
|
|
44 m_menuItemMove = new wxMenuItem( m_menuFile, ID_MENUITEMMOVE, wxString( wxT("移動\tF7") ) , wxEmptyString, wxITEM_NORMAL );
|
|
45 m_menuFile->Append( m_menuItemMove );
|
|
46
|
|
47 m_menuFile->AppendSeparator(); // ----
|
35
|
48 wxMenuItem* m_menuItemAutoDetect;
|
|
49 m_menuItemAutoDetect = new wxMenuItem( m_menuFile, ID_MENUITEMAUTOD, wxString( wxT("自動検知\tF2") ) , wxEmptyString, wxITEM_CHECK );
|
|
50 m_menuFile->Append( m_menuItemAutoDetect );
|
38
|
51 m_menuItemAutoDetect->Check(false);
|
35
|
52
|
|
53 m_menuFile->AppendSeparator(); // ----
|
0
|
54 wxMenuItem* m_menuItemParam;
|
29
|
55 m_menuItemParam = new wxMenuItem( m_menuFile, ID_MENUITEMPARAM, wxString( wxT("パラメータ\tAlt+P") ) , wxEmptyString, wxITEM_NORMAL );
|
0
|
56 m_menuFile->Append( m_menuItemParam );
|
|
57
|
|
58 wxMenuItem* m_menuItemAppDIr;
|
29
|
59 m_menuItemAppDIr = new wxMenuItem( m_menuFile, ID_MENUITEMAPPDIR, wxString( wxT("アプリフォルダを開く\tCtrl+O") ) , wxEmptyString, wxITEM_NORMAL );
|
0
|
60 m_menuFile->Append( m_menuItemAppDIr );
|
|
61
|
29
|
62 m_menuFile->AppendSeparator(); // ----
|
0
|
63
|
|
64 wxMenuItem* m_menuItemQuit;
|
29
|
65 m_menuItemQuit = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( wxT("終了\tAlt+X") ) , wxEmptyString, wxITEM_NORMAL );
|
0
|
66 m_menuFile->Append( m_menuItemQuit );
|
|
67
|
33
|
68 m_menubarFile->Append( m_menuFile, wxT("ファイル") );
|
0
|
69
|
|
70 this->SetMenuBar( m_menubarFile );
|
|
71
|
|
72 // コントロール
|
|
73 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
|
|
74
|
|
75 wxBoxSizer* bSizerFrom = new wxBoxSizer( wxHORIZONTAL );
|
|
76
|
|
77 m_staticTextWork = new wxStaticText( this, wxID_ANY, wxT("作業フォルダ"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
78 bSizerFrom->Add( m_staticTextWork, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
79
|
|
80 m_dirPickerWork = new wxDirPickerCtrl( this, wxID_ANY, wxGetApp().workdir, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE );
|
|
81 bSizerFrom->Add( m_dirPickerWork, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
82
|
|
83 bSizerTop->Add( bSizerFrom, 0, wxEXPAND, 5 );
|
|
84
|
1
|
85 wxBoxSizer* bSizerDist = new wxBoxSizer( wxHORIZONTAL );
|
|
86
|
|
87 m_staticTextDist = new wxStaticText( this, wxID_ANY, wxT("保存フォルダ"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
88 bSizerDist->Add( m_staticTextDist, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
89
|
|
90 m_textCtrlDist = new wxTextCtrl( this, ID_TEXTCTRLDIST, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
91 m_textCtrlDist->SetMaxLength( 15 );
|
|
92 bSizerDist->Add( m_textCtrlDist, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
93 bSizerDist->Add( 0, 0, 1, wxEXPAND, 5 );
|
0
|
94
|
|
95 m_staticTextDrive = new wxStaticText( this, wxID_ANY, wxT("ドライブ"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
96 bSizerDist->Add( m_staticTextDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
97
|
|
98 wxArrayString drives;
|
|
99 drives.Add(wxT("C:"));
|
|
100 drives.Add(wxT("Y:"));
|
|
101 drives.Add(wxT("Z:"));
|
|
102 m_comboBoxDrive = new wxComboBox( this, wxID_ANY, wxT("C:"), wxDefaultPosition, wxSize(50,-1), drives, 0 );
|
1
|
103 bSizerDist->Add( m_comboBoxDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
104
|
|
105 m_staticTextDate = new wxStaticText( this, wxID_ANY, wxT("開催日"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
106 bSizerDist->Add( m_staticTextDate, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
107
|
|
108 m_datePicker = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
|
1
|
109 bSizerDist->Add( m_datePicker, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
8
|
110
|
|
111 m_buttonNextThu = new wxButton( this, ID_BUTTONNEXTTHU, wxT("次木 >>"), wxDefaultPosition, wxSize(60,-1), 0 );
|
|
112 bSizerDist->Add( m_buttonNextThu, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
113
|
|
114 m_staticTextCcn = new wxStaticText( this, wxID_ANY, wxT("合議体"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
115 bSizerDist->Add( m_staticTextCcn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
116
|
30
|
117 wxArrayString ccns; wxString dummy;
|
|
118 GetCCnArrayInfo( ccns, -1, dummy, dummy );
|
0
|
119 m_comboBoxCcn = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(100,-1), ccns, 0 );
|
1
|
120 bSizerDist->Add( m_comboBoxCcn, 0, wxALL, 5 );
|
0
|
121
|
|
122 m_buttonMkDir = new wxButton( this, ID_BUTTONMKDIR, wxT("適用"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
123 bSizerDist->Add( m_buttonMkDir, 0, wxALL, 5 );
|
0
|
124
|
|
125 bSizerTop->Add( bSizerDist, 0, wxEXPAND, 5 );
|
|
126
|
|
127 wxBoxSizer* bSizerManip = new wxBoxSizer( wxHORIZONTAL );
|
|
128
|
27
|
129 wxBoxSizer* bSizerRecog = new wxBoxSizer( wxVERTICAL );
|
0
|
130
|
|
131 m_staticTextName = new wxStaticText( this, wxID_ANY, wxT("氏名"), wxDefaultPosition, wxDefaultSize, 0 );
|
27
|
132 bSizerRecog->Add( m_staticTextName, 0, wxTOP|wxLEFT, 5 );
|
4
|
133 wxString logo = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("logo.png");
|
|
134 wxBitmap bmp = wxBitmap( logo, wxBITMAP_TYPE_PNG );
|
33
|
135 m_bitmapName = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize(LOGO_W,LOGO_H), 0 );
|
27
|
136 bSizerRecog->Add( m_bitmapName, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
|
0
|
137
|
|
138 m_staticTextHhsno = new wxStaticText( this, wxID_ANY, wxT("被保険者番号"), wxDefaultPosition, wxDefaultSize, 0 );
|
27
|
139 bSizerRecog->Add( m_staticTextHhsno, 0, wxTOP|wxLEFT, 5 );
|
4
|
140 logo = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("0123456789.png");
|
|
141 bmp.LoadFile( logo, wxBITMAP_TYPE_PNG );
|
33
|
142 m_bitmapHhsno = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize(HHSN_W,HHSN_H), 0 );
|
27
|
143 bSizerRecog->Add( m_bitmapHhsno, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
|
0
|
144
|
|
145 m_staticTextGuess = new wxStaticText( this, wxID_ANY, wxT("推定値"), wxDefaultPosition, wxDefaultSize, 0 );
|
27
|
146 bSizerRecog->Add( m_staticTextGuess, 0, wxTOP|wxLEFT, 5 );
|
|
147
|
|
148 wxBoxSizer* bSizerGuess = new wxBoxSizer( wxHORIZONTAL );
|
|
149
|
0
|
150 m_textCtrlGuess = new wxTextCtrl( this, ID_TEXTCTRLGUESS, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
151 m_textCtrlGuess->SetMaxLength( 10 );
|
|
152 bSizerGuess->Add( m_textCtrlGuess, 0, wxALL, 5 );
|
27
|
153
|
|
154 m_textCtrlName = new wxTextCtrl( this, ID_TEXTCTRLNAME, wxEmptyString, wxDefaultPosition, wxSize(140,-1), 0 );
|
|
155 m_textCtrlName->SetBackgroundColour(wxT("LIGHT GREY"));
|
|
156 bSizerGuess->Add( m_textCtrlName, 0, wxALL, 5 );
|
0
|
157
|
27
|
158 bSizerRecog->Add( bSizerGuess, 0, wxEXPAND, 5 );
|
|
159
|
|
160 bSizerManip->Add( bSizerRecog, 0, wxEXPAND|wxLEFT, 5 );
|
0
|
161
|
|
162 m_listCtrlView = new wxListCtrl( this, ID_LISTCTRLVIEW, wxDefaultPosition, wxDefaultSize, wxLC_ICON );
|
1
|
163 m_listCtrlView->SetBackgroundColour(wxT("LIGHT GREY"));
|
33
|
164 bSizerManip->Add( m_listCtrlView, 1, wxALL|wxEXPAND, 5 );
|
27
|
165 m_imageList = new wxImageList( THUMB_W, THUMB_H );
|
0
|
166 m_listCtrlView->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL );
|
6
|
167 //m_listCtrlView->SetDropTarget( new DnDFile(m_dirPickerWork) );
|
|
168 this->SetDropTarget( new DnDFile(m_dirPickerWork) );
|
0
|
169
|
|
170 wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL );
|
21
|
171 wxGridSizer* gSizer = new wxGridSizer( 2, 2, 0, 0 );
|
0
|
172
|
21
|
173 m_buttonMove = new wxButton( this, ID_BUTTONMOVE, wxT("移動"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
174 gSizer->Add( m_buttonMove, 0, wxALL, 5 );
|
|
175 m_buttonMove->Enable(false);
|
1
|
176 m_buttonDetect = new wxButton( this, ID_BUTTONDETECT, wxT("検知"), wxDefaultPosition, wxDefaultSize, 0 );
|
21
|
177 gSizer->Add( m_buttonDetect, 0, wxALL, 5 );
|
5
|
178
|
0
|
179 m_buttonDel = new wxButton( this, ID_BUTTONDEL, wxT("削除"), wxDefaultPosition, wxDefaultSize, 0 );
|
21
|
180 gSizer->Add( m_buttonDel, 0, wxALL, 5 );
|
0
|
181 m_buttonUndo = new wxButton( this, ID_BUTTONUNDO, wxT("戻す"), wxDefaultPosition, wxDefaultSize, 0 );
|
21
|
182 gSizer->Add( m_buttonUndo, 0, wxALL, 5 );
|
4
|
183 m_buttonUndo->Enable(false);
|
21
|
184
|
|
185 bSizerButton->Add( gSizer, 0, wxALL, 5 );
|
|
186
|
27
|
187 m_listCtrlHhsDir = new wxListCtrl( this, ID_LISTCTRLDIR, wxDefaultPosition, wxSize(280,-1), wxLC_REPORT|wxLC_SINGLE_SEL );
|
21
|
188 wxListItem itemCol;
|
|
189 itemCol.SetText( wxT("通番") );
|
26
|
190 m_listCtrlHhsDir->InsertColumn( 0, itemCol );
|
27
|
191 m_listCtrlHhsDir->SetColumnWidth( 0, 40 );
|
21
|
192 itemCol.SetText( wxT("被保険者番号") );
|
26
|
193 m_listCtrlHhsDir->InsertColumn( 1, itemCol );
|
27
|
194 m_listCtrlHhsDir->SetColumnWidth( 1, 90 );
|
|
195 itemCol.SetText( wxT("枚数") );
|
26
|
196 m_listCtrlHhsDir->InsertColumn( 2, itemCol );
|
27
|
197 m_listCtrlHhsDir->SetColumnWidth( 2, 40 );
|
|
198 itemCol.SetText( wxT("氏名") );
|
|
199 m_listCtrlHhsDir->InsertColumn( 3, itemCol );
|
|
200 m_listCtrlHhsDir->SetColumnWidth( 3, 90 );
|
21
|
201
|
26
|
202 bSizerButton->Add( m_listCtrlHhsDir, 1, wxEXPAND|wxALL, 5 );
|
0
|
203
|
21
|
204 bSizerManip->Add( bSizerButton, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
205
|
|
206 bSizerTop->Add( bSizerManip, 1, wxEXPAND, 5 );
|
|
207
|
|
208 this->SetSizer( bSizerTop );
|
|
209 this->Layout();
|
|
210
|
|
211 // ステータスバー
|
24
|
212 int widths[] = { 250, 250, -1, 120 };
|
0
|
213 m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP );
|
|
214 m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths );
|
|
215 m_statusBar->SetStatusText( wxEmptyString, 0 );
|
|
216
|
|
217 this->Centre( wxBOTH );
|
35
|
218
|
40
|
219 autodetect_mode = false;
|
11
|
220 m_timer.SetOwner( this, ID_TIMER );
|
35
|
221
|
|
222 pd = new wxProgressDialog( wxT("進行状況"), wxT("処理開始..."), 100, this, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
|
|
223 pd->SetSize( wxSize(320,140) );
|
|
224 pd->Update( 100, wxEmptyString );
|
0
|
225 }
|
|
226
|
|
227 // destructor
|
|
228 MyFrame::~MyFrame()
|
|
229 {
|
|
230 }
|
|
231
|
|
232 // Event Table
|
|
233 BEGIN_EVENT_TABLE( MyFrame, wxFrame )
|
11
|
234 EVT_IDLE( MyFrame::OnIdle )
|
|
235 EVT_TIMER( ID_TIMER, MyFrame::OnTimer )
|
1
|
236 EVT_SIZE( MyFrame::OnWinSize )
|
|
237 EVT_MOVE( MyFrame::OnWinMove )
|
29
|
238 EVT_MENU( ID_MENUITEMDETECT, MyFrame::OnDetect )
|
|
239 EVT_MENU( ID_MENUITEMMOVE, MyFrame::OnMove )
|
35
|
240 EVT_MENU( ID_MENUITEMAUTOD, MyFrame::ToggleAutoDetect )
|
8
|
241 EVT_MENU( ID_MENUITEMPARAM, MyFrame::OnParam )
|
|
242 EVT_MENU( ID_MENUITEMAPPDIR, MyFrame::OnOpenAppDir )
|
|
243 EVT_MENU( wxID_EXIT, MyFrame::OnQuit )
|
23
|
244 EVT_LIST_ITEM_SELECTED( ID_LISTCTRLVIEW, MyFrame::OnItemSelected )
|
|
245 EVT_LIST_ITEM_DESELECTED( ID_LISTCTRLVIEW, MyFrame::OnItemDeselected )
|
|
246 EVT_LIST_ITEM_ACTIVATED( ID_LISTCTRLVIEW, MyFrame::ViewLarge )
|
8
|
247 EVT_BUTTON( ID_BUTTONNEXTTHU, MyFrame::OnNextThursday )
|
|
248 EVT_BUTTON( ID_BUTTONMKDIR, MyFrame::OnMakeDir )
|
|
249 EVT_BUTTON( ID_BUTTONDETECT, MyFrame::OnDetect )
|
|
250 EVT_BUTTON( ID_BUTTONMOVE, MyFrame::OnMove )
|
|
251 EVT_BUTTON( ID_BUTTONDEL, MyFrame::OnDelete )
|
|
252 EVT_BUTTON( ID_BUTTONUNDO, MyFrame::OnUndo )
|
21
|
253 EVT_LIST_ITEM_ACTIVATED( ID_LISTCTRLDIR, MyFrame::OnOpenHhsDir )
|
0
|
254 EVT_CLOSE( MyFrame::SaveConfig )
|
|
255 END_EVENT_TABLE()
|
|
256
|
30
|
257 // Event Handlers & Functions
|
37
|
258 /* 自動検知 ON/OFF */
|
35
|
259 void MyFrame::ToggleAutoDetect(wxCommandEvent& event)
|
|
260 {
|
|
261 if ( event.IsChecked() ) autodetect_mode = true;
|
|
262 else autodetect_mode = false;
|
|
263 }
|
|
264
|
30
|
265 void MyFrame::GetCCnArrayInfo(wxArrayString& array , int n, wxString& nName, wxString& nDir)
|
|
266 {
|
|
267 if ( n == -1 ) {
|
|
268 array.Add(wxT("角館1")); array.Add(wxT("角館2")); array.Add(wxT("角館3")); array.Add(wxT("角館4"));
|
|
269 array.Add(wxT("西仙1")); array.Add(wxT("西仙2")); array.Add(wxT("西仙3"));
|
|
270 array.Add(wxT("千畑1")); array.Add(wxT("千畑2")); array.Add(wxT("千畑3"));
|
|
271 array.Add(wxT("大曲1")); array.Add(wxT("大曲2")); array.Add(wxT("大曲3")); array.Add(wxT("大曲4")); array.Add(wxT("大曲5")); array.Add(wxT("大曲6"));
|
|
272 array.Add(wxT("六郷1")); array.Add(wxT("六郷2")); array.Add(wxT("六郷3"));
|
|
273 }
|
|
274 else {
|
|
275 wxArrayString ccndir;
|
|
276 ccndir.Add(wxT("0000000031")); ccndir.Add(wxT("0000000032")); ccndir.Add(wxT("0000000033")); ccndir.Add(wxT("0000000034"));
|
|
277 ccndir.Add(wxT("0000000021")); ccndir.Add(wxT("0000000022")); ccndir.Add(wxT("0000000023"));
|
|
278 ccndir.Add(wxT("0000000041")); ccndir.Add(wxT("0000000042")); ccndir.Add(wxT("0000000043"));
|
|
279 ccndir.Add(wxT("0000000001")); ccndir.Add(wxT("0000000002")); ccndir.Add(wxT("0000000003")); ccndir.Add(wxT("0000000004")); ccndir.Add(wxT("0000000005")); ccndir.Add(wxT("0000000006"));
|
|
280 ccndir.Add(wxT("00000000x1")); ccndir.Add(wxT("00000000x2")); ccndir.Add(wxT("00000000x3"));
|
|
281 nDir = ccndir[n];
|
|
282 }
|
|
283 }
|
8
|
284 /* 次の木曜日 */
|
|
285 void MyFrame::OnNextThursday(wxCommandEvent& WXUNUSED(event))
|
|
286 {
|
|
287 wxDateTime dt = m_datePicker->GetValue();
|
|
288 wxDateSpan ds( 0, 0, 0, 1 );
|
|
289 dt += ds;
|
|
290 dt.SetToNextWeekDay( wxDateTime::Thu );
|
|
291 m_datePicker->SetValue( dt );
|
|
292 }
|
|
293
|
0
|
294 /* 移動先フォルダ作成 */
|
3
|
295 void MyFrame::OnMakeDir(wxCommandEvent& WXUNUSED(event))
|
0
|
296 {
|
1
|
297 wxString to;
|
30
|
298 to.Append( m_comboBoxDrive->GetValue() ); // C:
|
|
299 to.Append( wxFILE_SEP_PATH ); // C:/
|
|
300 wxDateTime dt = m_datePicker->GetValue();
|
|
301 wxString month = dt.Format(wxT("%m"));
|
|
302 wxString year = dt.Format(wxT("%Y"));
|
|
303 if ( month.IsSameAs(wxT("01")) || month.IsSameAs(wxT("02")) || month.IsSameAs(wxT("03")) ) {
|
|
304 long y;
|
|
305 year.ToLong( &y, 10 );
|
|
306 y--;
|
|
307 year = wxString::Format(wxT("%d"),y);
|
|
308 }
|
|
309 to.Append( year ); // C:/20xx
|
|
310 to.Append( wxFILE_SEP_PATH ); // C:/20xx/
|
|
311 to.Append( dt.Format(wxT("%Y%m%d")) ); // C:/20xx/20yymmdd
|
|
312 to.Append( wxFILE_SEP_PATH ); // C:/20xx/20yymmdd/
|
|
313 to.Append( m_comboBoxCcn->GetValue() ); // C:/20xx/20yymmdd/XXN
|
1
|
314 m_textCtrlDist->SetValue( to );
|
|
315
|
0
|
316 wxString ccn = m_comboBoxCcn->GetValue();
|
1
|
317 if ( to.Len() < 15 || ccn.IsEmpty() ) {
|
0
|
318 wxMessageBox(wxT("フォルダを指定してください."));
|
|
319 return;
|
|
320 }
|
|
321
|
30
|
322 // いったんバラして,各階層のフォルダがあるかチェック.なければ作成
|
1
|
323 wxStringTokenizer tkz( to, wxFILE_SEP_PATH );
|
0
|
324 wxString d;
|
|
325 while ( tkz.HasMoreTokens() ) {
|
|
326 d.Append( tkz.GetNextToken() );
|
|
327 d.Append( wxFILE_SEP_PATH );
|
|
328 if ( !wxDirExists( d ) ) wxMkdir( d );
|
|
329 }
|
|
330
|
30
|
331 // 申請書フォルダ作成
|
|
332 int n = m_comboBoxCcn->GetCurrentSelection();
|
|
333 wxString ccndir, dummy; wxArrayString array;
|
|
334 GetCCnArrayInfo( array, n, dummy, ccndir );
|
|
335 d.Append( ccndir );
|
|
336 d.Append( wxFILE_SEP_PATH );
|
|
337 if ( !wxDirExists( d ) ) wxMkdir( d );
|
|
338
|
|
339 m_buttonMove->Enable(true);
|
35
|
340 m_listCtrlHhsDir->DeleteAllItems();
|
11
|
341
|
0
|
342 wxMessageBox(wxT("移動先フォルダ準備完了"));
|
1
|
343 wxString cmd = wxT("explorer ") + to;
|
0
|
344 wxExecute( cmd );
|
|
345 }
|
37
|
346
|
1
|
347 /* 検知 */
|
|
348 void MyFrame::OnDetect(wxCommandEvent& WXUNUSED(event))
|
|
349 {
|
35
|
350 by_autodetect = false;
|
29
|
351 UpdateCache();
|
35
|
352 ClearGuess();
|
29
|
353 UpdateListImage();
|
26
|
354 }
|
35
|
355 void MyFrame::ClearGuess()
|
|
356 {
|
|
357 // start-up iamge
|
|
358 wxString notfound = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("notfound.png");
|
|
359 wxBitmap bmp = wxBitmap( notfound, wxBITMAP_TYPE_PNG );
|
|
360 m_bitmapName->SetBitmap( bmp );
|
|
361 notfound = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("0000000000.png");
|
|
362 bmp.LoadFile( notfound, wxBITMAP_TYPE_PNG );
|
|
363 m_bitmapHhsno->SetBitmap( bmp );
|
|
364 }
|
26
|
365
|
|
366 /* 移動 */
|
|
367 void MyFrame::OnMove(wxCommandEvent& WXUNUSED(event))
|
|
368 {
|
29
|
369 wxString distdir = m_textCtrlDist->GetValue();
|
|
370 if ( distdir.IsEmpty() ) return;
|
|
371
|
|
372 MoveImages();
|
|
373 UpdateCache();
|
35
|
374 ClearGuess();
|
29
|
375 UpdateListImage();
|
|
376 ListHhsDir();
|
|
377 m_buttonUndo->Enable(true);
|
1
|
378 }
|
5
|
379
|
4
|
380 /* 選択したファイルを移動 */
|
26
|
381 void MyFrame::MoveImages()
|
4
|
382 {
|
|
383 m_undo.Clear();
|
|
384 wxString workdir = m_dirPickerWork->GetPath();
|
|
385 wxString distdir = m_textCtrlDist->GetValue();
|
35
|
386 wxString hhsno = m_textCtrlGuess->GetValue();
|
|
387
|
|
388 wxString hhsdir = distdir + wxFILE_SEP_PATH + hhsno;
|
|
389 if ( !wxDirExists( hhsdir ) ) {
|
|
390 wxMkdir( hhsdir );
|
|
391 wxGetApp().WriteLog( wxT("created distination directory - ") + hhsdir );
|
|
392 }
|
|
393 else {
|
|
394 wxGetApp().WriteLog( wxT("set distination directory - ") + hhsdir );
|
|
395 }
|
26
|
396
|
|
397 m_hhsList.Remove(hhsno);
|
|
398 m_hhsList.Add(hhsno);
|
4
|
399 long item = -1;
|
|
400 for ( ;; ) {
|
|
401 item = m_listCtrlView->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
402 if ( item == -1 ) break;
|
5
|
403
|
35
|
404 wxString file = m_listCtrlView->GetItemText( item );
|
4
|
405 wxString from = workdir + wxFILE_SEP_PATH + file;
|
35
|
406 wxString to = hhsdir + wxFILE_SEP_PATH + file;
|
4
|
407 wxRenameFile( from, to, true );
|
35
|
408 wxGetApp().WriteLog( wxT("moved : ") + file );
|
12
|
409
|
37
|
410 m_undo.Insert( to, 0 );
|
4
|
411 }
|
|
412 }
|
|
413 /* 選択したファイルを削除 */
|
|
414 void MyFrame::OnDelete(wxCommandEvent& WXUNUSED(event))
|
|
415 {
|
|
416 m_undo.Clear();
|
|
417 wxString workdir = m_dirPickerWork->GetPath();
|
|
418 wxString trash = wxGetCwd() + wxFILE_SEP_PATH + wxT("trash");
|
|
419 long item = -1;
|
|
420 for ( ;; ) {
|
|
421 item = m_listCtrlView->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
422 if ( item == -1 ) break;
|
|
423 wxString file = m_listCtrlView->GetItemText( item );
|
|
424 wxString from = workdir + wxFILE_SEP_PATH + file;
|
|
425 wxString to = trash + wxFILE_SEP_PATH + file;
|
|
426 wxRenameFile( from, to, true );
|
35
|
427 wxGetApp().WriteLog( wxT("deleted : ") + file );
|
12
|
428
|
37
|
429 m_undo.Insert( to, 0 );
|
4
|
430 }
|
37
|
431
|
12
|
432 UpdateCache();
|
35
|
433 ClearGuess();
|
12
|
434 UpdateListImage();
|
4
|
435 m_buttonUndo->Enable(true);
|
|
436 }
|
|
437 /* アンドゥ */
|
|
438 void MyFrame::OnUndo(wxCommandEvent& WXUNUSED(event))
|
|
439 {
|
37
|
440 wxString workdir = m_dirPickerWork->GetPath();
|
4
|
441 for ( int i=0; i<m_undo.GetCount(); i++ ) {
|
37
|
442 wxFileName file( m_undo[i] );
|
|
443 wxString to = workdir + wxFILE_SEP_PATH + file.GetFullName();
|
|
444 wxRenameFile( m_undo[i], to, true );
|
4
|
445 }
|
|
446 wxMessageBox(wxT("戻し完了."));
|
|
447 m_buttonUndo->Enable(false);
|
|
448 m_undo.Clear();
|
12
|
449 UpdateCache();
|
|
450 UpdateListImage();
|
26
|
451 ListHhsDir();
|
4
|
452 }
|
0
|
453
|
|
454 /* 画像をリストコントロールに表示 */
|
12
|
455 void MyFrame::UpdateListImage()
|
0
|
456 {
|
35
|
457 if ( !cache_changed && by_autodetect ) return;
|
0
|
458
|
12
|
459 // 本処理
|
0
|
460 m_listCtrlView->DeleteAllItems();
|
|
461 m_imageList->RemoveAll();
|
24
|
462 m_textCtrlGuess->SetBackgroundColour(*wxWHITE);
|
23
|
463
|
35
|
464 if ( by_autodetect ) pd->Update( 0, wxT("処理開始") );
|
0
|
465
|
12
|
466 wxArrayString keys;
|
|
467 for ( CacheHash::iterator it=CH.begin(); it != CH.end(); ++it ) {
|
|
468 keys.Add(it->first);
|
|
469 }
|
|
470 keys.Sort();
|
35
|
471 int kc = keys.GetCount();
|
|
472 // イメージリストを作成(サムネイル)
|
|
473 for ( int i=0; i<kc; i++ ) { // item image
|
23
|
474 CacheItem* ci = new CacheItem;
|
|
475 ci = CH[keys[i]];
|
|
476 m_imageList->Add( ci->thumbnail );
|
|
477 }
|
35
|
478 for ( int i=0; i<kc; i++ ) { // item selected image
|
23
|
479 CacheItem* ci = new CacheItem;
|
|
480 ci = CH[keys[i]];
|
|
481 m_imageList->Add( ci->selthumbnail );
|
|
482 }
|
|
483 // アイテム作成
|
|
484 bool select = true; // flag
|
35
|
485 for ( int i=0; i<kc; i++ ) {
|
12
|
486 CacheItem* ci = new CacheItem;
|
|
487 ci = CH[keys[i]];
|
23
|
488 m_listCtrlView->InsertItem( i, ci->filename, i );
|
12
|
489 m_listCtrlView->SetItem( i, 0, ci->filename, i );
|
3
|
490
|
12
|
491 if ( i == 0 ) { // 1枚目はマークシートのはず
|
|
492 wxImage marksheet( ci->fullpath, wxBITMAP_TYPE_JPEG );
|
4
|
493
|
27
|
494 // 氏名画像を表示
|
4
|
495 wxImage name_image;
|
38
|
496 name_image = marksheet.GetSubImage( wxRect( wxPoint(300,550), wxSize(640,190) ) );
|
27
|
497 wxBitmap name_bmp = ( name_image.Scale( LOGO_W, LOGO_H, wxIMAGE_QUALITY_HIGH ) );
|
4
|
498 m_bitmapName->SetBitmap( name_bmp );
|
|
499
|
27
|
500 // 被保険者番号画像を表示
|
4
|
501 wxImage hhsno_image;
|
|
502 hhsno_image = marksheet.GetSubImage( wxRect( wxPoint(1800,210), wxSize(594,100) ) );
|
27
|
503 wxBitmap hhsno_bmp = ( hhsno_image.Scale( HHSN_W, HHSN_H, wxIMAGE_QUALITY_HIGH ) );
|
4
|
504 m_bitmapHhsno->SetBitmap( hhsno_bmp );
|
|
505
|
12
|
506 wxString hhsno = GuessHhs( ci->fullpath );
|
4
|
507 m_textCtrlGuess->SetValue( hhsno );
|
24
|
508 wxString name;
|
|
509 int judge = IsHhsno( hhsno, name );
|
34
|
510 if ( judge == 0 ) m_textCtrlGuess->SetBackgroundColour(*wxRED); // not hhsno-style
|
27
|
511 else if ( judge == 1 ) m_textCtrlGuess->SetBackgroundColour(wxT("YELLOW")); // not in DB
|
|
512 m_textCtrlName->SetValue( name );
|
|
513
|
12
|
514 SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),ci->z,ci->l), 1 );
|
|
515 m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
3
|
516 }
|
12
|
517 else { // 2枚目以降で初めてマークシートを認識したら,それ以降は選択しない
|
|
518 if ( ci->marksheet ) select = false;
|
|
519 if ( select ) m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
3
|
520 }
|
|
521
|
35
|
522 if ( !by_autodetect ) pd->Update( (int)(100/kc*(i+1)), wxT("画像認識中") );
|
0
|
523 }
|
34
|
524 // 画像ファイル数が多ければ,おそらく申請書
|
35
|
525 if ( kc > 32 ) {
|
34
|
526 int n = m_comboBoxCcn->GetCurrentSelection();
|
|
527 wxString ccndir, dummy; wxArrayString array;
|
|
528 GetCCnArrayInfo( array, n, dummy, ccndir );
|
|
529 m_textCtrlGuess->SetValue( ccndir );
|
|
530 }
|
1
|
531
|
23
|
532 // 選択したものは青い画像を使う
|
|
533 long i = -1;
|
|
534 for ( ;; ) {
|
38
|
535 i = m_listCtrlView->GetNextItem( i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
23
|
536 if ( i == -1 ) break;
|
|
537 m_listCtrlView->SetItemImage( i, i+m_listCtrlView->GetItemCount() );
|
|
538 }
|
|
539
|
35
|
540 by_autodetect = false;
|
40
|
541 int m = m_listCtrlView->GetSelectedItemCount();
|
|
542 if ( m != 1 ) SetStatusText( wxString::Format(wxT("%d files selected."),m), 2 );
|
0
|
543 }
|
|
544
|
23
|
545 /* 画像を選択したとき画像の情報をステータスバーに表示 */
|
|
546 void MyFrame::OnItemSelected(wxListEvent& event)
|
1
|
547 {
|
23
|
548 int i = event.GetIndex();
|
40
|
549 int m = m_listCtrlView->GetSelectedItemCount();
|
|
550 m_listCtrlView->SetItemImage( i, i+m_listCtrlView->GetItemCount() ); // 青い画像
|
23
|
551
|
34
|
552 if ( m != 1 ) {
|
|
553 SetStatusText( wxString::Format(wxT("%d files selected."),m), 2 );
|
|
554 return;
|
|
555 }
|
2
|
556
|
3
|
557 wxString filename = event.GetText();
|
13
|
558 CacheItem* ci = new CacheItem;
|
|
559 ci = CH[filename];
|
3
|
560 wxString msg;
|
13
|
561 if ( ci->marksheet ) msg = wxT("perhaps marksheet !");
|
|
562 SetStatusText( wxString::Format(wxT("selected image : z = %f, l = %d ...")+msg, ci->z, ci->l ), 2 );
|
2
|
563 }
|
23
|
564 void MyFrame::OnItemDeselected(wxListEvent& event)
|
|
565 {
|
|
566 int i = event.GetIndex();
|
|
567 m_listCtrlView->SetItemImage( i, i );
|
|
568 }
|
2
|
569
|
|
570 /* 画像のスクリーン表示*/
|
|
571 void MyFrame::ViewLarge(wxListEvent& event)
|
|
572 {
|
|
573 int i = event.GetIndex();
|
|
574 wxListItem item;
|
|
575 item.SetId(i);
|
|
576
|
|
577 wxString filename = event.GetText();
|
|
578 wxString workdir = m_dirPickerWork->GetPath();
|
|
579 wxString imagefile = workdir + wxFILE_SEP_PATH + filename;
|
|
580
|
|
581 wxImage image( imagefile, wxBITMAP_TYPE_JPEG );
|
|
582 wxBitmap bmp( image.Scale( 707, 1000, wxIMAGE_QUALITY_HIGH ) );
|
|
583 wxSplashScreen* splash = new wxSplashScreen( bmp,
|
|
584 wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
|
35
|
585 2500, NULL, -1, wxDefaultPosition, wxDefaultSize,
|
2
|
586 wxSIMPLE_BORDER|wxSTAY_ON_TOP );
|
|
587 wxYield();
|
1
|
588 }
|
|
589
|
|
590 /* パラメータダイアログ */
|
|
591 void MyFrame::OnParam(wxCommandEvent& WXUNUSED(event))
|
|
592 {
|
35
|
593 ParamDialog* parad = new ParamDialog( NULL, wxID_ANY, wxT("Setting Parameters") );
|
|
594 if ( parad->ShowModal() == wxID_OK ) {
|
|
595 parad->NewParam( wxGetApp().lmin, wxGetApp().lmax, wxGetApp().zmin, wxGetApp().zmax );
|
5
|
596 }
|
35
|
597 parad->Destroy();
|
1
|
598 }
|
|
599
|
11
|
600 /* キャッシュ作成&更新 */
|
|
601 void MyFrame::UpdateCache()
|
|
602 {
|
24
|
603 double zmin, zmax; long lmin, lmax;
|
|
604 wxGetApp().zmin.ToDouble( &zmin );
|
|
605 wxGetApp().zmax.ToDouble( &zmax );
|
|
606 wxGetApp().lmin.ToLong( &lmin );
|
|
607 wxGetApp().lmax.ToLong( &lmax );
|
|
608
|
12
|
609 m_buttonDetect->Enable(false);
|
11
|
610 wxGetApp().WriteLog( wxT("start updating cache") );
|
24
|
611 wxStopWatch sw;
|
|
612 sw.Start(0);
|
11
|
613
|
12
|
614 /* キャッシュ存在フラグOFF */
|
|
615 for ( CacheHash::iterator it=CH.begin(); it != CH.end(); ++it ) {
|
11
|
616 CacheItem* ci = new CacheItem;
|
12
|
617 ci = it->second;
|
11
|
618 ci->exists = false;
|
|
619 }
|
12
|
620
|
|
621 wxString workdir = m_dirPickerWork->GetPath();
|
|
622 wxArrayString filenames;
|
|
623 wxListItem item;
|
|
624
|
|
625 /* キャッシュ作成 */
|
35
|
626 cache_changed = false;
|
26
|
627 unsigned int n = wxDir::GetAllFiles( workdir, &filenames, wxT("*.jpg"), wxDIR_FILES );
|
11
|
628 for ( int i=0; i<n; i++ ) {
|
12
|
629 wxString fullpath = filenames[i];
|
|
630 wxFileName f( fullpath );
|
|
631 wxString file = f.GetFullName();
|
|
632
|
11
|
633 CacheItem* ci = new CacheItem;
|
12
|
634 /* キャッシュ済みのものはスキップ */
|
|
635 if ( CH.count(file) ) {
|
|
636 ci = CH[file];
|
11
|
637 ci->exists = true;
|
|
638 continue;
|
|
639 }
|
12
|
640 /* 新しいファイルはキャッシュ */
|
24
|
641 float z; long l; bool m = IsMarksheet( fullpath, &z, &l, zmin, zmax, lmin, lmax );
|
12
|
642 wxImage image( fullpath, wxBITMAP_TYPE_JPEG );
|
27
|
643 wxImage thumbnail = image.Scale( THUMB_W, THUMB_H, wxIMAGE_QUALITY_HIGH );
|
23
|
644 wxBitmap bmp( thumbnail );
|
|
645 unsigned char *data = thumbnail.GetData();
|
27
|
646 for ( int y=0; y<THUMB_H; y++ ) for ( int x=0; x<THUMB_W; x++ ) data[(y*THUMB_W+x)*3+2] = 255; // 文字色:黒(0,0,0)->青(0,0.255)
|
23
|
647 wxBitmap bmp_mask( thumbnail );
|
12
|
648
|
23
|
649 ci->filename = file;
|
|
650 ci->fullpath = fullpath;
|
|
651 ci->marksheet = m;
|
|
652 ci->z = z;
|
|
653 ci->l = l;
|
|
654 ci->exists = true;
|
|
655 ci->thumbnail = bmp;
|
|
656 ci->selthumbnail = bmp_mask;
|
|
657 ci->modtime = wxEmptyString; // TODO.
|
12
|
658
|
11
|
659 CH[ci->filename] = ci; // add hash
|
35
|
660 cache_changed = true;
|
26
|
661 SetStatusText( wxString::Format( wxT("rebuiling cache...( %d/%d :%.1fsec passed )"), i+1, n, (float)sw.Time()/1000 ), 0 );
|
12
|
662 wxGetApp().WriteLog( file + wxT(" appended.") + wxString::Format(wxT(" ( m=%d z=%f l=%d )"), m ? 1 : 0, z, l ) );
|
11
|
663 }
|
|
664
|
12
|
665 /* 存在しないファイルはキャッシュから削除 */
|
|
666 wxArrayString removelist;
|
|
667 for ( CacheHash::iterator it=CH.begin(); it != CH.end(); ++it ) {
|
|
668 CacheItem* ci = new CacheItem;
|
|
669 ci = it->second;
|
|
670 if ( !ci->exists ) removelist.Add( ci->filename );
|
|
671 }
|
|
672 for ( int i=0; i<removelist.GetCount(); i++ ) {
|
|
673 CH.erase(removelist[i]);
|
35
|
674 cache_changed = true;
|
12
|
675 wxGetApp().WriteLog( removelist[i] + wxT(" removed.") );
|
|
676 }
|
|
677
|
|
678 m_buttonDetect->Enable(true);
|
11
|
679 SetStatusText( wxEmptyString, 0 );
|
40
|
680 m_timer.Start( 10*1000, wxTIMER_ONE_SHOT ); // restart
|
11
|
681 }
|
|
682
|
26
|
683 /* 被保険者フォルダを列挙 */
|
|
684 void MyFrame::ListHhsDir()
|
|
685 {
|
|
686 wxString distdir = m_textCtrlDist->GetValue();
|
|
687 wxString hhsdir;
|
|
688 wxString buf;
|
|
689
|
|
690 m_listCtrlHhsDir->DeleteAllItems();
|
|
691 for ( int i=0; i<m_hhsList.GetCount(); i++ ) {
|
35
|
692 unsigned int n = 0;
|
|
693 wxArrayString dummy;
|
26
|
694 hhsdir = distdir + wxFILE_SEP_PATH + m_hhsList[i];
|
35
|
695 if ( wxDirExists( hhsdir ) ) n = wxDir::GetAllFiles( hhsdir, &dummy, wxT("*.jpg"), wxDIR_FILES );
|
26
|
696
|
|
697 m_listCtrlHhsDir->InsertItem( i, -1 );
|
|
698 buf.Printf(wxT("%d"),i+1);
|
35
|
699 m_listCtrlHhsDir->SetItem( i, 0, buf, -1 ); // No
|
|
700 m_listCtrlHhsDir->SetItem( i, 1, m_hhsList[i], -1 ); // Hhsno
|
26
|
701 buf.Printf(wxT("%d"),n);
|
35
|
702 m_listCtrlHhsDir->SetItem( i, 2, buf, -1 ); // file count
|
|
703 m_listCtrlHhsDir->SetItem( i, 3, GetHhsName( m_hhsList[i]), -1 ); // name
|
26
|
704 if ( i % 2 ) m_listCtrlHhsDir->SetItemBackgroundColour( i, wxColour(wxT("WHEAT")) );
|
|
705 }
|
|
706 }
|
|
707
|
|
708 /* 被保険者フォルダを開く */
|
21
|
709 void MyFrame::OnOpenHhsDir(wxListEvent& event)
|
|
710 {
|
26
|
711 wxString hhsdir;
|
35
|
712 hhsdir = m_textCtrlDist->GetValue() + wxFILE_SEP_PATH;
|
21
|
713
|
27
|
714 int i = event.GetIndex();
|
|
715 wxListItem item;
|
|
716 item.SetId(i);
|
|
717
|
21
|
718 item.SetColumn(1);
|
|
719 item.SetMask(wxLIST_MASK_TEXT);
|
26
|
720 m_listCtrlHhsDir->GetItem( item );
|
21
|
721 hhsdir.Append( item.GetText() );
|
38
|
722
|
40
|
723 DirViewFrame* dvf = new DirViewFrame( (wxWindow*)this, wxID_ANY, wxEmptyString );
|
38
|
724 dvf->m_dir = hhsdir;
|
40
|
725 dvf->LoadListImage();
|
38
|
726 dvf->Show(true);
|
21
|
727 }
|
|
728
|
32
|
729 /* 以下,定型もの ***********************************************/
|
11
|
730 void MyFrame::OnTimer(wxTimerEvent& event)
|
|
731 {
|
35
|
732 if ( !autodetect_mode ) return;
|
|
733 by_autodetect = true;
|
11
|
734 UpdateCache();
|
35
|
735 UpdateListImage();
|
11
|
736 }
|
26
|
737
|
11
|
738 /* アイドリング */
|
|
739 void MyFrame::OnIdle(wxIdleEvent& event)
|
|
740 {
|
|
741 if ( !m_timer.IsRunning() ) {
|
|
742 m_timer.Start( 20*1000, wxTIMER_ONE_SHOT );
|
|
743 }
|
|
744 event.RequestMore();
|
|
745 event.Skip();
|
|
746 }
|
|
747
|
0
|
748 /* アプリフォルダを開く */
|
|
749 void MyFrame::OnOpenAppDir(wxCommandEvent& WXUNUSED(event))
|
|
750 {
|
5
|
751 wxString appdir = wxGetCwd();
|
0
|
752 wxString execmd = wxT("explorer ") + appdir;
|
|
753 wxExecute( execmd );
|
|
754 }
|
|
755
|
|
756 /* サイズ変更 */
|
1
|
757 void MyFrame::OnWinSize(wxSizeEvent& event)
|
0
|
758 {
|
|
759 this->Refresh( true, NULL );
|
|
760 TellLocation();
|
|
761 event.Skip();
|
|
762 }
|
|
763 /* ウィンドウ移動 */
|
1
|
764 void MyFrame::OnWinMove(wxMoveEvent& WXUNUSED(event))
|
0
|
765 {
|
|
766 TellLocation();
|
|
767 return;
|
|
768 }
|
|
769 /* ウィンドウ位置とサイズを表示 */
|
|
770 void MyFrame::TellLocation( void )
|
|
771 {
|
|
772 wxRect r = this->GetRect();
|
|
773 int x = r.GetX();
|
|
774 int y = r.GetY();
|
|
775 int w = r.GetWidth();
|
|
776 int h = r.GetHeight();
|
1
|
777 SetStatusText( wxString::Format(wxT("(%d,%d) %dx%d"),x,y,w,h), 3 );
|
0
|
778 }
|
|
779 /* 終了 */
|
|
780 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|
781 {
|
|
782 Close(true);
|
|
783 }
|
|
784 /* 設定を保存 */
|
|
785 void MyFrame::SaveConfig(wxCloseEvent& WXUNUSED(event))
|
|
786 {
|
|
787 if ( !IsIconized() && !IsMaximized() ) {
|
|
788 wxGetApp().rect = this->GetRect();
|
|
789 }
|
|
790 wxGetApp().workdir = m_dirPickerWork->GetPath();
|
|
791
|
|
792 Destroy();
|
|
793 }
|
|
794
|