diff --git a/resources/OpenBoard.qrc b/resources/OpenBoard.qrc index 3e41418a..480269c1 100644 --- a/resources/OpenBoard.qrc +++ b/resources/OpenBoard.qrc @@ -364,5 +364,7 @@ images/expand-all.png images/asc.png images/desc.png + images/toolPalette/axesTool.png + images/numbersTool.svg diff --git a/resources/forms/mainWindow.ui b/resources/forms/mainWindow.ui index dcacf33b..8b08f03c 100644 --- a/resources/forms/mainWindow.ui +++ b/resources/forms/mainWindow.ui @@ -1686,6 +1686,22 @@ Reset grid size + + + true + + + + :/images/minus.svg + :/images/save.svg:/images/minus.svg + + + Draw intermediate grid lines + + + Draw intermediate grid lines + + diff --git a/resources/i18n/OpenBoard_de.ts b/resources/i18n/OpenBoard_de.ts index a2561a13..00eaa08e 100644 --- a/resources/i18n/OpenBoard_de.ts +++ b/resources/i18n/OpenBoard_de.ts @@ -835,6 +835,10 @@ Color 5 Farbe 5 + + Draw intermediate grid lines + Gitter-Zwischenlinien zeichnen + PasswordDialog @@ -937,6 +941,10 @@ Grid size Gittergrösse + + Draw intermediate grid lines + Gitter-Zwischenlinien zeichnen + UBBoardController @@ -2226,6 +2234,10 @@ Miniaturansicht der Seite %1 wird geladen Cache Zwischenspeicher + + Axes + Achsen + UBTrapFlashController diff --git a/resources/images/numbersTool.svg b/resources/images/numbersTool.svg new file mode 100644 index 00000000..862270de --- /dev/null +++ b/resources/images/numbersTool.svg @@ -0,0 +1,63 @@ + + + +image/svg+xml1 + \ No newline at end of file diff --git a/resources/images/toolPalette/axesTool.png b/resources/images/toolPalette/axesTool.png new file mode 100644 index 00000000..05008c8c Binary files /dev/null and b/resources/images/toolPalette/axesTool.png differ diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 052ea10b..62a4e524 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -51,6 +51,7 @@ #include "domain/UBItem.h" #include "tools/UBGraphicsRuler.h" +#include "tools/UBGraphicsAxes.h" #include "tools/UBGraphicsCompass.h" #include "tools/UBGraphicsProtractor.h" #include "tools/UBGraphicsCurtainItem.h" @@ -468,6 +469,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProx mScene->setBackgroundGridSize(gridSize); } + + QStringRef ubIntermediateLines = mXmlReader.attributes().value(mNamespaceUri, "intermediate-lines"); + + if (!ubIntermediateLines.isNull()) { + bool intermediateLines = ubIntermediateLines.toInt(); + + mScene->setIntermediateLines(intermediateLines); + } } QStringRef ubRuledBackground = mXmlReader.attributes().value(mNamespaceUri, "ruled-background"); @@ -483,6 +492,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProx mScene->setBackgroundGridSize(gridSize); } + + QStringRef ubIntermediateLines = mXmlReader.attributes().value(mNamespaceUri, "intermediate-lines"); + + if (!ubIntermediateLines.isNull()) { + bool intermediateLines = ubIntermediateLines.toInt(); + + mScene->setIntermediateLines(intermediateLines); + } } UBPageBackground bg; @@ -754,6 +771,17 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProx mScene->registerTool(ruler); } + } + else if (mXmlReader.name() == "axes") + { + + UBGraphicsAxes *axes = axesFromSvg(); + if (axes) + { + mScene->addItem(axes); + mScene->registerTool(axes); + } + } else if (mXmlReader.name() == "compass") { @@ -1128,8 +1156,10 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement(UBDocumentProxy* pro if (crossedBackground || ruledBackground) { int gridSize = mScene->backgroundGridSize(); + bool intermediateLines = mScene->intermediateLines(); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "grid-size", QString::number(gridSize)); + mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "intermediate-lines", QString::number(intermediateLines)); } QDesktopWidget* desktop = UBApplication::desktop(); @@ -1353,6 +1383,14 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(UBDocumentProxy* proxy, continue; } + // Is the item a axes? + UBGraphicsAxes *axes = qgraphicsitem_cast (item); + if (axes && axes->isVisible()) + { + axesToSvg(axes); + continue; + } + // Is the item a cache? UBGraphicsCache* cache = qgraphicsitem_cast(item); if(cache && cache->isVisible()) @@ -2859,6 +2897,40 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::rulerToSvg(UBGraphicsRuler* item) mXmlWriter.writeEndElement(); } +void UBSvgSubsetAdaptor::UBSvgSubsetWriter::axesToSvg(UBGraphicsAxes *item) +{ + + /** + * + * sample + * + + + */ + + mXmlWriter.writeStartElement(UBSettings::uniboardDocumentNamespaceUri, "axes"); + mXmlWriter.writeAttribute("x", QString("%1").arg(item->pos().x())); + mXmlWriter.writeAttribute("y", QString("%1").arg(item->pos().y())); + mXmlWriter.writeAttribute("left", QString("%1").arg(item->bounds().left())); + mXmlWriter.writeAttribute("top", QString("%1").arg(item->bounds().top())); + mXmlWriter.writeAttribute("width", QString("%1").arg(item->bounds().width())); + mXmlWriter.writeAttribute("height", QString("%1").arg(item->bounds().height())); + mXmlWriter.writeAttribute("numbers", QString("%1").arg(item->showNumbes())); + + QString zs; + zs.setNum(item->zValue(), 'f'); // 'f' keeps precision + mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "z-value", zs); + + UBItem* ubItem = dynamic_cast(item); + + if (ubItem) + { + mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(ubItem->uuid())); + } + + mXmlWriter.writeEndElement(); +} + UBGraphicsRuler* UBSvgSubsetAdaptor::UBSvgSubsetReader::rulerFromSvg() { @@ -2883,6 +2955,43 @@ UBGraphicsRuler* UBSvgSubsetAdaptor::UBSvgSubsetReader::rulerFromSvg() return ruler; } +UBGraphicsAxes *UBSvgSubsetAdaptor::UBSvgSubsetReader::axesFromSvg() +{ + UBGraphicsAxes* axes = new UBGraphicsAxes(); + + graphicsItemFromSvg(axes); + + axes->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); + + QStringRef svgX = mXmlReader.attributes().value("x"); + QStringRef svgY = mXmlReader.attributes().value("y"); + QStringRef svgLeft = mXmlReader.attributes().value("left"); + QStringRef svgTop = mXmlReader.attributes().value("top"); + QStringRef svgWidth = mXmlReader.attributes().value("width"); + QStringRef svgHeight = mXmlReader.attributes().value("height"); + QStringRef svgNumbers = mXmlReader.attributes().value("numbers"); + + if (!svgX.isNull() && !svgY.isNull()) + { + axes->setPos(svgX.toString().toFloat(), svgY.toString().toFloat()); + } + + if (!svgWidth.isNull() && !svgHeight.isNull() && !svgLeft.isNull() && !svgTop.isNull()) + { + axes->setRect(svgLeft.toString().toFloat(), svgTop.toString().toFloat(), + svgWidth.toString().toFloat(), svgHeight.toString().toFloat()); + } + + if (!svgNumbers.isNull()) + { + axes->setShowNumbers(svgNumbers.toInt()); + } + + axes->setVisible(true); + + return axes; +} + void UBSvgSubsetAdaptor::UBSvgSubsetWriter::compassToSvg(UBGraphicsCompass* item) { diff --git a/src/adaptors/UBSvgSubsetAdaptor.h b/src/adaptors/UBSvgSubsetAdaptor.h index c66c8198..ea263969 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.h +++ b/src/adaptors/UBSvgSubsetAdaptor.h @@ -49,6 +49,7 @@ class UBGraphicsW3CWidgetItem; class UBGraphicsTextItem; class UBGraphicsCurtainItem; class UBGraphicsRuler; +class UBGraphicsAxes; class UBGraphicsCompass; class UBGraphicsProtractor; class UBGraphicsScene; @@ -144,6 +145,8 @@ class UBSvgSubsetAdaptor UBGraphicsRuler* rulerFromSvg(); + UBGraphicsAxes* axesFromSvg(); + UBGraphicsCompass* compassFromSvg(); UBGraphicsProtractor* protractorFromSvg(); @@ -247,6 +250,7 @@ class UBSvgSubsetAdaptor void textItemToSvg(UBGraphicsTextItem *item); void curtainItemToSvg(UBGraphicsCurtainItem *item); void rulerToSvg(UBGraphicsRuler *item); + void axesToSvg(UBGraphicsAxes *item); void compassToSvg(UBGraphicsCompass *item); void protractorToSvg(UBGraphicsProtractor *item); void cacheToSvg(UBGraphicsCache* item); diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 749b73e4..0ee35ae5 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1441,6 +1441,11 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl mActiveScene->addRuler(pPos); UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); } + else if (sourceUrl.toString() == UBToolsManager::manager()->axes.id) + { + mActiveScene->addAxes(pPos); + UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); + } else if (sourceUrl.toString() == UBToolsManager::manager()->protractor.id) { mActiveScene->addProtractor(pPos); diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 78ba7ba2..5ba68364 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -77,6 +77,7 @@ #include "document/UBDocumentProxy.h" #include "tools/UBGraphicsRuler.h" +#include "tools/UBGraphicsAxes.h" #include "tools/UBGraphicsCurtainItem.h" #include "tools/UBGraphicsCompass.h" #include "tools/UBGraphicsCache.h" @@ -467,6 +468,7 @@ bool UBBoardView::isCppTool(QGraphicsItem *item) { return (item->type() == UBGraphicsItemType::CompassItemType || item->type() == UBGraphicsItemType::RulerItemType + || item->type() == UBGraphicsItemType::AxesItemType || item->type() == UBGraphicsItemType::ProtractorItemType || item->type() == UBGraphicsItemType::TriangleItemType || item->type() == UBGraphicsItemType::CurtainItemType); @@ -537,6 +539,7 @@ Here we determines cases when items should to get mouse press event at pressing { case UBGraphicsProtractor::Type: case UBGraphicsRuler::Type: + case UBGraphicsAxes::Type: case UBGraphicsTriangle::Type: case UBGraphicsCompass::Type: case UBGraphicsCache::Type: @@ -1626,6 +1629,7 @@ void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect) } qreal gridSize = scene()->backgroundGridSize(); + bool intermediateLines = scene()->intermediateLines(); painter->setPen (bgCrossColor); @@ -1644,6 +1648,22 @@ void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect) { painter->drawLine (xPos, rect.y (), xPos, rect.y () + rect.height ()); } + + if (intermediateLines) { + QColor intermediateColor = bgCrossColor; + intermediateColor.setAlphaF(0.5 * bgCrossColor.alphaF()); + painter->setPen(intermediateColor); + + for (qreal yPos = firstY - gridSize/2; yPos < rect.y () + rect.height (); yPos += gridSize) + { + painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos); + } + + for (qreal xPos = firstX - gridSize/2; xPos < rect.x () + rect.width (); xPos += gridSize) + { + painter->drawLine (xPos, rect.y (), xPos, rect.y () + rect.height ()); + } + } } if (scene() && scene()->pageBackground() == UBPageBackground::ruled) @@ -1654,6 +1674,17 @@ void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect) { painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos); } + + if (intermediateLines) { + QColor intermediateColor = bgCrossColor; + intermediateColor.setAlphaF(0.5 * bgCrossColor.alphaF()); + painter->setPen(intermediateColor); + + for (qreal yPos = firstY - gridSize/2; yPos < rect.y () + rect.height (); yPos += gridSize) + { + painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos); + } + } } } diff --git a/src/core/UB.h b/src/core/UB.h index 86f9691a..0811b035 100644 --- a/src/core/UB.h +++ b/src/core/UB.h @@ -172,6 +172,7 @@ struct UBGraphicsItemType ToolWidgetItemType, //65555 GraphicsWidgetItemType, //65556 UserTypesCount, //65557 + AxesItemType, //65558 SelectionFrameType // this line must be the last line in this enum because it is types counter. }; }; diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index da16050e..23bbb069 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -50,6 +50,7 @@ int UBSettings::crossSize = 24; int UBSettings::defaultCrossSize = 24; int UBSettings::minCrossSize = 12; int UBSettings::maxCrossSize = 96; //TODO: user-settable? +bool UBSettings::intermediateLines = false; int UBSettings::colorPaletteSize = 5; int UBSettings::objectFrameWidth = 20; int UBSettings::boardMargin = 10; @@ -427,6 +428,15 @@ void UBSettings::init() communityPsw = new UBSetting(this, "Community", "Password", ""); communityCredentialsPersistence = new UBSetting(this,"Community", "CredentialsPersistence",false); + enableToolAxes = new UBSetting(this, "Board", "EnableToolAxes", false); + enableIntermediateLines = new UBSetting(this, "Board", "EnableIntermediateLines", false); + + if (enableToolAxes->get().toBool()) + { + // add axes tool id to list + UBToolsManager::manager()->addTool(UBToolsManager::manager()->axes); + } + QStringList uris = UBToolsManager::manager()->allToolIDs(); favoritesNativeToolUris = new UBSetting(this, "App", "FavoriteToolURIs", uris); diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index a7353108..653eb6dc 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -191,6 +191,7 @@ class UBSettings : public QObject static int defaultCrossSize; static int minCrossSize; static int maxCrossSize; + static bool intermediateLines; static int colorPaletteSize; static int objectFrameWidth; @@ -425,6 +426,9 @@ class UBSettings : public QObject UBSetting* magnifierDrawingMode; UBSetting* autoSaveInterval; + UBSetting* enableToolAxes; + UBSetting* enableIntermediateLines; + public slots: void setPenWidthIndex(int index); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index c35bf7cf..1ed8b150 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -50,6 +50,7 @@ #include "gui/UBResources.h" #include "tools/UBGraphicsRuler.h" +#include "tools/UBGraphicsAxes.h" #include "tools/UBGraphicsProtractor.h" #include "tools/UBGraphicsCompass.h" #include "tools/UBGraphicsTriangle.h" @@ -359,6 +360,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta } mBackgroundGridSize = UBSettings::settings()->crossSize; + mIntermediateLines = UBSettings::settings()->intermediateLines; // Just for debug. Do not delete please // connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); @@ -1164,6 +1166,15 @@ void UBGraphicsScene::setBackgroundGridSize(int pSize) } } +void UBGraphicsScene::setIntermediateLines(bool checked) +{ + mIntermediateLines = checked; + setModified(true); + + foreach(QGraphicsView* view, views()) + view->resetCachedContent(); +} + void UBGraphicsScene::setDrawingMode(bool bModeDesktop) { mIsDesktopMode = bModeDesktop; @@ -2201,6 +2212,20 @@ void UBGraphicsScene::addRuler(QPointF center) ruler->setVisible(true); } +void UBGraphicsScene::addAxes(QPointF center) +{ + UBGraphicsAxes* axes = new UBGraphicsAxes(); // mem : owned and destroyed by the scene + + axes->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); + + addItem(axes); + + QPointF itemSceneCenter = axes->sceneBoundingRect().center(); + axes->moveBy(center.x() - itemSceneCenter.x(), center.y() - itemSceneCenter.y()); + + axes->setVisible(true); +} + void UBGraphicsScene::addProtractor(QPointF center) { // Protractor diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index ab637756..6a22f14f 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -230,12 +230,18 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem return mBackgroundGridSize; } + bool intermediateLines() const + { + return mIntermediateLines; + } + bool hasBackground() { return (mBackgroundObject != 0); } void addRuler(QPointF center); + void addAxes(QPointF center); void addProtractor(QPointF center); void addCompass(QPointF center); void addTriangle(QPointF center); @@ -358,6 +364,7 @@ public slots: void setBackground(bool pIsDark, UBPageBackground pBackground); void setBackgroundZoomFactor(qreal zoom); void setBackgroundGridSize(int pSize); + void setIntermediateLines(bool checked); void setDrawingMode(bool bModeDesktop); void deselectAllItems(); @@ -443,6 +450,7 @@ public slots: bool mDarkBackground; UBPageBackground mPageBackground; int mBackgroundGridSize; + bool mIntermediateLines; bool mIsDesktopMode; qreal mZoomFactor; diff --git a/src/gui/UBBackgroundPalette.cpp b/src/gui/UBBackgroundPalette.cpp index 92ce0bd8..b975b33d 100644 --- a/src/gui/UBBackgroundPalette.cpp +++ b/src/gui/UBBackgroundPalette.cpp @@ -48,6 +48,7 @@ void UBBackgroundPalette::init() mSlider->setTracking(true); // valueChanged() is emitted during movement and not just upon releasing the slider mSliderLabel = new QLabel(tr("Grid size")); + mIntermediateLinesLabel = new QLabel(tr("Draw intermediate grid lines")); mResetDefaultGridSizeButton = createPaletteButton(UBApplication::mainWindow->actionDefaultGridSize, this); mResetDefaultGridSizeButton->setFixedSize(24,24); @@ -55,12 +56,32 @@ void UBBackgroundPalette::init() connect(UBApplication::mainWindow->actionDefaultGridSize, SIGNAL(triggered()), this, SLOT(defaultBackgroundGridSize())); + bool enableIntermediateLines = UBSettings::settings()->enableIntermediateLines->get().toBool(); + + if (enableIntermediateLines) + { + mDrawIntermediateLinesCheckBox = createPaletteButton(UBApplication::mainWindow->actionDrawIntermediateGridLines, this); + mDrawIntermediateLinesCheckBox->setFixedSize(24,24); + mDrawIntermediateLinesCheckBox->setCheckable(true); + mActions << UBApplication::mainWindow->actionDrawIntermediateGridLines; + mButtons.removeLast(); // don't add to button group + + connect(UBApplication::mainWindow->actionDrawIntermediateGridLines, SIGNAL(toggled(bool)), this, SLOT(toggleIntermediateLines(bool))); + } + mBottomLayout->addSpacing(16); mBottomLayout->addWidget(mSliderLabel); mBottomLayout->addWidget(mSlider); mBottomLayout->addWidget(mResetDefaultGridSizeButton); mBottomLayout->addSpacing(16); + if (enableIntermediateLines) + { + mBottomLayout->addWidget(mIntermediateLinesLabel); + mBottomLayout->addWidget(mDrawIntermediateLinesCheckBox); + mBottomLayout->addSpacing(16); + } + updateLayout(); } @@ -137,6 +158,11 @@ void UBBackgroundPalette::showEvent(QShowEvent* event) connect(mSlider, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int))); + if (UBSettings::settings()->enableIntermediateLines->get().toBool()) + { + mDrawIntermediateLinesCheckBox->setChecked(UBApplication::boardController->activeScene()->intermediateLines()); + } + QWidget::showEvent(event); } @@ -152,14 +178,26 @@ void UBBackgroundPalette::defaultBackgroundGridSize() sliderValueChanged(UBSettings::settings()->defaultCrossSize); } +void UBBackgroundPalette::toggleIntermediateLines(bool checked) +{ + UBApplication::boardController->activeScene()->setIntermediateLines(checked); + UBSettings::settings()->intermediateLines = checked; // since this function is called (indirectly, by refresh) when we switch scenes, the settings will always have the current scene's value. +} + void UBBackgroundPalette::backgroundChanged() { bool dark = UBApplication::boardController->activeScene()->isDarkBackground(); if (dark) + { mSliderLabel->setStyleSheet("QLabel { color : white; }"); + mIntermediateLinesLabel->setStyleSheet("QLabel { color : white; }"); + } else + { mSliderLabel->setStyleSheet("QLabel { color : black; }"); + mIntermediateLinesLabel->setStyleSheet("QLabel { color : black; }"); + } } void UBBackgroundPalette::refresh() diff --git a/src/gui/UBBackgroundPalette.h b/src/gui/UBBackgroundPalette.h index 83472d47..5a149a0f 100644 --- a/src/gui/UBBackgroundPalette.h +++ b/src/gui/UBBackgroundPalette.h @@ -28,6 +28,7 @@ class UBBackgroundPalette : public UBActionPalette protected slots: void sliderValueChanged(int value); void defaultBackgroundGridSize(); + void toggleIntermediateLines(bool checked); protected: virtual void updateLayout(); @@ -40,8 +41,9 @@ class UBBackgroundPalette : public UBActionPalette QSlider* mSlider; QLabel* mSliderLabel; + QLabel* mIntermediateLinesLabel; UBActionPaletteButton* mResetDefaultGridSizeButton; - + UBActionPaletteButton* mDrawIntermediateLinesCheckBox; }; diff --git a/src/tools/UBGraphicsAxes.cpp b/src/tools/UBGraphicsAxes.cpp new file mode 100644 index 00000000..9fb6be2f --- /dev/null +++ b/src/tools/UBGraphicsAxes.cpp @@ -0,0 +1,580 @@ +/* + * Copyright (C) 2015-2018 Département de l'Instruction Publique (DIP-SEM) + * + * Copyright (C) 2013 Open Education Foundation + * + * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour + * l'Education Numérique en Afrique (GIP ENA) + * + * This file is part of OpenBoard. + * + * OpenBoard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License, + * with a specific linking exception for the OpenSSL project's + * "OpenSSL" library (or with modified versions of it that use the + * same license as the "OpenSSL" library). + * + * OpenBoard is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenBoard. If not, see . + */ + + + + +#include + +#include "tools/UBGraphicsAxes.h" +#include "domain/UBGraphicsScene.h" +#include "frameworks/UBGeometryUtils.h" +#include "core/UBApplication.h" +#include "gui/UBResources.h" +#include "board/UBBoardController.h" // TODO UB 4.x clean that dependency +#include "board/UBDrawingController.h" + +#include "core/memcheck.h" + +const QRect UBGraphicsAxes::sDefaultRect = QRect(-200, -200, 400, 400); + +const QColor UBGraphicsAxes::sLightBackgroundDrawColor = QColor(0x33, 0x33, 0x33, sDrawTransparency); +const QColor UBGraphicsAxes::sDarkBackgroundDrawColor = QColor(0xff, 0xff, 0xff, sDrawTransparency); + + +UBGraphicsAxes::UBGraphicsAxes() + : QGraphicsPolygonItem() + , mResizing(false) +{ + setRect(sDefaultRect); + + setFlag(QGraphicsItem::ItemIsMovable, true); + setFlag(QGraphicsItem::ItemIsSelectable, true); + setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); + + setAcceptHoverEvents(true); + + mCloseSvgItem = new QGraphicsSvgItem(":/images/closeTool.svg", this); + mCloseSvgItem->setVisible(false); + mCloseSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); + + mNumbersSvgItem = new QGraphicsSvgItem(":/images/numbersTool.svg", this); + mNumbersSvgItem->setVisible(false); + mNumbersSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); + + mShowNumbers = true; + + setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::CppTool)); //Necessary to set if we want z value to be assigned correctly + + setFlag(QGraphicsItem::ItemIsSelectable, false); + updateResizeCursor(); + + connect(UBApplication::boardController, &UBBoardController::zoomChanged, [this](qreal){ + // recalculate shape when zoom factor changes + setRect(mBounds); + }); +} + +UBGraphicsAxes::~UBGraphicsAxes() +{ + // NOOP +} + +UBItem* UBGraphicsAxes::deepCopy() const +{ + UBGraphicsAxes* copy = new UBGraphicsAxes(); + + copyItemParameters(copy); + + // TODO UB 4.7 ... complete all members ? + + return copy; +} + +void UBGraphicsAxes::copyItemParameters(UBItem *copy) const +{ + UBGraphicsAxes *cp = dynamic_cast(copy); + if (cp) + { + cp->setPos(this->pos()); + cp->setRect(this->mBounds); + cp->setTransform(this->transform()); + } +} + +void UBGraphicsAxes::setRect(qreal x, qreal y, qreal w, qreal h) +{ + // Save the bounds rect + mBounds.setX(x); mBounds.setY(y); mBounds.setWidth(w); mBounds.setHeight(h); + + mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom()); + qreal range = sItemWidth * mAntiScaleRatio; + QPolygonF polygon; + polygon << QPointF(-range, -range) + << QPointF(-range, mBounds.top()) + << QPointF(range, mBounds.top()) + << QPointF(range, -range) + << QPointF(mBounds.right(), -range) + << QPointF(mBounds.right(), range) + << QPointF(range, range) + << QPointF(range, mBounds.bottom()) + << QPointF(-range, mBounds.bottom()) + << QPointF(-range, range) + << QPointF(mBounds.left(), range) + << QPointF(mBounds.left(), -range); + setPolygon(polygon); +} + +QRectF UBGraphicsAxes::bounds() const +{ + return mBounds; +} + +void UBGraphicsAxes::setShowNumbers(bool showNumbers) +{ + mShowNumbers = showNumbers; +} + +bool UBGraphicsAxes::showNumbes() const +{ + return mShowNumbers; +} + +void UBGraphicsAxes::paint(QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget) +{ + Q_UNUSED(styleOption); + Q_UNUSED(widget); + + mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom()); + QTransform antiScaleTransform; + antiScaleTransform.scale(mAntiScaleRatio, mAntiScaleRatio); + + mCloseSvgItem->setTransform(antiScaleTransform); + mCloseSvgItem->setPos(closeButtonRect().topLeft()); + + mNumbersSvgItem->setTransform(antiScaleTransform); + mNumbersSvgItem->setPos(numbersButtonRect().topLeft()); + + QTransform antiScaleTransform2; + qreal ratio = mAntiScaleRatio > 1.0 ? mAntiScaleRatio : 1.0; + antiScaleTransform2.scale(ratio, 1.0); + + QPen pen(drawColor()); + pen.setWidthF(2); + painter->setPen(pen); + painter->setRenderHint(QPainter::Antialiasing, true); + painter->drawLine(xAxis()); + painter->drawLine(yAxis()); + + // draw arrows at end + QPointF tip = xAxis().p1(); + painter->drawLine(tip.x(), tip.y(), tip.x() + sArrowLength, tip.y() + sArrowWidth); + painter->drawLine(tip.x(), tip.y(), tip.x() + sArrowLength, tip.y() - sArrowWidth); + + tip = xAxis().p2(); + painter->drawLine(tip.x(), tip.y(), tip.x() - sArrowLength, tip.y() + sArrowWidth); + painter->drawLine(tip.x(), tip.y(), tip.x() - sArrowLength, tip.y() - sArrowWidth); + + tip = yAxis().p1(); + painter->drawLine(tip.x(), tip.y(), tip.x() + sArrowWidth, tip.y() - sArrowLength); + painter->drawLine(tip.x(), tip.y(), tip.x() - sArrowWidth, tip.y() - sArrowLength); + + tip = yAxis().p2(); + painter->drawLine(tip.x(), tip.y(), tip.x() + sArrowWidth, tip.y() + sArrowLength); + painter->drawLine(tip.x(), tip.y(), tip.x() - sArrowWidth, tip.y() + sArrowLength); + + pen.setWidthF(1); + painter->setPen(pen); + paintGraduations(painter); +} + + +QVariant UBGraphicsAxes::itemChange(GraphicsItemChange change, const QVariant &value) +{ + if (change == QGraphicsItem::ItemVisibleHasChanged) + { + mCloseSvgItem->setParentItem(this); + mNumbersSvgItem->setParentItem(this); + } + + return QGraphicsPolygonItem::itemChange(change, value); +} + +void UBGraphicsAxes::paintGraduations(QPainter *painter) +{ + painter->save(); + painter->setFont(font()); + QFontMetricsF fontMetrics(painter->font()); + + // Update the width of one "centimeter" to correspond to the width of the background grid (whether it is displayed or not) + mPixelsPerCentimeter = UBApplication::boardController->activeScene()->backgroundGridSize(); + + // When a "centimeter" is too narrow, we only display every 5th number + double numbersWidth = fontMetrics.boundingRect("-00").width(); + bool shouldDisplayAllNumbers = (numbersWidth <= (mPixelsPerCentimeter - 5)); + + // draw numbers on x axis + int fromX = (xAxis().x1() + sMargin) / mPixelsPerCentimeter; + int toX = (xAxis().x2() - sMargin) / mPixelsPerCentimeter; + + for (int centimeters(fromX); centimeters <= toX; centimeters++) + { + bool isImportant = abs(centimeters) == 1 || abs(centimeters) % 5 == 0; + double graduationX = mPixelsPerCentimeter * centimeters; + double graduationHeight = UBGeometryUtils::millimeterGraduationHeight; + + painter->drawLine(QLineF(graduationX, graduationHeight, graduationX, -graduationHeight)); + + if (mShowNumbers && (shouldDisplayAllNumbers || isImportant) && centimeters != 0) + { + QString text = QString("%1").arg(centimeters); + + if (graduationX + fontMetrics.width(text) / 2 < xAxis().x2()) + { + qreal textWidth = fontMetrics.width(text); + qreal textHeight = fontMetrics.tightBoundingRect(text).height(); + painter->drawText( + QRectF(graduationX - textWidth / 2, textHeight - 5, textWidth, textHeight), + Qt::AlignVCenter, text); + } + } + } + + // draw numbers on y axis + int fromY = (-yAxis().y1() + sMargin) / mPixelsPerCentimeter; + int toY = (-yAxis().y2() - sMargin) / mPixelsPerCentimeter; + + for (int centimeters(fromY); centimeters <= toY; centimeters++) + { + bool isImportant = abs(centimeters) == 1 || abs(centimeters) % 5 == 0; + double graduationY = - mPixelsPerCentimeter * centimeters; + double graduationHeight = UBGeometryUtils::millimeterGraduationHeight; + + painter->drawLine(QLineF(graduationHeight, graduationY, - graduationHeight, graduationY)); + + if (mShowNumbers && (shouldDisplayAllNumbers || isImportant) && centimeters != 0) + { + QString text = QString("%1").arg(centimeters); + + qreal textWidth = fontMetrics.width(text); + qreal textHeight = fontMetrics.tightBoundingRect(text).height(); + painter->drawText( + QRectF(- textWidth - 10, graduationY - textHeight / 2, textWidth, textHeight), + Qt::AlignVCenter, text); + } + } + + painter->restore(); +} + +void UBGraphicsAxes::setRect(const QRectF &rect) +{ + setRect(rect.x(), rect.y(), rect.width(), rect.height()); +} + +void UBGraphicsAxes::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + if (resizeLeftRect().contains(event->pos())) + { + mResizeDirection = Left; + mResizing = true; + event->accept(); + } + else if (resizeRightRect().contains(event->pos())) + { + mResizeDirection = Right; + mResizing = true; + event->accept(); + } + else if (resizeTopRect().contains(event->pos())) + { + mResizeDirection = Top; + mResizing = true; + event->accept(); + } + else if (resizeBottomRect().contains(event->pos())) + { + mResizeDirection = Bottom; + mResizing = true; + event->accept(); + } + else + { + mResizing = false; + QGraphicsItem::mousePressEvent(event); + } + mCloseSvgItem->setVisible(false); + mNumbersSvgItem->setVisible(false); +} + +void UBGraphicsAxes::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + if (!mResizing) + { + QGraphicsItem::mouseMoveEvent(event); + } + else + { + QPointF delta = event->pos() - event->lastPos(); + prepareGeometryChange(); + + switch (mResizeDirection) + { + case Left: + delta.setY(0); + if (delta.x() > -mBounds.left() - sMinLength) + delta.setX(-mBounds.left() - sMinLength); + setRect(mBounds.x() + delta.x(), mBounds.y(), mBounds.width() - delta.x(), mBounds.height()); + break; + + case Right: + if (-delta.x() > mBounds.right() - sMinLength) + delta.setX(sMinLength - mBounds.right()); + setRect(mBounds.x(), mBounds.y(), mBounds.width() + delta.x(), mBounds.height()); + break; + + case Top: + delta.setX(0); + if (delta.y() > -mBounds.top() - sMinLength) + delta.setY(-mBounds.top() - sMinLength); + setRect(mBounds.x(), mBounds.y() + delta.y(), mBounds.width(), mBounds.height() - delta.y()); + break; + + case Bottom: + if (-delta.y() > mBounds.bottom() - sMinLength) + delta.setY(sMinLength - mBounds.bottom()); + setRect(mBounds.x(), mBounds.y(), mBounds.width(), mBounds.height() + delta.y()); + break; + } + + event->accept(); + } +} + +void UBGraphicsAxes::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + if (mResizing) + { + mResizing = false; + event->accept(); + } + else if (closeButtonRect().contains(event->pos())) + { + hide(); + event->accept(); + } + else if (numbersButtonRect().contains(event->pos())) + { + mShowNumbers = !mShowNumbers; + update(boundingRect()); + event->accept(); + } + else + { + // snap to grid + if (true) { + QPointF delta = pos(); + qreal gridSize = scene()->backgroundGridSize(); + qreal deltaX = delta.x() - round(delta.x() / gridSize) * gridSize; + qreal deltaY = delta.y() - round(delta.y() / gridSize) * gridSize; + setPos(pos() - QPointF(deltaX, deltaY)); + } + + QGraphicsItem::mouseReleaseEvent(event); + } + + if (scene()) + scene()->setModified(true); +} + +void UBGraphicsAxes::hoverEnterEvent(QGraphicsSceneHoverEvent *event) +{ + UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); + + if (currentTool == UBStylusTool::Selector || + currentTool == UBStylusTool::Play) + { + mCloseSvgItem->setParentItem(this); + mNumbersSvgItem->setParentItem(this); + + mShowButtons = true; + mCloseSvgItem->setVisible(mShowButtons); + mNumbersSvgItem->setVisible(mShowButtons); + selectCursor(event); + event->accept(); + update(); + } +} + +void UBGraphicsAxes::hoverMoveEvent(QGraphicsSceneHoverEvent *event) +{ + UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); + + if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play) + { + mCloseSvgItem->setVisible(mShowButtons); + mNumbersSvgItem->setVisible(mShowButtons); + selectCursor(event); + event->accept(); + } +} + +void UBGraphicsAxes::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) +{ + mShowButtons = false; + setCursor(Qt::ArrowCursor); + mCloseSvgItem->setVisible(mShowButtons); + mNumbersSvgItem->setVisible(mShowButtons); + UBDrawingController::drawingController()->mActiveRuler = NULL; + event->accept(); + update(); +} + +void UBGraphicsAxes::updateResizeCursor() +{ + QPixmap pix(":/images/cursors/resize.png"); + QTransform tr; + tr.rotate(-90); + mResizeCursorH = QCursor(pix, pix.width() / 2, pix.height() / 2); + mResizeCursorV = QCursor(pix.transformed(tr, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2); +} + +QCursor UBGraphicsAxes::resizeCursor() const +{ + switch (mResizeDirection) + { + case Left: + case Right: + return mResizeCursorH; + + default: + break; + } + + return mResizeCursorV; +} + +QCursor UBGraphicsAxes::closeCursor() const +{ + return Qt::ArrowCursor; +} + +QCursor UBGraphicsAxes::moveCursor() const +{ + return Qt::SizeAllCursor; +} + +void UBGraphicsAxes::selectCursor(QGraphicsSceneHoverEvent *event) +{ + if (resizeLeftRect().contains(event->pos())) + { + mResizeDirection = Left; + setCursor(resizeCursor()); + } + else if (resizeRightRect().contains(event->pos())) + { + mResizeDirection = Right; + setCursor(resizeCursor()); + } + else if (resizeTopRect().contains(event->pos())) + { + mResizeDirection = Top; + setCursor(resizeCursor()); + } + else if (resizeBottomRect().contains(event->pos())) + { + mResizeDirection = Bottom; + setCursor(resizeCursor()); + } else if (closeButtonRect().contains(event->pos())) + setCursor(closeCursor()); + else if (numbersButtonRect().contains(event->pos())) { + setCursor(closeCursor()); + } else { + setCursor(moveCursor()); + } +} + +QRectF UBGraphicsAxes::resizeLeftRect() const +{ + qreal range = sItemWidth * mAntiScaleRatio; + return QRectF(xAxis().x1(), xAxis().y1() - range, sArrowLength, 2 * range); +} + +QRectF UBGraphicsAxes::resizeRightRect() const +{ + qreal range = sItemWidth * mAntiScaleRatio; + return QRectF(xAxis().x2() - sArrowLength, xAxis().y2() - range, sArrowLength, 2 * range); +} + +QRectF UBGraphicsAxes::resizeBottomRect() const +{ + qreal range = sItemWidth * mAntiScaleRatio; + return QRectF(yAxis().x1() - range, yAxis().y1() - sArrowLength, 2 * range, sArrowLength); +} + +QRectF UBGraphicsAxes::resizeTopRect() const +{ + qreal range = sItemWidth * mAntiScaleRatio; + return QRectF(yAxis().x2() - range, yAxis().y2(), 2 * range, sArrowLength); +} + +QRectF UBGraphicsAxes::closeButtonRect() const +{ + QPixmap closePixmap(":/images/closeTool.svg"); + + QSizeF closeRectSize( + closePixmap.width() * mAntiScaleRatio, + closePixmap.height() * mAntiScaleRatio); + + QPointF closeRectTopLeft( + -sItemWidth * mAntiScaleRatio, + -sItemWidth * mAntiScaleRatio); + + return QRectF(closeRectTopLeft, closeRectSize); +} + +QRectF UBGraphicsAxes::numbersButtonRect() const +{ + QPixmap numbersPixmap(":/images/numbersTool.svg"); + + QSizeF numbersRectSize( + numbersPixmap.width() * mAntiScaleRatio, + numbersPixmap.height() * mAntiScaleRatio); + + QPointF numbersRectTopLeft( + sItemWidth * mAntiScaleRatio - numbersRectSize.width(), + sItemWidth * mAntiScaleRatio - numbersRectSize.height()); + + return QRectF(numbersRectTopLeft, numbersRectSize); +} + +QLineF UBGraphicsAxes::xAxis() const +{ + return QLineF(mBounds.left(), 0, mBounds.right(), 0); +} + +QLineF UBGraphicsAxes::yAxis() const +{ + return QLineF(0, mBounds.bottom(), 0, mBounds.top()); +} + +UBGraphicsScene* UBGraphicsAxes::scene() const +{ + return static_cast(QGraphicsPolygonItem::scene()); +} + +QColor UBGraphicsAxes::drawColor() const +{ + return scene()->isDarkBackground() ? sDarkBackgroundDrawColor : sLightBackgroundDrawColor; +} + +QFont UBGraphicsAxes::font() const +{ + QFont font("Arial"); + font.setPixelSize(16); + font.setBold(true); + return font; +} diff --git a/src/tools/UBGraphicsAxes.h b/src/tools/UBGraphicsAxes.h new file mode 100644 index 00000000..8edcd75c --- /dev/null +++ b/src/tools/UBGraphicsAxes.h @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2015-2018 Département de l'Instruction Publique (DIP-SEM) + * + * Copyright (C) 2013 Open Education Foundation + * + * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour + * l'Education Numérique en Afrique (GIP ENA) + * + * This file is part of OpenBoard. + * + * OpenBoard is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License, + * with a specific linking exception for the OpenSSL project's + * "OpenSSL" library (or with modified versions of it that use the + * same license as the "OpenSSL" library). + * + * OpenBoard is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenBoard. If not, see . + */ + + + + +#ifndef UBGRAPHICSAXES_H +#define UBGRAPHICSAXES_H + + +#include +#include + +#include "core/UB.h" +#include "domain/UBItem.h" + +class UBGraphicsScene; + +class UBGraphicsAxes : public QObject, public QGraphicsPolygonItem, public UBItem +{ + Q_OBJECT + + public: + UBGraphicsAxes(); + virtual ~UBGraphicsAxes(); + + enum { Type = UBGraphicsItemType::AxesItemType }; + + virtual int type() const + { + return Type; + } + + virtual UBItem* deepCopy() const; + virtual void copyItemParameters(UBItem *copy) const; + + void setRect(qreal x, qreal y, qreal w, qreal h); + QRectF bounds() const; + void setShowNumbers(bool showNumbers); + bool showNumbes() const; + + enum UBGraphicsAxesDirection + { + Left = 0, + Right, + Bottom, + Top + }; + + protected: + + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget); + virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); + void paintGraduations(QPainter *painter); + void setRect(const QRectF &rect); + + // Events + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + + private: + // Helpers + void updateResizeCursor(); + QCursor resizeCursor() const; + QCursor closeCursor() const; + QCursor moveCursor() const; + void selectCursor(QGraphicsSceneHoverEvent *event); + + virtual QRectF resizeLeftRect() const; + virtual QRectF resizeRightRect() const; + virtual QRectF resizeBottomRect() const; + virtual QRectF resizeTopRect() const; + virtual QRectF closeButtonRect() const; + virtual QRectF numbersButtonRect() const; + virtual QLineF xAxis() const; + virtual QLineF yAxis() const; + virtual UBGraphicsScene* scene() const; + + QColor drawColor() const; + QFont font() const; + + QGraphicsSvgItem* mCloseSvgItem; + QGraphicsSvgItem* mNumbersSvgItem; + + bool mResizing; + UBGraphicsAxesDirection mResizeDirection; + bool mShowButtons; + bool mShowNumbers; + + QCursor mResizeCursorH; + QCursor mResizeCursorV; + + qreal mAntiScaleRatio; + qreal mPixelsPerCentimeter; + QRectF mBounds; + + // Constants + static const QRect sDefaultRect; + + static const int sMinLength = 50; // 1sm + static const int sMaxLength = 35000; // 700sm + static const int sArrowLength = 12; + static const int sArrowWidth = 5; + static const int sMargin = 5; + static const int sItemWidth = 30; + static const int sDrawTransparency = 255; + static const QColor sLightBackgroundDrawColor; + static const QColor sDarkBackgroundDrawColor; +}; + +#endif // UBGRAPHICSAXES_H diff --git a/src/tools/UBToolsManager.cpp b/src/tools/UBToolsManager.cpp index 210f74f0..74a9eb66 100644 --- a/src/tools/UBToolsManager.cpp +++ b/src/tools/UBToolsManager.cpp @@ -68,6 +68,15 @@ UBToolsManager::UBToolsManager(QObject *parent) mDescriptors << ruler; + axes.id = "openboardtool://axes"; + axes.icon = QPixmap(":/images/toolPalette/axesTool.png"); + axes.label = tr("Axes"); + axes.version = "1.0"; + mToolsIcon.insert(axes.id, ":/images/toolPalette/axesTool.png"); +// disabled by default, added later in UBSettings:init if enabled +// mDescriptors << axes; + + compass.id = "openboardtool://compass"; compass.icon = QPixmap(":/images/toolPalette/compassTool.png"); compass.label = tr("Compass"); diff --git a/src/tools/UBToolsManager.h b/src/tools/UBToolsManager.h index beec45cf..9f1dc594 100644 --- a/src/tools/UBToolsManager.h +++ b/src/tools/UBToolsManager.h @@ -83,7 +83,13 @@ class UBToolsManager : public QObject return UBToolDescriptor(); } + void addTool(const UBToolDescriptor& tool) + { + mDescriptors << tool; + } + UBToolDescriptor ruler; + UBToolDescriptor axes; UBToolDescriptor protractor; UBToolDescriptor compass; UBToolDescriptor mask; diff --git a/src/tools/tools.pri b/src/tools/tools.pri index 1f2d00af..e43955af 100644 --- a/src/tools/tools.pri +++ b/src/tools/tools.pri @@ -1,4 +1,5 @@ HEADERS += src/tools/UBGraphicsRuler.h \ + src/tools/UBGraphicsAxes.h \ src/tools/UBGraphicsTriangle.h \ src/tools/UBGraphicsProtractor.h \ src/tools/UBGraphicsCompass.h \ @@ -9,6 +10,7 @@ HEADERS += src/tools/UBGraphicsRuler.h \ src/tools/UBGraphicsCache.h SOURCES += src/tools/UBGraphicsRuler.cpp \ + src/tools/UBGraphicsAxes.cpp \ src/tools/UBGraphicsTriangle.cpp \ src/tools/UBGraphicsProtractor.cpp \ src/tools/UBGraphicsCompass.cpp \