0
|
1 // Filename : myframe.cpp
|
5
|
2 // Last Change: 18-Oct-2011.
|
0
|
3 //
|
|
4
|
|
5 #include "main.h"
|
|
6 #include "myframe.h"
|
5
|
7 #include "param.h"
|
1
|
8 #include "marksheet.h"
|
0
|
9
|
5
|
10 // resources
|
|
11 // the application icon (under Windows and OS/2 it is in resources and even
|
|
12 // though we could still include the XPM here it would be unused)
|
|
13 #if !defined(__WXMSW__) && !defined(__WXPM__)
|
|
14 #include "sample.xpm"
|
|
15 #endif
|
|
16
|
0
|
17 //////////////////////////////////////////////////////////////////////////
|
|
18 // frame constructor
|
|
19 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
|
|
20 {
|
|
21 this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
|
|
22 // set the frame icon
|
5
|
23 SetIcon(wxICON(sample));
|
0
|
24
|
|
25 // メニューバー
|
|
26 m_menubarFile = new wxMenuBar();
|
|
27 m_menuFile = new wxMenu();
|
|
28 wxMenuItem* m_menuItemParam;
|
|
29 m_menuItemParam = new wxMenuItem( m_menuFile, ID_MENUITEMPARAM, wxString( wxT("パラメータ(&P)") ) , wxEmptyString, wxITEM_NORMAL );
|
|
30 m_menuFile->Append( m_menuItemParam );
|
|
31
|
|
32 wxMenuItem* m_menuItemAppDIr;
|
|
33 m_menuItemAppDIr = new wxMenuItem( m_menuFile, ID_MENUITEMAPPDIR, wxString( wxT("アプリフォルダを開く(&O)") ) , wxEmptyString, wxITEM_NORMAL );
|
|
34 m_menuFile->Append( m_menuItemAppDIr );
|
|
35
|
|
36 wxMenuItem* m_separator;
|
|
37 m_separator = m_menuFile->AppendSeparator(); // ----
|
|
38
|
|
39 wxMenuItem* m_menuItemQuit;
|
|
40 m_menuItemQuit = new wxMenuItem( m_menuFile, ID_MENUITEMQUIT, wxString( wxT("終了(&X)") ) , wxEmptyString, wxITEM_NORMAL );
|
|
41 m_menuFile->Append( m_menuItemQuit );
|
|
42
|
|
43 m_menubarFile->Append( m_menuFile, wxT("ファイル(&F)") );
|
|
44
|
|
45 this->SetMenuBar( m_menubarFile );
|
|
46
|
|
47 // コントロール
|
|
48 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
|
|
49
|
|
50 wxBoxSizer* bSizerFrom = new wxBoxSizer( wxHORIZONTAL );
|
|
51
|
|
52 m_staticTextWork = new wxStaticText( this, wxID_ANY, wxT("作業フォルダ"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
53 bSizerFrom->Add( m_staticTextWork, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
54
|
|
55 m_dirPickerWork = new wxDirPickerCtrl( this, wxID_ANY, wxGetApp().workdir, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE );
|
|
56 bSizerFrom->Add( m_dirPickerWork, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
57
|
|
58 bSizerTop->Add( bSizerFrom, 0, wxEXPAND, 5 );
|
|
59
|
1
|
60 wxBoxSizer* bSizerDist = new wxBoxSizer( wxHORIZONTAL );
|
|
61
|
|
62 m_staticTextDist = new wxStaticText( this, wxID_ANY, wxT("保存フォルダ"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
63 bSizerDist->Add( m_staticTextDist, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
64
|
|
65 m_textCtrlDist = new wxTextCtrl( this, ID_TEXTCTRLDIST, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
66 m_textCtrlDist->SetMaxLength( 15 );
|
|
67 bSizerDist->Add( m_textCtrlDist, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
68 bSizerDist->Add( 0, 0, 1, wxEXPAND, 5 );
|
0
|
69
|
|
70 m_staticTextDrive = new wxStaticText( this, wxID_ANY, wxT("ドライブ"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
71 bSizerDist->Add( m_staticTextDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
72
|
|
73 wxArrayString drives;
|
|
74 drives.Add(wxT("C:"));
|
|
75 drives.Add(wxT("Y:"));
|
|
76 drives.Add(wxT("Z:"));
|
|
77 m_comboBoxDrive = new wxComboBox( this, wxID_ANY, wxT("C:"), wxDefaultPosition, wxSize(50,-1), drives, 0 );
|
1
|
78 bSizerDist->Add( m_comboBoxDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
79
|
|
80 m_staticTextDate = new wxStaticText( this, wxID_ANY, wxT("開催日"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
81 bSizerDist->Add( m_staticTextDate, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
82
|
|
83 m_datePicker = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
|
1
|
84 bSizerDist->Add( m_datePicker, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
85
|
|
86 m_staticTextCcn = new wxStaticText( this, wxID_ANY, wxT("合議体"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
87 bSizerDist->Add( m_staticTextCcn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
88
|
|
89 wxArrayString ccns;
|
|
90 ccns.Add(wxT("角館1")); ccns.Add(wxT("角館2")); ccns.Add(wxT("角館3")); ccns.Add(wxT("角館4"));
|
|
91 ccns.Add(wxT("西仙1")); ccns.Add(wxT("西仙2")); ccns.Add(wxT("西仙3"));
|
|
92 ccns.Add(wxT("千畑1")); ccns.Add(wxT("千畑2")); ccns.Add(wxT("千畑3"));
|
|
93 ccns.Add(wxT("大曲1")); ccns.Add(wxT("大曲2")); ccns.Add(wxT("大曲3")); ccns.Add(wxT("大曲4")); ccns.Add(wxT("大曲5")); ccns.Add(wxT("大曲6"));
|
|
94 ccns.Add(wxT("六郷1")); ccns.Add(wxT("六郷2")); ccns.Add(wxT("六郷3"));
|
|
95 m_comboBoxCcn = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(100,-1), ccns, 0 );
|
1
|
96 bSizerDist->Add( m_comboBoxCcn, 0, wxALL, 5 );
|
0
|
97
|
|
98 m_buttonMkDir = new wxButton( this, ID_BUTTONMKDIR, wxT("適用"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
99 bSizerDist->Add( m_buttonMkDir, 0, wxALL, 5 );
|
0
|
100
|
|
101 bSizerTop->Add( bSizerDist, 0, wxEXPAND, 5 );
|
|
102
|
|
103 wxBoxSizer* bSizerManip = new wxBoxSizer( wxHORIZONTAL );
|
|
104
|
|
105 wxBoxSizer* bSizerGuess = new wxBoxSizer( wxVERTICAL );
|
|
106
|
|
107 m_staticTextName = new wxStaticText( this, wxID_ANY, wxT("氏名"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
108 bSizerGuess->Add( m_staticTextName, 0, wxTOP|wxLEFT, 5 );
|
4
|
109 wxString logo = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("logo.png");
|
|
110 wxBitmap bmp = wxBitmap( logo, wxBITMAP_TYPE_PNG );
|
|
111 m_bitmapName = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize(320,95), 0 );
|
0
|
112 bSizerGuess->Add( m_bitmapName, 0, wxALL, 5 );
|
|
113
|
|
114 m_staticTextHhsno = new wxStaticText( this, wxID_ANY, wxT("被保険者番号"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
115 bSizerGuess->Add( m_staticTextHhsno, 0, wxTOP|wxLEFT, 5 );
|
4
|
116 logo = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("0123456789.png");
|
|
117 bmp.LoadFile( logo, wxBITMAP_TYPE_PNG );
|
|
118 m_bitmapHhsno = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize(320,54), 0 );
|
|
119 bSizerGuess->Add( m_bitmapHhsno, 0, wxALL, 5 );
|
0
|
120
|
|
121 m_staticTextGuess = new wxStaticText( this, wxID_ANY, wxT("推定値"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
122 bSizerGuess->Add( m_staticTextGuess, 0, wxTOP|wxLEFT, 5 );
|
0
|
123 m_textCtrlGuess = new wxTextCtrl( this, ID_TEXTCTRLGUESS, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
124 m_textCtrlGuess->SetMaxLength( 10 );
|
|
125 bSizerGuess->Add( m_textCtrlGuess, 0, wxALL, 5 );
|
|
126
|
|
127 bSizerManip->Add( bSizerGuess, 0, wxEXPAND, 5 );
|
|
128
|
|
129 m_listCtrlView = new wxListCtrl( this, ID_LISTCTRLVIEW, wxDefaultPosition, wxDefaultSize, wxLC_ICON );
|
1
|
130 m_listCtrlView->SetBackgroundColour(wxT("LIGHT GREY"));
|
0
|
131 bSizerManip->Add( m_listCtrlView, 1, wxALL|wxEXPAND, 5 );
|
5
|
132 m_imageList = new wxImageList( 160, 226 );
|
0
|
133 m_listCtrlView->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL );
|
|
134
|
|
135 wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL );
|
|
136
|
1
|
137 m_buttonDetect = new wxButton( this, ID_BUTTONDETECT, wxT("検知"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
138 bSizerButton->Add( m_buttonDetect, 0, wxALL, 5 );
|
0
|
139 m_buttonMove = new wxButton( this, ID_BUTTONMOVE, wxT("移動"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
140 bSizerButton->Add( m_buttonMove, 0, wxALL, 5 );
|
4
|
141 m_buttonMove->Enable(false);
|
5
|
142
|
0
|
143 m_buttonDel = new wxButton( this, ID_BUTTONDEL, wxT("削除"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
144 bSizerButton->Add( m_buttonDel, 0, wxALL, 5 );
|
|
145 m_buttonUndo = new wxButton( this, ID_BUTTONUNDO, wxT("戻す"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
146 bSizerButton->Add( m_buttonUndo, 0, wxALL, 5 );
|
4
|
147 m_buttonUndo->Enable(false);
|
0
|
148
|
|
149 bSizerManip->Add( bSizerButton, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
|
150
|
|
151 bSizerTop->Add( bSizerManip, 1, wxEXPAND, 5 );
|
|
152
|
|
153 this->SetSizer( bSizerTop );
|
|
154 this->Layout();
|
|
155
|
|
156 // ステータスバー
|
3
|
157 int widths[] = { 150, 250, -1, 120 };
|
0
|
158 m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP );
|
|
159 m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths );
|
|
160 m_statusBar->SetStatusText( wxEmptyString, 0 );
|
|
161
|
|
162 this->Centre( wxBOTH );
|
|
163 }
|
|
164
|
|
165 // destructor
|
|
166 MyFrame::~MyFrame()
|
|
167 {
|
|
168 }
|
|
169
|
|
170 // Event Table
|
|
171 BEGIN_EVENT_TABLE( MyFrame, wxFrame )
|
1
|
172 EVT_SIZE( MyFrame::OnWinSize )
|
|
173 EVT_MOVE( MyFrame::OnWinMove )
|
|
174 EVT_MENU( ID_MENUITEMPARAM, MyFrame::OnParam )
|
|
175 EVT_MENU( ID_MENUITEMAPPDIR, MyFrame::OnOpenAppDir )
|
|
176 EVT_MENU( wxID_EXIT, MyFrame::OnQuit )
|
3
|
177 EVT_BUTTON( ID_BUTTONMKDIR, MyFrame::OnMakeDir )
|
1
|
178 EVT_BUTTON( ID_BUTTONDETECT, MyFrame::OnDetect )
|
|
179 EVT_BUTTON( ID_BUTTONMOVE, MyFrame::OnMove )
|
4
|
180 EVT_BUTTON( ID_BUTTONDEL, MyFrame::OnDelete )
|
|
181 EVT_BUTTON( ID_BUTTONUNDO, MyFrame::OnUndo )
|
3
|
182 EVT_LIST_ITEM_SELECTED( ID_LISTCTRLVIEW, MyFrame::GetImageInfo )
|
|
183 EVT_LIST_ITEM_ACTIVATED( ID_LISTCTRLVIEW, MyFrame::ViewLarge )
|
0
|
184 EVT_CLOSE( MyFrame::SaveConfig )
|
|
185 END_EVENT_TABLE()
|
|
186
|
|
187 // Event Handlers
|
|
188 /* 移動先フォルダ作成 */
|
3
|
189 void MyFrame::OnMakeDir(wxCommandEvent& WXUNUSED(event))
|
0
|
190 {
|
1
|
191 wxString to;
|
|
192 to.Append( m_comboBoxDrive->GetValue() );
|
|
193 to.Append( wxFILE_SEP_PATH );
|
|
194 wxDateTime dt = m_datePicker->GetValue();
|
|
195 to.Append( dt.Format(wxT("%Y%m%d")) );
|
|
196 to.Append( wxFILE_SEP_PATH );
|
|
197 to.Append( m_comboBoxCcn->GetValue() );
|
|
198 m_textCtrlDist->SetValue( to );
|
|
199
|
0
|
200 wxString ccn = m_comboBoxCcn->GetValue();
|
1
|
201 if ( to.Len() < 15 || ccn.IsEmpty() ) {
|
0
|
202 wxMessageBox(wxT("フォルダを指定してください."));
|
|
203 return;
|
|
204 }
|
|
205
|
1
|
206 wxStringTokenizer tkz( to, wxFILE_SEP_PATH );
|
0
|
207 wxString d;
|
|
208 while ( tkz.HasMoreTokens() ) {
|
|
209 d.Append( tkz.GetNextToken() );
|
|
210 d.Append( wxFILE_SEP_PATH );
|
|
211 if ( !wxDirExists( d ) ) wxMkdir( d );
|
|
212 }
|
4
|
213 m_buttonMove->Enable(true);
|
0
|
214
|
|
215 wxMessageBox(wxT("移動先フォルダ準備完了"));
|
1
|
216 wxString cmd = wxT("explorer ") + to;
|
0
|
217 wxExecute( cmd );
|
|
218 }
|
1
|
219 /* 検知 */
|
|
220 void MyFrame::OnDetect(wxCommandEvent& WXUNUSED(event))
|
|
221 {
|
|
222 ReadyImage();
|
|
223 }
|
5
|
224
|
4
|
225 /* 選択したファイルを移動 */
|
5
|
226 void MyFrame::OnMove(wxCommandEvent& WXUNUSED(event))
|
4
|
227 {
|
|
228 m_undo.Clear();
|
|
229 wxString workdir = m_dirPickerWork->GetPath();
|
|
230 wxString distdir = m_textCtrlDist->GetValue();
|
|
231 long item = -1;
|
|
232 for ( ;; ) {
|
|
233 item = m_listCtrlView->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
234 if ( item == -1 ) break;
|
5
|
235 wxString hhsno = m_textCtrlGuess->GetValue();
|
|
236 if ( !wxDirExists( distdir + wxFILE_SEP_PATH + hhsno ) ) wxMkdir( distdir + wxFILE_SEP_PATH + hhsno );
|
|
237
|
|
238 wxString file = m_listCtrlView->GetItemText( item );
|
4
|
239 wxString from = workdir + wxFILE_SEP_PATH + file;
|
5
|
240 wxString to = distdir + wxFILE_SEP_PATH + hhsno + wxFILE_SEP_PATH + file;
|
4
|
241 wxRenameFile( from, to, true );
|
5
|
242 m_undo.Insert( wxT("move ") + to + wxT(" ") + from, 0 );
|
4
|
243 }
|
|
244 ReadyImage();
|
|
245 m_buttonUndo->Enable(true);
|
|
246 }
|
|
247 /* 選択したファイルを削除 */
|
|
248 void MyFrame::OnDelete(wxCommandEvent& WXUNUSED(event))
|
|
249 {
|
|
250 m_undo.Clear();
|
|
251 wxString workdir = m_dirPickerWork->GetPath();
|
|
252 wxString trash = wxGetCwd() + wxFILE_SEP_PATH + wxT("trash");
|
|
253 long item = -1;
|
|
254 for ( ;; ) {
|
|
255 item = m_listCtrlView->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
256 if ( item == -1 ) break;
|
|
257 wxString file = m_listCtrlView->GetItemText( item );
|
|
258 wxString from = workdir + wxFILE_SEP_PATH + file;
|
|
259 wxString to = trash + wxFILE_SEP_PATH + file;
|
|
260 wxRenameFile( from, to, true );
|
5
|
261 m_undo.Insert( wxT("move ") + to + wxT(" ") + from, 0 );
|
4
|
262 }
|
|
263 ReadyImage();
|
|
264 m_buttonUndo->Enable(true);
|
|
265 }
|
|
266 /* アンドゥ */
|
|
267 void MyFrame::OnUndo(wxCommandEvent& WXUNUSED(event))
|
|
268 {
|
|
269 for ( int i=0; i<m_undo.GetCount(); i++ ) {
|
|
270 wxExecute( m_undo[i] );
|
|
271 }
|
|
272 wxMessageBox(wxT("戻し完了."));
|
|
273 m_buttonUndo->Enable(false);
|
|
274 m_undo.Clear();
|
|
275 ReadyImage();
|
|
276 }
|
0
|
277
|
|
278 /* 画像をリストコントロールに表示 */
|
|
279 void MyFrame::ReadyImage()
|
|
280 {
|
|
281 wxString workdir = m_dirPickerWork->GetPath();
|
|
282 wxDir dir( workdir );
|
|
283 if ( !dir.IsOpened() ) return;
|
4
|
284 wxString notfound = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("notfound.png");
|
|
285 wxBitmap bmp = wxBitmap( notfound, wxBITMAP_TYPE_PNG );
|
|
286 m_bitmapName->SetBitmap( bmp );
|
|
287 notfound = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("0000000000.png");
|
|
288 bmp.LoadFile( notfound, wxBITMAP_TYPE_PNG );
|
|
289 m_bitmapHhsno->SetBitmap( bmp );
|
0
|
290
|
|
291 wxString filename;
|
|
292 bool cout = dir.GetFirst( &filename, wxT("*.jpg"), wxDIR_FILES );
|
|
293
|
|
294 int i = 0;
|
|
295 m_listCtrlView->DeleteAllItems();
|
|
296 m_imageList->RemoveAll();
|
|
297 wxListItem item;
|
1
|
298 wxString first;
|
4
|
299 wxProgressDialog pd( wxT("進行状況"), wxT("処理開始..."), 7, this, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
|
|
300 pd.SetSize( wxSize(320,140) );
|
1
|
301 float b; long l;
|
0
|
302 while ( cout ) {
|
3
|
303 wxString imagefile = workdir + wxFILE_SEP_PATH + filename;
|
0
|
304
|
3
|
305 m_listCtrlView->InsertItem( i, filename );
|
|
306 m_listCtrlView->SetItem( i, 0, filename, i );
|
0
|
307
|
1
|
308 wxImage image( imagefile, wxBITMAP_TYPE_JPEG );
|
5
|
309 wxBitmap bmp( image.Scale( 160, 226, wxIMAGE_QUALITY_HIGH ) );
|
0
|
310 m_imageList->Add( bmp );
|
3
|
311
|
|
312 if ( i == 0 ) {
|
|
313 IsMarksheet( imagefile, &b, &l );
|
|
314 first = imagefile;
|
|
315 SetStatusText( wxString::Format(wxT("1st image : z = %f, l = %d"),b,l), 1 );
|
4
|
316
|
|
317 wxImage marksheet( first, wxBITMAP_TYPE_JPEG );
|
|
318 wxImage name_image;
|
|
319 name_image = marksheet.GetSubImage( wxRect( wxPoint(300,550), wxSize(640,190) ) );
|
|
320 wxBitmap name_bmp = ( name_image.Scale( 320, 95, wxIMAGE_QUALITY_HIGH ) );
|
|
321 m_bitmapName->SetBitmap( name_bmp );
|
|
322
|
|
323 wxImage hhsno_image;
|
|
324 hhsno_image = marksheet.GetSubImage( wxRect( wxPoint(1800,210), wxSize(594,100) ) );
|
|
325 wxBitmap hhsno_bmp = ( hhsno_image.Scale( 320, 54, wxIMAGE_QUALITY_HIGH ) );
|
|
326 m_bitmapHhsno->SetBitmap( hhsno_bmp );
|
|
327
|
|
328 wxString hhsno = GuessHhs( first );
|
|
329 m_textCtrlGuess->SetValue( hhsno );
|
3
|
330 }
|
|
331 else {
|
|
332 if ( i > 7 || IsMarksheet( imagefile, &b, &l ) ) {
|
|
333 break;
|
|
334 }
|
|
335 }
|
|
336 m_listCtrlView->SetItemState( i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
|
337
|
0
|
338 // write log
|
|
339 i++;
|
4
|
340 pd.Update( i, wxT("画像認識中") );
|
0
|
341 cout = dir.GetNext( &filename );
|
|
342 }
|
1
|
343
|
4
|
344 SetStatusText( wxEmptyString, 2 );
|
0
|
345 }
|
|
346
|
1
|
347 /* 画像を選択 */
|
3
|
348 void MyFrame::GetImageInfo(wxListEvent& event)
|
1
|
349 {
|
3
|
350 SetStatusText( wxEmptyString, 2 );
|
2
|
351 int i = event.GetIndex();
|
|
352
|
3
|
353 wxString filename = event.GetText();
|
|
354 wxString workdir = m_dirPickerWork->GetPath();
|
|
355 wxString imagefile = workdir + wxFILE_SEP_PATH + filename;
|
|
356 float b; long l;
|
|
357 wxString msg;
|
|
358 if ( IsMarksheet( imagefile, &b, &l ) ) {
|
4
|
359 msg = wxT("perhaps marksheet !");
|
2
|
360 }
|
3
|
361 SetStatusText( wxString::Format(wxT("selected image : z = %f, l = %d ...")+msg, b, l ), 2 );
|
2
|
362 }
|
|
363
|
|
364 /* 画像のスクリーン表示*/
|
|
365 void MyFrame::ViewLarge(wxListEvent& event)
|
|
366 {
|
|
367 int i = event.GetIndex();
|
|
368 wxListItem item;
|
|
369 item.SetId(i);
|
|
370
|
|
371 wxString filename = event.GetText();
|
|
372 wxString workdir = m_dirPickerWork->GetPath();
|
|
373 wxString imagefile = workdir + wxFILE_SEP_PATH + filename;
|
|
374
|
|
375 wxImage image( imagefile, wxBITMAP_TYPE_JPEG );
|
|
376 wxBitmap bmp( image.Scale( 707, 1000, wxIMAGE_QUALITY_HIGH ) );
|
|
377 wxSplashScreen* splash = new wxSplashScreen( bmp,
|
|
378 wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
|
|
379 3000, NULL, -1, wxDefaultPosition, wxDefaultSize,
|
|
380 wxSIMPLE_BORDER|wxSTAY_ON_TOP );
|
|
381 wxYield();
|
1
|
382 }
|
|
383
|
|
384 /* パラメータダイアログ */
|
|
385 void MyFrame::OnParam(wxCommandEvent& WXUNUSED(event))
|
|
386 {
|
5
|
387 ParamDialog* pd = new ParamDialog( NULL, wxID_ANY, wxT("Setting Parameters") );
|
|
388 if ( pd->ShowModal() == wxID_OK ) {
|
|
389 wxGetApp().lmin;
|
|
390 wxGetApp().lmax;
|
|
391 wxGetApp().zmin;
|
|
392 wxGetApp().zmax;
|
|
393 }
|
|
394 pd->Destroy();
|
1
|
395 }
|
|
396
|
0
|
397 // 以下,定型もの
|
|
398 /* アプリフォルダを開く */
|
|
399 void MyFrame::OnOpenAppDir(wxCommandEvent& WXUNUSED(event))
|
|
400 {
|
5
|
401 wxString appdir = wxGetCwd();
|
0
|
402 wxString execmd = wxT("explorer ") + appdir;
|
|
403 wxExecute( execmd );
|
|
404 }
|
|
405
|
|
406 /* サイズ変更 */
|
1
|
407 void MyFrame::OnWinSize(wxSizeEvent& event)
|
0
|
408 {
|
|
409 this->Refresh( true, NULL );
|
|
410 TellLocation();
|
|
411 event.Skip();
|
|
412 }
|
|
413 /* ウィンドウ移動 */
|
1
|
414 void MyFrame::OnWinMove(wxMoveEvent& WXUNUSED(event))
|
0
|
415 {
|
|
416 TellLocation();
|
|
417 return;
|
|
418 }
|
|
419 /* ウィンドウ位置とサイズを表示 */
|
|
420 void MyFrame::TellLocation( void )
|
|
421 {
|
|
422 wxRect r = this->GetRect();
|
|
423 int x = r.GetX();
|
|
424 int y = r.GetY();
|
|
425 int w = r.GetWidth();
|
|
426 int h = r.GetHeight();
|
1
|
427 SetStatusText( wxString::Format(wxT("(%d,%d) %dx%d"),x,y,w,h), 3 );
|
0
|
428 }
|
|
429 /* 終了 */
|
|
430 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|
431 {
|
|
432 Close(true);
|
|
433 }
|
|
434 /* 設定を保存 */
|
|
435 void MyFrame::SaveConfig(wxCloseEvent& WXUNUSED(event))
|
|
436 {
|
|
437 if ( !IsIconized() && !IsMaximized() ) {
|
|
438 wxGetApp().rect = this->GetRect();
|
|
439 }
|
|
440 wxGetApp().workdir = m_dirPickerWork->GetPath();
|
|
441
|
|
442 Destroy();
|
|
443 }
|
|
444
|