comparison src/rsearcher.cpp @ 4:06342fc544e4

mouse gesture.
author pyon@macmini
date Mon, 15 Oct 2018 20:07:38 +0900
parents db4813125eb8
children e3b10fb860b3
comparison
equal deleted inserted replaced
3:db4813125eb8 4:06342fc544e4
1 // Filename : rsearcher.cpp 1 // Filename : rsearcher.cpp
2 // Last Change: 2018-10-11 –Ø 18:28:07. 2 // Last Change: 2018-10-12 ‹à 16:40:12.
3 // 3 //
4 4
5 #include <wx/arrstr.h> 5 #include <wx/arrstr.h>
6 #include <wx/html/htmprint.h> 6 #include <wx/html/htmprint.h>
7 #include "id.h"
7 #include "rsearcher.h" 8 #include "rsearcher.h"
8 #include "main.h" 9 #include "main.h"
9 10
10 /********************/ 11 /********************/
11 /** MySearchCtrl **/ 12 /** MySearchCtrl **/
91 Disconnect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this ); 92 Disconnect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this );
92 Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this ); 93 Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this );
93 94
94 Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this ); 95 Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this );
95 Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this ); 96 Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this );
96
97 } 97 }
98 98
99 // Event Handlers 99 // Event Handlers
100 void MyStaticBitmap::OnWheel( wxMouseEvent& event ) 100 void MyStaticBitmap::OnWheel( wxMouseEvent& event )
101 { 101 {
162 int dy = y - cy; 162 int dy = y - cy;
163 float rad = fabs( atan2( dy, dx ) ); 163 float rad = fabs( atan2( dy, dx ) );
164 float pi = 3.14159; 164 float pi = 3.14159;
165 165
166 // to right 166 // to right
167 if ( rad < pi/8 && dx > 0 ) { 167 if ( rad < pi / 8 && dx > 0 ) {
168 wxMessageBox("right"); 168 ChangeBook( 1 );
169 } 169 }
170 // to left 170 // to left
171 else if ( rad > pi/8*7 && rad < pi && dx < 0 ) { 171 else if ( rad > pi / 8 * 7 && rad < pi && dx < 0 ) {
172 wxMessageBox("left"); 172 ChangeBook( -1 );
173 } 173 }
174 // to up-right 174 // to up-right
175 else if ( rad > pi/8 && rad < pi/8*3 && dx > 0 ) { 175 else if ( rad > pi / 8 && rad < pi / 8 * 3 && dx > 0 ) {
176 wxMessageBox("right-up"); 176 }
177 //Close(); 177 // down
178 } 178 else if ( rad > pi / 8 * 3 && rad < pi / 8 * 5 && dy > 0 ) {
179 MainFrame* mf = (MainFrame*)FindWindowById( ID_MAIN );
180 mf->PrintImages();
181 }
182 //wxMessageBox( wxString::Format( "%d %d %f", dx, dy, rad ));
179 } 183 }
180 184
181 // Functions 185 // Functions
186 void MyStaticBitmap::ChangeBook( int i )
187 {
188 wxNotebook* nb = (wxNotebook*)FindWindowById( ID_NBOOK );
189 int n = nb->GetSelection();
190 if ( i > 0 ) {
191 if ( n == nb->GetPageCount() - 1 ) return;
192 nb->SetSelection( ++n );
193 } else {
194 if ( n == 0 ) return;
195 nb->SetSelection( --n );
196 }
197 }
182 198
183 /********************/ 199 /********************/
184 /** Main Frame **/ 200 /** Main Frame **/
185 /********************/ 201 /********************/
186 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) 202 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
525 } 541 }
526 542
527 void MainFrame::PrintImages( void ) 543 void MainFrame::PrintImages( void )
528 { 544 {
529 int r = m_dataViewListCtrl->GetSelectedRow(); 545 int r = m_dataViewListCtrl->GetSelectedRow();
546 if ( r == wxNOT_FOUND ) {
547 wxMessageBox( wxT( "Not Ready for Print !!" ) );
548 return;
549 }
530 wxString ready = m_dataViewListCtrl->GetTextValue( r, 2 ); 550 wxString ready = m_dataViewListCtrl->GetTextValue( r, 2 );
531 551
532 if ( !ready.IsSameAs( wxT( "OK" ), true ) ) { 552 if ( !ready.IsSameAs( wxT( "OK" ), true ) ) {
533 wxMessageBox( wxT( "Not Ready for Print !!" ) ); 553 wxMessageBox( wxT( "Not Ready for Print !!" ) );
534 return; 554 return;
583 603
584 bool tb = false; 604 bool tb = false;
585 m_buttonTest->Enable( tb ); 605 m_buttonTest->Enable( tb );
586 m_buttonTest->Show( tb ); 606 m_buttonTest->Show( tb );
587 607
608 return;
609
588 // search 610 // search
589 m_searchCtrl->SetValue( wxT( "0100122642" ) ); 611 m_searchCtrl->SetValue( wxT( "0100122642" ) );
590 } 612 }
591 613