Commit 078592a5 authored by Robin Eschbach's avatar Robin Eschbach
Browse files

[ADD #41] hotkeys

parent 555f9c20
......@@ -233,3 +233,8 @@ size_t WFiberHandler::getSelectedFiber()
{
return m_selectedFiber;
}
WActionHandler::SPtr WFiberHandler::getActionHandler()
{
return m_actionHandler;
}
......@@ -127,6 +127,11 @@ public:
size_t getSelectedFiber();
/**
* \return WActionHandler::SPtr The WActionHandler of this class.
*/
WActionHandler::SPtr getActionHandler();
private:
/**
* Update handler for the properties
......
......@@ -22,8 +22,15 @@
//
//---------------------------------------------------------------------------
#include "WFiberHandler.h"
#include "WKeyboardHandler.h"
static const unsigned int CTRL_DOWN = 65507;
static const unsigned int CTRL_UP = 16777249;
static const unsigned int KEY_Z = 90;
static const unsigned int KEY_Y = 89;
WKeyboardHandler::WKeyboardHandler( WMPointConnector* connector ):
m_connector( connector )
{
......@@ -33,16 +40,28 @@ bool WKeyboardHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActio
{
if( ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN )
{
std::cout << "DOWN KEY:\t\t\t" << ea.getKey() << std::endl;
std::cout << "\tUnmodified Key:\t\t" << ea.getUnmodifiedKey() << std::endl;
std::cout << "\tModKeyMask:\t\t"<< ea.getModKeyMask() << std::endl;
if( ea.getKey() == CTRL_DOWN )
{
m_isCtrl = true;
}
else if( ea.getKey() == KEY_Z && m_isCtrl )
{
m_connector->getFiberHandler()->getActionHandler()->undo();
return true;
}
else if( ea.getKey() == KEY_Y && m_isCtrl )
{
m_connector->getFiberHandler()->getActionHandler()->redo();
return true;
}
}
if( ea.getEventType() == osgGA::GUIEventAdapter::KEYUP )
{
std::cout << "UP KEY:\t\t\t\t" << ea.getKey() << std::endl;
std::cout << "\tUnmodified Key:\t\t" << ea.getUnmodifiedKey() << std::endl;
std::cout << "\tModKeyMask:\t\t"<< ea.getModKeyMask() << std::endl;
if( ea.getKey() == CTRL_UP )
{
m_isCtrl = false;
}
}
return false;
......
......@@ -299,3 +299,8 @@ WConnectorData::SPtr WMPointConnector::getConnectorData()
{
return m_connectorData;
}
WFiberHandler::SPtr WMPointConnector::getFiberHandler()
{
return m_fiberHandler;
}
......@@ -122,6 +122,12 @@ public:
*/
boost::shared_ptr< WConnectorData > getConnectorData();
/**
*
* \return boost::shared_ptr< WFiberHandler > The WFiberHandler of this module.
*/
boost::shared_ptr< WFiberHandler > getFiberHandler();
protected:
/**
* Entry point after loading the module. Runs in separate thread.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment