diff --git a/GUI/View/Mask/MaskGraphicsScene.cpp b/GUI/View/Mask/MaskGraphicsScene.cpp index 240ae85734156a81887405f819d745ac9053037a..06c59fa63b3aedf06506c45e2939263bf0d1db21 100644 --- a/GUI/View/Mask/MaskGraphicsScene.cpp +++ b/GUI/View/Mask/MaskGraphicsScene.cpp @@ -533,8 +533,7 @@ bool MaskGraphicsScene::isValidForMaskAllDrawing(QGraphicsSceneMouseEvent* event //! Return true if area beneath the mouse contains views of given type. -bool MaskGraphicsScene::isAreaContains(QGraphicsSceneMouseEvent* event, - MaskType viewType) +bool MaskGraphicsScene::isAreaContains(QGraphicsSceneMouseEvent* event, MaskType viewType) { for (QGraphicsItem* graphicsItem : this->items(event->scenePos())) if (graphicsItem->type() == viewType) diff --git a/GUI/View/Mask/RegionOfInterestDisplay.cpp b/GUI/View/Mask/RegionOfInterestDisplay.cpp index 45284eacbd82c0808ba4ff10e1a34ab70aa4336e..e1490d01edbc1f6c3923f1366892899c06a587a0 100644 --- a/GUI/View/Mask/RegionOfInterestDisplay.cpp +++ b/GUI/View/Mask/RegionOfInterestDisplay.cpp @@ -13,8 +13,8 @@ // ************************************************************************************************ #include "GUI/View/Mask/RegionOfInterestDisplay.h" -#include "GUI/View/Shape/MaskEditorHelper.h" #include "GUI/Model/Mask/MaskItems.h" +#include "GUI/View/Shape/MaskUtil.h" #include "GUI/View/Shape/SceneAdaptor.h" #include <QPainter> @@ -43,6 +43,6 @@ void RegionOfInterestDisplay::paint(QPainter* painter, const QStyleOptionGraphic QPainterPath innerRect; innerRect.addRect(m_mask_rect); - painter->setBrush(MaskEditorHelper::getMaskBrush(true)); + painter->setBrush(MaskUtil::getMaskBrush(true)); painter->drawPath(outerRect.subtracted(innerRect)); } diff --git a/GUI/View/Shape/IMaskElementDisplay.cpp b/GUI/View/Shape/IMaskElementDisplay.cpp index 356be0917c582006f773992a19bf481968b946e7..044572d84769c6b6a39fc8582b3112fef5061522 100644 --- a/GUI/View/Shape/IMaskElementDisplay.cpp +++ b/GUI/View/Shape/IMaskElementDisplay.cpp @@ -13,8 +13,8 @@ // ************************************************************************************************ #include "GUI/View/Shape/IMaskElementDisplay.h" -#include "GUI/View/Shape/MaskEditorHelper.h" #include "GUI/Model/Mask/MaskItems.h" +#include "GUI/View/Shape/MaskUtil.h" #include "GUI/View/Shape/SceneAdaptor.h" #include <QAction> #include <QGraphicsScene> @@ -73,17 +73,17 @@ void IMaskElementDisplay::setViewSceneAdaptor(const SceneAdaptor* adaptor) void IMaskElementDisplay::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) { const bool is_masked = itemMaskValue(parameterizedItem()); - painter->setBrush(MaskEditorHelper::getMaskBrush(is_masked)); - painter->setPen(MaskEditorHelper::getMaskPen(is_masked)); + painter->setBrush(MaskUtil::getMaskBrush(is_masked)); + painter->setPen(MaskUtil::getMaskPen(is_masked)); painter->setRenderHints(QPainter::Antialiasing); painter->drawPath(maskedShape()); } QPainterPath IMaskElementDisplay::maskedShape() const { - static const QSet<MaskType> relevantMaskType = { - MaskType::RECTANGLE, MaskType::POLYGON, MaskType::VERTICALLINE, - MaskType::HORIZONTALLINE, MaskType::ELLIPSE}; + static const QSet<MaskType> relevantMaskType = {MaskType::RECTANGLE, MaskType::POLYGON, + MaskType::VERTICALLINE, + MaskType::HORIZONTALLINE, MaskType::ELLIPSE}; QPainterPath result = mapToScene(shape()); for (const QGraphicsItem* item : scene()->items()) { diff --git a/GUI/View/Shape/LineViews.cpp b/GUI/View/Shape/LineViews.cpp index 8cbe7030b0c5853758d25615ea40aa30c7801092..451acd290a1e8b01e498343d2c780b7469ba7c30 100644 --- a/GUI/View/Shape/LineViews.cpp +++ b/GUI/View/Shape/LineViews.cpp @@ -14,7 +14,7 @@ #include "GUI/View/Shape/LineViews.h" #include "GUI/Model/Mask/MaskItems.h" -#include "GUI/View/Shape/MaskEditorHelper.h" +#include "GUI/View/Shape/MaskUtil.h" #include "GUI/View/Shape/SceneAdaptor.h" #include <QCursor> #include <QPainter> @@ -75,8 +75,8 @@ void VerticalLineView::update_view() void VerticalLineView::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) { bool mask_value = static_cast<VerticalLineItem*>(m_item)->maskValue(); - painter->setBrush(MaskEditorHelper::getMaskBrush(mask_value)); - painter->setPen(MaskEditorHelper::getMaskPen(mask_value)); + painter->setBrush(MaskUtil::getMaskBrush(mask_value)); + painter->setPen(MaskUtil::getMaskPen(mask_value)); painter->drawRect( QRectF(-mask_visible_width / 2., 0.0, mask_visible_width, m_bounding_rect.height())); @@ -153,8 +153,8 @@ void HorizontalLineView::update_view() void HorizontalLineView::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) { bool mask_value = static_cast<HorizontalLineItem*>(m_item)->maskValue(); - painter->setBrush(MaskEditorHelper::getMaskBrush(mask_value)); - painter->setPen(MaskEditorHelper::getMaskPen(mask_value)); + painter->setBrush(MaskUtil::getMaskBrush(mask_value)); + painter->setPen(MaskUtil::getMaskPen(mask_value)); painter->drawRect( QRectF(0.0, -mask_visible_width / 2., m_bounding_rect.width(), mask_visible_width)); diff --git a/GUI/View/Shape/MaskEditorHelper.cpp b/GUI/View/Shape/MaskUtil.cpp similarity index 72% rename from GUI/View/Shape/MaskEditorHelper.cpp rename to GUI/View/Shape/MaskUtil.cpp index bdc3765e33318b767c21a3b2665e5f5b7bcac8a7..ede1899452b440d3d121dd0b809d7f2f1f468464 100644 --- a/GUI/View/Shape/MaskEditorHelper.cpp +++ b/GUI/View/Shape/MaskUtil.cpp @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Shape/MaskEditorHelper.cpp -//! @brief Implements class MaskEditorHelper +//! @file GUI/View/Shape/MaskUtil.cpp +//! @brief Implements class MaskUtil //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,13 +12,13 @@ // // ************************************************************************************************ -#include "GUI/View/Shape/MaskEditorHelper.h" +#include "GUI/View/Shape/MaskUtil.h" #include <QBrush> #include <QColor> #include <QPen> #include <QRectF> -QBrush MaskEditorHelper::getSelectionMarkerBrush() +QBrush MaskUtil::getSelectionMarkerBrush() { QBrush result; result.setStyle(Qt::SolidPattern); @@ -26,26 +26,26 @@ QBrush MaskEditorHelper::getSelectionMarkerBrush() return result; } -QPen MaskEditorHelper::getSelectionMarkerPen() +QPen MaskUtil::getSelectionMarkerPen() { return QPen(QColor(99, 162, 217)); } -QBrush MaskEditorHelper::getMaskBrush(bool mask_value) +QBrush MaskUtil::getMaskBrush(bool mask_value) { if (!mask_value) return Qt::NoBrush; return QBrush(QColor(0, 0, 80)); // deep blue } -QPen MaskEditorHelper::getMaskPen(bool mask_value) +QPen MaskUtil::getMaskPen(bool mask_value) { if (mask_value) return QPen(QColor(165, 80, 76)); // dark red return QPen(QColor(0, 140, 70)); // dark green } -QRectF MaskEditorHelper::getMarkerRectangle(const QPointF& pos) +QRectF MaskUtil::getMarkerRectangle(const QPointF& pos) { QRectF result(0, 0, 7, 7); result.moveCenter(pos); diff --git a/GUI/View/Shape/MaskEditorHelper.h b/GUI/View/Shape/MaskUtil.h similarity index 57% rename from GUI/View/Shape/MaskEditorHelper.h rename to GUI/View/Shape/MaskUtil.h index ed40d4cbba2bd4b449a3592d2f380f18c7ceb14a..b7b919db9840a1900315e8f4055c7c96d87f522b 100644 --- a/GUI/View/Shape/MaskEditorHelper.h +++ b/GUI/View/Shape/MaskUtil.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Shape/MaskEditorHelper.h -//! @brief Defines class MaskEditorHelper +//! @file GUI/View/Shape/MaskUtil.h +//! @brief Defines class MaskUtil //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_VIEW_SHAPE_MASKEDITORHELPER_H -#define BORNAGAIN_GUI_VIEW_SHAPE_MASKEDITORHELPER_H +#ifndef BORNAGAIN_GUI_VIEW_SHAPE_MASKUTIL_H +#define BORNAGAIN_GUI_VIEW_SHAPE_MASKUTIL_H class QBrush; class QPen; @@ -22,12 +22,12 @@ class QPointF; //! Static class to provide MaskEditor with common settings (colors, gradients, etc) -namespace MaskEditorHelper { - QBrush getSelectionMarkerBrush(); - QPen getSelectionMarkerPen(); - QBrush getMaskBrush(bool mask_value); - QPen getMaskPen(bool mask_value); - QRectF getMarkerRectangle(const QPointF& pos); -}; +namespace MaskUtil { +QBrush getSelectionMarkerBrush(); +QPen getSelectionMarkerPen(); +QBrush getMaskBrush(bool mask_value); +QPen getMaskPen(bool mask_value); +QRectF getMarkerRectangle(const QPointF& pos); +}; // namespace MaskUtil -#endif // BORNAGAIN_GUI_VIEW_SHAPE_MASKEDITORHELPER_H +#endif // BORNAGAIN_GUI_VIEW_SHAPE_MASKUTIL_H diff --git a/GUI/View/Shape/PolygonDisplay.cpp b/GUI/View/Shape/PolygonDisplay.cpp index f7ef306d565f5eef610f23344cf2951578a64267..1c2bd4e68c123670964f2789e7fb08517096ddf4 100644 --- a/GUI/View/Shape/PolygonDisplay.cpp +++ b/GUI/View/Shape/PolygonDisplay.cpp @@ -13,8 +13,8 @@ // ************************************************************************************************ #include "GUI/View/Shape/PolygonDisplay.h" -#include "GUI/View/Shape/MaskEditorHelper.h" #include "GUI/Model/Mask/MaskItems.h" +#include "GUI/View/Shape/MaskUtil.h" #include "GUI/View/Shape/PolygonPointDisplay.h" #include <QCursor> #include <QPainter> @@ -114,7 +114,7 @@ void PolygonDisplay::paint(QPainter* painter, const QStyleOptionGraphicsItem* o, ASSERT(m_item); const bool mask_value = static_cast<PolygonItem*>(m_item)->maskValue(); painter->setRenderHints(QPainter::Antialiasing); - painter->setPen(MaskEditorHelper::getMaskPen(mask_value)); + painter->setPen(MaskUtil::getMaskPen(mask_value)); painter->drawPolyline(m_polygon.toPolygon()); } } diff --git a/GUI/View/Shape/PolygonPointDisplay.cpp b/GUI/View/Shape/PolygonPointDisplay.cpp index fbb788c810924ace23d2264e3a5352f2868f9709..09090c2281757b91cfdc7ad297dc8003358d58ff 100644 --- a/GUI/View/Shape/PolygonPointDisplay.cpp +++ b/GUI/View/Shape/PolygonPointDisplay.cpp @@ -13,8 +13,8 @@ // ************************************************************************************************ #include "GUI/View/Shape/PolygonPointDisplay.h" -#include "GUI/View/Shape/MaskEditorHelper.h" #include "GUI/Model/Mask/MaskItems.h" +#include "GUI/View/Shape/MaskUtil.h" #include <QGraphicsSceneMouseEvent> #include <QPainter> @@ -56,11 +56,11 @@ void PolygonPointDisplay::onPropertyChange() void PolygonPointDisplay::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) { painter->setRenderHints(QPainter::Antialiasing); - QBrush brush = MaskEditorHelper::getSelectionMarkerBrush(); + QBrush brush = MaskUtil::getSelectionMarkerBrush(); if (acceptHoverEvents() && m_on_hover) brush.setColor(Qt::red); painter->setBrush(brush); - painter->setPen(MaskEditorHelper::getSelectionMarkerPen()); + painter->setPen(MaskUtil::getSelectionMarkerPen()); painter->drawEllipse(boundingRect()); } diff --git a/GUI/View/Shape/SizeHandleElement.cpp b/GUI/View/Shape/SizeHandleElement.cpp index 9be66452384be26e204a51d004542d9e6357390e..ed5f9eb0ef4691b712528c85556b08bfdf8744a6 100644 --- a/GUI/View/Shape/SizeHandleElement.cpp +++ b/GUI/View/Shape/SizeHandleElement.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "GUI/View/Shape/SizeHandleElement.h" -#include "GUI/View/Shape/MaskEditorHelper.h" +#include "GUI/View/Shape/MaskUtil.h" #include <QGraphicsSceneHoverEvent> #include <QPainter> @@ -96,8 +96,8 @@ void SizeHandleElement::paint(QPainter* painter, const QStyleOptionGraphicsItem* { painter->setRenderHints(QPainter::Antialiasing); - painter->setBrush(MaskEditorHelper::getSelectionMarkerBrush()); - painter->setPen(MaskEditorHelper::getSelectionMarkerPen()); + painter->setBrush(MaskUtil::getSelectionMarkerBrush()); + painter->setPen(MaskUtil::getSelectionMarkerPen()); if (getHandleType() == RESIZE) painter->drawRect(boundingRect()); else