0
|
1 // Filename : rsearcher.cpp
|
9
|
2 // Last Change: 2018-10-31 水 16:39:35.
|
0
|
3 //
|
|
4
|
2
|
5 #include <wx/arrstr.h>
|
3
|
6 #include <wx/html/htmprint.h>
|
5
|
7 #include <wx/clipbrd.h>
|
4
|
8 #include "id.h"
|
0
|
9 #include "rsearcher.h"
|
|
10 #include "main.h"
|
|
11
|
5
|
12
|
|
13 /********************/
|
|
14 /** HhsClass **/
|
|
15 /********************/
|
|
16 HhsClass::HhsClass( wxArrayString& buf )
|
|
17 {
|
|
18 no = buf[0];
|
|
19 birth = buf[1];
|
|
20 name = buf[2];
|
|
21 kana = buf[3];
|
|
22 addr = buf[4];
|
|
23 sex = buf[5];
|
|
24 }
|
|
25
|
0
|
26 /********************/
|
|
27 /** MySearchCtrl **/
|
|
28 /********************/
|
|
29 MySearchCtrl::MySearchCtrl( wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style )
|
|
30 : wxSearchCtrl( parent, id, value, pos, size, style )
|
|
31 {
|
|
32 m_parent = parent;
|
|
33 SetMaxLength( 10 );
|
|
34 #ifndef __WXMAC__
|
|
35 ShowSearchButton( true );
|
|
36 #endif
|
|
37 ShowCancelButton( false );
|
|
38
|
|
39 wxFont font( 12, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD );
|
|
40 SetFont( font );
|
|
41 }
|
|
42
|
|
43 MySearchCtrl::~MySearchCtrl()
|
|
44 {
|
|
45 }
|
|
46
|
|
47 // Event Table
|
|
48 BEGIN_EVENT_TABLE( MySearchCtrl, wxSearchCtrl )
|
|
49 EVT_CHAR( MySearchCtrl::OnKey )
|
|
50 END_EVENT_TABLE()
|
|
51
|
|
52 // Event Handlers & Functions
|
|
53 void MySearchCtrl::OnKey( wxKeyEvent& event )
|
|
54 {
|
|
55 int kc = event.GetKeyCode();
|
|
56
|
|
57 if ( kc == 13 ) { // Enter
|
2
|
58 SelectAll();
|
0
|
59
|
|
60 MainFrame* f = (MainFrame*)FindWindowById( ID_MAIN );
|
2
|
61 f->Cmd( GetValue() );
|
0
|
62
|
|
63 event.Skip();
|
|
64 return;
|
|
65 }
|
|
66
|
|
67 if ( kc == 45 ) { // Num-Key '-' as Backspace
|
|
68 wxString t = GetStringSelection();
|
|
69 if ( t.IsEmpty() ) {
|
|
70 long p = GetInsertionPoint();
|
|
71 if ( p > 0 ) Remove( p - 1, p );
|
|
72 }
|
|
73 else {
|
|
74 Cut();
|
|
75 }
|
|
76 return;
|
|
77 }
|
|
78
|
|
79 if ( kc == WXK_ESCAPE ) { // clear by ESC
|
|
80 this->Clear();
|
|
81 return;
|
|
82 }
|
|
83
|
|
84 event.Skip();
|
|
85 }
|
|
86
|
|
87 /********************/
|
|
88 /** MyStaticBitmap **/
|
|
89 /********************/
|
|
90 MyStaticBitmap::MyStaticBitmap( wxScrolledWindow *parent, wxWindowID id, const wxBitmap &label, const wxPoint &pos, const wxSize &size, long style, const wxString &name )
|
|
91 : wxStaticBitmap( parent, id, label, pos, size, style, name )
|
|
92 {
|
|
93 m_parent = parent;
|
9
|
94 Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( OnLeftDown ), NULL, this );
|
|
95 Connect( wxEVT_LEFT_UP, wxMouseEventHandler( OnLeftUp ), NULL, this );
|
|
96 Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( OnLeftDClick ), NULL, this );
|
|
97 Connect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( OnRightDClick ), NULL, this );
|
|
98 Connect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this );
|
|
99 Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this );
|
|
100 Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this );
|
|
101 Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this );
|
0
|
102 }
|
|
103
|
|
104 MyStaticBitmap::~MyStaticBitmap()
|
|
105 {
|
9
|
106 Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( OnLeftDown ), NULL, this );
|
|
107 Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( OnLeftUp ), NULL, this );
|
|
108 Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( OnLeftDClick ), NULL, this );
|
|
109 Disconnect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( OnRightDClick ), NULL, this );
|
|
110 Disconnect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this );
|
|
111 Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this );
|
|
112 Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this );
|
|
113 Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this );
|
0
|
114 }
|
|
115
|
|
116 // Event Handlers
|
|
117 void MyStaticBitmap::OnWheel( wxMouseEvent& event )
|
|
118 {
|
9
|
119 /*
|
0
|
120 if ( event.ControlDown() ) {
|
|
121 if ( event.GetWheelRotation() < 0 ) {
|
|
122 }
|
|
123 else {
|
|
124 }
|
|
125 return;
|
|
126 }
|
|
127 event.Skip();
|
9
|
128 */
|
0
|
129 }
|
|
130
|
|
131 void MyStaticBitmap::OnLeftDown( wxMouseEvent& event )
|
|
132 {
|
|
133 event.GetPosition( &m_dragx, &m_dragy );
|
|
134 SetCursor( wxCursor( wxCURSOR_SIZING ) );
|
|
135 }
|
|
136
|
|
137 void MyStaticBitmap::OnLeftUp( wxMouseEvent& WXUNUSED(event) )
|
|
138 {
|
|
139 SetCursor( wxCursor( wxCURSOR_ARROW ) );
|
|
140 }
|
|
141
|
9
|
142 void MyStaticBitmap::OnLeftDClick( wxMouseEvent& event )
|
|
143 {
|
|
144 if ( with_stl ) return;
|
|
145 MainFrame* mf = (MainFrame*)FindWindowById( ID_MAIN );
|
|
146 mf->ChangeCZoom( 1 );
|
|
147 }
|
|
148
|
|
149 void MyStaticBitmap::OnRightDClick( wxMouseEvent& event )
|
|
150 {
|
|
151 if ( with_stl ) return;
|
|
152 MainFrame* mf = (MainFrame*)FindWindowById( ID_MAIN );
|
|
153 mf->ChangeCZoom( -1 );
|
|
154 }
|
|
155
|
0
|
156 void MyStaticBitmap::OnMotion( wxMouseEvent& event )
|
|
157 {
|
5
|
158 if ( event.RightIsDown() ) return;
|
0
|
159 if ( event.Dragging() ) {
|
|
160 int xv, yv, x, y;
|
|
161 m_parent->GetViewStart( &xv, &yv );
|
|
162
|
|
163 event.GetPosition( &x, &y );
|
|
164
|
|
165 int xa = abs( x - m_dragx );
|
|
166 int ya = abs( y - m_dragy );
|
|
167 int xs = x - m_dragx < 0 ? -1 : 1;
|
|
168 int ys = y - m_dragy < 0 ? -1 : 1;
|
|
169
|
|
170 /* handai dakedo sumu-zu
|
|
171 m_parent->Scroll( xv + xs * log10( xa + 1 ), yv + ys * log10( ya + 1 ) );
|
|
172 */
|
|
173 m_parent->Scroll( xv + xs * log10( xa + 1 ), yv + ys * log10( ya + 1 ) );
|
|
174
|
|
175 m_dragx = x; m_dragy = y;
|
|
176 }
|
|
177 }
|
|
178
|
3
|
179 /* right-gesture: start detect */
|
|
180 void MyStaticBitmap::OnStartRGesture( wxMouseEvent& event )
|
|
181 {
|
|
182 event.GetPosition( &cx, &cy );
|
|
183 }
|
|
184
|
|
185 /* right-gesture: judge */
|
|
186 void MyStaticBitmap::OnEndRGesture( wxMouseEvent& event )
|
|
187 {
|
9
|
188 if ( with_stl ) return;
|
3
|
189 int x, y;
|
|
190 event.GetPosition( &x, &y );
|
|
191
|
|
192 int dx = x - cx;
|
|
193 int dy = y - cy;
|
|
194 float rad = fabs( atan2( dy, dx ) );
|
|
195 float pi = 3.14159;
|
|
196
|
|
197 // to right
|
4
|
198 if ( rad < pi / 8 && dx > 0 ) {
|
|
199 ChangeBook( 1 );
|
3
|
200 }
|
|
201 // to left
|
4
|
202 else if ( rad > pi / 8 * 7 && rad < pi && dx < 0 ) {
|
|
203 ChangeBook( -1 );
|
3
|
204 }
|
|
205 // to up-right
|
4
|
206 else if ( rad > pi / 8 && rad < pi / 8 * 3 && dx > 0 ) {
|
5
|
207 MainFrame* mf = (MainFrame*)FindWindowById( ID_MAIN );
|
|
208 mf->Close();
|
3
|
209 }
|
4
|
210 // down
|
|
211 else if ( rad > pi / 8 * 3 && rad < pi / 8 * 5 && dy > 0 ) {
|
|
212 MainFrame* mf = (MainFrame*)FindWindowById( ID_MAIN );
|
|
213 mf->PrintImages();
|
|
214 }
|
|
215 //wxMessageBox( wxString::Format( "%d %d %f", dx, dy, rad ));
|
3
|
216 }
|
|
217
|
0
|
218 // Functions
|
4
|
219 void MyStaticBitmap::ChangeBook( int i )
|
|
220 {
|
|
221 wxNotebook* nb = (wxNotebook*)FindWindowById( ID_NBOOK );
|
|
222 int n = nb->GetSelection();
|
|
223 if ( i > 0 ) {
|
|
224 if ( n == nb->GetPageCount() - 1 ) return;
|
|
225 nb->SetSelection( ++n );
|
|
226 } else {
|
|
227 if ( n == 0 ) return;
|
|
228 nb->SetSelection( --n );
|
|
229 }
|
|
230 }
|
0
|
231
|
|
232 /********************/
|
9
|
233 /** SatteliteView **/
|
|
234 /********************/
|
|
235 StlFrame::StlFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
|
|
236 : wxFrame( parent, id, title, pos, size, style )
|
|
237 {
|
|
238 wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL );
|
|
239
|
|
240 m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
|
241 m_scrolledWindow->SetScrollRate( 5, 5 );
|
|
242
|
|
243 m_staticBitmap = new MyStaticBitmap( m_scrolledWindow, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString );
|
|
244 m_staticBitmap->WithSatellite( true );
|
|
245
|
|
246 bSizerTop->Add( m_scrolledWindow, 1, wxEXPAND|wxALL, 0 );
|
|
247
|
|
248 this->SetSizer( bSizerTop );
|
|
249 this->Layout();
|
|
250 }
|
|
251
|
|
252 StlFrame::~StlFrame()
|
|
253 {
|
|
254 }
|
|
255
|
|
256 /********************/
|
0
|
257 /** Main Frame **/
|
|
258 /********************/
|
|
259 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
|
|
260 : wxFrame( parent, id, title, pos, size, style )
|
|
261 {
|
7
|
262 http = RsHttp();
|
1
|
263 CreateControls();
|
5
|
264 SetAccelerator();
|
|
265 LoadBitmaps( wxEmptyString, false );
|
3
|
266 m_timer.SetOwner( this, ID_TIMER );
|
1
|
267 }
|
|
268
|
|
269 MainFrame::~MainFrame()
|
|
270 {
|
|
271 }
|
|
272
|
|
273 // Event Table
|
|
274 BEGIN_EVENT_TABLE( MainFrame, wxFrame )
|
2
|
275 EVT_DATAVIEW_SELECTION_CHANGED( ID_LIST, MainFrame::OnItemSelected )
|
1
|
276 EVT_DATAVIEW_ITEM_ACTIVATED( ID_LIST, MainFrame::OnItemDClicked )
|
|
277 EVT_NOTEBOOK_PAGE_CHANGED( ID_NBOOK, MainFrame::OnNBookChanged )
|
7
|
278 EVT_BUTTON( ID_PSEARCH, MainFrame::OnPasteSearch )
|
3
|
279 EVT_BUTTON( wxID_PRINT, MainFrame::OnPrint )
|
7
|
280 EVT_CLOSE( MainFrame::OnClose )
|
|
281 EVT_IDLE( MainFrame::OnIdle )
|
|
282 EVT_TIMER( ID_TIMER, MainFrame::OnTimer )
|
|
283 // shortcut-key
|
|
284 EVT_BUTTON( ID_FOCUS, MainFrame::OnFocus )
|
6
|
285 EVT_BUTTON( ID_PZOOM, MainFrame::OnPlusZoom )
|
|
286 EVT_BUTTON( ID_MZOOM, MainFrame::OnMinusZoom )
|
|
287 EVT_BUTTON( ID_DARK, MainFrame::OnDark )
|
9
|
288 EVT_BUTTON( ID_SWIN, MainFrame::OnSatellite )
|
5
|
289 EVT_BUTTON( wxID_HELP, MainFrame::OnHelp )
|
7
|
290 EVT_BUTTON( wxID_CLOSE, MainFrame::OnBClose )
|
3
|
291 EVT_BUTTON( ID_LOGOUT, MainFrame::OnLogout )
|
1
|
292 END_EVENT_TABLE()
|
|
293
|
|
294
|
|
295 // Event Handler
|
2
|
296 void MainFrame::OnItemSelected( wxDataViewEvent& WXUNUSED(event) )
|
|
297 {
|
|
298 int r = m_dataViewListCtrl->GetSelectedRow();
|
9
|
299 if ( r == wxNOT_FOUND ) return;
|
|
300
|
2
|
301 wxString ready = m_dataViewListCtrl->GetTextValue( r, 2 );
|
3
|
302 if ( ready.IsSameAs( wxT( "OK" ), true ) ) {
|
|
303 wxString date = m_dataViewListCtrl->GetTextValue( r, 1 );
|
|
304 date.Replace( wxT( "-" ), wxEmptyString, true );
|
5
|
305 LoadBitmaps( date, false );
|
3
|
306 } else {
|
5
|
307 LoadBitmaps( wxEmptyString, false );
|
2
|
308 }
|
|
309 }
|
|
310
|
1
|
311 void MainFrame::OnItemDClicked( wxDataViewEvent& WXUNUSED(event) )
|
|
312 {
|
|
313 int r = m_dataViewListCtrl->GetSelectedRow();
|
3
|
314 wxString status = m_dataViewListCtrl->GetTextValue( r, 2 );
|
|
315 if ( status.IsSameAs( wxT( "OK" ), true ) ) return;
|
|
316
|
2
|
317 wxString date = m_dataViewListCtrl->GetTextValue( r, 1 );
|
|
318 date.Replace( wxT( "-" ), wxEmptyString, true );
|
|
319 GetImages( m_hhs, date );
|
5
|
320 if ( LoadBitmaps( date, true ) )
|
|
321 m_dataViewListCtrl->SetTextValue( wxT( "OK" ), r, 2 );
|
1
|
322 }
|
|
323
|
|
324 void MainFrame::OnNBookChanged( wxBookCtrlEvent& WXUNUSED(event) )
|
|
325 {
|
|
326 for ( int i = 0; i < m_notebook->GetPageCount(); i++ ) {
|
|
327 m_notebook->SetPageImage( i, 1 );
|
|
328 }
|
|
329 m_notebook->SetPageImage( m_notebook->GetSelection(), 0 );
|
|
330 }
|
|
331
|
7
|
332 void MainFrame::OnBClose( wxCommandEvent& WXUNUSED(event) )
|
|
333 {
|
|
334 Close();
|
|
335 }
|
|
336
|
|
337 void MainFrame::OnClose( wxCloseEvent& WXUNUSED(event) )
|
1
|
338 {
|
7
|
339 Close();
|
|
340 }
|
|
341
|
|
342 void MainFrame::OnFocus( wxCommandEvent& WXUNUSED(event) )
|
|
343 {
|
|
344 m_searchCtrl->SetFocus();
|
1
|
345 }
|
|
346
|
5
|
347 void MainFrame::OnPasteSearch( wxCommandEvent& WXUNUSED(event) )
|
|
348 {
|
8
|
349 m_textCtrlName->SetValue( wxEmptyString );
|
|
350 m_textCtrlAddr->SetValue( wxEmptyString );
|
|
351 m_dataViewListCtrl->DeleteAllItems();
|
|
352 PasteSearch();
|
5
|
353 }
|
|
354
|
3
|
355 void MainFrame::OnPrint( wxCommandEvent& WXUNUSED(event) )
|
|
356 {
|
|
357 PrintImages();
|
|
358 }
|
|
359
|
6
|
360 void MainFrame::OnPlusZoom( wxCommandEvent& WXUNUSED(event) )
|
|
361 {
|
|
362 ChangeCZoom( 1 );
|
|
363 }
|
|
364
|
|
365 void MainFrame::OnMinusZoom( wxCommandEvent& WXUNUSED(event ) )
|
|
366 {
|
|
367 ChangeCZoom( -1 );
|
|
368 }
|
|
369
|
|
370 void MainFrame::OnDark( wxCommandEvent& WXUNUSED(event ) )
|
|
371 {
|
|
372 ChangeColor( m_staticBitmap1 );
|
|
373 ChangeColor( m_staticBitmap2 );
|
|
374 ChangeColor( m_staticBitmap3 );
|
|
375 ChangeColor( m_staticBitmap4 );
|
|
376 ChangeColor( m_staticBitmap5 );
|
|
377 m_dark = !m_dark;
|
|
378 }
|
|
379
|
9
|
380 void MainFrame::OnSatellite( wxCommandEvent& WXUNUSED(event ) )
|
|
381 {
|
|
382 int n = m_notebook->GetSelection();
|
|
383 StlFrame *stl = new StlFrame( this, wxID_ANY, wxT( "Re:Searcher - satellite view" ), wxPoint( 0, 0 ), wxSize( 500, 600 ), wxFRAME_NO_TASKBAR|wxCLOSE_BOX|wxCAPTION|wxRESIZE_BORDER );
|
|
384 wxBitmap bmp;
|
|
385 if ( n == 0 ) bmp = m_staticBitmap1->GetBitmap();
|
|
386 if ( n == 1 ) bmp = m_staticBitmap2->GetBitmap();
|
|
387 if ( n == 2 ) bmp = m_staticBitmap3->GetBitmap();
|
|
388 if ( n == 3 ) bmp = m_staticBitmap4->GetBitmap();
|
|
389 if ( n == 4 ) bmp = m_staticBitmap5->GetBitmap();
|
|
390 stl->SetBitmap( bmp );
|
|
391
|
|
392 int w = bmp.GetWidth();
|
|
393 int h = bmp.GetHeight();
|
|
394 stl->SetScroll( w, h );
|
|
395
|
|
396 stl->Show();
|
|
397 }
|
|
398
|
5
|
399 void MainFrame::OnHelp( wxCommandEvent& WXUNUSED(event) )
|
|
400 {
|
|
401 wxString version, build;
|
|
402 version = wxString::Format( wxT( "Re:Searcher-- version %s / %s\n\n" ), RSVER, RSRELEASE );
|
|
403 build = wxString::Format( wxT( "build with %s\nrunning under %s." ), wxVERSION_STRING, wxGetOsDescription() );
|
|
404
|
|
405 wxMessageBox( version + build, wxT( "Help" ) );
|
|
406 return;
|
|
407 }
|
|
408
|
3
|
409 void MainFrame::OnLogout( wxCommandEvent& WXUNUSED(event) )
|
|
410 {
|
|
411 wxMessageBox("logout");
|
|
412 return;
|
|
413 }
|
|
414
|
|
415 void MainFrame::OnTimer( wxTimerEvent& WXUNUSED(event) )
|
|
416 {
|
5
|
417 //wxMessageBox( "timer !" );
|
3
|
418 // logout
|
|
419 }
|
|
420
|
|
421 void MainFrame::OnIdle( wxIdleEvent& event )
|
|
422 {
|
|
423 if ( !m_timer.IsRunning() ) {
|
|
424 m_timer.Start( 300 * 1000, wxTIMER_ONE_SHOT );
|
|
425 }
|
|
426 event.RequestMore();
|
|
427 event.Skip();
|
|
428 }
|
|
429
|
1
|
430 // Functions
|
|
431 void MainFrame::CreateControls( void )
|
|
432 {
|
0
|
433 this->SetIcon( wxIcon( wxT( "sample" ) ) );
|
|
434 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
5
|
435 this->SetBackgroundColour( wxColour( 30, 80, 40 ) );
|
|
436 //this->SetBackgroundColour( wxColour( 153, 153, 153 ) );
|
0
|
437
|
|
438 wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL );
|
|
439
|
|
440 // Left
|
|
441 wxImageList* imgList = new wxImageList( 16, 16, false, 1 );
|
|
442 wxBitmap bmp( wxT( "image/blue.png" ), wxBITMAP_TYPE_PNG );
|
|
443 imgList->Add( bmp, wxNullBitmap );
|
|
444 bmp.LoadFile( wxT( "image/water.png" ), wxBITMAP_TYPE_PNG );
|
|
445 imgList->Add( bmp, wxNullBitmap );
|
|
446
|
|
447 m_notebook = new wxNotebook( this, ID_NBOOK, wxDefaultPosition, wxDefaultSize, 0 );
|
|
448 m_notebook->SetImageList( imgList );
|
|
449
|
|
450 m_scrolledWindow1 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
|
451 m_scrolledWindow1->SetScrollRate( 5, 5 );
|
|
452 m_notebook->AddPage( m_scrolledWindow1, wxT( "Image-01" ), false, 0 );
|
|
453
|
|
454 m_scrolledWindow2 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
|
455 m_scrolledWindow2->SetScrollRate( 5, 5 );
|
|
456 m_notebook->AddPage( m_scrolledWindow2, wxT( "Image-02" ), false, 0 );
|
|
457
|
|
458 m_scrolledWindow3 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
|
459 m_scrolledWindow3->SetScrollRate( 5, 5 );
|
|
460 m_notebook->AddPage( m_scrolledWindow3, wxT( "Image-03" ), false, 0 );
|
|
461
|
|
462 m_scrolledWindow4 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
|
463 m_scrolledWindow4->SetScrollRate( 5, 5 );
|
|
464 m_notebook->AddPage( m_scrolledWindow4, wxT( "Image-04" ), false, 0 );
|
|
465
|
|
466 m_scrolledWindow5 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
|
467 m_scrolledWindow5->SetScrollRate( 5, 5 );
|
|
468 m_notebook->AddPage( m_scrolledWindow5, wxT( "Image-05" ), false, 0 );
|
|
469
|
|
470 m_scrolledWindow6 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
|
471 m_scrolledWindow6->SetScrollRate( 5, 5 );
|
|
472 m_notebook->AddPage( m_scrolledWindow6, wxT( "Image-06" ), false, 0 );
|
|
473
|
|
474 bSizerTop->Add( m_notebook, 1, wxEXPAND|wxALL, 5 );
|
|
475
|
|
476 // Right
|
|
477 wxBoxSizer* bSizerRight = new wxBoxSizer( wxVERTICAL );
|
|
478
|
|
479 m_searchCtrl = new MySearchCtrl( this, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxSize( -1, 24 ), wxTE_PROCESS_ENTER );
|
|
480 bSizerRight->Add( m_searchCtrl, 0, wxALL, 5 );
|
|
481 m_searchCtrl->SetFocus();
|
|
482
|
5
|
483 m_textCtrlName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, -1 ), wxTE_READONLY );
|
0
|
484 m_textCtrlName->SetBackgroundColour( wxColour( 180, 210, 240 ) );
|
|
485 bSizerRight->Add( m_textCtrlName, 0, wxALL, 5 );
|
|
486
|
5
|
487 m_textCtrlAddr = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 160, -1 ), wxTE_READONLY );
|
0
|
488 m_textCtrlAddr->SetBackgroundColour( wxColour( 180, 210, 240 ) );
|
|
489 bSizerRight->Add( m_textCtrlAddr, 0, wxALL|wxEXPAND, 5 );
|
|
490
|
|
491 m_dataViewListCtrl = new wxDataViewListCtrl( this, ID_LIST, wxDefaultPosition, wxDefaultSize, wxDV_ROW_LINES|wxDV_SINGLE );
|
2
|
492 m_dataViewListColumnNo = m_dataViewListCtrl->AppendTextColumn( wxT( "No" ), wxDATAVIEW_CELL_INERT, 30, wxALIGN_RIGHT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
|
|
493 m_dataViewListColumnDate = m_dataViewListCtrl->AppendTextColumn( wxT( "Date" ), wxDATAVIEW_CELL_INERT, 80, wxALIGN_CENTER, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
|
|
494 m_dataViewListColumnDate = m_dataViewListCtrl->AppendTextColumn( wxT( "Ready" ), wxDATAVIEW_CELL_INERT, 60, wxALIGN_CENTER, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
|
0
|
495
|
|
496 bSizerRight->Add( m_dataViewListCtrl, 1, wxALL|wxEXPAND, 5 );
|
|
497
|
|
498 m_textCtrlLog = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
499 bSizerRight->Add( m_textCtrlLog, 1, wxALL|wxEXPAND, 5 );
|
|
500
|
2
|
501 m_slider = new wxSlider( this, ID_SLDR, 1, 1, 5, wxDefaultPosition, wxSize( -1, 200 ), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_LABELS|wxSL_VERTICAL );
|
0
|
502 bSizerRight->Add( m_slider, 0, wxALL, 5 );
|
|
503
|
5
|
504 m_buttonPsearch = new wxButton( this, ID_PSEARCH, wxT( "Paste-Search" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
505 bSizerRight->Add( m_buttonPsearch, 0, wxALL, 5 );
|
|
506
|
3
|
507 m_buttonPrint = new wxButton( this, wxID_PRINT, wxT( "Print" ), wxDefaultPosition, wxDefaultSize, 0 );
|
0
|
508 bSizerRight->Add( m_buttonPrint, 0, wxALL, 5 );
|
|
509
|
3
|
510 m_buttonLogout = new wxButton( this, ID_LOGOUT, wxT( "Logout" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
511 bSizerRight->Add( m_buttonLogout, 0, wxALL, 5 );
|
|
512
|
6
|
513 // invisible buttons for shortcut-key
|
7
|
514 m_buttonFocus = new wxButton( this, ID_FOCUS, wxT( "Focus" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
515 m_buttonFocus->Hide();
|
6
|
516 m_buttonPzoom = new wxButton( this, ID_PZOOM, wxT( "ZOOM" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
517 m_buttonPzoom->Hide();
|
|
518 m_buttonMzoom = new wxButton( this, ID_MZOOM, wxT( "zoom" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
519 m_buttonMzoom->Hide();
|
|
520 m_buttonDark = new wxButton( this, ID_DARK, wxT( "Dark" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
521 m_buttonDark->Hide();
|
9
|
522 m_buttonSatellite = new wxButton( this, ID_SWIN, wxT( "Satellite" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
523 m_buttonSatellite->Hide();
|
7
|
524 m_buttonClose = new wxButton( this, wxID_CLOSE, wxT( "Close" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
525 m_buttonClose->Hide();
|
6
|
526 m_buttonHelp = new wxButton( this, wxID_HELP, wxT( "Help" ), wxDefaultPosition, wxDefaultSize, 0 );
|
|
527 m_buttonHelp->Hide();
|
|
528
|
0
|
529 bSizerTop->Add( bSizerRight, 0, wxEXPAND, 5 );
|
|
530
|
|
531 this->SetSizer( bSizerTop );
|
|
532 this->Layout();
|
|
533
|
|
534 //this->Centre( wxBOTH );
|
|
535
|
|
536 m_staticBitmap1 = new MyStaticBitmap( m_scrolledWindow1, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString );
|
|
537 m_staticBitmap2 = new MyStaticBitmap( m_scrolledWindow2, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString );
|
|
538 m_staticBitmap3 = new MyStaticBitmap( m_scrolledWindow3, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString );
|
|
539 m_staticBitmap4 = new MyStaticBitmap( m_scrolledWindow4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString );
|
|
540 m_staticBitmap5 = new MyStaticBitmap( m_scrolledWindow5, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString );
|
|
541 }
|
|
542
|
5
|
543 void MainFrame::SetAccelerator( void )
|
|
544 {
|
9
|
545 wxAcceleratorEntry entries[9];
|
6
|
546 entries[0].Set( wxACCEL_CTRL, (int)'P', wxID_PRINT );
|
|
547 entries[1].Set( wxACCEL_NORMAL, WXK_F1, wxID_HELP );
|
7
|
548 entries[2].Set( wxACCEL_NORMAL, WXK_F4, ID_FOCUS );
|
|
549 entries[3].Set( wxACCEL_NORMAL, (int)'Z', ID_PZOOM );
|
|
550 entries[4].Set( wxACCEL_NORMAL, (int)'X', ID_MZOOM );
|
|
551 entries[5].Set( wxACCEL_NORMAL, (int)'D', ID_DARK );
|
9
|
552 entries[6].Set( wxACCEL_CTRL, (int)'Q', wxID_CLOSE );
|
|
553 entries[7].Set( wxACCEL_SHIFT, (int)'W', ID_SWIN );
|
|
554 entries[8].Set( wxACCEL_SHIFT, (int)'L', ID_DARK ); // now building ( logout )
|
7
|
555 wxAcceleratorTable accel( 8, entries );
|
5
|
556 SetAcceleratorTable( accel );
|
|
557 }
|
|
558
|
0
|
559 void MainFrame::Cmd( wxString cmd )
|
|
560 {
|
6
|
561 m_textCtrlName->SetValue( wxEmptyString );
|
|
562 m_textCtrlAddr->SetValue( wxEmptyString );
|
8
|
563 m_dataViewListCtrl->DeleteAllItems();
|
|
564 wxGetApp().RemoveFile( wxT( ".cache/*" ) );
|
5
|
565 LoadBitmaps( wxEmptyString, false );
|
6
|
566
|
5
|
567 wxRegEx reHhs( wxT( "^0[1238][0-9]{8}$" ) );
|
0
|
568
|
2
|
569 if ( cmd.IsSameAs( wxT( "q" ), true ) || cmd.IsSameAs( wxT( "9" ), true ) ) {
|
0
|
570 Close();
|
2
|
571 return;
|
0
|
572 }
|
|
573
|
2
|
574 if ( cmd.IsSameAs( wxT( "c" ), true ) || cmd.IsSameAs( wxT( "cmd" ), true ) ) {
|
|
575 return;
|
|
576 }
|
|
577
|
3
|
578 if ( cmd.IsSameAs( wxT( "k" ), true ) ) {
|
|
579 // hiragana kensaku
|
|
580 return;
|
|
581 }
|
|
582
|
|
583 if ( cmd.IsSameAs( wxT( "." ), false ) ) {
|
0
|
584 wxString appdir = wxGetCwd();
|
|
585 wxString execmd = wxT( "explorer " ) + appdir;
|
|
586 wxExecute( execmd );
|
|
587 return;
|
|
588 }
|
|
589
|
3
|
590 if ( cmd.IsSameAs( wxT( "*" ), false ) ) {
|
8
|
591 PasteSearch();
|
5
|
592 return;
|
3
|
593 }
|
|
594
|
|
595 if ( cmd.IsSameAs( wxT( "+" ), false ) ) {
|
6
|
596 //PrintImages();
|
3
|
597 return;
|
|
598 }
|
|
599
|
0
|
600 if ( reHhs.Matches( cmd ) ) {
|
2
|
601 m_hhs = m_searchCtrl->GetValue();
|
|
602 Search();
|
|
603 return;
|
|
604 }
|
0
|
605
|
3
|
606 wxMessageBox( wxT( "Bad Input !!" ) );
|
0
|
607 }
|
|
608
|
6
|
609 bool MainFrame::LoadBitmap( wxScrolledWindow* sc, MyStaticBitmap* sb, wxString file )
|
0
|
610 {
|
5
|
611 sb->SetBitmap( wxNullBitmap );
|
6
|
612 sb->zoom = 0;
|
5
|
613 sc->Scroll( 0, 0 );
|
|
614
|
|
615 bool ok = true;
|
2
|
616 if ( startup ) {
|
5
|
617 file = wxT( "image/hello.jpg" );
|
2
|
618 startup = false;
|
|
619 }
|
5
|
620 if ( !wxFileExists( file ) ) {
|
|
621 file = wxT( "image/testpattern.jpg" );
|
|
622 ok = false;
|
|
623 }
|
0
|
624 wxBitmap bmp( file, wxBITMAP_TYPE_JPEG );
|
6
|
625 sb->SetOrigImage( bmp );
|
0
|
626 int width = bmp.GetWidth();
|
|
627 int height = bmp.GetHeight();
|
|
628 wxImage img = bmp.ConvertToImage();
|
|
629
|
|
630 int ww, wh;
|
1
|
631 sc->GetSize( &ww, &wh );
|
0
|
632
|
3
|
633 float w = ww - 30;
|
0
|
634 float h = w * height / width;
|
|
635 sb->SetBitmap( wxBitmap( img.Scale( w, h, wxIMAGE_QUALITY_HIGH ) ) );
|
5
|
636 sc->SetScrollbars( 10, 10, (int)w / 10, (int)h / 10 );
|
0
|
637
|
5
|
638 return ok;
|
0
|
639 }
|
|
640
|
5
|
641 bool MainFrame::LoadBitmaps( wxString date, bool reload )
|
0
|
642 {
|
5
|
643 bool ok;
|
|
644 ok = LoadBitmap( m_scrolledWindow1, m_staticBitmap1, wxString::Format( wxT( ".cache/%08s_1" ), date ) );
|
|
645 ok = LoadBitmap( m_scrolledWindow2, m_staticBitmap2, wxString::Format( wxT( ".cache/%08s_2" ), date ) );
|
|
646 ok = LoadBitmap( m_scrolledWindow3, m_staticBitmap3, wxString::Format( wxT( ".cache/%08s_3" ), date ) );
|
|
647 ok = LoadBitmap( m_scrolledWindow4, m_staticBitmap4, wxString::Format( wxT( ".cache/%08s_4" ), date ) );
|
|
648 ok = LoadBitmap( m_scrolledWindow5, m_staticBitmap5, wxString::Format( wxT( ".cache/%08s_5" ), date ) );
|
|
649
|
|
650 if ( !ok && reload ) {
|
|
651 wxSleep( 5 );
|
7
|
652 ok = LoadBitmaps( date, false );
|
5
|
653 }
|
|
654 return ok;
|
2
|
655 }
|
|
656
|
6
|
657 void MainFrame::ChangeCZoom( int z )
|
|
658 {
|
|
659 int n = m_notebook->GetSelection();
|
|
660 if ( n == 0 ) ChangeZoom( m_scrolledWindow1, m_staticBitmap1, z );
|
|
661 if ( n == 1 ) ChangeZoom( m_scrolledWindow2, m_staticBitmap2, z );
|
|
662 if ( n == 2 ) ChangeZoom( m_scrolledWindow3, m_staticBitmap3, z );
|
|
663 if ( n == 3 ) ChangeZoom( m_scrolledWindow4, m_staticBitmap4, z );
|
|
664 if ( n == 4 ) ChangeZoom( m_scrolledWindow5, m_staticBitmap5, z );
|
|
665 }
|
|
666
|
|
667 void MainFrame::ChangeZoom( wxScrolledWindow* sc, MyStaticBitmap* sb, int z )
|
|
668 {
|
|
669 if ( z > 0 ) sb->zoom++;
|
|
670 else sb->zoom--;
|
|
671
|
|
672 float zz = pow( 1.1, sb->zoom );
|
|
673
|
|
674 int x, y;
|
|
675 sc->GetViewStart( &x, &y );
|
|
676 sc->Scroll( 0, 0 );
|
|
677 wxBitmap bmp = sb->GetOrigImage();
|
|
678
|
|
679 int width = bmp.GetWidth();
|
|
680 int height = bmp.GetHeight();
|
|
681 wxImage img = bmp.ConvertToImage();
|
|
682
|
|
683 int ww, wh;
|
|
684 sc->GetSize( &ww, &wh );
|
|
685
|
|
686 float w = ww * zz - 30;
|
|
687 float h = w * height / width;
|
|
688 sb->SetBitmap( wxBitmap( img.Scale( w, h, wxIMAGE_QUALITY_HIGH ) ) );
|
|
689 sc->SetScrollbars( 10, 10, (int)w / 10, (int)h / 10 );
|
|
690 sc->Scroll( x, y );
|
|
691
|
|
692 if ( m_dark ) ChangeColor( sb );
|
|
693 }
|
|
694
|
|
695 void MainFrame::ChangeColor( MyStaticBitmap* sb )
|
|
696 {
|
|
697 wxBitmap bmp = sb->GetBitmap();
|
|
698 wxImage img = bmp.ConvertToImage();
|
|
699 unsigned char r, g, b;
|
|
700 for ( int x = 0; x < img.GetWidth(); x++ ) {
|
|
701 for ( int y = 0; y < img.GetHeight(); y++ ) {
|
|
702 r = 255 - img.GetRed( x, y );
|
|
703 g = 255 - img.GetGreen( x, y );
|
|
704 b = 255 - img.GetBlue( x, y );
|
|
705 img.SetRGB( x, y, r, g, b );
|
|
706 }
|
|
707 }
|
|
708 sb->SetBitmap( wxBitmap( img ) );
|
|
709 }
|
|
710
|
2
|
711 void MainFrame::GetImages( wxString hhs, wxString date )
|
|
712 {
|
8
|
713 int estimate = http.GetImagesSize( hhs, date ) / 1000000;
|
7
|
714 wxProgressDialog pd( wxT( "Connecting Server" ), wxT( "Start..." ), estimate, NULL, wxPD_APP_MODAL|wxPD_ELAPSED_TIME|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
|
|
715 pd.SetSize( wxSize( 320, 140 ) );
|
|
716
|
|
717 http.GetImages( hhs, date );
|
|
718 for ( int i = 0; i < estimate; i++ ) {
|
8
|
719 wxMilliSleep( 1 );
|
7
|
720 pd.Update( i, wxT( "Now Loading..." ) );
|
|
721 }
|
|
722 }
|
|
723
|
2
|
724 void MainFrame::Search( void )
|
0
|
725 {
|
5
|
726 // hhs info
|
|
727 if ( hhash.count( m_hhs ) ) {
|
|
728 m_textCtrlName->SetValue( hhash[ m_hhs ]->name );
|
|
729 m_textCtrlAddr->SetValue( hhash[ m_hhs ]->addr );
|
|
730 }
|
|
731
|
|
732 // index
|
2
|
733 wxString date;
|
|
734 int match_cnt = 0;
|
|
735 for ( int i = 0; i < m_index.GetCount(); i++ ) {
|
|
736 if ( m_index[i].StartsWith( m_hhs, &date ) ) {
|
|
737 wxVector<wxVariant> data;
|
|
738 data.push_back( wxString::Format( wxT( "%02d" ), ++match_cnt ) );
|
|
739 date = date.Mid( 1, 4 ) + wxT( "-" ) + date.Mid( 5, 2 ) + wxT( "-" ) + date.Mid( 7, 2 );
|
|
740 data.push_back( date );
|
|
741 data.push_back( wxEmptyString );
|
|
742 m_dataViewListCtrl->AppendItem( data );
|
|
743 data.clear();
|
|
744 }
|
|
745 }
|
5
|
746
|
|
747 if ( match_cnt == 0 ) {
|
|
748 wxMessageBox( wxT( "Not Matched !!" ) );
|
|
749 } else {
|
|
750 wxString date = m_dataViewListCtrl->GetTextValue( 0, 1 );
|
|
751 date.Replace( wxT( "-" ), wxEmptyString, true );
|
|
752 GetImages( m_hhs, date );
|
|
753 if ( LoadBitmaps( date, true ) ) {
|
|
754 m_dataViewListCtrl->SetTextValue( wxT( "OK" ), 0, 2 );
|
|
755 m_dataViewListCtrl->SelectRow( 0 );
|
|
756 }
|
|
757 }
|
|
758
|
|
759 WriteLog( wxT( "[search] " ) + m_hhs );
|
2
|
760 }
|
|
761
|
3
|
762 void MainFrame::LoadDB( void )
|
2
|
763 {
|
5
|
764 wxProgressDialog pd( wxT( "Load Data" ), wxT( "Now loading..." ), 100, NULL, wxPD_APP_MODAL|wxPD_ELAPSED_TIME|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
|
|
765 pd.SetSize( wxSize( 320, 140 ) );
|
|
766
|
|
767 // index
|
2
|
768 wxTextFile file;
|
|
769 file.Open( wxT( "index.db" ) );
|
|
770 for ( int i = 0; i < file.GetLineCount(); i++ )
|
|
771 m_index.Add( file.GetLine( i ) );
|
|
772 file.Close();
|
|
773 m_index.Sort( true );
|
3
|
774
|
5
|
775 // decrypto
|
|
776 wxString key = wxT( "12345678900123456789abcdefabcdef" );
|
|
777 wxArrayString args;
|
|
778 args.Add( wxT( "crypto.exe" ) );
|
|
779 args.Add( wxT( "-d" ) );
|
|
780 args.Add( wxT( "hhs.db" ) );
|
|
781 args.Add( wxT( "-k" ) );
|
|
782 args.Add( key );
|
|
783
|
|
784 wxArrayString output, errors;
|
|
785 wxExecute( wxJoin( args, ' ', '\\' ), output, errors );
|
|
786
|
|
787 for ( int i = 0; i < 100; i++ ) {
|
|
788 wxMilliSleep( 2 );
|
|
789 pd.Update( i, wxString::Format( wxT( "Now loding ... ( %0.1f %% )" ), (float)i ) );
|
|
790 }
|
|
791 if ( errors.GetCount() > 0 ) {
|
8
|
792 wxMessageBox( wxT( "crypto error: " )+ errors[0] );
|
5
|
793 return;
|
|
794 }
|
|
795 for ( int i = 0; i < output.GetCount(); i++ ) {
|
|
796 wxArrayString buf = wxSplit( output[i], ',', '\\' );
|
|
797 hhash[ buf[0] ] = new HhsClass( buf ); // no, birth, name, kana, addr, sex
|
3
|
798 }
|
5
|
799 }
|
|
800
|
8
|
801 void MainFrame::PasteSearch( void )
|
5
|
802 {
|
|
803 wxString s;
|
|
804 if ( wxTheClipboard->Open() ) {
|
|
805 if ( wxTheClipboard->IsSupported( wxDF_TEXT ) ) {
|
|
806 wxTextDataObject data;
|
|
807 wxTheClipboard->GetData( data );
|
|
808 s = data.GetText();
|
|
809 }
|
|
810 wxTheClipboard->Close();
|
|
811 }
|
|
812
|
|
813 s.Replace( wxT(" "), wxT(""), true );
|
|
814 wxRegEx reHhs( wxT( "^0[1238][0-9]{8}$" ) );
|
|
815 if ( reHhs.Matches( s ) ) {
|
|
816 m_searchCtrl->SetValue( s );
|
|
817 m_hhs = m_searchCtrl->GetValue();
|
|
818 Search();
|
|
819 return;
|
|
820 }
|
|
821 wxMessageBox( wxT( "Bad Input !!" ) );
|
3
|
822 }
|
|
823
|
|
824 void MainFrame::PrintImages( void )
|
|
825 {
|
|
826 int r = m_dataViewListCtrl->GetSelectedRow();
|
4
|
827 if ( r == wxNOT_FOUND ) {
|
|
828 wxMessageBox( wxT( "Not Ready for Print !!" ) );
|
|
829 return;
|
|
830 }
|
3
|
831 wxString ready = m_dataViewListCtrl->GetTextValue( r, 2 );
|
|
832
|
|
833 if ( !ready.IsSameAs( wxT( "OK" ), true ) ) {
|
|
834 wxMessageBox( wxT( "Not Ready for Print !!" ) );
|
|
835 return;
|
|
836 }
|
|
837
|
|
838 wxDateTime now = wxDateTime::Now();
|
|
839 wxString nowstr = now.Format( "%Y/%m/%d %H:%M", wxDateTime::GMT9 ).c_str();
|
|
840
|
|
841 wxString date = m_dataViewListCtrl->GetTextValue( r, 1 );
|
|
842 date.Replace( wxT( "-" ), wxEmptyString, true );
|
|
843
|
|
844 wxString html, file;
|
|
845 html = wxT( "<html><body>\n" );
|
|
846
|
|
847 for ( int i = 1; i < 6; i++ ) {
|
|
848 file = wxString::Format( wxT( ".cache/%08s_%d" ), date, i );
|
|
849 html = html + wxT( "<img src=\"" ) + file + wxT( "\" width=\"750\" height=\"1060\"/>\n" );
|
|
850 html = html + wxT( "<div align=right><font size=-2><u>" ) + m_hhs + wxT( "@" ) + m_user + wxT( "#" ) + nowstr + wxT( "</u></font></div>\n\n" );
|
|
851 }
|
|
852 html = html + wxT( "</body></html>" );
|
|
853
|
|
854 // start printing
|
|
855 wxHtmlPrintout hpout( wxT( "Re:Searcher" ) );
|
|
856 hpout.SetMargins( 0, 0, 0, 0, 0 );
|
|
857 wxPrintDialogData pd;
|
|
858 wxPrinter p( &pd );
|
|
859
|
|
860 hpout.SetHtmlText( html, wxEmptyString, false );
|
|
861 p.Print( NULL, &hpout, true );
|
5
|
862
|
|
863 WriteLog( wxT( "[print]" ) );
|
2
|
864 }
|
|
865
|
5
|
866 void MainFrame::WriteLog( wxString msg )
|
|
867 {
|
|
868 wxDateTime now = wxDateTime::Now();
|
|
869 wxString file = wxGetCwd() + wxFILE_SEP_PATH + wxT( "log" ) + wxFILE_SEP_PATH + now.Format( wxT( "%Y%m%d" ) ) + wxT( ".log" );
|
|
870
|
|
871 wxTextFile logfile;
|
|
872 if ( !wxFileExists( file ) ) logfile.Create( file );
|
|
873
|
|
874 logfile.Open( file );
|
|
875 logfile.AddLine( now.Format( wxT("%Y-%m-%d %H:%M:%S ") ) + msg );
|
|
876 logfile.Write();
|
|
877 logfile.Close();
|
|
878 }
|
|
879
|
7
|
880 void MainFrame::Close( void )
|
|
881 {
|
|
882 WriteLog( wxT( "[logout]" ) );
|
|
883 if ( !IsIconized() && !IsMaximized() ) {
|
|
884 wxGetApp().rect = this->GetRect();
|
|
885 }
|
|
886 Destroy();
|
|
887 }
|
|
888
|
1
|
889 void MainFrame::InDevelop( bool flag )
|
0
|
890 {
|
1
|
891 if ( !flag ) return;
|
0
|
892
|
3
|
893 bool lo = false;
|
|
894 m_buttonLogout->Enable( lo );
|
|
895 m_buttonLogout->Show( lo );
|
0
|
896
|
3
|
897 bool sl = false;
|
|
898 m_slider->Enable( sl );
|
|
899 m_slider->Show( sl );
|
0
|
900
|
4
|
901 return;
|
0
|
902 }
|
|
903
|