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