コード例 #1
0
bool TouchInputHandler::handleImpl(GdkEvent* event)
{
	XOJ_CHECK_TYPE(TouchInputHandler);

	GdkEventSequence* sequence = gdk_event_get_event_sequence(event);

	// Disallow multitouch
	if (this->currentSequence && this->currentSequence != sequence)
	{
		return false;
	}

	if (event->type == GDK_TOUCH_BEGIN && this->currentSequence == nullptr)
	{
		this->currentSequence = sequence;
		actionStart(event);
	}

	if (event->type == GDK_TOUCH_UPDATE)
	{
		actionMotion(event);
	}

	if (event->type == GDK_TOUCH_END || event->type == GDK_TOUCH_CANCEL)
	{
		actionEnd(event);
		this->currentSequence = nullptr;
	}

	return false;
}
コード例 #2
0
ファイル: InputSequence.cpp プロジェクト: xournalpp/xournalpp
/**
 * Check if input is still running, or if there an event was missed
 *
 * @return true if input is stopped now
 */
bool InputSequence::checkStillRunning()
{
	if (!inputRunning)
	{
		// Already stopped
		return true;
	}

	GdkModifierType mask = (GdkModifierType) 0;
	GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(inputHandler->getXournal()));
	gdk_device_get_state(device, window, NULL, &mask);

	if ((GDK_BUTTON1_MASK & mask) ||
		(GDK_BUTTON2_MASK & mask) ||
		(GDK_BUTTON3_MASK & mask) ||
		(GDK_BUTTON4_MASK & mask) ||
		(GDK_BUTTON5_MASK & mask))
	{
		// Button still down
		// Input is still running, probably everything OK
		return false;
	}

	// Button is not down, stop input now!
	// So the new input can start
	actionEnd(__UINT32_MAX__);

	return true;
}
コード例 #3
0
ファイル: InputSequence.cpp プロジェクト: xournalpp/xournalpp
InputSequence::~InputSequence()
{
	XOJ_CHECK_TYPE(InputSequence);

	if (inputRunning)
	{
		actionEnd(__UINT32_MAX__);
	}
	clearAxes();

	// Make 100% sure there is no input running
	stopInput();

	XOJ_RELEASE_TYPE(InputSequence);
}
コード例 #4
0
ファイル: PNPActionServer.cpp プロジェクト: mircolosi/HRI_LAS
void PNPActionServer::goalCallback(PNPAS::GoalHandle gh){
    boost::mutex::scoped_lock lock(state_mutex);

    current_gh = gh; 
    goal = *current_gh.getGoal();

    // Run action (wait until it finishes)
    //ROS_INFO_STREAM("### Received Goal: " << goal.id << " " << goal.name << " " << 
    //      goal.params << " " << goal.function);
    

    if (goal.function=="start") {
        ROS_DEBUG_STREAM("Starting action " << goal.robotname << " " << goal.name << " " << 
                        goal.params);
        current_gh.setAccepted();
        actionStart(goal.robotname, goal.name, goal.params);
        boost::thread t(
            boost::bind(&PNPActionServer::ActionExecutionThread, this, _1),
            current_gh);
    }
    else if (goal.function=="end") {
        ROS_DEBUG_STREAM("Terminating action " << goal.robotname << " " << goal.name << " " << 
                        goal.params);
        actionEnd(goal.robotname, goal.name, goal.params);
        CancelAction(goal.robotname,goal.name,goal.params);
        current_gh.setAccepted();
        for (int k=0; k<3; k++) { ros::spinOnce(); }
//        boost::this_thread::sleep(boost::posix_time::milliseconds(200));
        current_gh.setSucceeded();
    }
    else if (goal.function=="interrupt") {
        ROS_DEBUG_STREAM("Interrupting action " << goal.robotname << " " << goal.name << " " << 
                        goal.params);
        actionInterrupt(goal.robotname, goal.name, goal.params);
        CancelAction(goal.robotname,goal.name,goal.params);
        current_gh.setAccepted();
        for (int k=0; k<3; k++) { ros::spinOnce(); }
        //boost::this_thread::sleep(boost::posix_time::milliseconds(200));
        current_gh.setSucceeded();
    }

    // wait for actual delivery...
    for (int k=0; k<5; k++) { ros::spinOnce(); }
    // boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
}
コード例 #5
0
PropertiesPalette_XYZ::PropertiesPalette_XYZ( QWidget* parent) : QWidget(parent)
{
	m_ScMW=0;
	m_doc=0;
	m_haveDoc  = false;
	m_haveItem = false;
	m_lineMode = false;
	m_oldRotation = 0;
	m_unitRatio = 1.0;

	setupUi(this);
	setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));

	_userActionOn = false;
	userActionSniffer = new UserActionSniffer(this);
	connect(userActionSniffer, SIGNAL(actionStart()), this, SLOT(spinboxStartUserAction()));
	connect(userActionSniffer, SIGNAL(actionEnd()), this, SLOT(spinboxFinishUserAction()));

	nameEdit->setFocusPolicy(Qt::ClickFocus);

	installSniffer(xposSpin);
	installSniffer(yposSpin);
	installSniffer(widthSpin);
	installSniffer(heightSpin);

	xposLabel->setBuddy(xposSpin);
	yposLabel->setBuddy(yposSpin);
	widthLabel->setBuddy(widthSpin);
	heightLabel->setBuddy(heightSpin);

	keepFrameWHRatioButton->setCheckable( true );
	keepFrameWHRatioButton->setAutoRaise( true );
	keepFrameWHRatioButton->setMaximumSize( QSize( 15, 32767 ) );
	keepFrameWHRatioButton->setChecked(false);
	rotationSpin->setWrapping( true );
	installSniffer(rotationSpin);

	rotationSpin->setNewUnit(6);
	rotationLabel->setBuddy(rotationSpin);

	levelUp->setIcon(QIcon(loadIcon("16/go-up.png")));
	levelDown->setIcon(QIcon(loadIcon("16/go-down.png")));
	levelTop->setIcon(QIcon(loadIcon("16/go-top.png")));
	levelBottom->setIcon(QIcon(loadIcon("16/go-bottom.png")));
	levelLabel->setAlignment( Qt::AlignCenter );

	doGroup->setIcon(QIcon(loadIcon("group.png")));
	doUnGroup->setIcon(QIcon(loadIcon("ungroup.png")));

	flipH->setIcon(QIcon(loadIcon("16/flip-object-horizontal.png")));
	flipH->setCheckable( true );
	flipV->setIcon(QIcon(loadIcon("16/flip-object-vertical.png")));
	flipV->setCheckable( true );
	
	doLock->setCheckable( true );
	QIcon a = QIcon();
	a.addPixmap(loadIcon("16/lock.png"), QIcon::Normal, QIcon::On);
	a.addPixmap(loadIcon("16/lock-unlocked.png"), QIcon::Normal, QIcon::Off);
	doLock->setIcon(a);

	noPrint->setCheckable( true );
	QIcon a2 = QIcon();
	a2.addPixmap(loadIcon("NoPrint.png"), QIcon::Normal, QIcon::On);
	a2.addPixmap(loadIcon("16/document-print.png"), QIcon::Normal, QIcon::Off);
	noPrint->setIcon(a2);

	noResize->setCheckable( true );
	QIcon a3 = QIcon();
	a3.addPixmap(loadIcon("framenoresize.png"), QIcon::Normal, QIcon::On);
	a3.addPixmap(loadIcon("frameresize.png"), QIcon::Normal, QIcon::Off);
	noResize->setIcon(a3);

	m_lineMode = false;

	languageChange();

	connect(xposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewX()));
	connect(yposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewY()));
	connect(widthSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewW()));
	connect(heightSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewH()));
	connect(rotationSpin, SIGNAL(valueChanged(double)), this, SLOT(handleRotation()));
	connect(flipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
	connect(flipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
	connect(levelUp, SIGNAL(clicked()), this, SLOT(handleRaise()));
	connect(levelDown, SIGNAL(clicked()), this, SLOT(handleLower()));
	connect(levelTop, SIGNAL(clicked()), this, SLOT(handleFront()));
	connect(levelBottom, SIGNAL(clicked()), this, SLOT(handleBack()));
	connect(basePointWidget, SIGNAL(buttonClicked(int)), this, SLOT(handleBasePoint(int)));

	connect(nameEdit , SIGNAL(Leaved()) , this, SLOT(handleNewName()));
	connect(doLock   , SIGNAL(clicked()), this, SLOT(handleLock()));
	connect(noPrint  , SIGNAL(clicked()), this, SLOT(handlePrint()));
	connect(noResize , SIGNAL(clicked()), this, SLOT(handleLockSize()));
	connect(doGroup  , SIGNAL(clicked()), this, SLOT(handleGrouping()) );
	connect(doUnGroup, SIGNAL(clicked()), this, SLOT(handleUngrouping()) );

	m_haveItem = false;
	xposSpin->showValue(0);
	yposSpin->showValue(0);
	widthSpin->showValue(0);
	heightSpin->showValue(0);
	rotationSpin->showValue(0);
}