bool CameraViewSwitchManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter&)
{
    if (ea.getHandled()) return false;

    switch(ea.getEventType())
    {

        case(GUIEventAdapter::KEYDOWN):
            if (ea.getKey()=='[')
            {
                if (_currentView == 0)
                    _currentView = _cameraViews.size()-1;
                else
                    _currentView--;
                return true;
            }
            else if (ea.getKey()==']')
            {
                _currentView++;
                if (_currentView >= _cameraViews.size())
                    _currentView = 0;
                return true;
            }
            return false;

        default:
            return false;
    }
}
osgGA::GUIEventAdapter* EventQueue::keyRelease(int key, double time, int unmodifiedKey)
{
    switch(key)
    {
        case(GUIEventAdapter::KEY_Shift_L):      _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_LEFT_SHIFT & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Shift_R):      _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_RIGHT_SHIFT & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Control_L):    _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_LEFT_CTRL & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Control_R):    _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_RIGHT_CTRL & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Meta_L):       _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_LEFT_META & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Meta_R):       _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_RIGHT_META & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Alt_L):        _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_LEFT_ALT & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Alt_R):        _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_RIGHT_ALT & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Super_L):      _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_LEFT_SUPER & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Super_R):      _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_RIGHT_SUPER & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Hyper_L):      _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_LEFT_HYPER & _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Hyper_R):      _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_RIGHT_HYPER & _accumulateEventState->getModKeyMask()); break;
        default: break;
    }

    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::KEYUP);
    event->setKey(key);
    event->setUnmodifiedKey(unmodifiedKey);
    event->setTime(time);

    addEvent(event);

    return event;
}
bool KeySwitchMatrixManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa)
{
    if (!_current) return false;

    bool handled = false;

    if (!ea.getHandled() && ea.getEventType()==GUIEventAdapter::KEYDOWN)
    {

        KeyManipMap::iterator it=_manips.find(ea.getKey());
        if(it != _manips.end())
        {
            CameraManipulator* selectedManipulator = it->second.second.get();
            if (selectedManipulator!=_current)
            {            
                OSG_INFO<<"Switching to manipulator: "<<it->second.first<<std::endl;
                if ( !selectedManipulator->getNode() )
                {
                    selectedManipulator->setNode(_current->getNode());
                }
                selectedManipulator->setByMatrix(_current->getMatrix());
                selectedManipulator->init(ea,aa);
                
                _current = selectedManipulator;
            }
            handled = true;
        }
    }

    return _current->handle(ea,aa) || handled;
}
Exemple #4
0
/// Handles GUIEventAdapter::RELEASE event.
bool StandardManipulator::handleMouseRelease( const GUIEventAdapter& ea, GUIActionAdapter& us )
{
    if( ea.getButtonMask() == 0 )
    {

        double timeSinceLastRecordEvent = _ga_t0.valid() ? (ea.getTime() - _ga_t0->getTime()) : DBL_MAX;
        if( timeSinceLastRecordEvent > 0.02 )
            flushMouseEventStack();

        if( isMouseMoving() )
        {

            if( performMovement() && _allowThrow )
            {
                us.requestRedraw();
                us.requestContinuousUpdate( true );
                _thrown = true;
            }

            return true;
        }
    }

    flushMouseEventStack();
    addMouseEvent( ea );
    if( performMovement() )
        us.requestRedraw();
    us.requestContinuousUpdate( false );
    _thrown = false;

    return true;
}
Exemple #5
0
void CPanelActionListener::MouseClickEvent(const GUIEventAdapter& ea,GUIActionAdapter& aa)
{
	if (ea.getButton()==GUIEventAdapter::LEFT_MOUSE_BUTTON)
	{
		osgUtil::LineSegmentIntersector::Intersections intersections;
		if(pViewer->computeIntersections(ea.getX(),ea.getY(),intersections))
		{
			for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin();hitr!=intersections.end();++hitr)
			{
				osg::Node* node = hitr->nodePath.empty() ? NULL : hitr->nodePath.back();
				if(node->getNumDescriptions()>0 && node->getDescription(0)=="3DLINE")//µ¥»÷Á˹ã¸æÅÆ
				{
					curLine=atoi(node->getName().c_str());
					//pSwitch->setSingleChildOn(curLine);
					pSwitch->setAllChildrenOff();
					pDetailGrp->removeChildren(1,pDetailGrp->getNumChildren());
					osg::Node* pLinePoints=pGf->getLine(curLine).create3DLinePoints(curLine);
					pDetailGrp->addChild(pLinePoints);
					pDetailGrp->setSingleChildOn(1);
					//printf("CLICK LINE %s, support points=%d\n",node->getName().c_str(),0);
					break;
				}
			}
		}
	}
}
// doc in parent
bool SelectionManipulator::handleMouseMove( const GUIEventAdapter& ea, GUIActionAdapter& us )
{
	//return true;
	osgViewer::View* curView = (osgViewer::View*)us.asView();
	float x = ea.getX();
	float y = ea.getY();
	float delta = 2;

	osgUtil::PolytopeIntersector::Intersections intersections;
	osgUtil::PolytopeIntersector::Intersections::iterator hitr;
	osg::ref_ptr< osgUtil::PolytopeIntersector > picker = 
		new osgUtil::PolytopeIntersector(osgUtil::Intersector::WINDOW, x-delta, y-delta, x+delta, y+delta);
	//picker->setDimensionMask(osgUtil::PolytopeIntersector::AllDims);

	osgUtil::IntersectionVisitor iv(picker.get());
	curView->getCamera()->accept(iv);

	/*osgUtil::LineSegmentIntersector::Intersections intersections;
	osgUtil::LineSegmentIntersector::Intersections::iterator hitr;
	osg::ref_ptr< osgUtil::LineSegmentIntersector > picker = 
		new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, x, y);
	osgUtil::IntersectionVisitor iv(picker.get());
	curView->getCamera()->accept(iv);*/

	if (picker->containsIntersections())
	{
		intersections = picker->getIntersections();
		osgUtil::PolytopeIntersector::Intersection firstRes = 
			ComputerRightIntersection(intersections);
		/*osgUtil::LineSegmentIntersector::Intersection firstRes = 
			*(intersections.begin());*/
		osg::ref_ptr<osg::Node> lastNode = firstRes.nodePath.back();
		string nodeName = lastNode->getName();
		if (nodeName.find("VERTEX") == std::string::npos &&
			nodeName.find("EDGE") == std::string::npos &&
			nodeName.find("FACE") == std::string::npos)
		{
			ClearHighLightNode();
			curView->requestRedraw();
			return true;
		}
		
		if (!m_HighlightNodeList.empty() && lastNode == m_HighlightNodeList.front())
		{
			return true;
		}
		ClearHighLightNode();

		AddToHighLightNode(lastNode.get());

	}
	else
	{
		ClearHighLightNode();
	}
	// 9/8/2011 mwu : 
	curView->requestRedraw();

	return true;
}
Exemple #7
0
void EventQueue::closeWindow(double time)
{
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::CLOSE_WINDOW);
    event->setTime(time);
  
    addEvent(event);
}
Exemple #8
0
void EventQueue::frame(double time)
{
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::FRAME);
    event->setTime(time);
    
    addEvent(event);
}
bool ThirdPersonCameraManipulator::handleMouseScroll( const GUIEventAdapter& ea, GUIActionAdapter& aa )
{
	if (ea.getScrollingMotion() == GUIEventAdapter::SCROLL_UP )
		zoom(_zoomFactor);
	else if (ea.getScrollingMotion() == GUIEventAdapter::SCROLL_DOWN)
		zoom(-_zoomFactor);
	return true;
}
Exemple #10
0
void EventQueue::quitApplication(double time)
{
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::QUIT_APPLICATION);
    event->setTime(time);
  
    addEvent(event);
}
Exemple #11
0
void EventQueue::mouseScroll2D(float x, float y, double time)
{
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::SCROLL);
    event->setScrollingMotionDelta(x,y);
    event->setTime(time);
    
    addEvent(event);
}
Exemple #12
0
void EventQueue::mouseScroll(GUIEventAdapter::ScrollingMotion sm, double time)
{
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::SCROLL);
    event->setScrollingMotion(sm);
    event->setTime(time);
    
    addEvent(event);
}
Exemple #13
0
void EventQueue::userEvent(osg::Referenced* userEventData, double time)
{
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::USER);
    event->setUserData(userEventData);
    event->setTime(time);
    
    addEvent(event);
}
Exemple #14
0
void EventQueue::penPressure(float pressure, double time)
{
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::PEN_PRESSURE);
    event->setPenPressure(pressure);
    event->setTime(time);
    
    addEvent(event);
}
Exemple #15
0
void EventQueue::penProximity(GUIEventAdapter::TabletPointerType pt, bool isEntering, double time)
{
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType( (isEntering) ? GUIEventAdapter::PEN_PROXIMITY_ENTER : GUIEventAdapter::PEN_PROXIMITY_LEAVE);
    event->setTabletPointerType(pt);
    event->setTime(time);
    
    addEvent(event);
}
Exemple #16
0
void EventQueue::windowResize(int x, int y, int width, int height, double time)
{
    _accumulateEventState->setWindowRectangle(x, y, width, height, !_useFixedMouseInputRange);

    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::RESIZE);
    event->setTime(time);

    addEvent(event);
}
Exemple #17
0
bool Vwr::CameraManipulator::handle(const GUIEventAdapter& ea, GUIActionAdapter& us)
{
    switch(ea.getEventType())
    {
        case(GUIEventAdapter::FRAME):
        {
			return handleFrame(ea, us);
        }
        default:
            break;
    }

    if (ea.getHandled()) return false;

    switch(ea.getEventType())
    {
        case(GUIEventAdapter::PUSH):
        {
			return handlePush(ea, us);
        }
        case(GUIEventAdapter::RELEASE):
        {
            return handleRelease(ea, us);
        }
        case(GUIEventAdapter::DRAG):
        case(GUIEventAdapter::SCROLL):
        {
			return handleScroll(ea, us);
        }
        case(GUIEventAdapter::MOVE):
        {
            return false;
        }
		case(GUIEventAdapter::KEYDOWN):
		{
			return handleKeyDown(ea, us);
		}
		case(GUIEventAdapter::KEYUP):
		{
			return handleKeyUp( ea, us );
		}
        case(GUIEventAdapter::FRAME):
		{
            if (_thrown)
            {
                if (calcMovement()) us.requestRedraw();
            }

            return false;
		}
        default:
            return false;
    }
}
Exemple #18
0
void EventQueue::mouseMotion(float x, float y, double time)
{
    _accumulateEventState->setX(x);
    _accumulateEventState->setY(y);

    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(event->getButtonMask() ? GUIEventAdapter::DRAG : GUIEventAdapter::MOVE);
    event->setTime(time);
    
    addEvent(event);
}
Exemple #19
0
/// The method processes events for manipulation based on relative mouse movement (mouse delta).
bool StandardManipulator::handleMouseDeltaMovement( const GUIEventAdapter& ea, GUIActionAdapter& us )
{
    float dx = ea.getX() - _mouseCenterX;
    float dy = ea.getY() - _mouseCenterY;

    if( dx == 0.f && dy == 0.f )
        return false;

    addMouseEvent( ea );
    centerMousePointer( ea, us );

    return performMouseDeltaMovement( dx, dy );
}
Exemple #20
0
void GliderManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& us)
{
    flushMouseEventStack();

    us.requestContinuousUpdate(false);

    _velocity = 0.2f;

    if (ea.getEventType()!=GUIEventAdapter::RESIZE)
    {
        us.requestWarpPointer((ea.getXmin()+ea.getXmax())/2.0f,(ea.getYmin()+ea.getYmax())/2.0f);
    }
}
Exemple #21
0
GUIEventAdapter*  EventQueue::touchMoved(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, double time)
{
    _accumulateEventState->setX(x);
    _accumulateEventState->setY(y);

    
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::DRAG);
    event->setTime(time);
    event->addTouchPoint(id, phase, x, y, 0);
    addEvent(event);
    
    return event;
}
Exemple #22
0
bool ChaseCam::handle(const GUIEventAdapter& ea, GUIActionAdapter& us) 
{
    if (ea.getHandled()) return false;
    
    osgGA::GUIEventAdapter::EventType et = ea.getEventType();
    if (et == GUIEventAdapter::KEYDOWN || et == GUIEventAdapter::KEYUP)
    {
        bool onoff = (et == GUIEventAdapter::KEYDOWN);
        if (ea.getKey() == GUIEventAdapter::KEY_Space) {
            ship->sendInput(SpaceShipServer::ACCELERATE, onoff);
            return true;
        }
        else if (ea.getKey() == GUIEventAdapter::KEY_Left) {
            ship->sendInput(SpaceShipServer::LEFT, onoff);
            return true;
        }
        else if (ea.getKey() == GUIEventAdapter::KEY_Right) {
            ship->sendInput(SpaceShipServer::RIGHT, onoff);
            return true;
        }
        else if (ea.getKey() == GUIEventAdapter::KEY_Up) {
            ship->sendInput(SpaceShipServer::UP, onoff);
            return true;
        }
        else if (ea.getKey() == GUIEventAdapter::KEY_Down) {
            ship->sendInput(SpaceShipServer::DOWN, onoff);
            return true;
        }
        else if (ea.getKey() == GUIEventAdapter::KEY_S) {
            ship->sendInput(SpaceShipServer::BACK, onoff);
            return true;
        }
    }
    return false;
}
Exemple #23
0
GUIEventAdapter*  EventQueue::touchEnded(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, unsigned int tap_count, double time)
{
    _accumulateEventState->setButtonMask(~(1) & _accumulateEventState->getButtonMask());
    _accumulateEventState->setX(x);
    _accumulateEventState->setY(y);
    
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::RELEASE);
    event->setTime(time);
    event->addTouchPoint(id, phase, x, y, tap_count);
    addEvent(event);
    
    return event;
}
Exemple #24
0
/** Handles events. Returns true if handled, false otherwise.*/
bool StandardManipulator::handle( const GUIEventAdapter& ea, GUIActionAdapter& us )
{
    switch( ea.getEventType() )
    {

        case GUIEventAdapter::FRAME:
            return handleFrame( ea, us );

        case GUIEventAdapter::RESIZE:
            return handleResize( ea, us );

        default:
            break;
   }

    if( ea.getHandled() )
        return false;

    switch( ea.getEventType() )
    {
        case GUIEventAdapter::MOVE:
            return handleMouseMove( ea, us );

        case GUIEventAdapter::DRAG:
            return handleMouseDrag( ea, us );

        case GUIEventAdapter::PUSH:
            return handleMousePush( ea, us );

        case GUIEventAdapter::RELEASE:
            return handleMouseRelease( ea, us );

        case GUIEventAdapter::KEYDOWN:
            return handleKeyDown( ea, us );

        case GUIEventAdapter::KEYUP:
            return handleKeyUp( ea, us );

        case GUIEventAdapter::SCROLL:
            if( _flags & PROCESS_MOUSE_WHEEL )
            return handleMouseWheel( ea, us );
            else
            return false;

        default:
            return false;
    }
}
// doc in parent
bool FirstPersonManipulator::handleMouseWheel( const GUIEventAdapter& ea, GUIActionAdapter& us )
{
    osgGA::GUIEventAdapter::ScrollingMotion sm = ea.getScrollingMotion();

    // handle centering
    if( _flags & SET_CENTER_ON_WHEEL_FORWARD_MOVEMENT )
    {

        if( ((sm == GUIEventAdapter::SCROLL_DOWN) && (_wheelMovement > 0.)) ||
            ((sm == GUIEventAdapter::SCROLL_UP)   && (_wheelMovement < 0.)) )
        {

            // stop thrown animation
            _thrown = false;

            if( getAnimationTime() <= 0. )

                // center by mouse intersection (no animation)
                setCenterByMousePointerIntersection( ea, us );

            else {

                // start new animation only if there is no animation in progress
                if( !isAnimating() )
                    startAnimationByMousePointerIntersection( ea, us );

            }
        }
    }

    switch( sm )
    {

        // mouse scroll up event
        case GUIEventAdapter::SCROLL_UP:
        {
            // move forward
            moveForward( isAnimating() ? dynamic_cast< FirstPersonAnimationData* >( _animationData.get() )->_targetRot : _rotation,
                         -_wheelMovement * (getRelativeFlag( _wheelMovementFlagIndex ) ? _modelSize : 1. ));
            us.requestRedraw();
            us.requestContinuousUpdate( isAnimating() || _thrown );
            return true;
        }

        // mouse scroll down event
        case GUIEventAdapter::SCROLL_DOWN:
        {
            // move backward
            moveForward( _wheelMovement * (getRelativeFlag( _wheelMovementFlagIndex ) ? _modelSize : 1. ));
            _thrown = false;
            us.requestRedraw();
            us.requestContinuousUpdate( isAnimating() || _thrown );
            return true;
        }

        // unhandled mouse scrolling motion
        default:
            return false;
    }
}
Exemple #26
0
bool CPanelActionListener::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa)
{
	switch(ea.getEventType())
	{
	case GUIEventAdapter::KEYDOWN:
		KeyDownEvent(ea,aa);
		break;
	case GUIEventAdapter::PUSH:
		//MousePressEvent(ea,aa);
		break;
	case GUIEventAdapter::DRAG:
		//MouseDragEvent(ea,aa);
		break;
	case GUIEventAdapter::DOUBLECLICK:
		MouseClickEvent(ea,aa);
		break;
	case GUIEventAdapter::MOVE:
		//MouseMoveEvent(ea,aa);
		break;
	//case GUIEventAdapter::FRAME:
		//displayEachLine();
		//break;
	default:
		break;
	}
	return false;
}
Exemple #27
0
void DriveManipulator::home(const GUIEventAdapter& ea,GUIActionAdapter& us)
{
    if (getAutoComputeHomePosition()) computeHomePosition();

    computePosition(_homeEye, _homeCenter, _homeUp);
    
    _velocity = 0.0;
    
    _pitch = 0.0;

    us.requestRedraw();
    us.requestContinuousUpdate(false);

    us.requestWarpPointer((ea.getXmin()+ea.getXmax())/2.0f,(ea.getYmin()+ea.getYmax())/2.0f);

    flushMouseEventStack();
}
Exemple #28
0
GUIEventAdapter*  EventQueue::touchBegan(unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, double time)
{
    // emulate left mouse button press
    
    _accumulateEventState->setButtonMask((1) | _accumulateEventState->getButtonMask());
    _accumulateEventState->setX(x);
    _accumulateEventState->setY(y);
    
    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::PUSH);
    event->setTime(time);
    event->addTouchPoint(id, phase, x, y, 0);
  
    addEvent(event);
    
    return event;
}
osgGA::GUIEventAdapter* EventQueue::keyPress(int key, double time, int unmodifiedKey)
{
    switch(key)
    {
        case(GUIEventAdapter::KEY_Shift_L):      _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_SHIFT | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Shift_R):      _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_SHIFT | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Control_L):    _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_CTRL | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Control_R):    _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_CTRL | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Meta_L):       _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_META | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Meta_R):       _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_META | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Alt_L):        _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_ALT | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Alt_R):        _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_ALT | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Super_L):      _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_SUPER | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Super_R):      _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_SUPER | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Hyper_L):      _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_HYPER | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Hyper_R):      _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_HYPER | _accumulateEventState->getModKeyMask()); break;
        case(GUIEventAdapter::KEY_Caps_Lock):
        {
            if ((_accumulateEventState->getModKeyMask() & GUIEventAdapter::MODKEY_CAPS_LOCK)!=0)
                _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_CAPS_LOCK & _accumulateEventState->getModKeyMask());
            else
                _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_CAPS_LOCK | _accumulateEventState->getModKeyMask());
            break;
        }
        case(GUIEventAdapter::KEY_Num_Lock):
        {
            if ((_accumulateEventState->getModKeyMask() & GUIEventAdapter::MODKEY_NUM_LOCK)!=0)
                 _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_NUM_LOCK & _accumulateEventState->getModKeyMask());
            else
                 _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_NUM_LOCK | _accumulateEventState->getModKeyMask());
            break;
        }
        default: break;
    }

    GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
    event->setEventType(GUIEventAdapter::KEYDOWN);
    event->setKey(key);
    event->setUnmodifiedKey(unmodifiedKey);
    event->setTime(time);

    addEvent(event);
    
    return event;
}
// UNUSED. Future Uses
bool ViroManipulator::handleRelease(const GUIEventAdapter& ea){
	// Mid Button
	if (ea.getButtonMask() == GUIEventAdapter::MIDDLE_MOUSE_BUTTON){
		return true;
		}

	// Left Button
	else if (ea.getButtonMask() == GUIEventAdapter::LEFT_MOUSE_BUTTON){
		return true;
		}

	// Right Button
	else if (ea.getButtonMask() == GUIEventAdapter::RIGHT_MOUSE_BUTTON){
		Enable(PERIPHERAL_LOCK);
		return true;
		}
	return false;
}