0
|
1 // Filename : myframe.cpp
|
37
|
2 // Last Change: 18-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
|
5
|
19 // resources
|
|
20 // the application icon (under Windows and OS/2 it is in resources and even
|
|
21 // though we could still include the XPM here it would be unused)
|
|
22 #if !defined(__WXMSW__) && !defined(__WXPM__)
|
|
23 #include "sample.xpm"
|
|
24 #endif
|
|
25
|
0
|
26 //////////////////////////////////////////////////////////////////////////
|
|
27 // frame constructor
|
|
28 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
|
|
29 {
|
|
30 this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
|
|
31 // set the frame icon
|
5
|
32 SetIcon(wxICON(sample));
|
0
|
33
|
|
34 // メニューバー
|
|
35 m_menubarFile = new wxMenuBar();
|
|
36 m_menuFile = new wxMenu();
|
29
|
37
|
|
38 wxMenuItem* m_menuItemDetect;
|
|
39 m_menuItemDetect = new wxMenuItem( m_menuFile, ID_MENUITEMDETECT, wxString( wxT("検知\tF5") ) , wxEmptyString, wxITEM_NORMAL );
|
|
40 m_menuFile->Append( m_menuItemDetect );
|
|
41
|
|
42 wxMenuItem* m_menuItemMove;
|
|
43 m_menuItemMove = new wxMenuItem( m_menuFile, ID_MENUITEMMOVE, wxString( wxT("移動\tF7") ) , wxEmptyString, wxITEM_NORMAL );
|
|
44 m_menuFile->Append( m_menuItemMove );
|
|
45
|
|
46 m_menuFile->AppendSeparator(); // ----
|
35
|
47 wxMenuItem* m_menuItemAutoDetect;
|
|
48 m_menuItemAutoDetect = new wxMenuItem( m_menuFile, ID_MENUITEMAUTOD, wxString( wxT("自動検知\tF2") ) , wxEmptyString, wxITEM_CHECK );
|
|
49 m_menuFile->Append( m_menuItemAutoDetect );
|
|
50 m_menuItemAutoDetect->Check(true);
|
|
51
|
|
52 m_menuFile->AppendSeparator(); // ----
|
0
|
53 wxMenuItem* m_menuItemParam;
|
29
|
54 m_menuItemParam = new wxMenuItem( m_menuFile, ID_MENUITEMPARAM, wxString( wxT("パラメータ\tAlt+P") ) , wxEmptyString, wxITEM_NORMAL );
|
0
|
55 m_menuFile->Append( m_menuItemParam );
|
|
56
|
|
57 wxMenuItem* m_menuItemAppDIr;
|
29
|
58 m_menuItemAppDIr = new wxMenuItem( m_menuFile, ID_MENUITEMAPPDIR, wxString( wxT("アプリフォルダを開く\tCtrl+O") ) , wxEmptyString, wxITEM_NORMAL );
|
0
|
59 m_menuFile->Append( m_menuItemAppDIr );
|
|
60
|
29
|
61 m_menuFile->AppendSeparator(); // ----
|
0
|
62
|
|
63 wxMenuItem* m_menuItemQuit;
|
29
|
64 m_menuItemQuit = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( wxT("終了\tAlt+X") ) , wxEmptyString, wxITEM_NORMAL );
|
0
|
65 m_menuFile->Append( m_menuItemQuit );
|
|
66
|
33
|
67 m_menubarFile->Append( m_menuFile, wxT("ファイル") );
|
0
|
68
|
|
69 this->SetMenuBar( m_menubarFile );
|
|
70
|
|
71 // コントロール
|
|
72 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
|
|
73
|
|
74 wxBoxSizer* bSizerFrom = new wxBoxSizer( wxHORIZONTAL );
|
|
75
|
|
76 m_staticTextWork = new wxStaticText( this, wxID_ANY, wxT("作業フォルダ"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
77 bSizerFrom->Add( m_staticTextWork, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
78
|
|
79 m_dirPickerWork = new wxDirPickerCtrl( this, wxID_ANY, wxGetApp().workdir, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE );
|
|
80 bSizerFrom->Add( m_dirPickerWork, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
81
|
|
82 bSizerTop->Add( bSizerFrom, 0, wxEXPAND, 5 );
|
|
83
|
1
|
84 wxBoxSizer* bSizerDist = new wxBoxSizer( wxHORIZONTAL );
|
|
85
|
|
86 m_staticTextDist = new wxStaticText( this, wxID_ANY, wxT("保存フォルダ"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
87 bSizerDist->Add( m_staticTextDist, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
88
|
|
89 m_textCtrlDist = new wxTextCtrl( this, ID_TEXTCTRLDIST, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
90 m_textCtrlDist->SetMaxLength( 15 );
|
|
91 bSizerDist->Add( m_textCtrlDist, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
92 bSizerDist->Add( 0, 0, 1, wxEXPAND, 5 );
|
0
|
93
|
|
94 m_staticTextDrive = new wxStaticText( this, wxID_ANY, wxT("ドライブ"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
95 bSizerDist->Add( m_staticTextDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
96
|
|
97 wxArrayString drives;
|
|
98 drives.Add(wxT("C:"));
|
|
99 drives.Add(wxT("Y:"));
|
|
100 drives.Add(wxT("Z:"));
|
|
101 m_comboBoxDrive = new wxComboBox( this, wxID_ANY, wxT("C:"), wxDefaultPosition, wxSize(50,-1), drives, 0 );
|
1
|
102 bSizerDist->Add( m_comboBoxDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
103
|
|
104 m_staticTextDate = new wxStaticText( this, wxID_ANY, wxT("開催日"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
105 bSizerDist->Add( m_staticTextDate, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
106
|
|
107 m_datePicker = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
|
1
|
108 bSizerDist->Add( m_datePicker, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
8
|
109
|
|
110 m_buttonNextThu = new wxButton( this, ID_BUTTONNEXTTHU, wxT("次木 >>"), wxDefaultPosition, wxSize(60,-1), 0 );
|
|
111 bSizerDist->Add( m_buttonNextThu, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
112
|
|
113 m_staticTextCcn = new wxStaticText( this, wxID_ANY, wxT("合議体"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
114 bSizerDist->Add( m_staticTextCcn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
115
|
30
|
116 wxArrayString ccns; wxString dummy;
|
|
117 GetCCnArrayInfo( ccns, -1, dummy, dummy );
|
0
|
118 m_comboBoxCcn = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(100,-1), ccns, 0 );
|
1
|
119 bSizerDist->Add( m_comboBoxCcn, 0, wxALL, 5 );
|
0
|
120
|
|
121 m_buttonMkDir = new wxButton( this, ID_BUTTONMKDIR, wxT("適用"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
122 bSizerDist->Add( m_buttonMkDir, 0, wxALL, 5 );
|
0
|
123
|
|
124 bSizerTop->Add( bSizerDist, 0, wxEXPAND, 5 );
|
|
125
|
|
126 wxBoxSizer* bSizerManip = new wxBoxSizer( wxHORIZONTAL );
|
|
127
|
27
|
128 wxBoxSizer* bSizerRecog = new wxBoxSizer( wxVERTICAL );
|
0
|
129
|
|
130 m_staticTextName = new wxStaticText( this, wxID_ANY, wxT("氏名"), wxDefaultPosition, wxDefaultSize, 0 );
|
27
|
131 bSizerRecog->Add( m_staticTextName, 0, wxTOP|wxLEFT, 5 );
|
4
|
132 wxString logo = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("logo.png");
|
|
133 wxBitmap bmp = wxBitmap( logo, wxBITMAP_TYPE_PNG );
|
33
|
134 m_bitmapName = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize(LOGO_W,LOGO_H), 0 );
|
27
|
135 bSizerRecog->Add( m_bitmapName, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
|
0
|
136
|
|
137 m_staticTextHhsno = new wxStaticText( this, wxID_ANY, wxT("被保険者番号"), wxDefaultPosition, wxDefaultSize, 0 );
|
27
|
138 bSizerRecog->Add( m_staticTextHhsno, 0, wxTOP|wxLEFT, 5 );
|
4
|
139 logo = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("0123456789.png");
|
|
140 bmp.LoadFile( logo, wxBITMAP_TYPE_PNG );
|
33
|
141 m_bitmapHhsno = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize(HHSN_W,HHSN_H), 0 );
|
27
|
142 bSizerRecog->Add( m_bitmapHhsno, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
|
0
|
143
|
|
144 m_staticTextGuess = new wxStaticText( this, wxID_ANY, wxT("推定値"), wxDefaultPosition, wxDefaultSize, 0 );
|
27
|
145 bSizerRecog->Add( m_staticTextGuess, 0, wxTOP|wxLEFT, 5 );
|
|
146
|
|
147 wxBoxSizer* bSizerGuess = new wxBoxSizer( wxHORIZONTAL );
|
|
148
|
0
|
149 m_textCtrlGuess = new wxTextCtrl( this, ID_TEXTCTRLGUESS, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
150 m_textCtrlGuess->SetMaxLength( 10 );
|
|
151 bSizerGuess->Add( m_textCtrlGuess, 0, wxALL, 5 );
|
27
|
152
|
|
153 m_textCtrlName = new wxTextCtrl( this, ID_TEXTCTRLNAME, wxEmptyString, wxDefaultPosition, wxSize(140,-1), 0 );
|
|
154 m_textCtrlName->SetBackgroundColour(wxT("LIGHT GREY"));
|
|
155 bSizerGuess->Add( m_textCtrlName, 0, wxALL, 5 );
|
0
|
156
|
27
|
157 bSizerRecog->Add( bSizerGuess, 0, wxEXPAND, 5 );
|
|
158
|
|
159 bSizerManip->Add( bSizerRecog, 0, wxEXPAND|wxLEFT, 5 );
|
0
|
160
|
|
161 m_listCtrlView = new wxListCtrl( this, ID_LISTCTRLVIEW, wxDefaultPosition, wxDefaultSize, wxLC_ICON );
|
1
|
162 m_listCtrlView->SetBackgroundColour(wxT("LIGHT GREY"));
|
33
|
163 bSizerManip->Add( m_listCtrlView, 1, wxALL|wxEXPAND, 5 );
|
27
|
164 m_imageList = new wxImageList( THUMB_W, THUMB_H );
|
0
|
165 m_listCtrlView->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL );
|
6
|
166 //m_listCtrlView->SetDropTarget( new DnDFile(m_dirPickerWork) );
|
|
167 this->SetDropTarget( new DnDFile(m_dirPickerWork) );
|
0
|
168
|
|
169 wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL );
|
21
|
170 wxGridSizer* gSizer = new wxGridSizer( 2, 2, 0, 0 );
|
0
|
171
|
21
|
172 m_buttonMove = new wxButton( this, ID_BUTTONMOVE, wxT("移動"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
173 gSizer->Add( m_buttonMove, 0, wxALL, 5 );
|
|
174 m_buttonMove->Enable(false);
|
1
|
175 m_buttonDetect = new wxButton( this, ID_BUTTONDETECT, wxT("検知"), wxDefaultPosition, wxDefaultSize, 0 );
|
21
|
176 gSizer->Add( m_buttonDetect, 0, wxALL, 5 );
|
5
|
177
|
0
|
178 m_buttonDel = new wxButton( this, ID_BUTTONDEL, wxT("削除"), wxDefaultPosition, wxDefaultSize, 0 );
|
21
|
179 gSizer->Add( m_buttonDel, 0, wxALL, 5 );
|
0
|
180 m_buttonUndo = new wxButton( this, ID_BUTTONUNDO, wxT("戻す"), wxDefaultPosition, wxDefaultSize, 0 );
|
21
|
181 gSizer->Add( m_buttonUndo, 0, wxALL, 5 );
|
4
|
182 m_buttonUndo->Enable(false);
|
21
|
183
|
|
184 bSizerButton->Add( gSizer, 0, wxALL, 5 );
|
|
185
|
27
|
186 m_listCtrlHhsDir = new wxListCtrl( this, ID_LISTCTRLDIR, wxDefaultPosition, wxSize(280,-1), wxLC_REPORT|wxLC_SINGLE_SEL );
|
21
|
187 wxListItem itemCol;
|
|
188 itemCol.SetText( wxT("通番") );
|
26
|
189 m_listCtrlHhsDir->InsertColumn( 0, itemCol );
|
27
|
190 m_listCtrlHhsDir->SetColumnWidth( 0, 40 );
|
21
|
191 itemCol.SetText( wxT("被保険者番号") );
|
26
|
192 m_listCtrlHhsDir->InsertColumn( 1, itemCol );
|
27
|
193 m_listCtrlHhsDir->SetColumnWidth( 1, 90 );
|
|
194 itemCol.SetText( wxT("枚数") );
|
26
|
195 m_listCtrlHhsDir->InsertColumn( 2, itemCol );
|
27
|
196 m_listCtrlHhsDir->SetColumnWidth( 2, 40 );
|
|
197 itemCol.SetText( wxT("氏名") );
|
|
198 m_listCtrlHhsDir->InsertColumn( 3, itemCol );
|
|
199 m_listCtrlHhsDir->SetColumnWidth( 3, 90 );
|
21
|
200
|
26
|
201 bSizerButton->Add( m_listCtrlHhsDir, 1, wxEXPAND|wxALL, 5 );
|
0
|
202
|
21
|
203 bSizerManip->Add( bSizerButton, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
204
|
|
205 bSizerTop->Add( bSizerManip, 1, wxEXPAND, 5 );
|
|
206
|
|
207 this->SetSizer( bSizerTop );
|
|
208 this->Layout();
|
|
209
|
|
210 // ステータスバー
|
24
|
211 int widths[] = { 250, 250, -1, 120 };
|
0
|
212 m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP );
|
|
213 m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths );
|
|
214 m_statusBar->SetStatusText( wxEmptyString, 0 );
|
|
215
|
|
216 this->Centre( wxBOTH );
|
35
|
217
|
|
218 autodetect_mode = true;
|
11
|
219 m_timer.SetOwner( this, ID_TIMER );
|
35
|
220
|
|
221 pd = new wxProgressDialog( wxT("進行状況"), wxT("処理開始..."), 100, this, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
|
|
222 pd->SetSize( wxSize(320,140) );
|
|
223 pd->Update( 100, wxEmptyString );
|
0
|
224 }
|
|
225
|
|
226 // destructor
|
|
227 MyFrame::~MyFrame()
|
|
228 {
|
|
229 }
|
|
230
|
|
231 // Event Table
|
|
232 BEGIN_EVENT_TABLE( MyFrame, wxFrame )
|
11
|
233 EVT_IDLE( MyFrame::OnIdle )
|
|
234 EVT_TIMER( ID_TIMER, MyFrame::OnTimer )
|
1
|
235 EVT_SIZE( MyFrame::OnWinSize )
|
|
236 EVT_MOVE( MyFrame::OnWinMove )
|
29
|
237 EVT_MENU( ID_MENUITEMDETECT, MyFrame::OnDetect )
|
|
238 EVT_MENU( ID_MENUITEMMOVE, MyFrame::OnMove )
|
35
|
239 EVT_MENU( ID_MENUITEMAUTOD, MyFrame::ToggleAutoDetect )
|
8
|
240 EVT_MENU( ID_MENUITEMPARAM, MyFrame::OnParam )
|
|
241 EVT_MENU( ID_MENUITEMAPPDIR, MyFrame::OnOpenAppDir )
|
|
242 EVT_MENU( wxID_EXIT, MyFrame::OnQuit )
|
23
|
243 EVT_LIST_ITEM_SELECTED( ID_LISTCTRLVIEW, MyFrame::OnItemSelected )
|
|
244 EVT_LIST_ITEM_DESELECTED( ID_LISTCTRLVIEW, MyFrame::OnItemDeselected )
|
|
245 EVT_LIST_ITEM_ACTIVATED( ID_LISTCTRLVIEW, MyFrame::ViewLarge )
|
8
|
246 EVT_BUTTON( ID_BUTTONNEXTTHU, MyFrame::OnNextThursday )
|
|
247 EVT_BUTTON( ID_BUTTONMKDIR, MyFrame::OnMakeDir )
|
|
248 EVT_BUTTON( ID_BUTTONDETECT, MyFrame::OnDetect )
|
|
249 EVT_BUTTON( ID_BUTTONMOVE, MyFrame::OnMove )
|
|
250 EVT_BUTTON( ID_BUTTONDEL, MyFrame::OnDelete )
|
|
251 EVT_BUTTON( ID_BUTTONUNDO, MyFrame::OnUndo )
|
21
|
252 EVT_LIST_ITEM_ACTIVATED( ID_LISTCTRLDIR, MyFrame::OnOpenHhsDir )
|
0
|
253 EVT_CLOSE( MyFrame::SaveConfig )
|
|
254 END_EVENT_TABLE()
|
|
255
|
30
|
256 // Event Handlers & Functions
|
37
|
257 /* 自動検知 ON/OFF */
|
35
|
258 void MyFrame::ToggleAutoDetect(wxCommandEvent& event)
|
|
259 {
|
|
260 if ( event.IsChecked() ) autodetect_mode = true;
|
|
261 else autodetect_mode = false;
|
|
262 }
|
|
263
|
30
|
264 void MyFrame::GetCCnArrayInfo(wxArrayString& array , int n, wxString& nName, wxString& nDir)
|
|
265 {
|
|
266 if ( n == -1 ) {
|
|
267 array.Add(wxT("角館1")); array.Add(wxT("角館2")); array.Add(wxT("角館3")); array.Add(wxT("角館4"));
|
|
268 array.Add(wxT("西仙1")); array.Add(wxT("西仙2")); array.Add(wxT("西仙3"));
|
|
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")); array.Add(wxT("大曲4")); array.Add(wxT("大曲5")); array.Add(wxT("大曲6"));
|
|
271 array.Add(wxT("六郷1")); array.Add(wxT("六郷2")); array.Add(wxT("六郷3"));
|
|
272 }
|
|
273 else {
|
|
274 wxArrayString ccndir;
|
|
275 ccndir.Add(wxT("0000000031")); ccndir.Add(wxT("0000000032")); ccndir.Add(wxT("0000000033")); ccndir.Add(wxT("0000000034"));
|
|
276 ccndir.Add(wxT("0000000021")); ccndir.Add(wxT("0000000022")); ccndir.Add(wxT("0000000023"));
|
|
277 ccndir.Add(wxT("0000000041")); ccndir.Add(wxT("0000000042")); ccndir.Add(wxT("0000000043"));
|
|
278 ccndir.Add(wxT("0000000001")); ccndir.Add(wxT("0000000002")); ccndir.Add(wxT("0000000003")); ccndir.Add(wxT("0000000004")); ccndir.Add(wxT("0000000005")); ccndir.Add(wxT("0000000006"));
|
|
279 ccndir.Add(wxT("00000000x1")); ccndir.Add(wxT("00000000x2")); ccndir.Add(wxT("00000000x3"));
|
|
280 nDir = ccndir[n];
|
|
281 }
|
|
282 }
|
8
|
283 /* 次の木曜日 */
|
|
284 void MyFrame::OnNextThursday(wxCommandEvent& WXUNUSED(event))
|
|
285 {
|
|
286 wxDateTime dt = m_datePicker->GetValue();
|
|
287 wxDateSpan ds( 0, 0, 0, 1 );
|
|
288 dt += ds;
|
|
289 dt.SetToNextWeekDay( wxDateTime::Thu );
|
|
290 m_datePicker->SetValue( dt );
|
|
291 }
|
|
292
|
0
|
293 /* 移動先フォルダ作成 */
|
3
|
294 void MyFrame::OnMakeDir(wxCommandEvent& WXUNUSED(event))
|
0
|
295 {
|
1
|
296 wxString to;
|
30
|
297 to.Append( m_comboBoxDrive->GetValue() ); // C:
|
|
298 to.Append( wxFILE_SEP_PATH ); // C:/
|
|
299 wxDateTime dt = m_datePicker->GetValue();
|
|
300 wxString month = dt.Format(wxT("%m"));
|
|
301 wxString year = dt.Format(wxT("%Y"));
|
|
302 if ( month.IsSameAs(wxT("01")) || month.IsSameAs(wxT("02")) || month.IsSameAs(wxT("03")) ) {
|
|
303 long y;
|
|
304 year.ToLong( &y, 10 );
|
|
305 y--;
|
|
306 year = wxString::Format(wxT("%d"),y);
|
|
307 }
|
|
308 to.Append( year ); // C:/20xx
|
|
309 to.Append( wxFILE_SEP_PATH ); // C:/20xx/
|
|
310 to.Append( dt.Format(wxT("%Y%m%d")) ); // C:/20xx/20yymmdd
|
|
311 to.Append( wxFILE_SEP_PATH ); // C:/20xx/20yymmdd/
|
|
312 to.Append( m_comboBoxCcn->GetValue() ); // C:/20xx/20yymmdd/XXN
|
1
|
313 m_textCtrlDist->SetValue( to );
|
|
314
|
0
|
315 wxString ccn = m_comboBoxCcn->GetValue();
|
1
|
316 if ( to.Len() < 15 || ccn.IsEmpty() ) {
|
0
|
317 wxMessageBox(wxT("フォルダを指定してください."));
|
|
318 return;
|
|
319 }
|
|
320
|
30
|
321 // いったんバラして,各階層のフォルダがあるかチェック.なければ作成
|
1
|
322 wxStringTokenizer tkz( to, wxFILE_SEP_PATH );
|
0
|
323 wxString d;
|
|
324 while ( tkz.HasMoreTokens() ) {
|
|
325 d.Append( tkz.GetNextToken() );
|
|
326 d.Append( wxFILE_SEP_PATH );
|
|
327 if ( !wxDirExists( d ) ) wxMkdir( d );
|
|
328 }
|
|
329
|
30
|
330 // 申請書フォルダ作成
|
|
331 int n = m_comboBoxCcn->GetCurrentSelection();
|
|
332 wxString ccndir, dummy; wxArrayString array;
|
|
333 GetCCnArrayInfo( array, n, dummy, ccndir );
|
|
334 d.Append( ccndir );
|
|
335 d.Append( wxFILE_SEP_PATH );
|
|
336 if ( !wxDirExists( d ) ) wxMkdir( d );
|
|
337
|
|
338 m_buttonMove->Enable(true);
|
35
|
339 m_listCtrlHhsDir->DeleteAllItems();
|
11
|
340
|
0
|
341 wxMessageBox(wxT("移動先フォルダ準備完了"));
|
1
|
342 wxString cmd = wxT("explorer ") + to;
|
0
|
343 wxExecute( cmd );
|
|
344 }
|
37
|
345
|
1
|
346 /* 検知 */
|
|
347 void MyFrame::OnDetect(wxCommandEvent& WXUNUSED(event))
|
|
348 {
|
35
|
349 by_autodetect = false;
|
29
|
350 UpdateCache();
|
35
|
351 ClearGuess();
|
29
|
352 UpdateListImage();
|
26
|
353 }
|
35
|
354 void MyFrame::ClearGuess()
|
|
355 {
|
|
356 // start-up iamge
|
|
357 wxString notfound = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("notfound.png");
|
|
358 wxBitmap bmp = wxBitmap( notfound, wxBITMAP_TYPE_PNG );
|
|
359 m_bitmapName->SetBitmap( bmp );
|
|
360 notfound = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("0000000000.png");
|
|
361 bmp.LoadFile( notfound, wxBITMAP_TYPE_PNG );
|
|
362 m_bitmapHhsno->SetBitmap( bmp );
|
|
363 }
|
26
|
364
|
|
365 /* 移動 */
|
|
366 void MyFrame::OnMove(wxCommandEvent& WXUNUSED(event))
|
|
367 {
|
29
|
368 wxString distdir = m_textCtrlDist->GetValue();
|
|
369 if ( distdir.IsEmpty() ) return;
|
|
370
|
|
371 MoveImages();
|
|
372 UpdateCache();
|
35
|
373 ClearGuess();
|
29
|
374 UpdateListImage();
|
|
375 ListHhsDir();
|
|
376 m_buttonUndo->Enable(true);
|
1
|
377 }
|
5
|
378
|
4
|
379 /* 選択したファイルを移動 */
|
26
|
380 void MyFrame::MoveImages()
|
4
|
381 {
|
|
382 m_undo.Clear();
|
|
383 wxString workdir = m_dirPickerWork->GetPath();
|
|
384 wxString distdir = m_textCtrlDist->GetValue();
|
35
|
385 wxString hhsno = m_textCtrlGuess->GetValue();
|
|
386
|
|
387 wxString hhsdir = distdir + wxFILE_SEP_PATH + hhsno;
|
|
388 if ( !wxDirExists( hhsdir ) ) {
|
|
389 wxMkdir( hhsdir );
|
|
390 wxGetApp().WriteLog( wxT("created distination directory - ") + hhsdir );
|
|
391 }
|
|
392 else {
|
|
393 wxGetApp().WriteLog( wxT("set distination directory - ") + hhsdir );
|
|
394 }
|
26
|
395
|
|
396 m_hhsList.Remove(hhsno);
|
|
397 m_hhsList.Add(hhsno);
|
4
|
398 long item = -1;
|
|
399 for ( ;; ) {
|
|
400 item = m_listCtrlView->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
401 if ( item == -1 ) break;
|
5
|
402
|
35
|
403 wxString file = m_listCtrlView->GetItemText( item );
|
4
|
404 wxString from = workdir + wxFILE_SEP_PATH + file;
|
35
|
405 wxString to = hhsdir + wxFILE_SEP_PATH + file;
|
4
|
406 wxRenameFile( from, to, true );
|
35
|
407 wxGetApp().WriteLog( wxT("moved : ") + file );
|
12
|
408
|
37
|
409 m_undo.Insert( to, 0 );
|
4
|
410 }
|
|
411 }
|
|
412 /* 選択したファイルを削除 */
|
|
413 void MyFrame::OnDelete(wxCommandEvent& WXUNUSED(event))
|
|
414 {
|
|
415 m_undo.Clear();
|
|
416 wxString workdir = m_dirPickerWork->GetPath();
|
|
417 wxString trash = wxGetCwd() + wxFILE_SEP_PATH + wxT("trash");
|
|
418 long item = -1;
|
|
419 for ( ;; ) {
|
|
420 item = m_listCtrlView->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
421 if ( item == -1 ) break;
|
|
422 wxString file = m_listCtrlView->GetItemText( item );
|
|
423 wxString from = workdir + wxFILE_SEP_PATH + file;
|
|
424 wxString to = trash + wxFILE_SEP_PATH + file;
|
|
425 wxRenameFile( from, to, true );
|
35
|
426 wxGetApp().WriteLog( wxT("deleted : ") + file );
|
12
|
427
|
37
|
428 m_undo.Insert( to, 0 );
|
4
|
429 }
|
37
|
430
|
12
|
431 UpdateCache();
|
35
|
432 ClearGuess();
|
12
|
433 UpdateListImage();
|
4
|
434 m_buttonUndo->Enable(true);
|
|
435 }
|
|
436 /* アンドゥ */
|
|
437 void MyFrame::OnUndo(wxCommandEvent& WXUNUSED(event))
|
|
438 {
|
37
|
439 wxString workdir = m_dirPickerWork->GetPath();
|
4
|
440 for ( int i=0; i<m_undo.GetCount(); i++ ) {
|
37
|
441 wxFileName file( m_undo[i] );
|
|
442 wxString to = workdir + wxFILE_SEP_PATH + file.GetFullName();
|
|
443 wxRenameFile( m_undo[i], to, true );
|
4
|
444 }
|
|
445 wxMessageBox(wxT("戻し完了."));
|
|
446 m_buttonUndo->Enable(false);
|
|
447 m_undo.Clear();
|
12
|
448 UpdateCache();
|
|
449 UpdateListImage();
|
26
|
450 ListHhsDir();
|
4
|
451 }
|
0
|
452
|
|
453 /* 画像をリストコントロールに表示 */
|
12
|
454 void MyFrame::UpdateListImage()
|
0
|
455 {
|
35
|
456 if ( !cache_changed && by_autodetect ) return;
|
0
|
457
|
12
|
458 // 本処理
|
0
|
459 m_listCtrlView->DeleteAllItems();
|
|
460 m_imageList->RemoveAll();
|
|
461 wxListItem item;
|
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;
|
|
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 ( ;; ) {
|
|
535 i = m_listCtrlView->GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
536 if ( i == -1 ) break;
|
|
537 m_listCtrlView->SetItemImage( i, i+m_listCtrlView->GetItemCount() );
|
|
538 }
|
|
539
|
35
|
540 by_autodetect = false;
|
4
|
541 SetStatusText( wxEmptyString, 2 );
|
0
|
542 }
|
|
543
|
23
|
544 /* 画像を選択したとき画像の情報をステータスバーに表示 */
|
|
545 void MyFrame::OnItemSelected(wxListEvent& event)
|
1
|
546 {
|
23
|
547 int i = event.GetIndex();
|
34
|
548 int m = m_listCtrlView->GetSelectedItemCount();
|
|
549 m_listCtrlView->SetItemImage( i, i+m ); // 青い画像
|
23
|
550
|
34
|
551 if ( m != 1 ) {
|
|
552 SetStatusText( wxString::Format(wxT("%d files selected."),m), 2 );
|
|
553 return;
|
|
554 }
|
2
|
555
|
3
|
556 wxString filename = event.GetText();
|
13
|
557 CacheItem* ci = new CacheItem;
|
|
558 ci = CH[filename];
|
3
|
559 wxString msg;
|
13
|
560 if ( ci->marksheet ) msg = wxT("perhaps marksheet !");
|
|
561 SetStatusText( wxString::Format(wxT("selected image : z = %f, l = %d ...")+msg, ci->z, ci->l ), 2 );
|
2
|
562 }
|
23
|
563 void MyFrame::OnItemDeselected(wxListEvent& event)
|
|
564 {
|
|
565 int i = event.GetIndex();
|
|
566 m_listCtrlView->SetItemImage( i, i );
|
34
|
567 SetStatusText( wxString::Format(wxT("%d files selected."),m_listCtrlView->GetSelectedItemCount()), 2 );
|
23
|
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 );
|
35
|
680 m_timer.Start( 2*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() );
|
|
722 wxString execmd = wxT("explorer ") + hhsdir;
|
|
723 wxExecute( execmd );
|
|
724 }
|
|
725
|
32
|
726 /* 以下,定型もの ***********************************************/
|
11
|
727 void MyFrame::OnTimer(wxTimerEvent& event)
|
|
728 {
|
35
|
729 if ( !autodetect_mode ) return;
|
|
730 by_autodetect = true;
|
11
|
731 UpdateCache();
|
35
|
732 UpdateListImage();
|
11
|
733 }
|
26
|
734
|
11
|
735 /* アイドリング */
|
|
736 void MyFrame::OnIdle(wxIdleEvent& event)
|
|
737 {
|
|
738 if ( !m_timer.IsRunning() ) {
|
|
739 m_timer.Start( 20*1000, wxTIMER_ONE_SHOT );
|
|
740 }
|
|
741 event.RequestMore();
|
|
742 event.Skip();
|
|
743 }
|
|
744
|
0
|
745 /* アプリフォルダを開く */
|
|
746 void MyFrame::OnOpenAppDir(wxCommandEvent& WXUNUSED(event))
|
|
747 {
|
5
|
748 wxString appdir = wxGetCwd();
|
0
|
749 wxString execmd = wxT("explorer ") + appdir;
|
|
750 wxExecute( execmd );
|
|
751 }
|
|
752
|
|
753 /* サイズ変更 */
|
1
|
754 void MyFrame::OnWinSize(wxSizeEvent& event)
|
0
|
755 {
|
|
756 this->Refresh( true, NULL );
|
|
757 TellLocation();
|
|
758 event.Skip();
|
|
759 }
|
|
760 /* ウィンドウ移動 */
|
1
|
761 void MyFrame::OnWinMove(wxMoveEvent& WXUNUSED(event))
|
0
|
762 {
|
|
763 TellLocation();
|
|
764 return;
|
|
765 }
|
|
766 /* ウィンドウ位置とサイズを表示 */
|
|
767 void MyFrame::TellLocation( void )
|
|
768 {
|
|
769 wxRect r = this->GetRect();
|
|
770 int x = r.GetX();
|
|
771 int y = r.GetY();
|
|
772 int w = r.GetWidth();
|
|
773 int h = r.GetHeight();
|
1
|
774 SetStatusText( wxString::Format(wxT("(%d,%d) %dx%d"),x,y,w,h), 3 );
|
0
|
775 }
|
|
776 /* 終了 */
|
|
777 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|
778 {
|
|
779 Close(true);
|
|
780 }
|
|
781 /* 設定を保存 */
|
|
782 void MyFrame::SaveConfig(wxCloseEvent& WXUNUSED(event))
|
|
783 {
|
|
784 if ( !IsIconized() && !IsMaximized() ) {
|
|
785 wxGetApp().rect = this->GetRect();
|
|
786 }
|
|
787 wxGetApp().workdir = m_dirPickerWork->GetPath();
|
|
788
|
|
789 Destroy();
|
|
790 }
|
|
791
|