本文整理汇总了C++中ToolHandler::restoreLastConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolHandler::restoreLastConfig方法的具体用法?C++ ToolHandler::restoreLastConfig怎么用?C++ ToolHandler::restoreLastConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolHandler
的用法示例。
在下文中一共展示了ToolHandler::restoreLastConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: actionEnd
/**
* Mouse / Pen up / touch end
*/
void InputSequence::actionEnd(guint32 time)
{
XOJ_CHECK_TYPE(InputSequence);
if (!inputRunning)
{
return;
}
this->eventTime = time;
// Mouse button not pressed anymore
this->button = 0;
current_view = NULL;
GtkXournal* xournal = inputHandler->getXournal();
XournalppCursor* cursor = xournal->view->getCursor();
ToolHandler* h = inputHandler->getToolHandler();
if (xournal->view->getControl()->getWindow()->isGestureActive())
{
stopInput();
return;
}
cursor->setMouseDown(false);
inScrolling = false;
EditSelection* sel = xournal->view->getSelection();
if (sel)
{
sel->mouseUp();
}
if (currentInputPage)
{
PositionInputData pos = getInputDataRelativeToCurrentPage(currentInputPage);
currentInputPage->onButtonReleaseEvent(pos);
currentInputPage = NULL;
}
EditSelection* tmpSelection = xournal->selection;
xournal->selection = NULL;
h->restoreLastConfig();
// we need this workaround so it's possible to select something with the middle button
if (tmpSelection)
{
xournal->view->setSelection(tmpSelection);
}
stopInput();
}
示例2: gtk_xournal_button_release_event
gboolean gtk_xournal_button_release_event(GtkWidget* widget,
GdkEventButton* event)
{
#ifdef INPUT_DEBUG
gboolean isCore = (event->device == gdk_device_get_core_pointer());
INPUTDBG("ButtonRelease (%s) (x,y)=(%.2f,%.2f), button %d, modifier %x, isCore %i",
gdk_device_get_name(event->device), event->x, event->y,
event->button, event->state, isCore);
#endif
XInputUtils::fixXInputCoords((GdkEvent*) event, widget);
if (event->button > 3) // scroll wheel events
{
return true;
}
current_view = NULL;
GtkXournal* xournal = GTK_XOURNAL(widget);
Cursor* cursor = xournal->view->getCursor();
ToolHandler* h = xournal->view->getControl()->getToolHandler();
cursor->setMouseDown(false);
xournal->inScrolling = false;
EditSelection* sel = xournal->view->getSelection();
if (sel)
{
sel->mouseUp();
}
bool res = false;
if (xournal->currentInputPage)
{
xournal->currentInputPage->translateEvent((GdkEvent*) event, xournal->x,
xournal->y);
res = xournal->currentInputPage->onButtonReleaseEvent(widget, event);
xournal->currentInputPage = NULL;
}
EditSelection* tmpSelection = xournal->selection;
xournal->selection = NULL;
h->restoreLastConfig();
// we need this workaround so it's possible to select something with the middle button
if (tmpSelection)
{
xournal->view->setSelection(tmpSelection);
}
return res;
}
示例3: changeTool
/**
* Change the tool according to the device and button
* @return true to ignore event
*/
bool InputSequence::changeTool()
{
XOJ_CHECK_TYPE(InputSequence);
Settings* settings = inputHandler->getSettings();
ButtonConfig* cfgTouch = settings->getTouchButtonConfig();
ToolHandler* h = inputHandler->getToolHandler();
GtkXournal* xournal = inputHandler->getXournal();
ButtonConfig* cfg = NULL;
if (gdk_device_get_source(device) == GDK_SOURCE_PEN)
{
penDevice = true;
if (button == 2)
{
cfg = settings->getStylusButton1Config();
}
else if (button == 3)
{
cfg = settings->getStylusButton2Config();
}
}
else if (button == 2 /* Middle Button */ && !xournal->selection)
{
cfg = settings->getMiddleButtonConfig();
}
else if (button == 3 /* Right Button */ && !xournal->selection)
{
cfg = settings->getRightButtonConfig();
}
else if (gdk_device_get_source(device) == GDK_SOURCE_ERASER)
{
penDevice = true;
cfg = settings->getEraserButtonConfig();
}
else if (cfgTouch->device == gdk_device_get_name(device))
{
cfg = cfgTouch;
// If an action is defined we do it, even if it's a drawing action...
if (cfg->getDisableDrawing() && cfg->getAction() == TOOL_NONE)
{
ToolType tool = h->getToolType();
if (tool == TOOL_PEN || tool == TOOL_ERASER || tool == TOOL_HILIGHTER)
{
g_message("ignore touchscreen for drawing!\n");
return true;
}
}
}
if (cfg && cfg->getAction() != TOOL_NONE)
{
h->copyCurrentConfig();
cfg->acceptActions(h);
}
else
{
h->restoreLastConfig();
}
return false;
}