diff src/rsearcher.cpp @ 4:06342fc544e4

mouse gesture.
author pyon@macmini
date Mon, 15 Oct 2018 20:07:38 +0900
parents db4813125eb8
children e3b10fb860b3
line wrap: on
line diff
--- a/src/rsearcher.cpp	Thu Oct 11 22:11:09 2018 +0900
+++ b/src/rsearcher.cpp	Mon Oct 15 20:07:38 2018 +0900
@@ -1,9 +1,10 @@
 // Filename   : rsearcher.cpp
-// Last Change: 2018-10-11 –Ø 18:28:07.
+// Last Change: 2018-10-12 ‹à 16:40:12.
 //
 
 #include <wx/arrstr.h> 
 #include <wx/html/htmprint.h>
+#include "id.h"
 #include "rsearcher.h"
 #include "main.h"
 
@@ -93,7 +94,6 @@
 
     Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this );
     Disconnect( wxEVT_RIGHT_UP,   wxMouseEventHandler( OnEndRGesture   ), NULL, this );
-
 }
 
 // Event Handlers
@@ -164,21 +164,37 @@
     float pi = 3.14159;
 
     // to right
-    if ( rad < pi/8 && dx > 0 ) {
-		wxMessageBox("right");
+    if ( rad < pi / 8 && dx > 0 ) {
+		ChangeBook( 1 );
     }
     // to left
-    else if ( rad > pi/8*7 && rad < pi && dx < 0 ) { 
-		wxMessageBox("left");
+    else if ( rad > pi / 8 * 7 && rad < pi && dx < 0 ) { 
+		ChangeBook( -1 );
     }
     // to up-right
-    else if ( rad > pi/8 && rad < pi/8*3 && dx > 0 ) {
-		wxMessageBox("right-up");
-        //Close();
+    else if ( rad > pi / 8 && rad < pi / 8 * 3 && dx > 0 ) {
     }
+	// down
+    else if ( rad > pi / 8 * 3 && rad < pi / 8 * 5 && dy > 0 ) {
+		MainFrame* mf = (MainFrame*)FindWindowById( ID_MAIN );
+		mf->PrintImages();
+    }
+	//wxMessageBox( wxString::Format( "%d %d %f", dx, dy, rad ));
 }
 
 // Functions
+void MyStaticBitmap::ChangeBook( int i )
+{
+	wxNotebook* nb = (wxNotebook*)FindWindowById( ID_NBOOK );
+	int n = nb->GetSelection();
+	if ( i > 0 ) {
+		if ( n == nb->GetPageCount() - 1 ) return;
+		nb->SetSelection( ++n );
+	} else {
+		if ( n == 0 ) return;
+		nb->SetSelection( --n );
+	}
+}
 
 /********************/
 /** Main Frame     **/
@@ -527,6 +543,10 @@
 void MainFrame::PrintImages( void )
 {
     int r = m_dataViewListCtrl->GetSelectedRow();
+	if ( r == wxNOT_FOUND ) {
+		wxMessageBox( wxT( "Not Ready for Print !!" ) );
+		return;
+	}
     wxString ready = m_dataViewListCtrl->GetTextValue( r, 2 );
 
 	if ( !ready.IsSameAs( wxT( "OK" ), true ) ) {
@@ -585,6 +605,8 @@
 	m_buttonTest->Enable( tb );
 	m_buttonTest->Show( tb );
 
+	return;
+
 	// search
 	m_searchCtrl->SetValue( wxT( "0100122642" ) );
 }