本文整理汇总了C++中PageView::getPage方法的典型用法代码示例。如果您正苦于以下问题:C++ PageView::getPage方法的具体用法?C++ PageView::getPage怎么用?C++ PageView::getPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageView
的用法示例。
在下文中一共展示了PageView::getPage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pageSelected
void XournalView::pageSelected(size_t page)
{
XOJ_CHECK_TYPE(XournalView);
if (this->currentPage == page && this->lastSelectedPage == page)
{
return;
}
Document* doc = control->getDocument();
doc->lock();
path file = doc->getEvMetadataFilename();
doc->unlock();
control->getMetadataManager()->setInt(file, "page", page);
if (this->lastSelectedPage != size_t_npos && this->lastSelectedPage < this->viewPagesLen)
{
this->viewPages[this->lastSelectedPage]->setSelected(false);
}
this->currentPage = page;
size_t pdfPage = size_t_npos;
if (page != size_t_npos && page < viewPagesLen)
{
PageView* vp = viewPages[page];
vp->setSelected(true);
lastSelectedPage = page;
pdfPage = vp->getPage()->getPdfPageNr();
}
control->updatePageNumbers(currentPage, pdfPage);
control->updateBackgroundSizeButton();
}
示例2: gtk_xournal_button_press_event
//.........这里部分代码省略.........
return false;
}
XInputUtils::fixXInputCoords((GdkEvent*) event, widget);
if (event->type != GDK_BUTTON_PRESS)
{
INPUTDBG2("gtk_xournal_button_press_event return false (event->type != GDK_BUTTON_PRESS)");
return false; // this event is not handled here
}
if (event->button > 3) // scroll wheel events
{
XInputUtils::handleScrollEvent(event, widget);
INPUTDBG2("gtk_xournal_button_press_event return true handled scroll event");
return true;
}
gtk_widget_grab_focus(widget);
// none button release event was sent, send one now
if (xournal->currentInputPage)
{
INPUTDBG2("gtk_xournal_button_press_event (xournal->currentInputPage != NULL)");
GdkEventButton ev = *event;
xournal->currentInputPage->translateEvent((GdkEvent*) &ev, xournal->x,
xournal->y);
xournal->currentInputPage->onButtonReleaseEvent(widget, &ev);
}
ToolHandler* h = xournal->view->getControl()->getToolHandler();
// Change the tool depending on the key or device
if(change_tool(settings, event, xournal))
return true;
// hand tool don't change the selection, so you can scroll e.g.
// with your touchscreen without remove the selection
if (h->getToolType() == TOOL_HAND)
{
Cursor* cursor = xournal->view->getCursor();
cursor->setMouseDown(true);
xournal->lastMousePositionX = 0;
xournal->lastMousePositionY = 0;
xournal->inScrolling = true;
gtk_widget_get_pointer(widget, &xournal->lastMousePositionX,
&xournal->lastMousePositionY);
INPUTDBG2("gtk_xournal_button_press_event (h->getToolType() == TOOL_HAND) return true");
return true;
}
else if (xournal->selection)
{
EditSelection* selection = xournal->selection;
PageView* view = selection->getView();
GdkEventButton ev = *event;
view->translateEvent((GdkEvent*) &ev, xournal->x, xournal->y);
CursorSelectionType selType = selection->getSelectionTypeForPos(ev.x, ev.y,
xournal->view->getZoom());
if (selType)
{
if(selType == CURSOR_SELECTION_MOVE && event->button == 3)
{
selection->copySelection();
}
xournal->view->getCursor()->setMouseDown(true);
xournal->selection->mouseDown(selType, ev.x, ev.y);
INPUTDBG2("gtk_xournal_button_press_event (selection) return true");
return true;
}
else
{
xournal->view->clearSelection();
if(change_tool(settings, event, xournal))
return true;
}
}
PageView* pv = gtk_xournal_get_page_view_for_pos_cached(xournal, event->x,
event->y);
current_view = pv;
if (pv)
{
xournal->currentInputPage = pv;
pv->translateEvent((GdkEvent*) event, xournal->x, xournal->y);
INPUTDBG2("gtk_xournal_button_press_event (pv->onButtonPressEvent) return");
xournal->view->getDocument()->indexOf(pv->getPage());
return pv->onButtonPressEvent(widget, event);
}
INPUTDBG2("gtk_xournal_button_press_event (not handled) return false");
return false; // not handled
}
示例3: gtk_xournal_button_press_event
//.........这里部分代码省略.........
if(isCore && settings->isXinputEnabled() && settings->isIgnoreCoreEvents()) {
INPUTDBG2("gtk_xournal_button_press_event return false (ignore core)");
return false;
}
XInputUtils::fixXInputCoords((GdkEvent*) event, widget);
if (event->type != GDK_BUTTON_PRESS) {
INPUTDBG2("gtk_xournal_button_press_event return false (event->type != GDK_BUTTON_PRESS)");
return false; // this event is not handled here
}
if (event->button > 3) { // scroll wheel events
XInputUtils::handleScrollEvent(event, widget);
INPUTDBG2("gtk_xournal_button_press_event return true handled scroll event");
return true;
}
gtk_widget_grab_focus(widget);
ToolHandler * h = xournal->view->getControl()->getToolHandler();
// none button release event was sent, send one now
if (xournal->currentInputPage) {
INPUTDBG2("gtk_xournal_button_press_event (xournal->currentInputPage != NULL)");
GdkEventButton ev = *event;
xournal->currentInputPage->translateEvent((GdkEvent*) &ev, xournal->x, xournal->y);
xournal->currentInputPage->onButtonReleaseEvent(widget, &ev);
}
// Change the tool depending on the key or device
ButtonConfig * cfg = NULL;
ButtonConfig * cfgTouch = settings->getTouchButtonConfig();
if (event->button == 2) { // Middle Button
cfg = settings->getMiddleButtonConfig();
} else if (event->button == 3) { // Right Button
cfg = settings->getRightButtonConfig();
} else if (event->device->source == GDK_SOURCE_ERASER) {
cfg = settings->getEraserButtonConfig();
} else if (cfgTouch->device == event->device->name) {
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) {
printf("ignore touchscreen for drawing!\n");
return true;
}
}
}
if (cfg && cfg->getAction() != TOOL_NONE) {
h->copyCurrentConfig();
cfg->acceptActions(h);
}
// hand tool don't change the selection, so you can scroll e.g.
// with your touchscreen without remove the selection
if (h->getToolType() == TOOL_HAND) {
Cursor * cursor = xournal->view->getCursor();
cursor->setMouseDown(true);
xournal->lastMousePositionX = 0;
xournal->lastMousePositionY = 0;
xournal->inScrolling = true;
gtk_widget_get_pointer(widget, &xournal->lastMousePositionX, &xournal->lastMousePositionY);
INPUTDBG2("gtk_xournal_button_press_event (h->getToolType() == TOOL_HAND) return true");
return true;
} else if (xournal->selection) {
EditSelection * selection = xournal->selection;
PageView * view = selection->getView();
GdkEventButton ev = *event;
view->translateEvent((GdkEvent*) &ev, xournal->x, xournal->y);
CursorSelectionType selType = selection->getSelectionTypeForPos(ev.x, ev.y, xournal->view->getZoom());
if (selType) {
xournal->view->getCursor()->setMouseDown(true);
xournal->selection->mouseDown(selType, ev.x, ev.y);
INPUTDBG2("gtk_xournal_button_press_event (selection) return true");
return true;
} else {
xournal->view->clearSelection();
}
}
PageView * pv = gtk_xournal_get_page_view_for_pos_cached(xournal, event->x, event->y);
if (pv) {
xournal->currentInputPage = pv;
pv->translateEvent((GdkEvent*) event, xournal->x, xournal->y);
INPUTDBG2("gtk_xournal_button_press_event (pv->onButtonPressEvent) return");
xournal->view->getDocument()->indexOf(pv->getPage());
return pv->onButtonPressEvent(widget, event);
}
INPUTDBG2("gtk_xournal_button_press_event (not handled) return false");
return false; // not handled
}
示例4: mouseMove
//.........这里部分代码省略.........
this->view->getXournal()->repaintSelection();
} else if (this->mouseDownType == CURSOR_SELECTION_TOP_LEFT) {
double dx = x - this->x;
double dy = y - this->y;
double f;
if (ABS(dy) < ABS(dx)) {
f = (this->height + dy) / this->height;
} else {
f = (this->width + dx) / this->width;
}
double oldW = this->width;
double oldH = this->height;
this->width /= f;
this->height /= f;
this->x += oldW - this->width;
this->y += oldH - this->height;
this->view->getXournal()->repaintSelection();
} else if (this->mouseDownType == CURSOR_SELECTION_TOP_RIGHT) {
double dx = x - this->x - this->width;
double dy = y - this->y;
double f;
if (ABS(dy) < ABS(dx)) {
f = this->height / (this->height + dy);
} else {
f = (this->width + dx) / this->width;
}
double oldH = this->height;
this->width *= f;
this->height *= f;
this->y += oldH - this->height;
this->view->getXournal()->repaintSelection();
} else if (this->mouseDownType == CURSOR_SELECTION_BOTTOM_LEFT) {
double dx = x - this->x;
double dy = y - this->y - this->height;
double f;
if (ABS(dy) < ABS(dx)) {
f = (this->height + dy) / this->height;
} else {
f = this->width / (this->width + dx);
}
double oldW = this->width;
this->width *= f;
this->height *= f;
this->x += oldW - this->width;
this->view->getXournal()->repaintSelection();
} else if (this->mouseDownType == CURSOR_SELECTION_BOTTOM_RIGHT) {
double dx = x - this->x - this->width;
double dy = y - this->y - this->height;
double f;
if (ABS(dy) < ABS(dx)) {
f = (this->height + dy) / this->height;
} else {
f = (this->width + dx) / this->width;
}
this->width *= f;
this->height *= f;
this->view->getXournal()->repaintSelection();
} else if (this->mouseDownType == CURSOR_SELECTION_TOP) {
double dy = y - this->y;
this->height -= dy;
this->y += dy;
this->view->getXournal()->repaintSelection();
} else if (this->mouseDownType == CURSOR_SELECTION_BOTTOM) {
double dy = y - this->y - this->height;
this->height += dy;
this->view->getXournal()->repaintSelection();
} else if (this->mouseDownType == CURSOR_SELECTION_LEFT) {
double dx = x - this->x;
this->width -= dx;
this->x += dx;
this->view->getXournal()->repaintSelection();
} else if (this->mouseDownType == CURSOR_SELECTION_RIGHT) {
double dx = x - this->x - this->width;
this->width += dx;
this->view->getXournal()->repaintSelection();
}
PageView * v = getBestMatchingPageView();
if (v && v != this->view) {
XournalView * xournal = this->view->getXournal();
int pageNr = xournal->getControl()->getDocument()->indexOf(v->getPage());
xournal->pageSelected(pageNr);
translateToView(v);
}
}