本文整理汇总了C++中ToolHandler::getEraserType方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolHandler::getEraserType方法的具体用法?C++ ToolHandler::getEraserType怎么用?C++ ToolHandler::getEraserType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolHandler
的用法示例。
在下文中一共展示了ToolHandler::getEraserType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onMotionNotifyEvent
bool PageView::onMotionNotifyEvent(GtkWidget * widget, GdkEventMotion * event) {
XOJ_CHECK_TYPE(PageView);
double zoom = xournal->getZoom();
double x = event->x / zoom;
double y = event->y / zoom;
ToolHandler * h = xournal->getControl()->getToolHandler();
if (this->inputHandler->onMotionNotifyEvent(event)) {
//input handler used this event
} else if (this->selection) {
this->selection->currentPos(x, y);
} else if (this->verticalSpace) {
this->verticalSpace->currentPos(x, y);
} else if (this->textEditor) {
Cursor * cursor = getXournal()->getCursor();
cursor->setInvisible(false);
Text * text = this->textEditor->getText();
this->textEditor->mouseMoved(x - text->getX(), y - text->getY());
} else if (h->getToolType() == TOOL_ERASER && h->getEraserType() != ERASER_TYPE_WHITEOUT && this->inEraser) {
this->eraser->erase(x, y);
}
return false;
}
示例2: onButtonPressEvent
bool PageView::onButtonPressEvent(GtkWidget * widget, GdkEventButton * event) {
XOJ_CHECK_TYPE(PageView);
if ((event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) != 0) {
return false; // not handled here
}
if (!this->selected) {
xournal->getControl()->firePageSelected(this->page);
}
ToolHandler * h = xournal->getControl()->getToolHandler();
double x = event->x;
double y = event->y;
if ((x < 0 || y < 0) && !extendedWarningDisplayd && settings->isXinputEnabled()) {
GtkWidget * dialog = gtk_message_dialog_new((GtkWindow *) *xournal->getControl()->getWindow(), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
GTK_BUTTONS_NONE, _("There was a wrong input event, input is not working.\nDo you want to disable \"Extended Input\"?"));
gtk_dialog_add_button(GTK_DIALOG(dialog), "Disable \"Extended Input\"", 1);
gtk_dialog_add_button(GTK_DIALOG(dialog), "Cancel", 2);
this->extendedWarningDisplayd = true;
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(this->xournal->getControl()->getWindow()->getWindow()));
if (gtk_dialog_run(GTK_DIALOG(dialog)) == 1) {
settings->setXinputEnabled(false);
xournal->updateXEvents();
}
gtk_widget_destroy(dialog);
return true;
}
double zoom = xournal->getZoom();
x /= zoom;
y /= zoom;
Cursor * cursor = xournal->getCursor();
cursor->setMouseDown(true);
if (h->getToolType() == TOOL_PEN) {
this->inputHandler->startStroke(event, STROKE_TOOL_PEN, x, y);
} else if (h->getToolType() == TOOL_HILIGHTER) {
this->inputHandler->startStroke(event, STROKE_TOOL_HIGHLIGHTER, x, y);
} else if (h->getToolType() == TOOL_ERASER) {
if (h->getEraserType() == ERASER_TYPE_WHITEOUT) {
this->inputHandler->startStroke(event, STROKE_TOOL_ERASER, x, y);
this->inputHandler->getTmpStroke()->setColor(0xffffff); // White
} else {
this->eraser->erase(x, y);
this->inEraser = true;
}
} else if (h->getToolType() == TOOL_VERTICAL_SPACE) {
this->verticalSpace = new VerticalToolHandler(this, this->page, y, zoom);
} else if (h->getToolType() == TOOL_SELECT_RECT || h->getToolType() == TOOL_SELECT_REGION || h->getToolType() == TOOL_SELECT_OBJECT) {
if (h->getToolType() == TOOL_SELECT_RECT) {
if (this->selection) {
delete this->selection;
this->selection = NULL;
repaintPage();
}
this->selection = new RectSelection(x, y, this);
} else if (h->getToolType() == TOOL_SELECT_REGION) {
if (this->selection) {
delete this->selection;
this->selection = NULL;
repaintPage();
}
this->selection = new RegionSelect(x, y, this);
} else if (h->getToolType() == TOOL_SELECT_OBJECT) {
selectObjectAt(x, y);
}
} else if (h->getToolType() == TOOL_TEXT) {
startText(x, y);
} else if (h->getToolType() == TOOL_IMAGE) {
ImageHandler imgHandler(xournal->getControl(), this);
imgHandler.insertImage(x, y);
}
return true;
}