From 9db4494753456b82b200c342be36c611fb014899 Mon Sep 17 00:00:00 2001 From: Peter Klausing Date: Thu, 21 Mar 2019 19:45:19 +0100 Subject: [PATCH 1/2] specify abs to std library --- src/control/tools/EditSelectionContents.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/control/tools/EditSelectionContents.cpp b/src/control/tools/EditSelectionContents.cpp index c030907d..113ae6c4 100644 --- a/src/control/tools/EditSelectionContents.cpp +++ b/src/control/tools/EditSelectionContents.cpp @@ -403,7 +403,7 @@ void EditSelectionContents::finalizeSelection(double x, double y, double width, fy = f; } bool scale = (width != this->originalWidth || height != this->originalHeight); - bool rotate = (abs(this->rotation) > __DBL_EPSILON__); + bool rotate = (std::abs(this->rotation) > __DBL_EPSILON__); double mx = x - this->originalX; double my = y - this->originalY; @@ -466,7 +466,7 @@ void EditSelectionContents::updateContent(double x, double y, double rotation, d } bool scale = (width != this->lastWidth || height != this->lastHeight); - bool rotate = (abs(this->rotation) > __DBL_EPSILON__); + bool rotate = (std::abs(this->rotation) > __DBL_EPSILON__); if (type == CURSOR_SELECTION_MOVE) { @@ -540,8 +540,8 @@ void EditSelectionContents::paint(cairo_t* cr, double x, double y, double rotati this->relativeY = y; } - if (abs(rotation) > __DBL_EPSILON__) - { + if (std::abs(rotation) > __DBL_EPSILON__) + { this->rotation = rotation; } @@ -573,7 +573,7 @@ void EditSelectionContents::paint(cairo_t* cr, double x, double y, double rotati double sx = (double) wTarget / wImg; double sy = (double) hTarget / hImg; - if (wTarget != wImg || hTarget != hImg || abs(rotation) > __DBL_EPSILON__) + if (wTarget != wImg || hTarget != hImg || std::abs(rotation) > __DBL_EPSILON__) { if (!this->rescaleId) { From c963499da723ae632e917bb4ebe0947ece8efee4 Mon Sep 17 00:00:00 2001 From: Peter Klausing Date: Thu, 21 Mar 2019 20:27:18 +0100 Subject: [PATCH 2/2] replace math. header with cmath --- src/control/PrintHandler.cpp | 2 +- src/control/shaperecognizer/CircleRecognizer.cpp | 2 +- src/control/shaperecognizer/Inertia.cpp | 2 +- src/control/shaperecognizer/RecoSegment.cpp | 2 +- src/control/shaperecognizer/ShapeRecognizer.cpp | 2 +- src/control/tools/EditSelection.cpp | 2 +- src/control/tools/EraseHandler.cpp | 2 +- src/control/tools/InputHandler.cpp | 2 +- src/control/tools/StrokeHandler.cpp | 2 +- src/gui/PageView.cpp | 1 - src/gui/XournalView.cpp | 2 -- src/gui/toolbarMenubar/ColorToolItem.cpp | 2 +- src/gui/toolbarMenubar/icon/ColorSelectImage.cpp | 2 +- src/gui/widgets/XournalWidget.cpp | 1 - src/model/Stroke.cpp | 2 +- src/model/eraser/EraseableStroke.cpp | 2 +- 16 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/control/PrintHandler.cpp b/src/control/PrintHandler.cpp index a78176d4..2f444935 100644 --- a/src/control/PrintHandler.cpp +++ b/src/control/PrintHandler.cpp @@ -6,7 +6,7 @@ #include "model/Document.h" #include "view/DocumentView.h" -#include +#include PrintHandler::PrintHandler() { diff --git a/src/control/shaperecognizer/CircleRecognizer.cpp b/src/control/shaperecognizer/CircleRecognizer.cpp index 592ff07d..ff349779 100644 --- a/src/control/shaperecognizer/CircleRecognizer.cpp +++ b/src/control/shaperecognizer/CircleRecognizer.cpp @@ -4,7 +4,7 @@ #include "ShapeRecognizerConfig.h" #include "model/Stroke.h" -#include +#include /** * Create circle stroke for inertia diff --git a/src/control/shaperecognizer/Inertia.cpp b/src/control/shaperecognizer/Inertia.cpp index 4432890a..dc96609d 100644 --- a/src/control/shaperecognizer/Inertia.cpp +++ b/src/control/shaperecognizer/Inertia.cpp @@ -2,7 +2,7 @@ #include "model/Point.h" -#include +#include Inertia::Inertia() { diff --git a/src/control/shaperecognizer/RecoSegment.cpp b/src/control/shaperecognizer/RecoSegment.cpp index b5cce263..eaae0fcb 100644 --- a/src/control/shaperecognizer/RecoSegment.cpp +++ b/src/control/shaperecognizer/RecoSegment.cpp @@ -2,7 +2,7 @@ #include "Inertia.h" -#include +#include #include RecoSegment::RecoSegment() diff --git a/src/control/shaperecognizer/ShapeRecognizer.cpp b/src/control/shaperecognizer/ShapeRecognizer.cpp index 56d90e54..57b33026 100644 --- a/src/control/shaperecognizer/ShapeRecognizer.cpp +++ b/src/control/shaperecognizer/ShapeRecognizer.cpp @@ -8,7 +8,7 @@ #include -#include +#include ShapeRecognizer::ShapeRecognizer() { diff --git a/src/control/tools/EditSelection.cpp b/src/control/tools/EditSelection.cpp index 2332c662..7962f194 100644 --- a/src/control/tools/EditSelection.cpp +++ b/src/control/tools/EditSelection.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include EditSelection::EditSelection(UndoRedoHandler* undo, PageRef page, XojPageView* view) { diff --git a/src/control/tools/EraseHandler.cpp b/src/control/tools/EraseHandler.cpp index 992cc244..1295388e 100644 --- a/src/control/tools/EraseHandler.cpp +++ b/src/control/tools/EraseHandler.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include EraseHandler::EraseHandler(UndoRedoHandler* undo, Document* doc, PageRef page, ToolHandler* handler, Redrawable* view) { diff --git a/src/control/tools/InputHandler.cpp b/src/control/tools/InputHandler.cpp index 0f5d09ad..39175fb5 100644 --- a/src/control/tools/InputHandler.cpp +++ b/src/control/tools/InputHandler.cpp @@ -12,7 +12,7 @@ #include "gui/MainWindow.h" -#include +#include #define PIXEL_MOTION_THRESHOLD 0.3 diff --git a/src/control/tools/StrokeHandler.cpp b/src/control/tools/StrokeHandler.cpp index 5a8b8759..a3a68c09 100644 --- a/src/control/tools/StrokeHandler.cpp +++ b/src/control/tools/StrokeHandler.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include StrokeHandler::StrokeHandler(XournalView* xournal, XojPageView* redrawable, PageRef page) : InputHandler(xournal, redrawable, page), diff --git a/src/gui/PageView.cpp b/src/gui/PageView.cpp index 08e6b1c1..e4907aa9 100644 --- a/src/gui/PageView.cpp +++ b/src/gui/PageView.cpp @@ -45,7 +45,6 @@ #include #include -#include XojPageView::XojPageView(XournalView* xournal, PageRef page) { diff --git a/src/gui/XournalView.cpp b/src/gui/XournalView.cpp index 252d6748..ce6f9593 100644 --- a/src/gui/XournalView.cpp +++ b/src/gui/XournalView.cpp @@ -21,8 +21,6 @@ #include -#include - XournalView::XournalView(GtkWidget* parent, Control* control, ScrollHandling* scrollHandling) : scrollHandling(scrollHandling), control(control) diff --git a/src/gui/toolbarMenubar/ColorToolItem.cpp b/src/gui/toolbarMenubar/ColorToolItem.cpp index 051131b8..918a655f 100644 --- a/src/gui/toolbarMenubar/ColorToolItem.cpp +++ b/src/gui/toolbarMenubar/ColorToolItem.cpp @@ -160,7 +160,7 @@ bool ColorToolItem::colorEqualsMoreOreLess(int color) int g2 = (this->color & 0xff00) >> 8; int b2 = (this->color & 0xff); - if (abs(r1 - r2) < 10 && abs(g1 - g2) < 10 && abs(b1 - b2) < 10) + if (std::abs(r1 - r2) < 10 && std::abs(g1 - g2) < 10 && std::abs(b1 - b2) < 10) { return true; } diff --git a/src/gui/toolbarMenubar/icon/ColorSelectImage.cpp b/src/gui/toolbarMenubar/icon/ColorSelectImage.cpp index 6e41145b..b10c631b 100644 --- a/src/gui/toolbarMenubar/icon/ColorSelectImage.cpp +++ b/src/gui/toolbarMenubar/icon/ColorSelectImage.cpp @@ -2,7 +2,7 @@ #include -#include +#include ColorSelectImage::ColorSelectImage(int color, bool circle) : color(color), diff --git a/src/gui/widgets/XournalWidget.cpp b/src/gui/widgets/XournalWidget.cpp index f33e77d3..c74b4e42 100644 --- a/src/gui/widgets/XournalWidget.cpp +++ b/src/gui/widgets/XournalWidget.cpp @@ -18,7 +18,6 @@ #include #include -#include static void gtk_xournal_class_init(GtkXournalClass* klass); static void gtk_xournal_init(GtkXournal* xournal); diff --git a/src/model/Stroke.cpp b/src/model/Stroke.cpp index 076e417d..53aaa442 100644 --- a/src/model/Stroke.cpp +++ b/src/model/Stroke.cpp @@ -5,7 +5,7 @@ #include -#include +#include Stroke::Stroke() : AudioElement(ELEMENT_STROKE) diff --git a/src/model/eraser/EraseableStroke.cpp b/src/model/eraser/EraseableStroke.cpp index 5ac9e1b7..d9b43654 100644 --- a/src/model/eraser/EraseableStroke.cpp +++ b/src/model/eraser/EraseableStroke.cpp @@ -6,7 +6,7 @@ #include -#include +#include EraseableStroke::EraseableStroke(Stroke* stroke) : stroke(stroke)