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