0
|
1 // Filename : myframe.cpp
|
11
|
2 // Last Change: 02-May-2014.
|
0
|
3 //
|
|
4 #include "main.h"
|
1
|
5 #include "db.h"
|
0
|
6 #include "about.h"
|
|
7 #include "kana.h"
|
|
8 #include "hist.h"
|
9
|
9 #include "preview.h"
|
0
|
10 #include "index.h"
|
11
|
11 #include "cache.h"
|
4
|
12 #include "param.h"
|
2
|
13 #include "marksheet.h"
|
|
14 #include "myframe.h"
|
|
15 #include "bprint.h"
|
0
|
16
|
10
|
17 #define DEBUG 1
|
9
|
18
|
1
|
19 ///////////////////////////////////////////////////////////////
|
|
20 // カスタム検索ボックス
|
|
21 MySearchBox::MySearchBox( wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style )
|
|
22 : wxSearchCtrl( parent, id, value, pos, size, style )
|
|
23 {
|
|
24 }
|
|
25
|
|
26 MySearchBox::~MySearchBox()
|
|
27 {
|
|
28 }
|
|
29
|
9
|
30 void MySearchBox::SetMessage( wxString msg )
|
|
31 {
|
|
32 wxFrame* p = (wxFrame*)FindWindowById( ID_MAIN );
|
|
33 p->SetStatusText( msg, 0 );
|
|
34 }
|
|
35
|
1
|
36 // Event Table
|
|
37 BEGIN_EVENT_TABLE( MySearchBox, wxSearchCtrl )
|
|
38 EVT_CHAR( MySearchBox::OnKey )
|
|
39 END_EVENT_TABLE()
|
|
40
|
|
41 // Event Handlers & Functions
|
|
42 void MySearchBox::OnKey( wxKeyEvent& event )
|
|
43 {
|
9
|
44 int kc = event.GetKeyCode();
|
1
|
45 wxString s = GetValue();
|
|
46
|
9
|
47 if ( kc == 13 ) {
|
|
48 event.Skip();
|
|
49 return;
|
|
50 }
|
|
51
|
|
52 if ( kc == 45 ) { // テンキーの '-' キーで1文字削除
|
1
|
53 wxString t = GetStringSelection();
|
|
54 if ( t.IsEmpty() ) {
|
|
55 long p = GetInsertionPoint();
|
|
56 if ( p > 0 ) Remove( p - 1, p );
|
|
57 }
|
|
58 else {
|
|
59 Cut();
|
|
60 }
|
|
61 return;
|
|
62 }
|
|
63
|
9
|
64 if ( kc == WXK_ESCAPE ) { // clear by ESC
|
2
|
65 this->Clear();
|
1
|
66 return;
|
|
67 }
|
|
68
|
9
|
69 // auto-complete
|
|
70 Cut();
|
|
71 if ( kc >=48 && kc<=57 ) { // [0-9]
|
|
72 kc -= 48;
|
|
73 wxString input = GetValue() + wxString::Format( wxT("%d"), kc );
|
|
74 if ( input.Len() < 5 ) {
|
|
75 event.Skip();
|
|
76 return;
|
|
77 }
|
|
78 for ( unsigned int i = 0; i < m_jhhsno.GetCount(); i++ ) {
|
|
79 if ( m_jhhsno[i].StartsWith( input ) ) {
|
|
80 ChangeValue( m_jhhsno[i] );
|
|
81 SetSelection( input.Len(), 10 );
|
|
82
|
|
83 wxArrayString s = wxSplit( GetHhsInfoByHhsNo( m_jhhsno[i] ), '_', '\\' );
|
|
84 wxString msg = wxT("もしかして... ") + s[0] + wxT(" ?!");
|
|
85 SetMessage( msg );
|
|
86 return;
|
|
87 }
|
|
88 SetMessage( wxEmptyString );
|
|
89 }
|
|
90 event.Skip();
|
|
91 return;
|
|
92 }
|
1
|
93 event.Skip();
|
|
94 }
|
|
95
|
9
|
96 ///////////////////////////////////////////////////////////////
|
|
97 // サムネイルパネル
|
|
98 #define THUMB_W 60
|
|
99 #define THUMB_H 75
|
|
100 ThumbnailPanel::ThumbnailPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
|
|
101 : wxPanel( parent, id, pos, size, style )
|
|
102 {
|
|
103 wxBoxSizer* bSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
104 this->SetBackgroundColour( wxColour( 192, 192, 192 ) );
|
|
105
|
|
106 wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png");
|
|
107 wxBitmap bmp = wxBitmap( thumb, wxBITMAP_TYPE_PNG );
|
|
108
|
10
|
109 m_bitmap0 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
|
9
|
110 bSizer->Add( m_bitmap0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
111 m_bitmap0->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick0 ), NULL, this );
|
|
112
|
10
|
113 m_bitmap1 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
|
9
|
114 bSizer->Add( m_bitmap1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
115 m_bitmap1->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick1 ), NULL, this );
|
|
116
|
10
|
117 m_bitmap2 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
|
9
|
118 bSizer->Add( m_bitmap2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
119 m_bitmap2->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick2 ), NULL, this );
|
|
120
|
10
|
121 m_bitmap3 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
|
9
|
122 bSizer->Add( m_bitmap3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
123 m_bitmap3->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick3 ), NULL, this );
|
|
124
|
10
|
125 m_bitmap4 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
|
9
|
126 bSizer->Add( m_bitmap4, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
127 m_bitmap4->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick4 ), NULL, this );
|
|
128
|
10
|
129 m_bitmap5 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
|
9
|
130 bSizer->Add( m_bitmap5, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
131 m_bitmap5->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick5 ), NULL, this );
|
|
132
|
|
133 this->SetSizer( bSizer );
|
|
134 this->Layout();
|
|
135 }
|
|
136
|
|
137 ThumbnailPanel::~ThumbnailPanel()
|
|
138 {
|
|
139 m_bitmap0->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick0 ), NULL, this );
|
|
140 m_bitmap1->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick1 ), NULL, this );
|
|
141 m_bitmap2->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick2 ), NULL, this );
|
|
142 m_bitmap3->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick3 ), NULL, this );
|
|
143 m_bitmap4->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick4 ), NULL, this );
|
|
144 m_bitmap5->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick5 ), NULL, this );
|
|
145 }
|
|
146
|
|
147 // Functions
|
|
148 /* サムネイル表示 */
|
10
|
149 void ThumbnailPanel::SetCacheImages( wxString dirpath )
|
9
|
150 {
|
|
151 wxDir dir( dirpath );
|
|
152 if ( !dir.IsOpened() ) return;
|
10
|
153
|
9
|
154 m_imagefiles.Clear();
|
|
155 wxDir::GetAllFiles( dirpath, &m_imagefiles, wxT("*.jpg"), wxDIR_FILES );
|
|
156
|
|
157 wxString cachedir = wxT("cache") + dirpath.AfterLast( ':' );
|
|
158 wxDir cdir( cachedir );
|
|
159 if ( !cdir.IsOpened() ) return;
|
|
160
|
10
|
161 m_cachefiles.Clear();
|
|
162 wxDir::GetAllFiles( cachedir, &m_cachefiles, wxT("*.png"), wxDIR_FILES );
|
9
|
163
|
|
164 wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png");
|
10
|
165 int n = m_cachefiles.GetCount();
|
9
|
166 if ( n < 6 ) {
|
|
167 while ( n < 6 ) {
|
10
|
168 m_cachefiles.Add( thumb );
|
9
|
169 n++;
|
|
170 }
|
|
171 }
|
|
172
|
|
173 wxBitmap bmp;
|
10
|
174 bmp.LoadFile( m_cachefiles[0], wxBITMAP_TYPE_PNG ); m_bitmap0->SetBitmap( bmp );
|
|
175 bmp.LoadFile( m_cachefiles[1], wxBITMAP_TYPE_PNG ); m_bitmap1->SetBitmap( bmp );
|
|
176 bmp.LoadFile( m_cachefiles[2], wxBITMAP_TYPE_PNG ); m_bitmap2->SetBitmap( bmp );
|
|
177 bmp.LoadFile( m_cachefiles[3], wxBITMAP_TYPE_PNG ); m_bitmap3->SetBitmap( bmp );
|
|
178 bmp.LoadFile( m_cachefiles[4], wxBITMAP_TYPE_PNG ); m_bitmap4->SetBitmap( bmp );
|
|
179 bmp.LoadFile( m_cachefiles[5], wxBITMAP_TYPE_PNG ); m_bitmap5->SetBitmap( bmp );
|
9
|
180 }
|
10
|
181 /* 画像クリックダブルで拡大表示 */
|
|
182 void ThumbnailPanel::OnDClick0( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 0 ); }
|
|
183 void ThumbnailPanel::OnDClick1( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 1 ); }
|
|
184 void ThumbnailPanel::OnDClick2( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 2 ); }
|
|
185 void ThumbnailPanel::OnDClick3( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 3 ); }
|
|
186 void ThumbnailPanel::OnDClick4( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 4 ); }
|
|
187 void ThumbnailPanel::OnDClick5( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 5 ); }
|
|
188 void ThumbnailPanel::DoPreview( int n )
|
9
|
189 {
|
10
|
190 if ( m_imagefiles.GetCount() < n + 1 ) return;
|
9
|
191
|
|
192 PreviewDialog* pd = new PreviewDialog( this, wxID_ANY, wxT("プレビュー"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxFRAME_NO_TASKBAR );
|
|
193 pd->Show();
|
|
194 pd->Maximize( true );
|
10
|
195 pd->SetFiles( m_imagefiles, m_cachefiles );
|
|
196 pd->SetPreviewImage( n );
|
9
|
197 }
|
2
|
198
|
1
|
199 ///////////////////////////////////////////////////////////////
|
|
200 // メインフレーム
|
2
|
201 #define WINL_W 480
|
0
|
202 #define LOGO_W 200
|
|
203 #define LOGO_H 92
|
|
204
|
|
205 // resources
|
|
206 #if !defined(__WXMSW__) && !defined(__WXPM__)
|
|
207 #include "sample.xpm"
|
|
208 #endif
|
|
209
|
|
210 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
|
|
211 : wxFrame( parent, id, title, pos, size, style )
|
|
212 {
|
|
213 this->SetSizeHints( wxSize( WINL_W, 500 ), wxDefaultSize );
|
9
|
214 //this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) );
|
|
215 this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
|
0
|
216
|
|
217 // set the frame icon
|
|
218 SetIcon(wxICON(sample));
|
|
219
|
|
220 // メニューバー Menu
|
|
221 m_menubar = new wxMenuBar( 0 );
|
|
222 m_menuFile = new wxMenu();
|
|
223
|
2
|
224 wxMenuItem* m_menuItemBPrintMode = new wxMenuItem( m_menuFile, ID_MNBPNT, wxString( wxT("バッチ印刷モード\tF12") ) , wxT("Batch Print Mode"), wxITEM_NORMAL );
|
|
225 m_menuFile->Append( m_menuItemBPrintMode );
|
|
226
|
|
227 wxMenuItem* m_menuItemIndex = new wxMenuItem( m_menuFile, ID_MNINDEX, wxString( wxT("インデックス\tF11") ) , wxT("Update index"), wxITEM_NORMAL );
|
|
228 m_menuFile->Append( m_menuItemIndex );
|
0
|
229
|
11
|
230 wxMenuItem* m_menuItemCache = new wxMenuItem( m_menuFile, ID_MNCACHE, wxString( wxT("キャッシュ\tF9") ) , wxT("Make cache"), wxITEM_NORMAL );
|
|
231 m_menuFile->Append( m_menuItemCache );
|
|
232
|
0
|
233 m_menuFile->AppendSeparator(); // ----
|
|
234
|
2
|
235 wxMenuItem* m_menuItemBkup = new wxMenuItem( m_menuFile, ID_MNDBBKUP, wxString( wxT("DBバックアップ(&B)") ) , wxT("Backup databases"), wxITEM_NORMAL );
|
|
236 m_menuFile->Append( m_menuItemBkup );
|
|
237
|
4
|
238 // params
|
|
239 m_menuParam = new wxMenu();
|
|
240 wxMenuItem* m_menuItemMask = new wxMenuItem( m_menuParam, ID_MNMASKPARAM, wxString( wxT("マスク(&M)") ) , wxT("Setup mask parameters"), wxITEM_NORMAL );
|
|
241 m_menuParam->Append( m_menuItemMask );
|
0
|
242
|
4
|
243 wxMenuItem* m_menuItemMark = new wxMenuItem( m_menuParam, ID_MNMARKPARAM, wxString( wxT("マークシート(&S)") ) , wxT("Setup marksheet parameters"), wxITEM_NORMAL );
|
|
244 m_menuParam->Append( m_menuItemMark );
|
|
245
|
|
246 m_menuFile->Append( -1, wxT("パラメータ(&P)"), m_menuParam );
|
|
247
|
|
248 //
|
2
|
249 wxMenuItem* m_menuItemAppDir = new wxMenuItem( m_menuFile, ID_MNAPPDIR, wxString( wxT("アプリケーションフォルダを開く(&O)") ) , wxT("Open application directory"), wxITEM_NORMAL );
|
0
|
250 m_menuFile->Append( m_menuItemAppDir );
|
|
251
|
|
252 m_menuFile->AppendSeparator(); // ----
|
|
253
|
|
254 wxMenuItem* m_menuItemAbout = new wxMenuItem( m_menuFile, ID_MNABOUT, wxString( wxT("&About...\tF1") ) , wxT("Show about dialog"), wxITEM_NORMAL );
|
|
255 m_menuFile->Append( m_menuItemAbout );
|
|
256
|
|
257 m_menubar->Append( m_menuFile, wxT("ファイル(&F)") );
|
|
258
|
|
259 this->SetMenuBar( m_menubar );
|
|
260
|
|
261 //
|
|
262 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
|
|
263
|
9
|
264 m_panelMain = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
|
265
|
2
|
266 wxBoxSizer* bSizerMain = new wxBoxSizer( wxVERTICAL );
|
0
|
267
|
|
268 wxString logo = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("logo.png");
|
|
269 wxBitmap bmp = wxBitmap( logo, wxBITMAP_TYPE_PNG );
|
2
|
270 m_bitmap = new wxStaticBitmap( m_panelMain, wxID_ANY, bmp, wxDefaultPosition, wxSize( LOGO_W, LOGO_H ), 0 );
|
|
271 bSizerMain->Add( m_bitmap, 0, wxALL, 5 );
|
0
|
272
|
2
|
273 m_textCtrlName = new wxTextCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200, -1 ), 0 );
|
|
274 bSizerMain->Add( m_textCtrlName, 0, wxALL, 5 );
|
0
|
275
|
2
|
276 m_textCtrlAddr = new wxTextCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 380, -1 ), 0 );
|
|
277 bSizerMain->Add( m_textCtrlAddr, 0, wxALL, 5 );
|
0
|
278
|
2
|
279 m_listCtrl = new wxListCtrl( m_panelMain, ID_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
|
0
|
280 wxListItem itemCol;
|
|
281 itemCol.SetText( wxT("通番") );
|
|
282 m_listCtrl->InsertColumn( 0, itemCol );
|
|
283 m_listCtrl->SetColumnWidth( 0, 50 );
|
|
284 itemCol.SetText( wxT("年月日") );
|
|
285 m_listCtrl->InsertColumn( 1, itemCol );
|
|
286 m_listCtrl->SetColumnWidth( 1, 80 );
|
|
287 itemCol.SetText( wxT("場所") );
|
|
288 m_listCtrl->InsertColumn( 2, itemCol );
|
|
289 m_listCtrl->SetColumnWidth( 2, 300 );
|
9
|
290 bSizerMain->Add( m_listCtrl, 1, wxRIGHT|wxLEFT|wxBOTTOM|wxEXPAND, 5 );
|
|
291
|
|
292 m_thumbPanel = new ThumbnailPanel( m_panelMain, wxID_ANY, wxDefaultPosition, wxSize( -1, 100 ), wxSUNKEN_BORDER );
|
|
293 bSizerMain->Add( m_thumbPanel, 0, wxRIGHT|wxLEFT|wxBOTTOM|wxEXPAND, 5 );
|
0
|
294
|
9
|
295 //
|
0
|
296 wxBoxSizer* bSizerCmd = new wxBoxSizer( wxHORIZONTAL );
|
|
297
|
2
|
298 m_staticText = new wxStaticText( m_panelMain, wxID_ANY, wxT("コマンド?"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
299 bSizerCmd->Add( m_staticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
300
|
2
|
301 m_searchBox = new MySearchBox( m_panelMain, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
|
9
|
302 m_searchBox->SetJudgedHhs( GetJudgedHhsNo() );
|
0
|
303 #ifndef __WXMAC__
|
1
|
304 m_searchBox->ShowSearchButton( true );
|
0
|
305 #endif
|
1
|
306 m_searchBox->ShowCancelButton( false );
|
|
307 m_searchBox->SetFocus();
|
2
|
308 bSizerCmd->Add( m_searchBox, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
309
|
2
|
310 m_buttonKana = new wxButton( m_panelMain, ID_KANA, wxT("カナ検索"), wxDefaultPosition, wxSize( 65, -1 ), 0 );
|
1
|
311 bSizerCmd->Add( m_buttonKana, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 20 );
|
0
|
312
|
2
|
313 m_buttonHist = new wxButton( m_panelMain, ID_HIST, wxT("検索履歴"), wxDefaultPosition, wxSize( 65, -1 ), 0 );
|
0
|
314 bSizerCmd->Add( m_buttonHist, 0, wxALL, 5 );
|
|
315
|
9
|
316 //
|
2
|
317 bSizerMain->Add( bSizerCmd, 0, wxEXPAND, 5 );
|
0
|
318
|
2
|
319 m_panelMain->SetSizer( bSizerMain );
|
|
320 m_panelMain->Layout();
|
|
321 bSizerMain->Fit( m_panelMain );
|
9
|
322 bSizerTop->Add( m_panelMain, 1, wxEXPAND|wxALL, 5 );
|
2
|
323
|
|
324 //
|
0
|
325 this->SetSizer( bSizerTop );
|
|
326 this->Layout();
|
|
327
|
|
328 // ステータスバー Statusbar
|
1
|
329 m_statusBar = new wxStatusBar( this, wxID_ANY, wxST_SIZEGRIP );
|
2
|
330 int widths[] = { 200, -1, 10, 90 };
|
1
|
331 m_statusBar->SetFieldsCount( 4, widths );
|
|
332 this->SetStatusBar( m_statusBar );
|
|
333 SetStatusText( wxT("被保番を入力してスタート!") );
|
0
|
334
|
|
335 this->Centre( wxBOTH );
|
4
|
336 LoadParam();
|
0
|
337 }
|
|
338
|
|
339 MyFrame::~MyFrame()
|
|
340 {
|
|
341 }
|
|
342
|
|
343 // Event Table
|
|
344 BEGIN_EVENT_TABLE( MyFrame, wxFrame )
|
9
|
345 EVT_MENU( ID_MNABOUT, MyFrame::OnAbout )
|
|
346 EVT_MENU( wxID_EXIT, MyFrame::OnQuit )
|
|
347 EVT_MENU( ID_MNBPNT, MyFrame::OnBPrintMode )
|
|
348 EVT_MENU( ID_MNINDEX, MyFrame::OnIndex )
|
11
|
349 EVT_MENU( ID_MNCACHE, MyFrame::OnCache )
|
9
|
350 EVT_MENU( ID_MNDBBKUP, MyFrame::OnDBBackup )
|
0
|
351 EVT_MENU( ID_MNMASKPARAM, MyFrame::OnMaskParam )
|
5
|
352 EVT_MENU( ID_MNMARKPARAM, MyFrame::OnMarkParam )
|
9
|
353 EVT_MENU( ID_MNAPPDIR, MyFrame::OnOpenAppDir )
|
|
354 EVT_LIST_ITEM_SELECTED( ID_LIST, MyFrame::OnSelectItem )
|
|
355 EVT_LIST_ITEM_ACTIVATED( ID_LIST, MyFrame::OnDClickItem )
|
0
|
356 EVT_BUTTON( ID_KANA, MyFrame::OnKana )
|
|
357 EVT_BUTTON( ID_HIST, MyFrame::OnHistory )
|
9
|
358 EVT_TEXT_ENTER( ID_SEARCH, MyFrame::OnCommand )
|
0
|
359 EVT_SIZE( MyFrame::OnWinSize )
|
|
360 EVT_MOVE( MyFrame::OnWinMove )
|
|
361 EVT_CLOSE( MyFrame::SaveConfig )
|
|
362 END_EVENT_TABLE()
|
|
363
|
|
364 // Event Handlers & Functions
|
2
|
365 /* エンターキーフック */
|
|
366 void MyFrame::OnCommand( wxCommandEvent& event )
|
0
|
367 {
|
9
|
368 wxString s = m_searchBox->GetLineText(0);
|
|
369
|
|
370 if ( s.IsSameAs( wxT(".") ) ) {
|
|
371 OpenAppDir();
|
|
372 return;
|
|
373 }
|
2
|
374
|
|
375 if ( s.IsSameAs( wxT("99") ) ) {
|
|
376 Close();
|
|
377 return;
|
|
378 }
|
|
379
|
|
380 if ( s.IsSameAs( wxT("+") ) ) {
|
|
381 PrintImages( m_hhsno );
|
|
382 return;
|
|
383 }
|
|
384
|
|
385 wxRegEx reHhs( wxT("^0[1238][0-9]{8}$") );
|
|
386 if ( reHhs.Matches( s ) ) {
|
|
387 m_hhsno = s;
|
|
388 UpdateList( m_hhsno );
|
9
|
389 UpdateThumbmail( 0 );
|
2
|
390 return;
|
|
391 }
|
|
392
|
|
393 wxRegEx reNo( wxT("^[0-9]{1,2}$") );
|
|
394 if ( reNo.Matches( s ) ) {
|
|
395 long n;
|
|
396 s.ToLong( &n, 10 );
|
|
397 n--;
|
|
398 OpenHhsDir( (int)n );
|
|
399 return;
|
|
400 }
|
|
401
|
|
402 SetStatusMessage( wxT("不適切な入力です."), 0 );
|
|
403 return;
|
|
404
|
|
405 event.Skip();
|
0
|
406 }
|
4
|
407 /* パラメータを設定ファイルから読み込む */
|
|
408 void MyFrame::LoadParam( void )
|
1
|
409 {
|
|
410 conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("app.conf");
|
|
411 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
|
|
412
|
|
413 int x, y, w, h;
|
|
414
|
|
415 config->SetPath( wxT("/Mask") );
|
|
416
|
|
417 config->Read( wxT("x1"), &x );
|
|
418 config->Read( wxT("y1"), &y );
|
|
419 config->Read( wxT("w1"), &w );
|
|
420 config->Read( wxT("h1"), &h );
|
|
421 m_mask1.SetPosition( wxPoint( x, y ) );
|
|
422 m_mask1.SetSize( wxSize( w, h ) );
|
|
423
|
|
424 config->Read( wxT("x2"), &x );
|
|
425 config->Read( wxT("y2"), &y );
|
|
426 config->Read( wxT("w2"), &w );
|
|
427 config->Read( wxT("h2"), &h );
|
|
428 m_mask2.SetPosition( wxPoint( x, y ) );
|
|
429 m_mask2.SetSize( wxSize( w, h ) );
|
|
430
|
|
431 config->Read( wxT("x3"), &x );
|
|
432 config->Read( wxT("y3"), &y );
|
|
433 config->Read( wxT("w3"), &w );
|
|
434 config->Read( wxT("h3"), &h );
|
|
435 m_mask3.SetPosition( wxPoint( x, y ) );
|
|
436 m_mask3.SetSize( wxSize( w, h ) );
|
|
437
|
2
|
438 config->Read( wxT("x1o"), &x );
|
|
439 config->Read( wxT("y1o"), &y );
|
|
440 config->Read( wxT("w1o"), &w );
|
|
441 config->Read( wxT("h1o"), &h );
|
|
442 m_mask1old.SetPosition( wxPoint( x, y ) );
|
|
443 m_mask1old.SetSize( wxSize( w, h ) );
|
|
444
|
|
445 config->Read( wxT("x2o"), &x );
|
|
446 config->Read( wxT("y2o"), &y );
|
|
447 config->Read( wxT("w2o"), &w );
|
|
448 config->Read( wxT("h2o"), &h );
|
|
449 m_mask2old.SetPosition( wxPoint( x, y ) );
|
|
450 m_mask2old.SetSize( wxSize( w, h ) );
|
|
451
|
|
452 config->Read( wxT("x3o"), &x );
|
|
453 config->Read( wxT("y3o"), &y );
|
|
454 config->Read( wxT("w3o"), &w );
|
|
455 config->Read( wxT("h3o"), &h );
|
|
456 m_mask3old.SetPosition( wxPoint( x, y ) );
|
|
457 m_mask3old.SetSize( wxSize( w, h ) );
|
5
|
458
|
|
459 //
|
|
460 config->SetPath( wxT("/Marksheet") );
|
|
461
|
|
462 config->Read( wxT("lmin"), &lmin );
|
|
463 config->Read( wxT("lmax"), &lmax );
|
|
464 config->Read( wxT("zmin"), &zmin );
|
|
465 config->Read( wxT("zmax"), &zmax );
|
9
|
466
|
2
|
467 }
|
|
468 /* 印刷 */
|
|
469 void MyFrame::PrintImages( wxString hhsno )
|
|
470 {
|
7
|
471 bool mask_flag = false;
|
9
|
472 wxMessageDialog md( this, wxT("マスクしますか?"), wxT("印刷オプション"), wxYES_NO, wxDefaultPosition );
|
7
|
473 if ( md.ShowModal() == wxID_YES ) {
|
|
474 mask_flag = true;
|
|
475 }
|
|
476
|
2
|
477 // 印刷用の html を作成
|
|
478 wxArrayString path = GetPathByHhsNo( hhsno );
|
|
479 if ( path.IsEmpty() ) return;
|
|
480
|
|
481 wxDir dir( path[0] );
|
|
482 if ( !dir.IsOpened() ) return;
|
|
483
|
|
484 wxString html;
|
|
485 html = html + wxT("<html><body>\n");
|
|
486
|
|
487 wxString file;
|
|
488 bool cout = dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES );
|
4
|
489 bool notyet_mask = true;
|
2
|
490 int n = 0;
|
|
491 wxString tmpdir = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH;
|
|
492 while ( cout ) {
|
|
493 file = path[0] + wxFILE_SEP_PATH + file;
|
|
494 file.Replace( wxFILE_SEP_PATH, wxT("/") );
|
|
495 wxString tmpjpg = wxString::Format( wxT("%stmp%d.jpg"), tmpdir, n );
|
4
|
496
|
|
497 if ( notyet_mask && IsMarksheet( file, zmin, zmax, lmin, lmax ) ) { // マークシート表面をマスクする
|
2
|
498 wxImage img_org( file, wxBITMAP_TYPE_JPEG );
|
7
|
499 if ( mask_flag ) {
|
|
500 int ver = GetMarksheetVersion( file );
|
|
501 if ( ver == 2 ) {
|
|
502 img_org.SetRGB( m_mask1, 255, 255, 255 ); // cm name
|
|
503 img_org.SetRGB( m_mask2, 255, 255, 255 ); // cm no.
|
|
504 img_org.SetRGB( m_mask3, 255, 255, 255 ); // barcode
|
|
505 }
|
|
506 else { // 古いマークシート ver == 1
|
|
507 img_org.SetRGB( m_mask1old, 255, 255, 255 ); // cm name
|
|
508 img_org.SetRGB( m_mask2old, 255, 255, 255 ); // cm no.
|
|
509 img_org.SetRGB( m_mask3old, 255, 255, 255 ); // barcode
|
|
510 }
|
2
|
511 }
|
|
512 img_org.SaveFile( tmpjpg );
|
4
|
513 notyet_mask = false;
|
2
|
514 }
|
|
515 else {
|
|
516 wxCopyFile( file, tmpjpg, true );
|
|
517 }
|
|
518 html = html + wxT("<img src=\"") + tmpjpg + wxT("\" width=\"750\" height=\"1060\"/>");
|
|
519 cout = dir.GetNext( &file );
|
|
520 n++;
|
|
521 }
|
|
522 html = html + wxT("</body></html>");
|
|
523
|
|
524 // start printing
|
|
525 wxHtmlPrintout hpout( wxT("Searcher03") );
|
|
526 hpout.SetMargins( 0, 0, 0, 0, 0 );
|
|
527 wxPrintDialogData pd;
|
|
528 wxPrinter p( &pd );
|
|
529
|
|
530 hpout.SetHtmlText( html, wxEmptyString, false );
|
|
531 p.Print( NULL, &hpout, true );
|
|
532
|
|
533 // end
|
|
534 SetStatusMessage( wxT("被保番かフォルダ番号を."), 0 );
|
|
535 }
|
|
536 /* 一括印刷モード */
|
|
537 void MyFrame::OnBPrintMode( wxCommandEvent& WXUNUSED(event) )
|
|
538 {
|
8
|
539 FrameBatchPrint* bp = new FrameBatchPrint( this, wxID_ANY, wxT("一括印刷"), wxDefaultPosition, wxSize( 700, 600 ), wxCAPTION|wxFRAME_NO_TASKBAR );
|
2
|
540 bp->SetMask1( m_mask1 );
|
|
541 bp->SetMask2( m_mask2 );
|
|
542 bp->SetMask3( m_mask3 );
|
|
543 bp->SetMask1Old( m_mask1old );
|
|
544 bp->SetMask2Old( m_mask2old );
|
|
545 bp->SetMask3Old( m_mask3old );
|
5
|
546 bp->SetMark( lmin, lmax, zmin, zmax );
|
2
|
547 bp->Show( true );
|
|
548 }
|
|
549 /* インデックス作成ダイアログ */
|
|
550 void MyFrame::OnIndex( wxCommandEvent& WXUNUSED(event) )
|
|
551 {
|
|
552 wxString rootdir;
|
|
553 config->SetPath( wxT("/Index") );
|
|
554 config->Read( wxT("rootdir"), &rootdir );
|
|
555
|
7
|
556 IndexDialog* index = new IndexDialog( this, wxID_ANY, wxT("インデックス作成"), wxDefaultPosition, wxSize( 700, 600 ), wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP );
|
8
|
557 index->SetRootdir( rootdir );
|
7
|
558 index->ShowModal();
|
1
|
559 }
|
11
|
560 /* キャッシュ作成ダイアログ */
|
|
561 void MyFrame::OnCache( wxCommandEvent& WXUNUSED(event) )
|
|
562 {
|
|
563 wxString rootdir;
|
|
564 config->SetPath( wxT("/Index") );
|
|
565 config->Read( wxT("rootdir"), &rootdir );
|
|
566
|
|
567 CacheDialog* cache = new CacheDialog( this, wxID_ANY, wxT("キャッシュ作成"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxSTAY_ON_TOP );
|
|
568 cache->Setting( rootdir, THUMB_W, THUMB_H );
|
|
569 cache->ShowModal();
|
|
570 }
|
4
|
571 /* マークシートパラメータ設定ダイアログ */
|
|
572 void MyFrame::OnMarkParam( wxCommandEvent& WXUNUSED(event) )
|
|
573 {
|
5
|
574 SetParams( 2 );
|
4
|
575 }
|
0
|
576 /* マスクパラメータ設定ダイアログ */
|
|
577 void MyFrame::OnMaskParam( wxCommandEvent& WXUNUSED(event) )
|
|
578 {
|
5
|
579 SetParams( 0 );
|
|
580 }
|
|
581 /* 設定を保存 */
|
|
582 void MyFrame::SetParams( int tab )
|
|
583 {
|
|
584 ParamDialog* param = new ParamDialog( this, wxID_ANY, wxT("各種パラメータの指定"), wxDefaultPosition, wxSize( 350, 250 ), wxCAPTION|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP|wxTAB_TRAVERSAL );
|
4
|
585 param->SetMask1( m_mask1 );
|
|
586 param->SetMask2( m_mask2 );
|
|
587 param->SetMask3( m_mask3 );
|
|
588 param->SetMask1Old( m_mask1old );
|
|
589 param->SetMask2Old( m_mask2old );
|
|
590 param->SetMask3Old( m_mask3old );
|
5
|
591 param->SetMark( lmin, lmax, zmin, zmax );
|
4
|
592 param->LoadParams();
|
|
593 param->ShowWithEffect( wxSHOW_EFFECT_SLIDE_TO_BOTTOM );
|
5
|
594 param->SelectTAb( tab );
|
1
|
595
|
4
|
596 if ( param->ShowModal() == wxID_OK ) {
|
|
597 m_mask1 = param->GetMask1();
|
|
598 m_mask2 = param->GetMask2();
|
|
599 m_mask3 = param->GetMask3();
|
|
600 m_mask1old = param->GetMask1Old();
|
|
601 m_mask2old = param->GetMask2Old();
|
|
602 m_mask3old = param->GetMask3Old();
|
5
|
603 lmin = param->GetLmin();
|
|
604 lmax = param->GetLmax();
|
|
605 zmin = param->GetZmin();
|
|
606 zmax = param->GetZmax();
|
1
|
607
|
|
608 config->SetPath( wxT("/Mask") );
|
|
609
|
|
610 config->Write( wxT("x1"), m_mask1.GetX() );
|
|
611 config->Write( wxT("y1"), m_mask1.GetY() );
|
|
612 config->Write( wxT("w1"), m_mask1.GetWidth() );
|
|
613 config->Write( wxT("h1"), m_mask1.GetHeight() );
|
|
614
|
|
615 config->Write( wxT("x2"), m_mask2.GetX() );
|
|
616 config->Write( wxT("y2"), m_mask2.GetY() );
|
|
617 config->Write( wxT("w2"), m_mask2.GetWidth() );
|
|
618 config->Write( wxT("h2"), m_mask2.GetHeight() );
|
|
619
|
|
620 config->Write( wxT("x3"), m_mask3.GetX() );
|
|
621 config->Write( wxT("y3"), m_mask3.GetY() );
|
|
622 config->Write( wxT("w3"), m_mask3.GetWidth() );
|
|
623 config->Write( wxT("h3"), m_mask3.GetHeight() );
|
|
624
|
2
|
625 config->Write( wxT("x1o"), m_mask1old.GetX() );
|
|
626 config->Write( wxT("y1o"), m_mask1old.GetY() );
|
|
627 config->Write( wxT("w1o"), m_mask1old.GetWidth() );
|
|
628 config->Write( wxT("h1o"), m_mask1old.GetHeight() );
|
|
629
|
|
630 config->Write( wxT("x2o"), m_mask2old.GetX() );
|
|
631 config->Write( wxT("y2o"), m_mask2old.GetY() );
|
|
632 config->Write( wxT("w2o"), m_mask2old.GetWidth() );
|
|
633 config->Write( wxT("h2o"), m_mask2old.GetHeight() );
|
|
634
|
|
635 config->Write( wxT("x3o"), m_mask3old.GetX() );
|
|
636 config->Write( wxT("y3o"), m_mask3old.GetY() );
|
|
637 config->Write( wxT("w3o"), m_mask3old.GetWidth() );
|
|
638 config->Write( wxT("h3o"), m_mask3old.GetHeight() );
|
|
639
|
5
|
640 config->SetPath( wxT("/Marksheet") );
|
|
641
|
|
642 config->Write( wxT("lmin"), lmin );
|
|
643 config->Write( wxT("lmax"), lmax );
|
|
644 config->Write( wxT("zmin"), zmin );
|
|
645 config->Write( wxT("zmax"), zmax );
|
|
646
|
2
|
647 config->Flush( false );
|
1
|
648 }
|
0
|
649 }
|
2
|
650 /* データベースファイルのバックアップ */
|
|
651 void MyFrame::OnDBBackup( wxCommandEvent& WXUNUSED(event) )
|
|
652 {
|
|
653 wxDateTime now = wxDateTime::Now();
|
|
654 wxString str = now.Format( wxT("%Y%m%d%H%M%S") );
|
|
655
|
|
656 wxString org, bk;
|
|
657 wxString dbdir = wxGetCwd() + wxFILE_SEP_PATH + wxT("db");
|
|
658
|
|
659 org = dbdir + wxFILE_SEP_PATH + wxT("hhs.db");
|
|
660 bk = dbdir + wxFILE_SEP_PATH + str + wxT("_hhs.db");
|
|
661 wxCopyFile( org, bk, false );
|
|
662
|
|
663 org = dbdir + wxFILE_SEP_PATH + wxT("ccn.db");
|
|
664 bk = dbdir + wxFILE_SEP_PATH + str + wxT("_ccn.db");
|
|
665 wxCopyFile( org, bk, false );
|
|
666
|
|
667 wxMessageBox( wxT("バックアップ終了.") );
|
|
668 return;
|
|
669 }
|
0
|
670 /* アプリフォルダを開く */
|
|
671 void MyFrame::OnOpenAppDir( wxCommandEvent& WXUNUSED(event) )
|
|
672 {
|
9
|
673 OpenAppDir();
|
|
674 }
|
|
675 void MyFrame::OpenAppDir( )
|
|
676 {
|
0
|
677 wxString appdir = wxGetCwd();
|
|
678 wxString execmd = wxT("explorer ") + appdir;
|
|
679 wxExecute( execmd );
|
|
680 }
|
|
681 /* 被保険者フォルダを開く */
|
9
|
682 void MyFrame::OnDClickItem( wxListEvent& event )
|
0
|
683 {
|
|
684 int i = event.GetIndex();
|
2
|
685 OpenHhsDir( i );
|
9
|
686 UpdateThumbmail( i );
|
2
|
687 }
|
|
688 /* 番号で指定したフォルダを開く */
|
|
689 void MyFrame::OpenHhsDir( int n )
|
|
690 {
|
0
|
691 wxListItem item;
|
2
|
692 item.SetId( n );
|
|
693 item.SetColumn( 2 );
|
|
694 item.SetMask( wxLIST_MASK_TEXT );
|
|
695 m_listCtrl->GetItem( item );
|
|
696 wxString dir = item.GetText();
|
|
697 wxString execmd = wxT("explorer ") + dir;
|
|
698 wxExecute( execmd );
|
0
|
699 }
|
1
|
700
|
0
|
701 /* カナ検索ダイアログ */
|
|
702 void MyFrame::OnKana( wxCommandEvent& WXUNUSED(event) )
|
|
703 {
|
2
|
704 KanaDialog* kana = new KanaDialog( this, wxID_ANY, wxT("カナ氏名で被保番を検索"), wxDefaultPosition, wxSize( 640, 600 ), wxCAPTION|wxFRAME_NO_TASKBAR|wxRESIZE_BORDER|wxSTAY_ON_TOP|wxTAB_TRAVERSAL );
|
0
|
705 kana->ShowWithEffect( wxSHOW_EFFECT_SLIDE_TO_BOTTOM );
|
1
|
706
|
|
707 if ( kana->ShowModal() == wxID_OK ) {
|
2
|
708 m_hhsno = kana->GetHhsNo();
|
|
709 UpdateList( m_hhsno );
|
9
|
710 UpdateThumbmail( 0 );
|
1
|
711 }
|
0
|
712 }
|
|
713 /* 検索履歴検索ダイアログ */
|
|
714 void MyFrame::OnHistory( wxCommandEvent& WXUNUSED(event) )
|
|
715 {
|
2
|
716 HistDialog* hist = new HistDialog( this, wxID_ANY, wxT("検索履歴"), wxDefaultPosition, wxSize( 600, 500 ), wxCAPTION|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP|wxTAB_TRAVERSAL );
|
0
|
717 hist->ShowWithEffect( wxSHOW_EFFECT_SLIDE_TO_BOTTOM );
|
1
|
718
|
|
719 if ( hist->ShowModal() == wxID_OK ) {
|
2
|
720 m_hhsno = hist->GetHhsNo();
|
|
721 UpdateList( m_hhsno );
|
9
|
722 UpdateThumbmail( 0 );
|
1
|
723 }
|
|
724 }
|
|
725
|
|
726 /* 検索結果をリストアップ */
|
2
|
727 void MyFrame::UpdateList( wxString hhsno )
|
1
|
728 {
|
|
729 m_listCtrl->DeleteAllItems();
|
2
|
730 for ( int i = 0; i < m_statusBar->GetFieldsCount(); i++ ) {
|
|
731 SetStatusMessage( wxEmptyString, i );
|
|
732 }
|
|
733
|
|
734 //
|
|
735 wxArrayString s = wxSplit( GetHhsInfoByHhsNo( hhsno ), '_', '\\' );
|
|
736 wxString history;
|
|
737 if ( s.IsEmpty() ) {
|
|
738 SetStatusMessage( wxT("データベースに存在しない被保険者です."), 0 );
|
|
739 history = hhsno + wxT("###");
|
|
740 }
|
|
741 else {
|
|
742 m_textCtrlName->SetValue( s[0] );
|
|
743 m_textCtrlAddr->SetValue( s[1] );
|
|
744 history = hhsno + wxT("#") + s[0] + wxT("#") + s[1] + wxT("#");
|
|
745 }
|
|
746 m_searchBox->SetValue( hhsno );
|
|
747 m_searchBox->SelectAll();
|
|
748 m_searchBox->SetFocus();
|
|
749
|
|
750 wxArrayString path = GetPathByHhsNo( hhsno );
|
|
751 if ( path.IsEmpty() ) {
|
|
752 SetStatusMessage( wxT("審査会履歴がありません."), 1 );
|
|
753 return;
|
|
754 }
|
|
755
|
|
756 wxRegEx reDate(wxT("(^.*20[0-9]{2}.)(20[0-9]{2})([0-2][0-9])([0-9]{2})(.*$)"));
|
|
757 for ( int i = 0; i < path.GetCount(); i++ ) {
|
|
758 wxString date = path[i];
|
|
759 reDate.ReplaceAll( &date, wxT("\\2-\\3-\\4") );
|
|
760
|
|
761 m_listCtrl->InsertItem( i, -1 );
|
|
762 m_listCtrl->SetItem( i, 0,wxString::Format( wxT("%d"), i + 1 ) , -1 ); // No
|
|
763 m_listCtrl->SetItem( i, 1, date, -1 );
|
|
764 m_listCtrl->SetItem( i, 2, path[i], -1 );
|
|
765
|
|
766 if ( i % 2 ) m_listCtrl->SetItemBackgroundColour( i, wxColour( wxT("WHEAT") ) );
|
|
767 }
|
|
768
|
|
769 SetStatusMessage( wxT("「+」キーで通番1を印刷."), 0 );
|
|
770
|
|
771 //
|
|
772 wxString filename = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("history");
|
|
773 wxDateTime now = wxDateTime::Now();
|
|
774 history = history + now.Format( wxT("%Y-%m-%d %H:%M:%S") );
|
|
775
|
|
776 wxTextFile hist( filename );
|
|
777 hist.Open();
|
|
778 hist.RemoveLine( 20 );
|
|
779 hist.InsertLine( history, 0 );
|
|
780 hist.Write();
|
|
781 hist.Close();
|
1
|
782 }
|
9
|
783 /* フォルダを選択したとき */
|
|
784 void MyFrame::OnSelectItem( wxListEvent& event )
|
|
785 {
|
|
786 UpdateThumbmail( event.GetIndex() );
|
|
787 }
|
|
788 /* サムネイルを更新 */
|
|
789 void MyFrame::UpdateThumbmail( int n )
|
|
790 {
|
|
791 wxListItem item;
|
|
792 item.SetId( n );
|
|
793
|
|
794 item.SetColumn( 2 );
|
|
795 item.SetMask( wxLIST_MASK_TEXT );
|
|
796 m_listCtrl->GetItem( item );
|
|
797
|
10
|
798 m_thumbPanel->SetCacheImages( item.GetText() );
|
9
|
799 }
|
1
|
800 /* ステータスバーにメッセージを出力 */
|
|
801 void MyFrame::SetStatusMessage( wxString msg, long n )
|
|
802 {
|
|
803 if ( GetStatusBar() )
|
|
804 SetStatusText( msg, n );
|
0
|
805 }
|
|
806
|
|
807 /* サイズ変更 */
|
|
808 void MyFrame::OnWinSize( wxSizeEvent& event )
|
|
809 {
|
|
810 this->Refresh( true, NULL );
|
|
811 TellLocation();
|
|
812 event.Skip();
|
|
813 }
|
|
814 /* ウィンドウ移動 */
|
|
815 void MyFrame::OnWinMove( wxMoveEvent& WXUNUSED(event) )
|
|
816 {
|
|
817 TellLocation();
|
|
818 return;
|
|
819 }
|
|
820 /* ウィンドウ位置とサイズを表示 */
|
|
821 void MyFrame::TellLocation( void )
|
|
822 {
|
|
823 wxRect r = this->GetRect();
|
|
824 int x = r.GetX();
|
|
825 int y = r.GetY();
|
|
826 int w = r.GetWidth();
|
|
827 int h = r.GetHeight();
|
1
|
828
|
|
829 if ( GetStatusBar() )
|
|
830 SetStatusText( wxString::Format(wxT( "(%d,%d) %dx%d"),x,y,w,h ), 3 );
|
0
|
831 }
|
|
832 /* 終了 */
|
|
833 void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
|
|
834 {
|
|
835 Close( true );
|
|
836 }
|
|
837 /* 設定を保存 */
|
|
838 void MyFrame::SaveConfig( wxCloseEvent& WXUNUSED(event) )
|
|
839 {
|
|
840 if ( !IsIconized() && !IsMaximized() ) {
|
|
841 wxGetApp().rect = this->GetRect();
|
|
842 }
|
9
|
843 delete config;
|
0
|
844 Destroy();
|
|
845 }
|
|
846 /* アバウトダイアログ */
|
|
847 void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
|
|
848 {
|
|
849 AboutDialog* aboutDlg = new AboutDialog( this, wxID_ANY, wxT("About this Software"), wxDefaultPosition, wxSize(320,280), wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP );
|
|
850 aboutDlg->ShowModal();
|
|
851 }
|
|
852
|