MainWindowAdaptor::MainWindowAdaptor( MainWindow * window ) : QDBusAbstractAdaptor(window), m_window( window ) { connect( m_window, SIGNAL( presentationStarted( ) ), this, SIGNAL( presentationStarted( ) ) ); connect( m_window, SIGNAL( presentationStopped() ), this, SIGNAL( presentationStopped() ) ); connect( m_window, SIGNAL( nextSlide() ), this, SIGNAL( nextSlide() ) ); connect( m_window, SIGNAL( previousSlide() ), this, SIGNAL( previousSlide() ) ); }
bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&) { switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYDOWN): { if (ea.getKey()=='a') { _autoSteppingActive = !_autoSteppingActive; _previousTime = ea.getTime(); return true; } else if ((ea.getKey()=='n') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_Right)) { nextSlide(); return true; } else if ((ea.getKey()=='p') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_Left)) { previousSlide(); return true; } else if ((ea.getKey()=='w') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Add)) { scaleImage(0.99f); return true; } else if ((ea.getKey()=='s') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Subtract)) { scaleImage(1.01f); return true; } else if (ea.getKey()=='j') { offsetImage(-0.001f,0.0f); return true; } else if (ea.getKey()=='k') { offsetImage(0.001f,0.0f); return true; } else if (ea.getKey()=='i') { offsetImage(0.0f,-0.001f); return true; } else if (ea.getKey()=='m') { offsetImage(0.0f,0.001f); return true; } else if (ea.getKey()==' ') { initTexMatrices(); return true; } return false; } case(osgGA::GUIEventAdapter::DRAG): case(osgGA::GUIEventAdapter::MOVE): { static float px = ea.getXnormalized(); static float py = ea.getYnormalized(); float dx = ea.getXnormalized()-px; float dy = ea.getYnormalized()-py; px = ea.getXnormalized(); py = ea.getYnormalized(); rotateImage(dx,dy); return true; } default: return false; } }
void CAPresentationHandler::gotoPreviousPage() { previousSlide(); }