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