diff --git a/src/control/tools/ArrowHandler.cpp b/src/control/tools/ArrowHandler.cpp index c685da2c..ff86dfbe 100644 --- a/src/control/tools/ArrowHandler.cpp +++ b/src/control/tools/ArrowHandler.cpp @@ -6,7 +6,7 @@ #include ArrowHandler::ArrowHandler(XournalView* xournal, XojPageView* redrawable, PageRef page) - : BaseStrokeHandler(xournal, redrawable, page) + : BaseStrokeHandler(xournal, redrawable, page) { XOJ_INIT_TYPE(ArrowHandler); } @@ -20,6 +20,8 @@ ArrowHandler::~ArrowHandler() void ArrowHandler::drawShape(Point& c, bool shiftDown) { + XOJ_CHECK_TYPE(ArrowHandler); + /** * Snap first point to grid (if enabled) */ diff --git a/src/control/tools/CircleHandler.cpp b/src/control/tools/CircleHandler.cpp index edb26879..d2c7dd21 100644 --- a/src/control/tools/CircleHandler.cpp +++ b/src/control/tools/CircleHandler.cpp @@ -6,7 +6,7 @@ #include CircleHandler::CircleHandler(XournalView* xournal, XojPageView* redrawable, PageRef page) - : BaseStrokeHandler(xournal, redrawable, page) + : BaseStrokeHandler(xournal, redrawable, page) { XOJ_INIT_TYPE(CircleHandler); } @@ -20,6 +20,8 @@ CircleHandler::~CircleHandler() void CircleHandler::drawShape(Point& c, bool shiftDown) { + XOJ_CHECK_TYPE(CircleHandler); + /** * Snap first point to grid (if enabled) */ diff --git a/src/control/tools/CoordinateSystemHandler.cpp b/src/control/tools/CoordinateSystemHandler.cpp index ff689b10..7b28c3ac 100644 --- a/src/control/tools/CoordinateSystemHandler.cpp +++ b/src/control/tools/CoordinateSystemHandler.cpp @@ -27,6 +27,8 @@ CoordinateSystemHandler::~CoordinateSystemHandler() */ void CoordinateSystemHandler::drawShape(Point& currentPoint, bool shiftDown) { + XOJ_CHECK_TYPE(CoordinateSystemHandler); + /** * Snap first point to grid (if enabled) */ diff --git a/src/control/tools/EditSelection.cpp b/src/control/tools/EditSelection.cpp index 03500a07..5b39480c 100644 --- a/src/control/tools/EditSelection.cpp +++ b/src/control/tools/EditSelection.cpp @@ -343,6 +343,8 @@ UndoAction* EditSelection::setFont(XojFont& font) */ void EditSelection::fillUndoItem(DeleteUndoAction* undo) { + XOJ_CHECK_TYPE(EditSelection); + this->contents->fillUndoItem(undo); } @@ -401,6 +403,8 @@ void EditSelection::mouseUp() */ void EditSelection::mouseDown(CursorSelectionType type, double x, double y) { + XOJ_CHECK_TYPE(EditSelection); + double zoom = this->view->getXournal()->getZoom(); x /= zoom; y /= zoom; @@ -415,6 +419,8 @@ void EditSelection::mouseDown(CursorSelectionType type, double x, double y) */ void EditSelection::mouseMove(double x, double y) { + XOJ_CHECK_TYPE(EditSelection); + double zoom = this->view->getXournal()->getZoom(); x /= zoom; y /= zoom; @@ -553,6 +559,8 @@ void EditSelection::mouseMove(double x, double y) XojPageView* EditSelection::getBestMatchingPageView() { + XOJ_CHECK_TYPE(EditSelection); + PagePositionHandler* pp = this->view->getXournal()->getPagePositionHandler(); int rx = this->getXOnViewAbsolute(); int ry = this->getYOnViewAbsolute(); @@ -566,6 +574,8 @@ XojPageView* EditSelection::getBestMatchingPageView() */ void EditSelection::translateToView(XojPageView* v) { + XOJ_CHECK_TYPE(EditSelection); + double zoom = view->getXournal()->getZoom(); int aX1 = getXOnViewAbsolute(); @@ -591,6 +601,8 @@ void EditSelection::translateToView(XojPageView* v) void EditSelection::copySelection() { + XOJ_CHECK_TYPE(EditSelection); + undo->addUndoAction(contents->copySelection(this->view->getPage(), this->view, this->x, this->y)); } @@ -599,6 +611,8 @@ void EditSelection::copySelection() */ bool EditSelection::isMoving() { + XOJ_CHECK_TYPE(EditSelection); + return this->mouseDownType != CURSOR_SELECTION_NONE; } @@ -712,6 +726,8 @@ CursorSelectionType EditSelection::getSelectionTypeForPos(double x, double y, do void EditSelection::snapRotation() { + XOJ_CHECK_TYPE(EditSelection); + bool snapping = this->view->getXournal()->getControl()->getSettings()->isSnapRotation(); if (!snapping) { @@ -846,6 +862,8 @@ XojPageView* EditSelection::getView() void EditSelection::serialize(ObjectOutputStream& out) { + XOJ_CHECK_TYPE(EditSelection); + out.writeObject("EditSelection"); out.writeDouble(this->x); @@ -865,6 +883,8 @@ void EditSelection::serialize(ObjectOutputStream& out) void EditSelection::readSerialized(ObjectInputStream& in) { + XOJ_CHECK_TYPE(EditSelection); + in.readObject("EditSelection"); this->x = in.readDouble(); this->y = in.readDouble(); diff --git a/src/control/tools/EditSelectionContents.cpp b/src/control/tools/EditSelectionContents.cpp index 23405ecb..5736a28d 100644 --- a/src/control/tools/EditSelectionContents.cpp +++ b/src/control/tools/EditSelectionContents.cpp @@ -318,6 +318,8 @@ UndoAction* EditSelectionContents::setColor(int color) */ void EditSelectionContents::fillUndoItem(DeleteUndoAction* undo) { + XOJ_CHECK_TYPE(EditSelectionContents); + Layer* layer = this->sourceLayer; // Always insert the elements on top @@ -368,6 +370,8 @@ void EditSelectionContents::deleteViewBuffer() */ double EditSelectionContents::getOriginalWidth() { + XOJ_CHECK_TYPE(EditSelectionContents); + return this->originalWidth; } @@ -376,6 +380,8 @@ double EditSelectionContents::getOriginalWidth() */ double EditSelectionContents::getOriginalHeight() { + XOJ_CHECK_TYPE(EditSelectionContents); + return this->originalHeight; } @@ -385,6 +391,8 @@ double EditSelectionContents::getOriginalHeight() void EditSelectionContents::finalizeSelection(double x, double y, double width, double height, bool aspectRatio, Layer* layer, PageRef targetPage, XojPageView* targetView, UndoRedoHandler* undo) { + XOJ_CHECK_TYPE(EditSelectionContents); + double fx = width / this->originalWidth; double fy = height / this->originalHeight; @@ -425,6 +433,8 @@ void EditSelectionContents::updateContent(double x, double y, double rotation, d Layer* layer, PageRef targetPage, XojPageView* targetView, UndoRedoHandler* undo, CursorSelectionType type) { + XOJ_CHECK_TYPE(EditSelectionContents); + double mx = x - this->lastX; double my = y - this->lastY; this->rotation = rotation; @@ -503,6 +513,8 @@ void EditSelectionContents::updateContent(double x, double y, double rotation, d */ void EditSelectionContents::paint(cairo_t* cr, double x, double y, double rotation, double width, double height, double zoom) { + XOJ_CHECK_TYPE(EditSelectionContents); + double fx = width / this->originalWidth; double fy = height / this->originalHeight; @@ -565,6 +577,8 @@ void EditSelectionContents::paint(cairo_t* cr, double x, double y, double rotati UndoAction* EditSelectionContents::copySelection(PageRef page, XojPageView *view, double x, double y) { + XOJ_CHECK_TYPE(EditSelectionContents); + Layer* layer = page->getSelectedLayer(); vector new_elems; @@ -586,6 +600,8 @@ UndoAction* EditSelectionContents::copySelection(PageRef page, XojPageView *view void EditSelectionContents::serialize(ObjectOutputStream& out) { + XOJ_CHECK_TYPE(EditSelectionContents); + out.writeObject("EditSelectionContents"); out.writeDouble(this->originalWidth); @@ -602,6 +618,8 @@ void EditSelectionContents::serialize(ObjectOutputStream& out) void EditSelectionContents::readSerialized(ObjectInputStream& in) { + XOJ_CHECK_TYPE(EditSelectionContents); + in.readObject("EditSelectionContents"); this->originalWidth = in.readDouble(); diff --git a/src/control/tools/RectangleHandler.cpp b/src/control/tools/RectangleHandler.cpp index da3af4f8..d6966242 100644 --- a/src/control/tools/RectangleHandler.cpp +++ b/src/control/tools/RectangleHandler.cpp @@ -5,7 +5,7 @@ #include "undo/InsertUndoAction.h" RectangleHandler::RectangleHandler(XournalView* xournal, XojPageView* redrawable, PageRef page) - : BaseStrokeHandler(xournal, redrawable, page) + : BaseStrokeHandler(xournal, redrawable, page) { XOJ_INIT_TYPE(RectangleHandler); } diff --git a/src/control/tools/RulerHandler.cpp b/src/control/tools/RulerHandler.cpp index 83f80cd3..c274d2f2 100644 --- a/src/control/tools/RulerHandler.cpp +++ b/src/control/tools/RulerHandler.cpp @@ -6,7 +6,7 @@ #include RulerHandler::RulerHandler(XournalView* xournal, XojPageView* redrawable, PageRef page) - : BaseStrokeHandler(xournal, redrawable, page) + : BaseStrokeHandler(xournal, redrawable, page) { XOJ_INIT_TYPE(RulerHandler); } diff --git a/src/control/tools/Selection.cpp b/src/control/tools/Selection.cpp index ce98a99d..7d7160a9 100644 --- a/src/control/tools/Selection.cpp +++ b/src/control/tools/Selection.cpp @@ -336,7 +336,7 @@ bool RegionSelect::contains(double x, double y) } } - return ((hits & 1) != 0); + return (hits & 1) != 0; } bool RegionSelect::finalize(PageRef page)