void SingleCellViewGraphPanelPlotWidget::mouseReleaseEvent(QMouseEvent *pEvent)
{
    // Default handling of the event

    QwtPlot::mouseReleaseEvent(pEvent);

    // Check whether we need to carry out a action

    if (mAction == None)
        return;

    // Finish carrying out the action, if needed

    switch (mAction) {
    case ZoomRegion: {
        // Retrieve our zoom region

        QRect zoomRegionRect = mOverlayWidget->zoomRegion();

        // Reset our action

        resetAction();

        // Effectively zoom our region, if possible, by updating our axes

        QRectF zoomRegion = QRectF(canvasPoint(zoomRegionRect.topLeft(), false),
                                   canvasPoint(zoomRegionRect.topLeft()+QPoint(zoomRegionRect.width(), zoomRegionRect.height()), false));

        if (zoomRegion.width() && zoomRegion.height())
            setAxes(zoomRegion.left(), zoomRegion.left()+zoomRegion.width(),
                    zoomRegion.top()+zoomRegion.height(), zoomRegion.top());

        break;
    }
    default:
        // A action that doesn't require anything specific to be done, except to
        // reset our action

        resetAction();
    }

    // Show our context menu, if still needed

    if (mNeedContextMenu) {
        mOriginPoint = mapFromGlobal(QCursor::pos());

        mContextMenu->exec(QCursor::pos());
    }
}
예제 #2
0
void gkActionActuator::doInit(void)
{
	m_action = m_object->getAnimationPlayer(m_startAct);
	
	if (!m_action)
	{
		gkAnimation* res = gkAnimationManager::getSingleton().getAnimation(gkResourceName(m_startAct, getObjectGroupName()));
		if(res)
			m_action = m_object->addAnimation(res, m_startAct);
	}
	
	if (m_action)
	{
		if (m_start > m_end)
		{
			m_start = 0;
			m_end = m_action->getLength();
		}

		//if (m_mode == AA_PLAY)
			m_action->setMode(AK_ACT_END);
		//else
		//	m_action->setMode(AK_ACT_LOOP);
	}
	
	resetAction();
}
예제 #3
0
void gkActionActuator::stateChanged(void)
{
	DEBUG_PRINT("state %s changed %d -> %d\n", m_startAct.c_str(), m_state, m_link->getState());
	stopAction();
		
	if (m_reset)
		resetAction();

	m_ignorePulseOn = false;	
}
예제 #4
0
파일: igm.c 프로젝트: magicseb/ced2911repo
void igmDoAction()
{
	switch(menuselected)
	{
		case ITEM_RETURN_TO_MENU:
			if(isel)
			{
				//shutdownEmulation();
				exitRequested=1;
				emulationPaused=0;
				displayInfo=0;
			}
			else
			{
				//Cancel
				resetAction();
			}

			break;
		case ITEM_DISPLAY_INFO:
			if(!isel)
			{
				resetAction();
				emulationPaused=0;
				displayInfo=0;
			}
			break;
		case 0:
			menuselected=isel;
			break;

		default:
			break;

	}
	isel=0;
}
예제 #5
0
void gkActionActuator::playAction(void)
{
	GK_ASSERT(m_action);

	DEBUG_PRINT("play: %s %d %d\n", m_startAct.c_str(), m_link->getState(), m_ignorePulseOn);

	if (m_mode != AA_LOOP_STOP)
		resetAction();

	m_isPlaying = true;
	m_object->playAnimation(m_action, m_blend);
	m_state = m_link->getState();

	if (isPulseOn() && m_mode != AA_LOOP_STOP) //ignore on until next off
		m_ignorePulseOn = true;

	m_link->getLogicManager()->requestUpdate(this);
}
//emit the result to the client
void MobBaseAction::emitResult(int errorCode, const QVariant &retValue)
{
//	m_result.clear();
//	m_result.insert("Error", QVariant(errorCode));
//	m_result.insert("ReturnValue", retValue);
//	
//	QContactAction::Status status;
//	
//	if (errorCode == 0){
//		status = QContactAction::Finished;
//	}
//	
//	else{
//		status = QContactAction::FinishedWithError;
//	}
//	
//	emit progress(status, m_result);

	resetAction(); //reset values in the action
}
예제 #7
0
void gkActionActuator::update(void)
{	
	if (!m_isPlaying) return;

	if (m_state != m_link->getState())
	{
		stateChanged();
		return;
	}

	gkScalar t = getElapsedTime() + m_start;
	bool end = t >= m_end;
	bool off = isPulseOff();

	if (off)
		m_ignorePulseOn = false;

	if (m_mode == AA_LOOP_END)
	{
		if (end)
		{
			stopAction();
			if (!off)
				playAction();
		}
	}
	else if (m_mode == AA_LOOP_STOP)
	{
		if (off)
			stopAction();
		else if (end)
			resetAction(false);
	}
	else //if (m_mode == AA_PLAY)
	{
		if (end)
			stopAction();
	}
}
예제 #8
0
파일: igm.c 프로젝트: magicseb/ced2911repo
int igmInput()
{
	struct controller_data_s c;
	int ret=get_controller_data(&c, 0);

	//Que droite et gauche
	if(c.left&&!lastinputc.left)
	{
		isel--;
		nframe=0;
	}
	if(c.right&&!lastinputc.right)
	{
		isel++;
		nframe=0;
	}
	//Action
	if(c.a&&!lastinputc.a)
	{
		igmDoAction();
	}
	if(c.b&&!lastinputc.b)
	{
		resetAction();
	}
	if(c.logo&&!lastinputc.logo)
	{
		displayInfo=0;
		emulationPaused=0;
	}
	//fix le choix
	fixisel();
	lastinputc=c;
	//usb_do_poll();

	return ret;
}
예제 #9
0
void Action::onLeave(Agents::BaseAgent* agent) {
  if (_undoOnExit) {
    resetAction(agent);
  }
  leaveAction(agent);
}
void SingleCellViewGraphPanelPlotWidget::mousePressEvent(QMouseEvent *pEvent)
{
    // Default handling of the event

    QwtPlot::mousePressEvent(pEvent);

    // Check that the position of the mouse is over our canvas

    if (!plotLayout()->canvasRect().contains(pEvent->pos()))
        return;

    // Make sure that we are not already carrying out a action (e.g. we were
    // zooming in/out and then pressed on the left mouse button) and if so, then
    // cancel it by resetting our action

    if (mAction != None) {
        resetAction();

        return;
    }

    // Check which action to can carry out

    if (   (pEvent->button() == Qt::LeftButton)
        && (pEvent->modifiers() == Qt::NoModifier)) {
        // We want to pan, but only do this if we are not completely zoomed out

        if (mCanZoomOutX || mCanZoomOutY) {
            mAction = Pan;

            mPoint = pEvent->pos();
        }
    } else if (   (pEvent->button() == Qt::LeftButton)
               && (pEvent->modifiers() == Qt::ShiftModifier)) {
        // We want to show the coordinates

        mAction = ShowCoordinates;

        mOverlayWidget->setPoint(pEvent->pos());
    } else if (   (pEvent->button() == Qt::RightButton)
               && (pEvent->modifiers() == Qt::NoModifier)) {
        // We want to zoom in/out

        mAction = Zoom;

        mOriginPoint = pEvent->pos();
        mPoint = pEvent->pos();
    } else if (   (pEvent->button() == Qt::RightButton)
               && (pEvent->modifiers() == Qt::ControlModifier)) {
        // We want to zoom a region, but only allow it if we are not already
        // fully zoomed in

        if (mCanZoomInX || mCanZoomInY) {
            mAction = ZoomRegion;

            mOverlayWidget->setOriginPoint(pEvent->pos());
            mOverlayWidget->setPoint(pEvent->pos());
        }
    }

    // Check whether we might need to show our context menu

    mNeedContextMenu = pEvent->button() == Qt::RightButton;
}