From b4caf0c95c34b3f541fde72e3545745f48899bbb Mon Sep 17 00:00:00 2001 From: "markummitchell@gmail.com" Date: Fri, 29 Nov 2019 19:25:50 -0800 Subject: [PATCH] Remove Guideline changes for release 12.1 --- engauge.pro | 107 -------- src/Create/CreateActions.cpp | 11 - src/Create/CreateMenus.cpp | 1 - src/DigitizeState/DigitizeStateAxis.cpp | 1 - .../DigitizeStateColorPicker.cpp | 1 - src/DigitizeState/DigitizeStateCurve.cpp | 1 - src/DigitizeState/DigitizeStateEmpty.cpp | 1 - src/DigitizeState/DigitizeStatePointMatch.cpp | 1 - src/DigitizeState/DigitizeStateScale.cpp | 1 - src/DigitizeState/DigitizeStateSegment.cpp | 1 - src/DigitizeState/DigitizeStateSelect.cpp | 7 +- src/Dlg/DlgSettingsMainWindow.cpp | 23 -- src/Dlg/DlgSettingsMainWindow.h | 2 - src/Graphics/GraphicsItemType.h | 3 +- src/Guideline/GuidelineAbstract.cpp | 162 ----------- src/Guideline/GuidelineAbstract.h | 191 ------------- src/Guideline/GuidelineEllipse.cpp | 251 ----------------- src/Guideline/GuidelineEllipse.h | 80 ------ src/Guideline/GuidelineFormat.cpp | 46 ---- src/Guideline/GuidelineFormat.h | 48 ---- src/Guideline/GuidelineLine.cpp | 182 ------------- src/Guideline/GuidelineLine.h | 78 ------ src/Guideline/GuidelineProjectorAbstract.cpp | 53 ---- src/Guideline/GuidelineProjectorAbstract.h | 37 --- src/Guideline/GuidelineProjectorConstantR.cpp | 67 ----- src/Guideline/GuidelineProjectorConstantR.h | 40 --- src/Guideline/GuidelineProjectorConstantT.cpp | 184 ------------- src/Guideline/GuidelineProjectorConstantT.h | 44 --- src/Guideline/GuidelineProjectorConstantX.cpp | 93 ------- src/Guideline/GuidelineProjectorConstantX.h | 47 ---- src/Guideline/GuidelineProjectorConstantY.cpp | 93 ------- src/Guideline/GuidelineProjectorConstantY.h | 47 ---- src/Guideline/GuidelineState.h | 45 ---- src/Guideline/GuidelineStateAbstractBase.cpp | 72 ----- src/Guideline/GuidelineStateAbstractBase.h | 91 ------- src/Guideline/GuidelineStateContext.cpp | 255 ------------------ src/Guideline/GuidelineStateContext.h | 210 --------------- .../GuidelineStateDeployedAbstract.cpp | 65 ----- .../GuidelineStateDeployedAbstract.h | 44 --- ...uidelineStateDeployedConstantRAbstract.cpp | 62 ----- .../GuidelineStateDeployedConstantRAbstract.h | 29 -- .../GuidelineStateDeployedConstantRActive.cpp | 75 ------ .../GuidelineStateDeployedConstantRActive.h | 35 --- .../GuidelineStateDeployedConstantRHide.cpp | 72 ----- .../GuidelineStateDeployedConstantRHide.h | 35 --- .../GuidelineStateDeployedConstantRHover.cpp | 74 ----- .../GuidelineStateDeployedConstantRHover.h | 35 --- .../GuidelineStateDeployedConstantRLocked.cpp | 74 ----- .../GuidelineStateDeployedConstantRLocked.h | 35 --- ...uidelineStateDeployedConstantTAbstract.cpp | 61 ----- .../GuidelineStateDeployedConstantTAbstract.h | 29 -- .../GuidelineStateDeployedConstantTActive.cpp | 75 ------ .../GuidelineStateDeployedConstantTActive.h | 35 --- .../GuidelineStateDeployedConstantTHide.cpp | 72 ----- .../GuidelineStateDeployedConstantTHide.h | 35 --- .../GuidelineStateDeployedConstantTHover.cpp | 74 ----- .../GuidelineStateDeployedConstantTHover.h | 35 --- .../GuidelineStateDeployedConstantTLocked.cpp | 74 ----- .../GuidelineStateDeployedConstantTLocked.h | 35 --- ...uidelineStateDeployedConstantXAbstract.cpp | 60 ----- .../GuidelineStateDeployedConstantXAbstract.h | 29 -- .../GuidelineStateDeployedConstantXActive.cpp | 75 ------ .../GuidelineStateDeployedConstantXActive.h | 35 --- .../GuidelineStateDeployedConstantXHide.cpp | 72 ----- .../GuidelineStateDeployedConstantXHide.h | 35 --- .../GuidelineStateDeployedConstantXHover.cpp | 74 ----- .../GuidelineStateDeployedConstantXHover.h | 35 --- .../GuidelineStateDeployedConstantXLocked.cpp | 74 ----- .../GuidelineStateDeployedConstantXLocked.h | 35 --- ...uidelineStateDeployedConstantYAbstract.cpp | 60 ----- .../GuidelineStateDeployedConstantYAbstract.h | 29 -- .../GuidelineStateDeployedConstantYActive.cpp | 75 ------ .../GuidelineStateDeployedConstantYActive.h | 35 --- .../GuidelineStateDeployedConstantYHide.cpp | 72 ----- .../GuidelineStateDeployedConstantYHide.h | 35 --- .../GuidelineStateDeployedConstantYHover.cpp | 74 ----- .../GuidelineStateDeployedConstantYHover.h | 35 --- .../GuidelineStateDeployedConstantYLocked.cpp | 74 ----- .../GuidelineStateDeployedConstantYLocked.h | 35 --- src/Guideline/GuidelineStateDiscarded.cpp | 99 ------- src/Guideline/GuidelineStateDiscarded.h | 39 --- src/Guideline/GuidelineStateHandle.cpp | 116 -------- src/Guideline/GuidelineStateHandle.h | 42 --- .../GuidelineStateTemplateAbstract.cpp | 55 ---- .../GuidelineStateTemplateAbstract.h | 33 --- ...eStateTemplateHorizontalBottomAbstract.cpp | 25 -- ...ineStateTemplateHorizontalBottomAbstract.h | 28 -- ...elineStateTemplateHorizontalBottomHide.cpp | 74 ----- ...idelineStateTemplateHorizontalBottomHide.h | 35 --- ...lineStateTemplateHorizontalBottomHover.cpp | 86 ------ ...delineStateTemplateHorizontalBottomHover.h | 35 --- ...neStateTemplateHorizontalBottomLurking.cpp | 88 ------ ...lineStateTemplateHorizontalBottomLurking.h | 35 --- ...lineStateTemplateHorizontalTopAbstract.cpp | 24 -- ...delineStateTemplateHorizontalTopAbstract.h | 28 -- ...uidelineStateTemplateHorizontalTopHide.cpp | 73 ----- .../GuidelineStateTemplateHorizontalTopHide.h | 35 --- ...idelineStateTemplateHorizontalTopHover.cpp | 84 ------ ...GuidelineStateTemplateHorizontalTopHover.h | 35 --- ...elineStateTemplateHorizontalTopLurking.cpp | 87 ------ ...idelineStateTemplateHorizontalTopLurking.h | 35 --- ...elineStateTemplateVerticalLeftAbstract.cpp | 24 -- ...idelineStateTemplateVerticalLeftAbstract.h | 28 -- ...GuidelineStateTemplateVerticalLeftHide.cpp | 73 ----- .../GuidelineStateTemplateVerticalLeftHide.h | 35 --- ...uidelineStateTemplateVerticalLeftHover.cpp | 84 ------ .../GuidelineStateTemplateVerticalLeftHover.h | 35 --- ...delineStateTemplateVerticalLeftLurking.cpp | 87 ------ ...uidelineStateTemplateVerticalLeftLurking.h | 35 --- ...lineStateTemplateVerticalRightAbstract.cpp | 24 -- ...delineStateTemplateVerticalRightAbstract.h | 28 -- ...uidelineStateTemplateVerticalRightHide.cpp | 73 ----- .../GuidelineStateTemplateVerticalRightHide.h | 35 --- ...idelineStateTemplateVerticalRightHover.cpp | 84 ------ ...GuidelineStateTemplateVerticalRightHover.h | 35 --- ...elineStateTemplateVerticalRightLurking.cpp | 87 ------ ...idelineStateTemplateVerticalRightLurking.h | 35 --- src/Guideline/Guidelines.cpp | 205 -------------- src/Guideline/Guidelines.h | 78 ------ src/engauge_test_template.pro | 106 -------- src/main/MainWindow.cpp | 42 --- src/main/MainWindow.h | 14 - src/main/MainWindowModel.cpp | 19 +- src/main/MainWindowModel.h | 8 - src/util/ZValues.cpp | 4 - src/util/ZValues.h | 4 - 126 files changed, 5 insertions(+), 7253 deletions(-) delete mode 100644 src/Guideline/GuidelineAbstract.cpp delete mode 100644 src/Guideline/GuidelineAbstract.h delete mode 100644 src/Guideline/GuidelineEllipse.cpp delete mode 100644 src/Guideline/GuidelineEllipse.h delete mode 100644 src/Guideline/GuidelineFormat.cpp delete mode 100644 src/Guideline/GuidelineFormat.h delete mode 100644 src/Guideline/GuidelineLine.cpp delete mode 100644 src/Guideline/GuidelineLine.h delete mode 100644 src/Guideline/GuidelineProjectorAbstract.cpp delete mode 100644 src/Guideline/GuidelineProjectorAbstract.h delete mode 100644 src/Guideline/GuidelineProjectorConstantR.cpp delete mode 100644 src/Guideline/GuidelineProjectorConstantR.h delete mode 100644 src/Guideline/GuidelineProjectorConstantT.cpp delete mode 100644 src/Guideline/GuidelineProjectorConstantT.h delete mode 100644 src/Guideline/GuidelineProjectorConstantX.cpp delete mode 100644 src/Guideline/GuidelineProjectorConstantX.h delete mode 100644 src/Guideline/GuidelineProjectorConstantY.cpp delete mode 100644 src/Guideline/GuidelineProjectorConstantY.h delete mode 100644 src/Guideline/GuidelineState.h delete mode 100644 src/Guideline/GuidelineStateAbstractBase.cpp delete mode 100644 src/Guideline/GuidelineStateAbstractBase.h delete mode 100644 src/Guideline/GuidelineStateContext.cpp delete mode 100644 src/Guideline/GuidelineStateContext.h delete mode 100644 src/Guideline/GuidelineStateDeployedAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedAbstract.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRAbstract.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRActive.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRActive.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRHide.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRHide.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRHover.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRHover.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRLocked.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantRLocked.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTAbstract.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTActive.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTActive.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTHide.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTHide.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTHover.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTHover.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTLocked.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantTLocked.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXAbstract.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXActive.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXActive.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXHide.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXHide.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXHover.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXHover.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXLocked.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantXLocked.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYAbstract.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYActive.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYActive.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYHide.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYHide.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYHover.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYHover.h delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYLocked.cpp delete mode 100644 src/Guideline/GuidelineStateDeployedConstantYLocked.h delete mode 100644 src/Guideline/GuidelineStateDiscarded.cpp delete mode 100644 src/Guideline/GuidelineStateDiscarded.h delete mode 100644 src/Guideline/GuidelineStateHandle.cpp delete mode 100644 src/Guideline/GuidelineStateHandle.h delete mode 100644 src/Guideline/GuidelineStateTemplateAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateAbstract.h delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.h delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalBottomHide.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalBottomHide.h delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalBottomHover.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalBottomHover.h delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.h delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.h delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalTopHide.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalTopHide.h delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalTopHover.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalTopHover.h delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalTopLurking.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateHorizontalTopLurking.h delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.h delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalLeftHide.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalLeftHide.h delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalLeftHover.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalLeftHover.h delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalLeftLurking.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalLeftLurking.h delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalRightAbstract.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalRightAbstract.h delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalRightHide.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalRightHide.h delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalRightHover.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalRightHover.h delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalRightLurking.cpp delete mode 100644 src/Guideline/GuidelineStateTemplateVerticalRightLurking.h delete mode 100644 src/Guideline/Guidelines.cpp delete mode 100644 src/Guideline/Guidelines.h diff --git a/engauge.pro b/engauge.pro index 3f62a9a6..99a7c4e2 100644 --- a/engauge.pro +++ b/engauge.pro @@ -344,60 +344,6 @@ HEADERS += \ src/Grid/GridLog.h \ src/Grid/GridRemoval.h \ src/Grid/GridTriangleFill.h \ - src/Guideline/GuidelineAbstract.h \ - src/Guideline/GuidelineEllipse.h \ - src/Guideline/GuidelineFormat.h \ - src/Guideline/GuidelineLine.h \ - src/Guideline/GuidelineProjectorAbstract.h \ - src/Guideline/GuidelineProjectorConstantR.h \ - src/Guideline/GuidelineProjectorConstantT.h \ - src/Guideline/GuidelineProjectorConstantX.h \ - src/Guideline/GuidelineProjectorConstantY.h \ - src/Guideline/Guidelines.h \ - src/Guideline/GuidelineLine.h \ - src/Guideline/GuidelineState.h \ - src/Guideline/GuidelineStateAbstractBase.h \ - src/Guideline/GuidelineStateContext.h \ - src/Guideline/GuidelineStateDeployedAbstract.h \ - src/Guideline/GuidelineStateDeployedConstantRAbstract.h \ - src/Guideline/GuidelineStateDeployedConstantRActive.h \ - src/Guideline/GuidelineStateDeployedConstantRHide.h \ - src/Guideline/GuidelineStateDeployedConstantRLocked.h \ - src/Guideline/GuidelineStateDeployedConstantRHover.h \ - src/Guideline/GuidelineStateDeployedConstantTAbstract.h \ - src/Guideline/GuidelineStateDeployedConstantTActive.h \ - src/Guideline/GuidelineStateDeployedConstantTHide.h \ - src/Guideline/GuidelineStateDeployedConstantTHover.h \ - src/Guideline/GuidelineStateDeployedConstantTLocked.h \ - src/Guideline/GuidelineStateDeployedConstantXAbstract.h \ - src/Guideline/GuidelineStateDeployedConstantXActive.h \ - src/Guideline/GuidelineStateDeployedConstantXHide.h \ - src/Guideline/GuidelineStateDeployedConstantXHover.h \ - src/Guideline/GuidelineStateDeployedConstantXLocked.h \ - src/Guideline/GuidelineStateDeployedConstantYAbstract.h \ - src/Guideline/GuidelineStateDeployedConstantYActive.h \ - src/Guideline/GuidelineStateDeployedConstantYHide.h \ - src/Guideline/GuidelineStateDeployedConstantYHover.h \ - src/Guideline/GuidelineStateDeployedConstantYLocked.h \ - src/Guideline/GuidelineStateDiscarded.h \ - src/Guideline/GuidelineStateHandle.h \ - src/Guideline/GuidelineStateTemplateAbstract.h \ - src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.h \ - src/Guideline/GuidelineStateTemplateHorizontalBottomHide.h \ - src/Guideline/GuidelineStateTemplateHorizontalBottomHover.h \ - src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.h \ - src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.h \ - src/Guideline/GuidelineStateTemplateHorizontalTopHide.h \ - src/Guideline/GuidelineStateTemplateHorizontalTopHover.h \ - src/Guideline/GuidelineStateTemplateHorizontalTopLurking.h \ - src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.h \ - src/Guideline/GuidelineStateTemplateVerticalLeftHide.h \ - src/Guideline/GuidelineStateTemplateVerticalLeftHover.h \ - src/Guideline/GuidelineStateTemplateVerticalLeftLurking.h \ - src/Guideline/GuidelineStateTemplateVerticalRightAbstract.h \ - src/Guideline/GuidelineStateTemplateVerticalRightHide.h \ - src/Guideline/GuidelineStateTemplateVerticalRightHover.h \ - src/Guideline/GuidelineStateTemplateVerticalRightLurking.h \ src/Import/ImportCropping.h \ src/Import/ImportCroppingUtilBase.h \ src/Import/ImportCroppingUtilNonPdf.h \ @@ -745,58 +691,6 @@ SOURCES += \ src/Grid/GridLog.cpp \ src/Grid/GridRemoval.cpp \ src/Grid/GridTriangleFill.cpp \ - src/Guideline/GuidelineAbstract.cpp \ - src/Guideline/GuidelineEllipse.cpp \ - src/Guideline/GuidelineFormat.cpp \ - src/Guideline/GuidelineLine.cpp \ - src/Guideline/GuidelineProjectorAbstract.cpp \ - src/Guideline/GuidelineProjectorConstantR.cpp \ - src/Guideline/GuidelineProjectorConstantT.cpp \ - src/Guideline/GuidelineProjectorConstantX.cpp \ - src/Guideline/GuidelineProjectorConstantY.cpp \ - src/Guideline/Guidelines.cpp \ - src/Guideline/GuidelineStateAbstractBase.cpp \ - src/Guideline/GuidelineStateContext.cpp \ - src/Guideline/GuidelineStateDeployedAbstract.cpp \ - src/Guideline/GuidelineStateDeployedConstantRAbstract.cpp \ - src/Guideline/GuidelineStateDeployedConstantRActive.cpp \ - src/Guideline/GuidelineStateDeployedConstantRHide.cpp \ - src/Guideline/GuidelineStateDeployedConstantRLocked.cpp \ - src/Guideline/GuidelineStateDeployedConstantRHover.cpp \ - src/Guideline/GuidelineStateDeployedConstantTAbstract.cpp \ - src/Guideline/GuidelineStateDeployedConstantTActive.cpp \ - src/Guideline/GuidelineStateDeployedConstantTHide.cpp \ - src/Guideline/GuidelineStateDeployedConstantTHover.cpp \ - src/Guideline/GuidelineStateDeployedConstantTLocked.cpp \ - src/Guideline/GuidelineStateDeployedConstantXAbstract.cpp \ - src/Guideline/GuidelineStateDeployedConstantXActive.cpp \ - src/Guideline/GuidelineStateDeployedConstantXHide.cpp \ - src/Guideline/GuidelineStateDeployedConstantXHover.cpp \ - src/Guideline/GuidelineStateDeployedConstantXLocked.cpp \ - src/Guideline/GuidelineStateDeployedConstantYAbstract.cpp \ - src/Guideline/GuidelineStateDeployedConstantYActive.cpp \ - src/Guideline/GuidelineStateDeployedConstantYHide.cpp \ - src/Guideline/GuidelineStateDeployedConstantYHover.cpp \ - src/Guideline/GuidelineStateDeployedConstantYLocked.cpp \ - src/Guideline/GuidelineStateDiscarded.cpp \ - src/Guideline/GuidelineStateHandle.cpp \ - src/Guideline/GuidelineStateTemplateAbstract.cpp \ - src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.cpp \ - src/Guideline/GuidelineStateTemplateHorizontalBottomHide.cpp \ - src/Guideline/GuidelineStateTemplateHorizontalBottomHover.cpp \ - src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.cpp \ - src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.cpp \ - src/Guideline/GuidelineStateTemplateHorizontalTopHide.cpp \ - src/Guideline/GuidelineStateTemplateHorizontalTopHover.cpp \ - src/Guideline/GuidelineStateTemplateHorizontalTopLurking.cpp \ - src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.cpp \ - src/Guideline/GuidelineStateTemplateVerticalLeftHide.cpp \ - src/Guideline/GuidelineStateTemplateVerticalLeftHover.cpp \ - src/Guideline/GuidelineStateTemplateVerticalLeftLurking.cpp \ - src/Guideline/GuidelineStateTemplateVerticalRightAbstract.cpp \ - src/Guideline/GuidelineStateTemplateVerticalRightHide.cpp \ - src/Guideline/GuidelineStateTemplateVerticalRightHover.cpp \ - src/Guideline/GuidelineStateTemplateVerticalRightLurking.cpp \ src/Import/ImportCroppingUtilBase.cpp \ src/Import/ImportCroppingUtilNonPdf.cpp \ src/Import/ImportImageExtensions.cpp \ @@ -986,7 +880,6 @@ INCLUDEPATH += src \ src/Ghosts \ src/Graphics \ src/Grid \ - src/Guideline \ src/Help \ src/img \ src/Import \ diff --git a/src/Create/CreateActions.cpp b/src/Create/CreateActions.cpp index 7aa76155..4c7ee2d7 100644 --- a/src/Create/CreateActions.cpp +++ b/src/Create/CreateActions.cpp @@ -497,17 +497,6 @@ void CreateActions::createView (MainWindow &mw) "which can improve accuracy in distorted graphs")); connect (mw.m_actionViewGridLines, SIGNAL (triggered ()), &mw, SLOT (slotViewGridLines())); - mw.m_actionViewGuidelines = new QAction (tr ("Guidelines"), &mw); - mw.m_actionViewGuidelines->setCheckable (true); - mw.m_actionViewGuidelines->setChecked (true); // Offer initially since otherwise user will never know about the guidelines - mw.m_actionViewGuidelines->setStatusTip (tr ("Show or hide guidelines.")); - mw.m_actionViewGuidelines->setWhatsThis (tr ("View Guidelines\n\n" - "Show or hide guidelines that can be used to align objects. Along each of " - "the four sides of the main window is a guideline that will appear under " - "the cursor. Guidelines can be moved by dragging. Each guideline shows " - "a constant coordinate value, as displayed in the status bar.")); - connect (mw.m_actionViewGuidelines, SIGNAL (triggered ()), &mw, SLOT (slotViewGuidelines())); - mw.m_actionViewBackgroundNone = new QAction (tr ("No Background"), &mw); mw.m_actionViewBackgroundNone->setCheckable (true); mw.m_actionViewBackgroundNone->setStatusTip (tr ("Do not show the image underneath the points.")); diff --git a/src/Create/CreateMenus.cpp b/src/Create/CreateMenus.cpp index ccb6662a..01457162 100644 --- a/src/Create/CreateMenus.cpp +++ b/src/Create/CreateMenus.cpp @@ -73,7 +73,6 @@ void CreateMenus::create(MainWindow &mw) mw.m_menuView->insertSeparator (mw.m_actionViewToolTips); mw.m_menuView->addAction (mw.m_actionViewToolTips); mw.m_menuView->addAction (mw.m_actionViewGridLines); - mw.m_menuView->addAction (mw.m_actionViewGuidelines); mw.m_menuView->insertSeparator (mw.m_actionViewBackgroundNone); mw.m_menuViewBackground = new QMenu (tr ("Background")); mw.m_menuViewBackground->addAction (mw.m_actionViewBackgroundNone); diff --git a/src/DigitizeState/DigitizeStateAxis.cpp b/src/DigitizeState/DigitizeStateAxis.cpp index 1375bce3..ac7fefdd 100644 --- a/src/DigitizeState/DigitizeStateAxis.cpp +++ b/src/DigitizeState/DigitizeStateAxis.cpp @@ -42,7 +42,6 @@ void DigitizeStateAxis::begin (CmdMediator *cmdMediator, setCursor(cmdMediator); context().setDragMode(QGraphicsView::NoDrag); - context().mainWindow().handleGuidelinesActiveChange (false); context().mainWindow().updateViewsOfSettings(activeCurve ()); } diff --git a/src/DigitizeState/DigitizeStateColorPicker.cpp b/src/DigitizeState/DigitizeStateColorPicker.cpp index e316e391..e93a47ba 100644 --- a/src/DigitizeState/DigitizeStateColorPicker.cpp +++ b/src/DigitizeState/DigitizeStateColorPicker.cpp @@ -47,7 +47,6 @@ void DigitizeStateColorPicker::begin (CmdMediator *cmdMediator, m_previousDigitizeState = previousState; m_previousBackground = context().mainWindow().selectOriginal(BACKGROUND_IMAGE_ORIGINAL); // Only makes sense to have original image with all its colors - context().mainWindow().handleGuidelinesActiveChange (false); context().mainWindow().updateViewsOfSettings(activeCurve ()); } diff --git a/src/DigitizeState/DigitizeStateCurve.cpp b/src/DigitizeState/DigitizeStateCurve.cpp index dc763cee..23d6edf4 100644 --- a/src/DigitizeState/DigitizeStateCurve.cpp +++ b/src/DigitizeState/DigitizeStateCurve.cpp @@ -39,7 +39,6 @@ void DigitizeStateCurve::begin (CmdMediator *cmdMediator, setCursor(cmdMediator); context().setDragMode(QGraphicsView::NoDrag); - context().mainWindow().handleGuidelinesActiveChange (false); context().mainWindow().updateViewsOfSettings(activeCurve ()); } diff --git a/src/DigitizeState/DigitizeStateEmpty.cpp b/src/DigitizeState/DigitizeStateEmpty.cpp index a01272c4..27fedc5d 100644 --- a/src/DigitizeState/DigitizeStateEmpty.cpp +++ b/src/DigitizeState/DigitizeStateEmpty.cpp @@ -32,7 +32,6 @@ void DigitizeStateEmpty::begin (CmdMediator *cmdMediator, LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::begin"; setCursor(cmdMediator); - context().mainWindow().handleGuidelinesActiveChange (false); context().mainWindow().updateViewsOfSettings(activeCurve ()); } diff --git a/src/DigitizeState/DigitizeStatePointMatch.cpp b/src/DigitizeState/DigitizeStatePointMatch.cpp index befd96b3..d2052595 100644 --- a/src/DigitizeState/DigitizeStatePointMatch.cpp +++ b/src/DigitizeState/DigitizeStatePointMatch.cpp @@ -56,7 +56,6 @@ void DigitizeStatePointMatch::begin (CmdMediator *cmdMediator, setCursor(cmdMediator); context().setDragMode(QGraphicsView::NoDrag); - context().mainWindow().handleGuidelinesActiveChange (false); context().mainWindow().updateViewsOfSettings(activeCurve ()); // Add outline that will move with the cursor diff --git a/src/DigitizeState/DigitizeStateScale.cpp b/src/DigitizeState/DigitizeStateScale.cpp index d19215a2..89749b8c 100644 --- a/src/DigitizeState/DigitizeStateScale.cpp +++ b/src/DigitizeState/DigitizeStateScale.cpp @@ -48,7 +48,6 @@ void DigitizeStateScale::begin (CmdMediator *cmdMediator, setCursor(cmdMediator); context().setDragMode(QGraphicsView::NoDrag); - context().mainWindow().handleGuidelinesActiveChange (false); context().mainWindow().updateViewsOfSettings(activeCurve ()); } diff --git a/src/DigitizeState/DigitizeStateSegment.cpp b/src/DigitizeState/DigitizeStateSegment.cpp index 404bf328..7c611f95 100644 --- a/src/DigitizeState/DigitizeStateSegment.cpp +++ b/src/DigitizeState/DigitizeStateSegment.cpp @@ -43,7 +43,6 @@ void DigitizeStateSegment::begin (CmdMediator *cmdMediator, setCursor(cmdMediator); context().setDragMode(QGraphicsView::NoDrag); - context().mainWindow().handleGuidelinesActiveChange (false); context().mainWindow().updateViewsOfSettings(activeCurve ()); handleCurveChange(cmdMediator); diff --git a/src/DigitizeState/DigitizeStateSelect.cpp b/src/DigitizeState/DigitizeStateSelect.cpp index e5e4c2b7..3e51d660 100644 --- a/src/DigitizeState/DigitizeStateSelect.cpp +++ b/src/DigitizeState/DigitizeStateSelect.cpp @@ -60,8 +60,7 @@ void DigitizeStateSelect::addHoverHighlighting() for (itr = items.begin (); itr != items.end (); itr++) { QGraphicsItem *item = *itr; - if (item->data (DATA_KEY_GRAPHICS_ITEM_TYPE) == GRAPHICS_ITEM_TYPE_POINT || - item->data (DATA_KEY_GRAPHICS_ITEM_TYPE) == GRAPHICS_ITEM_TYPE_GUIDELINE) { + if (item->data (DATA_KEY_GRAPHICS_ITEM_TYPE) == GRAPHICS_ITEM_TYPE_POINT) { item->setAcceptHoverEvents(true); } } @@ -76,7 +75,6 @@ void DigitizeStateSelect::begin (CmdMediator *cmdMediator, context().setDragMode(QGraphicsView::RubberBandDrag); addHoverHighlighting(); - context().mainWindow().handleGuidelinesActiveChange (true); context().mainWindow().updateViewsOfSettings(activeCurve ()); } @@ -455,8 +453,7 @@ void DigitizeStateSelect::removeHoverHighlighting() for (itr = items.begin (); itr != items.end (); itr++) { QGraphicsItem *item = *itr; - if (item->data (DATA_KEY_GRAPHICS_ITEM_TYPE) == GRAPHICS_ITEM_TYPE_POINT || - item->data (DATA_KEY_GRAPHICS_ITEM_TYPE) == GRAPHICS_ITEM_TYPE_GUIDELINE) { + if (item->data (DATA_KEY_GRAPHICS_ITEM_TYPE) == GRAPHICS_ITEM_TYPE_POINT) { item->setAcceptHoverEvents(false); } } diff --git a/src/Dlg/DlgSettingsMainWindow.cpp b/src/Dlg/DlgSettingsMainWindow.cpp index 075ef106..f66dafd8 100644 --- a/src/Dlg/DlgSettingsMainWindow.cpp +++ b/src/Dlg/DlgSettingsMainWindow.cpp @@ -252,17 +252,6 @@ void DlgSettingsMainWindow::createControls (QGridLayout *layout, "element M and significant digits S as T = M / 10^S.")); connect (m_spinSignificantDigits, SIGNAL (valueChanged (int)), this, SLOT (slotSignificantDigits (int))); layout->addWidget (m_spinSignificantDigits, row++, 2); - - QLabel *labelGuidelineColor = new QLabel (QString ("%1:").arg (tr ("Guideline color"))); - layout->addWidget (labelGuidelineColor, row, 1); - - m_cmbGuidelineColor = new QComboBox; - m_cmbGuidelineColor->setWhatsThis (tr ("Guidelines Color\n\n" - "Set the color of the guidelines that can be dragged from the edges of the scene, and used " - "to align points")); - populateColorComboWithoutTransparent (*m_cmbGuidelineColor); - connect (m_cmbGuidelineColor, SIGNAL (activated (const QString &)), this, SLOT (slotGuidelineColor (const QString &))); // activated() ignores code changes - layout->addWidget (m_cmbGuidelineColor, row++, 2); } void DlgSettingsMainWindow::createOptionalSaveDefault (QHBoxLayout * /* layout */) @@ -357,10 +346,6 @@ void DlgSettingsMainWindow::loadMainWindowModel (CmdMediator &cmdMediator, m_spinSignificantDigits->setValue (m_modelMainWindowAfter->significantDigits ()); m_chkImageReplaceRenamesDocument->setChecked (m_modelMainWindowAfter->imageReplaceRenamesDocument()); - int indexColor = m_cmbGuidelineColor->findData(QVariant(m_modelMainWindowAfter->guidelineColor())); - ENGAUGE_ASSERT (indexColor >= 0); - m_cmbGuidelineColor->setCurrentIndex(indexColor); - updateControls (); enableOk (false); // Disable Ok button since there not yet any changes } @@ -377,14 +362,6 @@ void DlgSettingsMainWindow::slotDragDropExport (bool) updateControls (); } -void DlgSettingsMainWindow::slotGuidelineColor (QString const &) -{ - LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotColor"; - - m_modelMainWindowAfter->setGuidelineColor(static_cast (m_cmbGuidelineColor->currentData().toInt())); - updateControls(); -} - void DlgSettingsMainWindow::slotHighlightOpacity(double) { LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotHighlightOpacity"; diff --git a/src/Dlg/DlgSettingsMainWindow.h b/src/Dlg/DlgSettingsMainWindow.h index f674a6ef..1af0b66f 100644 --- a/src/Dlg/DlgSettingsMainWindow.h +++ b/src/Dlg/DlgSettingsMainWindow.h @@ -41,7 +41,6 @@ class DlgSettingsMainWindow : public DlgSettingsAbstractBase private slots: void slotDragDropExport (bool); - void slotGuidelineColor (const QString &); void slotHighlightOpacity (double); void slotImageReplaceRenamesDocument (bool); void slotImportCropping (int index); @@ -78,7 +77,6 @@ private slots: QCheckBox *m_chkDragDropExport; QSpinBox *m_spinSignificantDigits; QCheckBox *m_chkImageReplaceRenamesDocument; - QComboBox *m_cmbGuidelineColor; MainWindowModel *m_modelMainWindowBefore; MainWindowModel *m_modelMainWindowAfter; diff --git a/src/Graphics/GraphicsItemType.h b/src/Graphics/GraphicsItemType.h index 8f4ee4a5..a3f1ebc6 100644 --- a/src/Graphics/GraphicsItemType.h +++ b/src/Graphics/GraphicsItemType.h @@ -13,8 +13,7 @@ enum GraphicsItemType { GRAPHICS_ITEM_TYPE_LINE, GRAPHICS_ITEM_TYPE_POINT, GRAPHICS_ITEM_TYPE_SCALE_BAR, - GRAPHICS_ITEM_TYPE_SEGMENT, - GRAPHICS_ITEM_TYPE_GUIDELINE + GRAPHICS_ITEM_TYPE_SEGMENT }; #endif // GRAPHICS_ITEM_TYPE_H diff --git a/src/Guideline/GuidelineAbstract.cpp b/src/Guideline/GuidelineAbstract.cpp deleted file mode 100644 index a03f5d4f..00000000 --- a/src/Guideline/GuidelineAbstract.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "DataKey.h" -#include "EngaugeAssert.h" -#include "EnumsToQt.h" -#include "GraphicsItemType.h" -#include "GuidelineAbstract.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "Guidelines.h" -#include "GuidelineStateContext.h" -#include "Logger.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Transformation.h" -#include "ZValues.h" - -GuidelineAbstract::GuidelineAbstract(QGraphicsScene &scene) : - m_scene (scene), - m_context (nullptr), - m_guidelineVisible (nullptr) -{ -} - -GuidelineAbstract::~GuidelineAbstract () -{ - delete m_context; -} - -void GuidelineAbstract::bindGuidelineVisible (GuidelineAbstract *guidelineVisible) -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineAbstract::bindGuidelineVisible state=" << m_context->state ().toLatin1().data(); - - m_guidelineVisible = guidelineVisible; - - connect (this, SIGNAL (signalHandleMoved (QPointF)), - guidelineVisible, SLOT (slotHandleMoved (QPointF))); -} - -GuidelineStateContext *GuidelineAbstract::context () -{ - return m_context; -} - -const GuidelineStateContext *GuidelineAbstract::context () const -{ - return m_context; -} - -void GuidelineAbstract::detachVisibleGuideline (const QPointF &posScene) -{ - if (m_guidelineVisible != nullptr) { - - // If scene position is off-screen then user is removing the visible Guideline - if (!m_scene.sceneRect().contains (posScene)) { - - m_guidelineVisible->draggedOffScreen (); - - } - - m_guidelineVisible = nullptr; - } -} - -void GuidelineAbstract::draggedOffScreen () -{ - m_context->draggedOffScreen (); -} - -void GuidelineAbstract::handleActiveChange (bool active) -{ - m_context->handleActiveChange (active); -} - -void GuidelineAbstract::handleHoverEnterEvent() -{ - m_context->handleHoverEnterEvent (); -} - -void GuidelineAbstract::handleHoverLeaveEvent() -{ - m_context->handleHoverLeaveEvent (); -} - -void GuidelineAbstract::handleMouseMoveEvent (const QPointF &posScene) -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineAbstract::handleMouseMoveEvent"; - - // Skip if there is no bound visible Guideline - if (m_guidelineVisible != nullptr) { - - emit signalHandleMoved (posScene); - } -} - -void GuidelineAbstract::handleMousePressEvent(const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineAbstract::handleMousePressEvent state=" << m_context->state ().toLatin1().data(); - - m_context->handleMousePress(posScene); -} - -void GuidelineAbstract::handleMouseReleaseEvent (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineAbstract::handleMouseReleaseEvent state=" << m_context->state ().toLatin1().data(); - - m_context->handleMouseRelease (posScene); -} - -void GuidelineAbstract::handleVisibleChange (bool visible) -{ - m_context->handleVisibleChange (visible); -} - -QGraphicsScene &GuidelineAbstract::scene () -{ - return m_scene; -} - -void GuidelineAbstract::setContext (GuidelineStateContext *context) -{ - m_context = context; -} - -void GuidelineAbstract::slotHandleMoved (QPointF posScreen) -{ - updateGeometry (posScreen); -} - -QString GuidelineAbstract::state () const -{ - // This is used by Guidelines::stateDump and GuidelineStateContext::stateDump - QString out; - QTextStream str (&out); - - str << " " << m_context->state(); - str << " ("; - str << (getGraphicsItemSelected() ? "selected" : "unselected") << " "; - str << (getGraphicsItemAcceptHover() ? "hoverable" : "unhoverable") << " "; - str << ((graphicsItemFlags () & QGraphicsItem::ItemIsFocusable ) != 0 ? "focusable" : "unfocusable") << " "; - str << ((graphicsItemFlags () & QGraphicsItem::ItemIsMovable ) != 0 ? "movable" : "unmovable") << " "; - str << ((graphicsItemFlags () & QGraphicsItem::ItemIsSelectable) != 0 ? "selectable" : "unselectable") << " "; - str << ")"; - - return out; -} - -void GuidelineAbstract::updateWithLatestTransformation () -{ - m_context->updateWithLatestTransformation (); -} diff --git a/src/Guideline/GuidelineAbstract.h b/src/Guideline/GuidelineAbstract.h deleted file mode 100644 index 3c9e1a17..00000000 --- a/src/Guideline/GuidelineAbstract.h +++ /dev/null @@ -1,191 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_ABSTRACT_H -#define GUIDELINE_ABSTRACT_H - -#include "GuidelineStateContext.h" -#include -#include -#include - -class QGraphicsScene; -class QMouseEvent; -class QPainter; -class QPointF; -class QStyleOptionGraphicsItem; -class QWidget; - -/// This class is a special case of the standard QGraphicsLineItem for guidelines, -/// and serves as the base class for the guideline state classes. This class has -/// a state machine to handle state-specific behavior for hovering, dragging, and -/// formatting. -/// -/// General strategy: -/// 1) Four template Guidelines lie around the four scene borders -/// 2) A deployed Guideline is created by dragging a template Guideline from its original position -/// 3) When a (template or deployed) Guideline is dragged, the following process occurs -/// 3a) The dragged Guideline becomes invisible, and its state changes to Handle -/// 3b) A new deployed Guideline is generated where the dragged Guideline was located -/// 3c) Dragging the Handle causes the same movements in the new deployed Guideline -/// 3d) The new deployed Guideline is continually resized to just fit the scene, and in the -/// case of polar coordinates resized to go between origin and scene edge (theta) or -/// curved elliptically (range) -/// 3e) At the end of the drag, the Handle is no longer needed so it transitions to Discarded state -/// 3f) At the end of the drag, if it started with a template Guideline then a replacement -/// is put back on the scene edge -/// State transitions are diagrammed in the GuidelineStateContext class -/// -/// This strategy works with the following constraints -/// 1) Since it is not the dragged object that we modify in 3d above, we can resize and adjust -/// the curvature of the visible new deployed Guideline as necessary -/// -/// A simple way to describe this approach: Clicking and dragging involves the clicked Guideline -/// dying and a new Guideline being born in its place -/// -/// State names are defined as: -/// # horizontal = Follows constant-y isocontour -/// # vertical = Follows constant-x isocontour -/// # template = One of the guidelines along every scene border that can be dragged -/// # deployed = One of the guidelines created by the user dragging a template guideline -/// # hide = Used when all Guidelines have been turned off -/// # hover = Applies when cursor is hovering over the Guideline, to add some highlighting -/// # normal = After a deployed Guideline has been created and lost the hover -/// # discarded = A noop state. The Guideline is no longer useful and has been removed -/// # handle = This Guideline is invisible, being dragged, and moving a bound deployed -/// Guideline along the same drag trajectory -/// # lurking = Template Guideline state for when active but not seen, and waiting for hover -/// -/// There are two derived classes: -/// # one for drawing lines (cartesian and polar angle) with QGraphicsLineItem -/// # one for drawing ellipses (range angle) with QGraphicsEllipseItem -/// An attempt to draw lines with just QGraphicsEllipseItem, for simplicity, failed with -/// the result having sinusoidally changing line width. -class GuidelineAbstract : public QObject -{ - Q_OBJECT; - -public: - /// Single constructor. - GuidelineAbstract(QGraphicsScene &scene); - ~GuidelineAbstract(); - - /// Bind a newly-created visible Guideline to this Guideline, and make this one invisible - void bindGuidelineVisible (GuidelineAbstract *guidelineVisible); - - /// Detach visible Guideline after click and drag - void detachVisibleGuideline (const QPointF &posScene); - - /// Guideline has been dragged off screen so remove it - void draggedOffScreen (); - - /// Return true if accepting hover events - virtual bool getGraphicsItemAcceptHover () const = 0; - - /// Wrapper for QGraphicsItem::isSelected - virtual bool getGraphicsItemSelected () const = 0; - - /// Wraps QGraphicsItem::flags - virtual QGraphicsItem::GraphicsItemFlags graphicsItemFlags () const = 0; - - /// DigitizeState change so active status may (or may not) be toggled - void handleActiveChange (bool active); - - /// Highlight this Guideline upon hover enter - void handleHoverEnterEvent(); - - /// Unset highlighting triggered by hover enter - void handleHoverLeaveEvent(); - - /// Forwad movements to visible Guideline - void handleMouseMoveEvent (const QPointF &posScene); - - /// Forward press event to state machine - void handleMousePressEvent(const QPointF &posScene); - - /// Cleanup after being dragged - void handleMouseReleaseEvent (const QPointF &posScene); - - /// User toggled Guideline visibility - void handleVisibleChange (bool visible); - - /// Make graphics item remove itself from the scene - virtual void removeFromScene (QGraphicsScene *scene) = 0; - - /// GraphicsScene that owns this class - QGraphicsScene &scene (); - - /// Wrapper for QGraphicsItem::setAcceptHoverEvents - virtual void setGraphicsItemAcceptHoverEvents (bool accept) = 0; - - /// Wrapper for QGraphicsItem::setFlags - virtual void setGraphicsItemFlags (QGraphicsItem::GraphicsItemFlags flags) = 0; - - /// Wrapper for QGraphicsLineItem::setLine - virtual void setGraphicsItemLine (const QLineF &line) = 0; - - /// Wrapper for QGraphicsItem::setPen - virtual void setGraphicsItemPen (const QColor &color, - double lineWidth) = 0; - - /// Wrapper for QGraphicsItem::setVisible - virtual void setGraphicsItemVisible (bool visible) = 0; - - /// Wrapper for QGraphicsItem::setZValue - virtual void setGraphicsItemZValue (double z) = 0; - - /// State as a string for debugging only - QString state () const; - - /// Update active versus inactive state. Inactive state applies when DigitizeState is not DigitizeStateSelect, since - /// the Guidelines can help with moving points around. This method is called on DigitizeState transitions. - /// Active is not the same as visibility. When inactive, guidelines ignore hover and click events - void updateActive (bool active); - - /// Force a color update - virtual void updateColor () = 0; - - /// Update the geometry so it passes through the specified point - virtual void updateGeometry (const QPointF &pos) = 0; - - /// Update given Transformation in GuidelineStateContext. This is called after a command has been executed - void updateWithLatestTransformation (); - -signals: - - /// Signal for cloned deployed Guideline from handle Guideline - void signalHandleMoved (QPointF); - -public slots: - - /// Slot for signal from cloned deployed Guideline from handle Guideline - void slotHandleMoved (QPointF posScreen); - -protected: - /// State machine context owned by this class - GuidelineStateContext *context(); - - /// State machine context owned by this class as a const - const GuidelineStateContext *context () const; - - /// Create state machine after virtual methods of child classes have been defined - void setContext (GuidelineStateContext *context); - -private: - GuidelineAbstract(); - - QGraphicsScene &m_scene; - - // Context is allocated as a final step in the constructor, at which point - // this class has registered with the QGraphicsScene - GuidelineStateContext *m_context; - - // After binding to visible Guideline - GuidelineAbstract *m_guidelineVisible; - -}; - -#endif // GUIDELINE_ABSTRACT_H diff --git a/src/Guideline/GuidelineEllipse.cpp b/src/Guideline/GuidelineEllipse.cpp deleted file mode 100644 index a846ba75..00000000 --- a/src/Guideline/GuidelineEllipse.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "DataKey.h" -#include "EngaugeAssert.h" -#include "EnumsToQt.h" -#include "GraphicsItemType.h" -#include "GuidelineEllipse.h" -#include "GuidelineFormat.h" -#include "Guidelines.h" -#include "GuidelineStateContext.h" -#include "Logger.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "ZValues.h" - -GuidelineEllipse::GuidelineEllipse(QGraphicsScene &scene, - Guidelines &guidelines, - GuidelineState guidelineStateInitial) : - GuidelineAbstract (scene) -{ - // Create context after all virtual methods have been created. The transition - // into the initial state will position the line if it is a template guideline - setContext (new GuidelineStateContext (*this, - guidelines, - guidelineStateInitial)); - - setData (DATA_KEY_GRAPHICS_ITEM_TYPE, QVariant (GRAPHICS_ITEM_TYPE_GUIDELINE)); - - scene.addItem (this); -} - -GuidelineEllipse::~GuidelineEllipse () -{ -} - -bool GuidelineEllipse::collidesWithPath (const QPainterPath &path, - Qt::ItemSelectionMode mode) const -{ - const double RATIO = 1000.0; // Ratio of many pixels to few pixels, for preventing divide by zero - bool collides = false; - - if (QGraphicsEllipseItem::collidesWithPath (path, - mode)) { - - // Slow test to not count interior region - - GuidelineFormat guidelineFormat (context ()->color ()); - - // Bounding box of ellipse - double a = rect().width() / 2.0; - double b = rect().height() / 2.0; - - // Loop through points in path polygon - QPolygonF poly = path.toFillPolygon(); - QPolygonF::const_iterator itr; - for (itr = poly.begin(); (itr != poly.end()) && !collides; itr++) { - - // This point is for the ellipse that has already been rotated to be aligned with axes - const QPointF &pointAligned = *itr; - - // Project point onto ellipse. The projection is assumed to be the closest ellipse portion to that point. - // Starting with (x/a)^2+(y/b)^2=1 with x=r cos(Theta) and y=r sin(Theta), we can solve to get r^2 (cT^2/a^2 + sT2/b^2) = 1 - double xGot = pointAligned.x(); - double yGot = pointAligned.y(); - double rGot = qSqrt (xGot * xGot + yGot * yGot); - if (rGot * RATIO > qAbs (xGot) || rGot * RATIO > qAbs (yGot)) { - - // Check for divide by zero passed so keep going - double cTheta = xGot / rGot; - double sTheta = yGot / rGot; - double rProjected = qSqrt (1.0 / (cTheta * cTheta / a / a + sTheta * sTheta / b / b)); - double xProjected = rProjected * cTheta; - double yProjected = rProjected * sTheta; - - // Distance to projection - double distance = qSqrt ((xProjected - xGot) * (xProjected - xGot) + - (yProjected - yGot) * (yProjected - yGot)); - - if (distance < guidelineFormat.lineWidthHover()) { - - // This will make the loop exit immediately for speed - collides = true; - } - } - } - } - - return collides; -} - -bool GuidelineEllipse::getGraphicsItemAcceptHover () const -{ - return acceptHoverEvents(); -} - -bool GuidelineEllipse::getGraphicsItemSelected () const -{ - return QGraphicsEllipseItem::isSelected (); -} - -QGraphicsItem::GraphicsItemFlags GuidelineEllipse::graphicsItemFlags () const -{ - return QGraphicsEllipseItem::flags (); -} - -void GuidelineEllipse::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -{ - handleHoverEnterEvent (); - - QGraphicsEllipseItem::hoverEnterEvent (event); -} - -void GuidelineEllipse::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - handleHoverLeaveEvent (); - - QGraphicsEllipseItem::hoverLeaveEvent (event); -} - -void GuidelineEllipse::mouseMoveEvent (QGraphicsSceneMouseEvent *event) -{ - handleMouseMoveEvent (event->scenePos ()); - - QGraphicsEllipseItem::mouseMoveEvent (event); -} - -void GuidelineEllipse::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineEllipse::mousePressEvent state=" << context()->state ().toLatin1().data(); - - QGraphicsEllipseItem::mousePressEvent (event); - - handleMousePressEvent (event->scenePos ()); - - context()->handleMousePress(event->scenePos()); -} - -void GuidelineEllipse::mouseReleaseEvent (QGraphicsSceneMouseEvent *event) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineEllipse::mouseReleaseEvent state=" << context()->state ().toLatin1().data(); - - handleMouseReleaseEvent (event->scenePos()); - - QGraphicsEllipseItem::mouseReleaseEvent (event); - - context()->handleMouseRelease (event->scenePos ()); -} - -void GuidelineEllipse::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - if (context()->doPaint ()) { - - QGraphicsEllipseItem::paint (painter, - option, - widget); - } -} - -void GuidelineEllipse::removeFromScene (QGraphicsScene *scene) -{ - scene->removeItem (this); -} - -void GuidelineEllipse::setGraphicsItemAcceptHoverEvents (bool accept) -{ - QGraphicsEllipseItem::setAcceptHoverEvents (accept); -} - -void GuidelineEllipse::setGraphicsItemFlags (QGraphicsItem::GraphicsItemFlags flags) -{ - QGraphicsEllipseItem::setFlags (flags); -} - -void GuidelineEllipse::setGraphicsItemLine (const QLineF & /* line */) -{ - // Noop -} - -void GuidelineEllipse::setGraphicsItemPen (const QColor &color, - double lineWidth) -{ - QBrush brush (color); - - setPen (QPen (brush, - lineWidth)); -} - -void GuidelineEllipse::setGraphicsItemVisible (bool visible) -{ - QGraphicsEllipseItem::setVisible (visible); -} - -void GuidelineEllipse::setGraphicsItemZValue (double z) -{ - QGraphicsEllipseItem::setZValue (z); -} - -void GuidelineEllipse::updateColor () -{ - // Apply color to brush and pen defined in setGraphicsItemPen. - - QPen p = QGraphicsEllipseItem::pen(); - QBrush br = p.brush(); - double alphaF = br.color().alphaF(); - double lineWidth = p.width (); - - QColor color = ColorPaletteToQColor (context()->color()); - color.setAlphaF (alphaF); - - setGraphicsItemPen (color, - lineWidth); -} - -void GuidelineEllipse::updateGeometry (const QPointF &posScreen) -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineEllipse::updateGeometry scale=" << scale() - << " rotation(deg)=" << rotation(); - - EllipseParameters ellipseParameters = context()->pointToEllipse (posScreen); - - QPointF posCenter = ellipseParameters.posCenter(); - - double a = ellipseParameters.a(); - double b= ellipseParameters.b(); - - setRect (QRectF (- QPointF (a, b), - + QPointF (a, b))); - - // Rotate. Originally the rectangle was centered at posCenter, the rotation center - // was set using setTransformOriginPoint to posCenter, but the resulting shape was not right - setRotation (qRadiansToDegrees (ellipseParameters.angleRadians())); - setPos (posCenter); - - // Save the graph value for later - QPointF posGraph; - context()->transformation().transformScreenToRawGraph (posScreen, - posGraph); - context()->setPosCursorGraph (posGraph); -} diff --git a/src/Guideline/GuidelineEllipse.h b/src/Guideline/GuidelineEllipse.h deleted file mode 100644 index b82f8e58..00000000 --- a/src/Guideline/GuidelineEllipse.h +++ /dev/null @@ -1,80 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_ELLIPSE_H -#define GUIDELINE_ELLIPSE_H - -#include "GuidelineAbstract.h" -#include -#include - -class QMouseEvent; -class QPainter; -class QGraphicsScene; -class QStyleOptionGraphicsItem; -class QWidget; - -/// Ellipse version of GuidelineAbstract -class GuidelineEllipse : public GuidelineAbstract, public QGraphicsEllipseItem -{ -public: - /// Single constructor. - GuidelineEllipse(QGraphicsScene &scene, - Guidelines &guidelines, - GuidelineState guidelineStateInitial); - ~GuidelineEllipse(); - - /// Override normal QGraphicsEllipseItem collision detection that covers ellipse boundary - /// and entire interior region, to exclude the interior region - virtual bool collidesWithPath (const QPainterPath &path, - Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; - - virtual bool getGraphicsItemSelected () const; - - virtual bool getGraphicsItemAcceptHover () const; - - virtual QGraphicsItem::GraphicsItemFlags graphicsItemFlags () const; - - /// Highlight this Guideline upon hover enter - virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); - - /// Unset highlighting triggered by hover enter - virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); - - /// Forwad movements to visible Guideline - virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event); - - /// Forward press event to state machine - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - - /// Cleanup after being dragged - virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event); - - /// Override painting so this disappears when selected. Selected Guidelines are never visible - virtual void paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget = Q_NULLPTR); - - virtual void removeFromScene (QGraphicsScene *scene); - virtual void setGraphicsItemAcceptHoverEvents (bool accept); - virtual void setGraphicsItemFlags (QGraphicsItem::GraphicsItemFlags flags); - virtual void setGraphicsItemLine (const QLineF &line); - virtual void setGraphicsItemPen (const QColor &color, - double lineWidth); - virtual void setGraphicsItemVisible (bool visible); - virtual void setGraphicsItemZValue (double z); - virtual void updateColor (); - virtual void updateGeometry (const QPointF &posScreen); - -private: - GuidelineEllipse(); - - // Forces use of setPenColor instead of QGraphicsLineItem::setPen - using QGraphicsEllipseItem::setPen; - -}; - -#endif // GUIDELINE_ELLIPSE_H diff --git a/src/Guideline/GuidelineFormat.cpp b/src/Guideline/GuidelineFormat.cpp deleted file mode 100644 index 61d1dd00..00000000 --- a/src/Guideline/GuidelineFormat.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EnumsToQt.h" -#include "GuidelineFormat.h" -#include - -GuidelineFormat::GuidelineFormat(ColorPalette color) : - m_color (ColorPaletteToQColor (color)) -{ -} - -GuidelineFormat::~GuidelineFormat() -{ -} - -QColor GuidelineFormat::colorDeployedHover () const -{ - QColor color (m_color); - color.setAlphaF (0.8); - - return color; -} - -QColor GuidelineFormat::colorDeployedNonHover () const -{ - return m_color; -} - -QColor GuidelineFormat::colorHidden () const -{ - return QColor (Qt::transparent); -} - -double GuidelineFormat::lineWidthHover () const -{ - return 2.0; // Wide so easy to see and click on -} - -double GuidelineFormat::lineWidthNonHover () const -{ - return 0.8; // Narrow for precision -} diff --git a/src/Guideline/GuidelineFormat.h b/src/Guideline/GuidelineFormat.h deleted file mode 100644 index 851e999c..00000000 --- a/src/Guideline/GuidelineFormat.h +++ /dev/null @@ -1,48 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_FORMAT_H -#define GUIDELINE_FORMAT_H - -#include "ColorPalette.h" -#include - -/// This class centralizes the formatting information (color, line width, alpha) for the Guidelines -class GuidelineFormat -{ -public: - /// Single constructor. - GuidelineFormat(ColorPalette color); - ~GuidelineFormat(); - - /// Public enum - enum HoverOption { - HOVER_OFF, - HOVER_ON - }; - - /// Guideline color when hovering - QColor colorDeployedHover () const; - - /// Guideline color when not hovering - QColor colorDeployedNonHover () const; - - /// Color when object is transparent but still handling (probably hover) events - QColor colorHidden () const; - - /// Guideline line width for non-templates Guidelines - double lineWidthHover () const; - - /// Guideline line width of template Guideline as drawn - double lineWidthNonHover () const; - -private: - GuidelineFormat(); - - QColor m_color; -}; - -#endif // GUIDELINE_FORMAT_H diff --git a/src/Guideline/GuidelineLine.cpp b/src/Guideline/GuidelineLine.cpp deleted file mode 100644 index 3e7714dc..00000000 --- a/src/Guideline/GuidelineLine.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "DataKey.h" -#include "EngaugeAssert.h" -#include "EnumsToQt.h" -#include "GraphicsItemType.h" -#include "GuidelineLine.h" -#include "Guidelines.h" -#include "GuidelineStateContext.h" -#include "Logger.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "ZValues.h" - -GuidelineLine::GuidelineLine(QGraphicsScene &scene, - Guidelines &guidelines, - GuidelineState guidelineStateInitial) : - GuidelineAbstract (scene) -{ - // Create context after all virtual methods have been created. The transition - // into the initial state will position the line if it is a template guideline - setContext (new GuidelineStateContext (*this, - guidelines, - guidelineStateInitial)); - - setData (DATA_KEY_GRAPHICS_ITEM_TYPE, QVariant (GRAPHICS_ITEM_TYPE_GUIDELINE)); - - scene.addItem (this); -} - -GuidelineLine::~GuidelineLine () -{ -} - -bool GuidelineLine::getGraphicsItemAcceptHover () const -{ - return acceptHoverEvents(); -} - -bool GuidelineLine::getGraphicsItemSelected () const -{ - return QGraphicsLineItem::isSelected(); -} - -QGraphicsItem::GraphicsItemFlags GuidelineLine::graphicsItemFlags () const -{ - return QGraphicsLineItem::flags (); -} - -void GuidelineLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -{ - handleHoverEnterEvent (); - - QGraphicsLineItem::hoverEnterEvent (event); -} - -void GuidelineLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - handleHoverLeaveEvent (); - - QGraphicsLineItem::hoverLeaveEvent (event); -} - -void GuidelineLine::mouseMoveEvent (QGraphicsSceneMouseEvent *event) -{ - handleMouseMoveEvent (event->scenePos ()); - - QGraphicsLineItem::mouseMoveEvent (event); -} - -void GuidelineLine::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineLine::mousePressEvent state=" << context()->state ().toLatin1().data(); - - handleMousePressEvent (event->scenePos ()); - - QGraphicsLineItem::mousePressEvent (event); - - context()->handleMousePress(event->scenePos()); -} - -void GuidelineLine::mouseReleaseEvent (QGraphicsSceneMouseEvent *event) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineLine::mouseReleaseEvent state=" << context()->state ().toLatin1().data(); - - handleMouseReleaseEvent (event->scenePos ()); - - QGraphicsLineItem::mouseReleaseEvent (event); - - context()->handleMouseRelease (event->scenePos ()); -} - -void GuidelineLine::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - if (context()->doPaint ()) { - - QGraphicsLineItem::paint (painter, - option, - widget); - } -} - -void GuidelineLine::removeFromScene (QGraphicsScene *scene) -{ - scene->removeItem (this); -} - -void GuidelineLine::setGraphicsItemAcceptHoverEvents (bool accept) -{ - QGraphicsLineItem::setAcceptHoverEvents (accept); -} - -void GuidelineLine::setGraphicsItemFlags (QGraphicsItem::GraphicsItemFlags flags) -{ - QGraphicsLineItem::setFlags (flags); -} - -void GuidelineLine::setGraphicsItemLine (const QLineF &line) -{ - QGraphicsLineItem::setLine (line); -} - -void GuidelineLine::setGraphicsItemPen (const QColor &color, - double lineWidth) -{ - QBrush brush (color); - - setPen (QPen (brush, - lineWidth)); -} - -void GuidelineLine::setGraphicsItemVisible (bool visible) -{ - QGraphicsLineItem::setVisible (visible); -} - -void GuidelineLine::setGraphicsItemZValue (double z) -{ - QGraphicsLineItem::setZValue (z); -} - -void GuidelineLine::updateColor () -{ - // Apply color to brush and pen defined in setGraphicsItemPen. - // Alpha from alphaF() on QColor on QBrush is unused - - QPen p = QGraphicsLineItem::pen(); - QBrush br = p.brush(); - double alphaF = br.color().alphaF(); - double lineWidth = p.width (); - - QColor color = ColorPaletteToQColor (context()->color()); - color.setAlphaF (alphaF); - - setGraphicsItemPen (color, - lineWidth); -} - -void GuidelineLine::updateGeometry (const QPointF &posScreen) -{ - QLineF line = context()->pointToLine (posScreen); - - setLine (line); - - // Save the graph value for later - QPointF posGraph; - context()->transformation().transformScreenToRawGraph (posScreen, - posGraph); - context()->setPosCursorGraph (posGraph); -} diff --git a/src/Guideline/GuidelineLine.h b/src/Guideline/GuidelineLine.h deleted file mode 100644 index 651b0d64..00000000 --- a/src/Guideline/GuidelineLine.h +++ /dev/null @@ -1,78 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_LINE_H -#define GUIDELINE_LINE_H - -#include "GuidelineAbstract.h" -#include -#include - -class QMouseEvent; -class QPainter; -class QGraphicsScene; -class QStyleOptionGraphicsItem; -class QWidget; - -/// Line version of GuidelineAbstract -class GuidelineLine : public GuidelineAbstract, public QGraphicsLineItem -{ -public: - /// Single constructor. - GuidelineLine(QGraphicsScene &scene, - Guidelines &guidelines, - GuidelineState guidelineStateInitial); - ~GuidelineLine(); - - virtual bool getGraphicsItemAcceptHover () const; - - virtual bool getGraphicsItemSelected () const; - - virtual QGraphicsItem::GraphicsItemFlags graphicsItemFlags () const; - - /// User toggled guideline visibility - void handleVisibilityChange (bool visible); - - /// Highlight this Guideline upon hover enter - virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); - - /// Unset highlighting triggered by hover enter - virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); - - /// Forwad movements to visible Guideline - virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event); - - /// Forward press event to state machine - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - - /// Cleanup after being dragged - virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event); - - /// Override painting so this disappears when selected. Selected Guidelines are never visible - virtual void paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget = Q_NULLPTR); - - virtual void removeFromScene (QGraphicsScene *scene); - virtual void setGraphicsItemAcceptHoverEvents (bool accept); - virtual void setGraphicsItemFlags (QGraphicsItem::GraphicsItemFlags flags); - virtual void setGraphicsItemLine (const QLineF &line); - virtual void setGraphicsItemPen (const QColor &color, - double lineWidth); - virtual void setGraphicsItemVisible (bool visible); - virtual void setGraphicsItemZValue (double z); - virtual void updateColor (); - virtual void updateGeometry (const QPointF &posScreen); - -private: - GuidelineLine(); - - // Forces use of setPenColor instead of QGraphicsLineItem::setPen - using QGraphicsLineItem::setPen; - -}; - -#endif // GUIDELINE_LINE_H diff --git a/src/Guideline/GuidelineProjectorAbstract.cpp b/src/Guideline/GuidelineProjectorAbstract.cpp deleted file mode 100644 index c9682902..00000000 --- a/src/Guideline/GuidelineProjectorAbstract.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineProjectorAbstract.h" -#include -#include -#include "Transformation.h" - -GuidelineProjectorAbstract::GuidelineProjectorAbstract() -{ -} - -GuidelineProjectorAbstract::~GuidelineProjectorAbstract() -{ -} - -void GuidelineProjectorAbstract::calculateCorners (const Transformation &transformation, - const QRectF &sceneRect, - QPointF &posGraphBL, - QPointF &posGraphTL, - QPointF &posGraphTR, - QPointF &posGraphBR) const -{ - double width = sceneRect.width(); - double height = sceneRect.height(); - - // Convert sceneRect to graph coordinates - QPointF posScreenBL (0, 0), posScreenTL (0, height), posScreenTR (width, height), posScreenBR (width, 0); - - transformation.transformScreenToRawGraph (posScreenBL, posGraphBL); - transformation.transformScreenToRawGraph (posScreenTL, posGraphTL); - transformation.transformScreenToRawGraph (posScreenTR, posGraphTR); - transformation.transformScreenToRawGraph (posScreenBR, posGraphBR); -} - -bool GuidelineProjectorAbstract::isOutside (const QRectF &sceneRect, - const QPointF &posScreen) const -{ - double width = sceneRect.width(); - double height = sceneRect.height(); - - QPointF posScreenBL (0, 0), posScreenTL (0, height), posScreenTR (width, height), posScreenBR (width, 0); - - QPolygonF polygon; - polygon << posScreenBL << posScreenTL << posScreenTR << posScreenBR; - - // Qt::OddEvenFill is faster and less accurate and Qt::WindingFill is slower and more accurate - return !polygon.containsPoint (posScreen, - Qt::WindingFill); -} diff --git a/src/Guideline/GuidelineProjectorAbstract.h b/src/Guideline/GuidelineProjectorAbstract.h deleted file mode 100644 index 38a66d8e..00000000 --- a/src/Guideline/GuidelineProjectorAbstract.h +++ /dev/null @@ -1,37 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_PROJECTOR_ABSTRACT_H -#define GUIDELINE_PROJECTOR_ABSTRACT_H - -class QPointF; -class QRectF; -class Transformation; - -/// Base class for Guideline projectors -class GuidelineProjectorAbstract -{ -public: - /// Single constructor - GuidelineProjectorAbstract(); - ~GuidelineProjectorAbstract(); - -protected: - - /// Conpute four corners of scene in graph coordinates - void calculateCorners (const Transformation &transformation, - const QRectF &sceneRect, - QPointF &posGraphBL, - QPointF &posGraphTL, - QPointF &posGraphTR, - QPointF &posGraphBR) const; - - /// Return true if point is outside of the scene - bool isOutside (const QRectF &sceneRect, - const QPointF &posScreen) const; -}; - -#endif // GUIDELINE_PROJECTOR_ABSTRACT_H diff --git a/src/Guideline/GuidelineProjectorConstantR.cpp b/src/Guideline/GuidelineProjectorConstantR.cpp deleted file mode 100644 index 2a133491..00000000 --- a/src/Guideline/GuidelineProjectorConstantR.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include -#include "EllipseParameters.h" -#include "GuidelineProjectorConstantR.h" -#include "Logger.h" -#include "mmsubs.h" -#include -#include -#include -#include "Transformation.h" - -GuidelineProjectorConstantR::GuidelineProjectorConstantR() -{ -} - -GuidelineProjectorConstantR::~GuidelineProjectorConstantR() -{ -} - -EllipseParameters GuidelineProjectorConstantR::fromCoordinateR (const Transformation &transformation, - const QRectF & /* sceneRect */, - double rGraph) -{ - // Points at 45, 135, 225 and 315 degrees at range rGraph - QPointF posScreenCenter, posScreenTL, posScreenTR, posScreenBR; // No need for BL point - transformation.transformLinearCartesianGraphToScreen (QPointF (0, 0), - posScreenCenter); - transformation.transformLinearCartesianGraphToScreen (QPointF (-rGraph, rGraph), - posScreenTL); - transformation.transformLinearCartesianGraphToScreen (QPointF (rGraph, rGraph), - posScreenTR); - transformation.transformLinearCartesianGraphToScreen (QPointF (rGraph, -rGraph), - posScreenBR); - - double angleRadians = 0, aAligned = 0, bAligned = 0; - ellipseFromParallelogram (posScreenTL.x() - posScreenCenter.x(), - posScreenTL.y() - posScreenCenter.y(), - posScreenTR.x() - posScreenCenter.x(), - posScreenTR.y() - posScreenCenter.y(), - posScreenBR.x() - posScreenCenter.x(), - posScreenBR.y() - posScreenCenter.y(), - angleRadians, - aAligned, - bAligned); - - return EllipseParameters (posScreenCenter, - angleRadians, - aAligned, - bAligned); -} - -EllipseParameters GuidelineProjectorConstantR::fromPosScreen (const Transformation &transformation, - const QRectF &sceneRect, - const QPointF &posScreen) -{ - QPointF posGraph; - transformation.transformScreenToRawGraph (posScreen, posGraph); - - return fromCoordinateR (transformation, - sceneRect, - posGraph.y()); -} diff --git a/src/Guideline/GuidelineProjectorConstantR.h b/src/Guideline/GuidelineProjectorConstantR.h deleted file mode 100644 index c21a0136..00000000 --- a/src/Guideline/GuidelineProjectorConstantR.h +++ /dev/null @@ -1,40 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_PROJECTOR_CONSTANT_R_H -#define GUIDELINE_PROJECTOR_CONSTANT_R_H - -#include "EllipseParameters.h" -#include "GuidelineProjectorAbstract.h" -#include -#include -#include - -class QRectF; -class Transformation; - -/// Project a point along the tangential direction in graph coordinates to produce -/// a curve along the constant-range direction, passing through a specified point -class GuidelineProjectorConstantR : public GuidelineProjectorAbstract -{ -public: - /// Single constructor. - GuidelineProjectorConstantR(); - ~GuidelineProjectorConstantR(); - - /// Return line through y in graph coordinates - EllipseParameters fromCoordinateR (const Transformation &transformation, - const QRectF &sceneRect, - double rGraph); - - /// Return line through point in screen coordinates - EllipseParameters fromPosScreen (const Transformation &transformation, - const QRectF &sceneRect, - const QPointF &posScreen); - -}; - -#endif // GUIDELINE_PROJECTOR_CONSTANT_R_H diff --git a/src/Guideline/GuidelineProjectorConstantT.cpp b/src/Guideline/GuidelineProjectorConstantT.cpp deleted file mode 100644 index 1c1c541c..00000000 --- a/src/Guideline/GuidelineProjectorConstantT.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include -#include "GuidelineProjectorConstantT.h" -#include -#include -#include -#include "Transformation.h" - -GuidelineProjectorConstantT::GuidelineProjectorConstantT() -{ -} - -GuidelineProjectorConstantT::~GuidelineProjectorConstantT() -{ -} - -QLineF GuidelineProjectorConstantT::fromCoordinateT (const Transformation &transformation, - const QRectF &sceneRect, - double thetaGraphDegrees) -{ - QPointF posGraphBL, posGraphTL, posGraphTR, posGraphBR; - calculateCorners (transformation, - sceneRect, - posGraphBL, - posGraphTL, - posGraphTR, - posGraphBR); - - // These containers would be QVector2D to emphasize we are not working with x and y valuees, but - // QVector2D would give double/float conversion errors - QPointF anglesLeft (qMin (posGraphBL.x(), posGraphTL.x()), - qMax (posGraphBL.x(), posGraphTL.x())); - QPointF anglesTop (qMin (posGraphTL.x(), posGraphTR.x()), - qMax (posGraphTL.x(), posGraphTR.x())); - QPointF anglesRight (qMin (posGraphTR.x(), posGraphBR.x()), - qMax (posGraphTR.x(), posGraphBR.x())); - QPointF anglesBottom (qMin (posGraphBR.x(), posGraphBL.x()), - qMax (posGraphBR.x(), posGraphBL.x())); - - // Fix any side that crosses over the discontinuous transition - if (qAbs (anglesLeft.y() - anglesLeft.x()) > 180.0) { - double temp = anglesLeft.x(); - anglesLeft.setX (anglesLeft.y()); - anglesLeft.setY (temp + 360.0); - } - if (qAbs (anglesTop.y() - anglesTop.x()) > 180.0) { - double temp = anglesTop.x(); - anglesTop.setX (anglesTop.y()); - anglesTop.setY (temp + 360.0); - } - if (qAbs (anglesRight.y() - anglesRight.x()) > 180.0) { - double temp = anglesRight.x(); - anglesRight.setX (anglesRight.y()); - anglesRight.setY (temp + 360.0); - } - if (qAbs (anglesBottom.y() - anglesBottom.x()) > 180.0) { - double temp = anglesBottom.x(); - anglesBottom.setX (anglesBottom.y()); - anglesBottom.setY (temp + 360.0); - } - - // Which side matches theta? - QLineF line; - double thetaGraphPlus = thetaGraphDegrees + 360.0; - if ((anglesLeft.x() <= thetaGraphDegrees && thetaGraphDegrees <= anglesLeft.y()) || - (anglesLeft.x() <= thetaGraphPlus && thetaGraphPlus <= anglesLeft.y())) { - - // Left side - line = intersect (transformation, - thetaGraphDegrees, - posGraphBL, - posGraphTL); - - } else if ((anglesTop.x() <= thetaGraphDegrees && thetaGraphDegrees <= anglesTop.y()) || - (anglesTop.x() <= thetaGraphPlus && thetaGraphPlus <= anglesTop.y())) { - - // Top side - line = intersect (transformation, - thetaGraphDegrees, - posGraphTL, - posGraphTR); - - } else if ((anglesRight.x() <= thetaGraphDegrees && thetaGraphDegrees <= anglesRight.y()) || - (anglesRight.x() <= thetaGraphPlus && thetaGraphPlus <= anglesRight.y())) { - - // Right side - line = intersect (transformation, - thetaGraphDegrees, - posGraphTR, - posGraphBR); - - } else { - - // Bottom side - line = intersect (transformation, - thetaGraphDegrees, - posGraphBR, - posGraphBL); - - } - - return line; -} - -QLineF GuidelineProjectorConstantT::fromPosScreen (const Transformation &transformation, - const QRectF &sceneRect, - const QPointF &posScreen) -{ - QPointF posGraph; - transformation.transformScreenToRawGraph (posScreen, posGraph); - - return fromCoordinateT (transformation, - sceneRect, - posGraph.x()); -} - -QLineF GuidelineProjectorConstantT::intersect (const Transformation &transformation, - double thetaGraphDegrees, - const QPointF &posPolar1, - const QPointF &posPolar2) const -{ - QPointF p1, p2; // Cartesian coordinates - transformation.transformRawGraphToLinearCartesianGraph (posPolar1, - p1); - transformation.transformRawGraphToLinearCartesianGraph (posPolar2, - p2); - - // Intersect y = x tan (theta) = slope * x - // (x - x0) / (x1 - x0) = (y - y0) / (y1 - y0) - // with divide by zero errors prevented by treating the second equation as either - // OPTION 1 (x - x0) = [(x1 - x0) / (y1 - y0)] * (y - y0) - // or - // OPTION 2 (y - y0) = [(y1 - y0) / (x1 - x0)] * (x - x0) - - double deltaX = p2.x() - p1.x(); - double deltaY = p2.y() - p1.y(); - - double x, y; - if (qAbs (deltaX) < qAbs (deltaY)) { - - // Safe to compute since mostly horizontal - double slope = qTan (qDegreesToRadians (thetaGraphDegrees)); - - // Use OPTION 1 with x - x0 = fraction * (y - y0) - // substituting y = slope * x - // we get x * (1 - fraction * slope) = x0 - fraction * y0 - // since line is mostly vertical (deltaX -#include -#include - -class QRectF; -class Transformation; - -/// Project a point along the radial direction in graph coordinates to produce -/// a curve along the constant-theta direction, passing through a specified point -class GuidelineProjectorConstantT : public GuidelineProjectorAbstract -{ -public: - /// Single constructor. - GuidelineProjectorConstantT(); - ~GuidelineProjectorConstantT(); - - /// Return line through theta in graph coordinates - QLineF fromCoordinateT (const Transformation &transformation, - const QRectF &sceneRect, - double tGraph); - - /// Return line through point in screen coordinates - QLineF fromPosScreen (const Transformation &transformation, - const QRectF &sceneRect, - const QPointF &posScreen); - -private: - QLineF intersect (const Transformation &transformation, - double thetaGraphDegrees, - const QPointF &p1, - const QPointF &p2) const; -}; - -#endif // GUIDELINE_PROJECTOR_CONSTANT_T_H diff --git a/src/Guideline/GuidelineProjectorConstantX.cpp b/src/Guideline/GuidelineProjectorConstantX.cpp deleted file mode 100644 index 10c2de75..00000000 --- a/src/Guideline/GuidelineProjectorConstantX.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include -#include "GuidelineProjectorConstantX.h" -#include -#include -#include "Transformation.h" - -GuidelineProjectorConstantX::GuidelineProjectorConstantX() -{ -} - -GuidelineProjectorConstantX::~GuidelineProjectorConstantX() -{ -} - -void GuidelineProjectorConstantX::addSide (const Transformation &transformation, - double x, - const QPointF &p1, - const QPointF &p2, - QList &intersections) -{ - // We start with the vector equation - // R = (1-s)*P1 + s*P2 - // For each corner, intersect just the y components of the vector equation - // x = (1-s)*x1 + s*x2 - // x = x0 - // to get an s value. To prevent overflow due to division by zero, we use the - // trick that only values of s between 0 and 1 (=between the 2 endpoints) are - // desired - double num = x - p1.x(); - double den = p2.x () - p1.x (); - - // Prevent divide by zero. Working with s=num/den and 0= 0) && (0.0 * den <= num) && (num < den); - bool okForDenNegative = (den < 0) && (0.0 * den >= num) && (num > 1.0 * den); - - if (okForDenPositive || okForDenNegative) { - double sIntercept = num / den; - QPointF pIntercept ((1.0 - sIntercept) * p1 + sIntercept * p2); - - QPointF posScreen; - transformation.transformRawGraphToScreen (pIntercept, - posScreen); - intersections.push_back (posScreen); - } -} - -QLineF GuidelineProjectorConstantX::fromCoordinateX (const Transformation &transformation, - const QRectF &sceneRect, - double xGraph) -{ - QLineF line (0, 0, 0, 0); - QPointF posGraphBL, posGraphTL, posGraphTR, posGraphBR; - calculateCorners (transformation, - sceneRect, - posGraphBL, - posGraphTL, - posGraphTR, - posGraphBR); - - // Intersections found on all the sides - QList intersections; - - addSide (transformation, xGraph, posGraphBL, posGraphTL, intersections); - addSide (transformation, xGraph, posGraphTL, posGraphTR, intersections); - addSide (transformation, xGraph, posGraphTR, posGraphBR, intersections); - addSide (transformation, xGraph, posGraphBR, posGraphBL, intersections); - - if (intersections.size() == 2) { - line = QLineF (intersections.at (0), - intersections.at (1)); - } - - return line; -} - -QLineF GuidelineProjectorConstantX::fromPosScreen (const Transformation &transformation, - const QRectF &sceneRect, - const QPointF &posScreen) -{ - QPointF posGraph; - transformation.transformScreenToRawGraph (posScreen, posGraph); - - return fromCoordinateX (transformation, - sceneRect, - posGraph.x()); -} diff --git a/src/Guideline/GuidelineProjectorConstantX.h b/src/Guideline/GuidelineProjectorConstantX.h deleted file mode 100644 index 97208139..00000000 --- a/src/Guideline/GuidelineProjectorConstantX.h +++ /dev/null @@ -1,47 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_PROJECTOR_CONSTANT_X_H -#define GUIDELINE_PROJECTOR_CONSTANT_X_H - -#include "GuidelineProjectorAbstract.h" -#include -#include -#include - -class QRectF; -class Transformation; - -/// Project a point along the vertical direction in graph coordinates to produce -/// a line segment along the constant-x direction, passing through a specified point -class GuidelineProjectorConstantX : public GuidelineProjectorAbstract -{ -public: - /// Single constructor. - GuidelineProjectorConstantX(); - ~GuidelineProjectorConstantX(); - - /// Return line through x in graph coordinates - QLineF fromCoordinateX (const Transformation &transformation, - const QRectF &sceneRect, - double xGraph); - - /// Return line through point in screen coordinates - QLineF fromPosScreen (const Transformation &transformation, - const QRectF &sceneRect, - const QPointF &posScreen); - -private: - - void addSide (const Transformation &transformation, - double x, - const QPointF &p1, - const QPointF &p2, - QList &intersections); - -}; - -#endif // GUIDELINE_PROJECTOR_CONSTANT_X_H diff --git a/src/Guideline/GuidelineProjectorConstantY.cpp b/src/Guideline/GuidelineProjectorConstantY.cpp deleted file mode 100644 index b4c8029c..00000000 --- a/src/Guideline/GuidelineProjectorConstantY.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include -#include "GuidelineProjectorConstantY.h" -#include -#include -#include "Transformation.h" - -GuidelineProjectorConstantY::GuidelineProjectorConstantY() -{ -} - -GuidelineProjectorConstantY::~GuidelineProjectorConstantY() -{ -} - -void GuidelineProjectorConstantY::addSide (const Transformation &transformation, - double y, - const QPointF &p1, - const QPointF &p2, - QList &intersections) -{ - // We start with the vector equation - // R = (1-s)*P1 + s*P2 - // For each corner, intersect just the y components of the vector equation - // y = (1-s)*y1 + s*y2 - // y = y0 - // to get an s value. To prevent overflow due to division by zero, we use the - // trick that only values of s between 0 and 1 (=between the 2 endpoints) are - // desired - double num = y - p1.y(); - double den = p2.y () - p1.y (); - - // Prevent divide by zero. Working with s=num/den and 0= 0) && (0.0 * den <= num) && (num < den); - bool okForDenNegative = (den < 0) && (0.0 * den >= num) && (num > 1.0 * den); - - if (okForDenPositive || okForDenNegative) { - double sIntercept = num / den; - QPointF pIntercept ((1.0 - sIntercept) * p1 + sIntercept * p2); - - QPointF posScreen; - transformation.transformRawGraphToScreen (pIntercept, - posScreen); - intersections.push_back (posScreen); - } -} - -QLineF GuidelineProjectorConstantY::fromCoordinateY (const Transformation &transformation, - const QRectF &sceneRect, - double yGraph) -{ - QLineF line (0, 0, 0, 0); - QPointF posGraphBL, posGraphTL, posGraphTR, posGraphBR; - calculateCorners (transformation, - sceneRect, - posGraphBL, - posGraphTL, - posGraphTR, - posGraphBR); - - // Intersections found on all the sides - QList intersections; - - addSide (transformation, yGraph, posGraphBL, posGraphTL, intersections); - addSide (transformation, yGraph, posGraphTL, posGraphTR, intersections); - addSide (transformation, yGraph, posGraphTR, posGraphBR, intersections); - addSide (transformation, yGraph, posGraphBR, posGraphBL, intersections); - - if (intersections.size() == 2) { - line = QLineF (intersections.at (0), - intersections.at (1)); - } - - return line; -} - -QLineF GuidelineProjectorConstantY::fromPosScreen (const Transformation &transformation, - const QRectF &sceneRect, - const QPointF &posScreen) -{ - QPointF posGraph; - transformation.transformScreenToRawGraph (posScreen, posGraph); - - return fromCoordinateY (transformation, - sceneRect, - posGraph.y()); -} diff --git a/src/Guideline/GuidelineProjectorConstantY.h b/src/Guideline/GuidelineProjectorConstantY.h deleted file mode 100644 index ab41da3d..00000000 --- a/src/Guideline/GuidelineProjectorConstantY.h +++ /dev/null @@ -1,47 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_PROJECTOR_CONSTANT_Y_H -#define GUIDELINE_PROJECTOR_CONSTANT_Y_H - -#include "GuidelineProjectorAbstract.h" -#include -#include -#include - -class QRectF; -class Transformation; - -/// Project a point along the horizontal direction in graph coordinates to produce -/// a line segment along the constant-y direction, passing through a specified point -class GuidelineProjectorConstantY : public GuidelineProjectorAbstract -{ -public: - /// Single constructor. - GuidelineProjectorConstantY(); - ~GuidelineProjectorConstantY(); - - /// Return line through y in graph coordinates - QLineF fromCoordinateY (const Transformation &transformation, - const QRectF &sceneRect, - double yGraph); - - /// Return line through point in screen coordinates - QLineF fromPosScreen (const Transformation &transformation, - const QRectF &sceneRect, - const QPointF &posScreen); - -private: - - void addSide (const Transformation &transformation, - double y, - const QPointF &p1, - const QPointF &p2, - QList &intersections); - -}; - -#endif // GUIDELINE_PROJECTOR_CONSTANT_Y_H diff --git a/src/Guideline/GuidelineState.h b/src/Guideline/GuidelineState.h deleted file mode 100644 index 146f67c4..00000000 --- a/src/Guideline/GuidelineState.h +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_H -#define GUIDELINE_STATE_H - -/// Set of possible Guideline states. See class Guideline for more information -enum GuidelineState { - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE, - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HIDE, - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER, - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_LOCKED, - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE, - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HIDE, - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER, - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_LOCKED, - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE, - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HIDE, - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER, - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_LOCKED, - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE, - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HIDE, - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER, - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_LOCKED, - GUIDELINE_STATE_DISCARDED, - GUIDELINE_STATE_HANDLE, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HIDE, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HOVER, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HIDE, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HOVER, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING, - GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HIDE, - GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HOVER, - GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING, - GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HIDE, - GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HOVER, - GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING, - NUM_GUIDELINE_STATES -}; - -#endif // GUIDELINE_STATE_H diff --git a/src/Guideline/GuidelineStateAbstractBase.cpp b/src/Guideline/GuidelineStateAbstractBase.cpp deleted file mode 100644 index e6b59c00..00000000 --- a/src/Guideline/GuidelineStateAbstractBase.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "DataKey.h" -#include "EnumsToQt.h" -#include "GraphicsItemType.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateAbstractBase.h" -#include "GuidelineStateContext.h" -#include "Logger.h" -#include -#include - -GuidelineStateAbstractBase::GuidelineStateAbstractBase(GuidelineStateContext &context) : - m_context (context) -{ -} - -GuidelineStateAbstractBase::~GuidelineStateAbstractBase () -{ -} - -GuidelineStateContext &GuidelineStateAbstractBase::context () const -{ - return m_context; -} - -void GuidelineStateAbstractBase::handleMousePressCommon (const QPointF &posScreen, - GuidelineState stateDeployed, - GuidelineState stateReplacement) -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateAbstractBase::handleMousePressCommon " - << m_context.stateDump ().toLatin1().data(); - - context().setStateReplacement (stateReplacement); - - // Unselect all selected items. This prevents the extremely confusing error where an - // existing axis point stays selected and gets dragged along with this Guideline, - // which moves the axis unexpectedly - QList::iterator itr; - QList items = m_context.guideline().scene().selectedItems(); - for (itr = items.begin(); itr != items.end(); itr++) { - QGraphicsItem *item = *itr; - - // How do we know which is the Guideline that we want to keep selected? By its type - if (item->data (DATA_KEY_GRAPHICS_ITEM_TYPE).toInt () != GRAPHICS_ITEM_TYPE_GUIDELINE) { - item->setSelected (false); - } - } - - // Visible Guideline will follow this one. Its geometry will be set after every drag event - GuidelineAbstract *guidelineVisible = context().createGuideline (stateDeployed); - - GuidelineFormat guidelineFormat (context().color()); - guidelineVisible->setGraphicsItemPen (guidelineFormat.colorDeployedNonHover (), - guidelineFormat.lineWidthNonHover ()); - - guidelineVisible->updateGeometry (posScreen); - - context().guideline().bindGuidelineVisible (guidelineVisible); - - context().requestStateTransition (GUIDELINE_STATE_HANDLE); -} - -QRectF GuidelineStateAbstractBase::sceneRect () const -{ - return m_context.guideline().scene().sceneRect(); -} diff --git a/src/Guideline/GuidelineStateAbstractBase.h b/src/Guideline/GuidelineStateAbstractBase.h deleted file mode 100644 index c35547b9..00000000 --- a/src/Guideline/GuidelineStateAbstractBase.h +++ /dev/null @@ -1,91 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_ABSTRACT_BASE_H -#define GUIDELINE_STATE_ABSTRACT_BASE_H - -#include "EllipseParameters.h" -#include "GuidelineState.h" -#include -#include -#include -#include -#include - -class GuidelineStateContext; - -/// This class maintains deployed/template horizontal/vertical state behaviors for the Guideline class -class GuidelineStateAbstractBase -{ -public: - /// Single constructor. - GuidelineStateAbstractBase (GuidelineStateContext &context); - virtual ~GuidelineStateAbstractBase(); - - /// Transition into state - virtual void begin () = 0; - - /// Allow/skip painting of the owner Guideline. This prevents display of selection markings on - /// otherwise-invisible handle Guideline - virtual bool doPaint () const = 0; - - /// Transition out of state - virtual void end () = 0; - - /// DigitizeState change so active status may (or may not) be toggled - virtual void handleActiveChange (bool active) = 0; - - /// If transparent then make visible when hover starts - virtual void handleHoverEnterEvent () = 0; - - /// If previously transparent before hover enter then make transparent again - virtual void handleHoverLeaveEvent () = 0; - - /// At the start of dragging, convert the template Guideline into an invisible handle and visible - /// slaved deployed Guideline - virtual void handleMousePress (const QPointF &posScene) = 0; - - /// At the end of dragging, clone the Guideline that owns the state machine where these states live - virtual void handleMouseRelease (const QPointF &posScene) = 0; - - /// User toggled Guideline visibility - virtual void handleVisibleChange (bool visibility) = 0; - - /// Return ellipse representing constant range, that passes through the specified point - virtual EllipseParameters pointToEllipse (const QPointF &posScreen) const = 0; - - /// Return line parallel to an axis line, that passes through the specified point - virtual QLineF pointToLine (const QPointF &poscreen) const = 0; - - /// State as a string for debugging only - virtual QString state () const = 0; - - - /// Update given Transformation in GuidelineStateContext - virtual void updateWithLatestTransformation () = 0; - -protected: - - /// Context in charge of the state classes - GuidelineStateContext &context () const; - - /// Common mouse press handling. This is expected to be used by - /// every derived leaf class except GUIDELINE_STATE_HANDLE (which this method creates) - /// and GUIDELINE_STATE_DISCARDED (which is a noop) - void handleMousePressCommon (const QPointF &pos, - GuidelineState stateDeployed, - GuidelineState stateReplacement); - - /// Scene rectangle in screen coordinates (=pixels) - QRectF sceneRect () const; - -private: - GuidelineStateAbstractBase(); - - GuidelineStateContext &m_context; -}; - -#endif // GUIDELINE_STATE_ABSTRACT_BASE_H diff --git a/src/Guideline/GuidelineStateContext.cpp b/src/Guideline/GuidelineStateContext.cpp deleted file mode 100644 index 28f79061..00000000 --- a/src/Guideline/GuidelineStateContext.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "Guidelines.h" -#include "GuidelineStateAbstractBase.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantRActive.h" -#include "GuidelineStateDeployedConstantRHide.h" -#include "GuidelineStateDeployedConstantRHover.h" -#include "GuidelineStateDeployedConstantRLocked.h" -#include "GuidelineStateDeployedConstantTActive.h" -#include "GuidelineStateDeployedConstantTHide.h" -#include "GuidelineStateDeployedConstantTHover.h" -#include "GuidelineStateDeployedConstantTLocked.h" -#include "GuidelineStateDeployedConstantXActive.h" -#include "GuidelineStateDeployedConstantXHide.h" -#include "GuidelineStateDeployedConstantXHover.h" -#include "GuidelineStateDeployedConstantXLocked.h" -#include "GuidelineStateDeployedConstantYActive.h" -#include "GuidelineStateDeployedConstantYHide.h" -#include "GuidelineStateDeployedConstantYHover.h" -#include "GuidelineStateDeployedConstantYLocked.h" -#include "GuidelineStateDiscarded.h" -#include "GuidelineStateHandle.h" -#include "GuidelineStateTemplateHorizontalBottomHide.h" -#include "GuidelineStateTemplateHorizontalBottomHover.h" -#include "GuidelineStateTemplateHorizontalBottomLurking.h" -#include "GuidelineStateTemplateHorizontalTopHide.h" -#include "GuidelineStateTemplateHorizontalTopHover.h" -#include "GuidelineStateTemplateHorizontalTopLurking.h" -#include "GuidelineStateTemplateVerticalLeftHide.h" -#include "GuidelineStateTemplateVerticalLeftHover.h" -#include "GuidelineStateTemplateVerticalLeftLurking.h" -#include "GuidelineStateTemplateVerticalRightHide.h" -#include "GuidelineStateTemplateVerticalRightHover.h" -#include "GuidelineStateTemplateVerticalRightLurking.h" -#include -#include "Transformation.h" - -GuidelineStateContext::GuidelineStateContext (GuidelineAbstract &guideline, - Guidelines &guidelines, - GuidelineState guidelineStateInitial) : - m_guideline (guideline), - m_guidelines (guidelines) -{ - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE , new GuidelineStateDeployedConstantRActive (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HIDE , new GuidelineStateDeployedConstantRHide (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER , new GuidelineStateDeployedConstantRHover (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_R_LOCKED , new GuidelineStateDeployedConstantRLocked (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE , new GuidelineStateDeployedConstantTActive (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HIDE , new GuidelineStateDeployedConstantTHide (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER , new GuidelineStateDeployedConstantTHover (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_T_LOCKED , new GuidelineStateDeployedConstantTLocked (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE , new GuidelineStateDeployedConstantXActive (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HIDE , new GuidelineStateDeployedConstantXHide (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER , new GuidelineStateDeployedConstantXHover (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_X_LOCKED , new GuidelineStateDeployedConstantXLocked (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE , new GuidelineStateDeployedConstantYActive (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HIDE , new GuidelineStateDeployedConstantYHide (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER , new GuidelineStateDeployedConstantYHover (*this)); - m_states.insert (GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_LOCKED , new GuidelineStateDeployedConstantYLocked (*this)); - m_states.insert (GUIDELINE_STATE_DISCARDED , new GuidelineStateDiscarded (*this)); - m_states.insert (GUIDELINE_STATE_HANDLE , new GuidelineStateHandle (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HIDE , new GuidelineStateTemplateHorizontalBottomHide (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HOVER , new GuidelineStateTemplateHorizontalBottomHover (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING, new GuidelineStateTemplateHorizontalBottomLurking(*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HIDE , new GuidelineStateTemplateHorizontalTopHide (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HOVER , new GuidelineStateTemplateHorizontalTopHover (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING , new GuidelineStateTemplateHorizontalTopLurking (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HIDE , new GuidelineStateTemplateVerticalLeftHide (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HOVER , new GuidelineStateTemplateVerticalLeftHover (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING , new GuidelineStateTemplateVerticalLeftLurking (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HIDE , new GuidelineStateTemplateVerticalRightHide (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HOVER , new GuidelineStateTemplateVerticalRightHover (*this)); - m_states.insert (GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING , new GuidelineStateTemplateVerticalRightLurking (*this)); - ENGAUGE_ASSERT (m_states.size () == NUM_GUIDELINE_STATES); - - m_currentState = NUM_GUIDELINE_STATES; // Value that forces a transition right away - m_nextState = guidelineStateInitial; - - transitionIfRequested (); -} - -GuidelineStateContext::~GuidelineStateContext () -{ -} - -bool GuidelineStateContext::cartesian() const -{ - return m_guidelines.coordsType () == COORDS_TYPE_CARTESIAN; -} - -ColorPalette GuidelineStateContext::color () const -{ - return m_guidelines.color (); -} - -GuidelineAbstract *GuidelineStateContext::createGuideline (GuidelineState stateInitial) const -{ - return m_guidelines.createGuideline (stateInitial); -} - -bool GuidelineStateContext::doPaint () const -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - return m_states[m_currentState]->doPaint (); -} - -void GuidelineStateContext::draggedOffScreen () -{ - requestStateTransition (GUIDELINE_STATE_DISCARDED); - transitionIfRequested (); -} - -GuidelineAbstract &GuidelineStateContext::guideline () -{ - return m_guideline; -} - -void GuidelineStateContext::handleActiveChange (bool active) -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - m_states[m_currentState]->handleActiveChange (active); - transitionIfRequested (); -} -void GuidelineStateContext::handleHoverEnterEvent () -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - m_states[m_currentState]->handleHoverEnterEvent (); - transitionIfRequested (); -} - -void GuidelineStateContext::handleHoverLeaveEvent () -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - m_states[m_currentState]->handleHoverLeaveEvent (); - transitionIfRequested (); -} - -void GuidelineStateContext::handleMousePress (const QPointF &posScene) -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - m_states[m_currentState]->handleMousePress (posScene); - transitionIfRequested (); -} - -void GuidelineStateContext::handleMouseRelease (const QPointF &posScene) -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - m_states[m_currentState]->handleMouseRelease (posScene); - transitionIfRequested (); -} - -void GuidelineStateContext::handleVisibleChange (bool visible) -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - m_states[m_currentState]->handleVisibleChange (visible); - transitionIfRequested (); -} - -EllipseParameters GuidelineStateContext::pointToEllipse (const QPointF &posScreen) const -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - return m_states[m_currentState]->pointToEllipse (posScreen); -} - -QLineF GuidelineStateContext::pointToLine (const QPointF &posScreen) const -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - return m_states[m_currentState]->pointToLine (posScreen); -} - -QPointF GuidelineStateContext::posCursorGraph () const -{ - return m_posCursorGraph; -} - -void GuidelineStateContext::requestStateTransition (GuidelineState guidelineState) -{ - ENGAUGE_ASSERT (guidelineState != NUM_GUIDELINE_STATES); - - m_nextState = guidelineState; -} - -void GuidelineStateContext::setPosCursorGraph (const QPointF &posGraph) -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - m_posCursorGraph = posGraph; -} - -void GuidelineStateContext::setStateReplacement (GuidelineState stateReplacement) -{ - m_stateReplacement = stateReplacement; -} - -QString GuidelineStateContext::state () const -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - return m_states[m_currentState]->state(); -} - -QString GuidelineStateContext::stateDump () const -{ - return m_guidelines.stateDump (); -} - -GuidelineState GuidelineStateContext::stateReplacement () const -{ - return m_stateReplacement; -} - -Transformation GuidelineStateContext::transformation() const -{ - return m_guidelines.transformation (); -} - -void GuidelineStateContext::transitionIfRequested () -{ - if (m_currentState != m_nextState) { - - // End the current state if there is one - if (m_currentState != NUM_GUIDELINE_STATES) { - m_states[m_currentState]->end (); - } - - m_currentState = m_nextState; - - // Start the requested state - m_states[m_currentState]->begin(); - } -} - -void GuidelineStateContext::updateWithLatestTransformation() -{ - ENGAUGE_ASSERT (m_currentState != NUM_GUIDELINE_STATES); - - m_states[m_currentState]->updateWithLatestTransformation(); - transitionIfRequested (); -} diff --git a/src/Guideline/GuidelineStateContext.h b/src/Guideline/GuidelineStateContext.h deleted file mode 100644 index 32baaa8c..00000000 --- a/src/Guideline/GuidelineStateContext.h +++ /dev/null @@ -1,210 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_CONTEXT_H -#define GUIDELINE_STATE_CONTEXT_H - -#include "ColorPalette.h" -#include "EllipseParameters.h" -#include "GuidelineState.h" -#include "GuidelineStateAbstractBase.h" -#include -#include -#include - -class GuidelineAbstract; -class Guidelines; -class Transformation; - -/// Context class for state machine that belongs to the Guideline class. The GuidelineAbstract -/// class owns an instance of this class. The base class for all guideline states is -/// GuidelineStateAbstractBase. -/// -/// The state machine graph: -/// \dot -/// digraph guidelines { -/// rankdir = LR; -/// -/// Start -> DeployedConstantRHover [label = DragHorizontalTemplateWithPolarCoordinates]; -/// DeployedConstantRHover -> DeployedConstantRActive [label = HoverLeave]; -/// DeployedConstantRHover -> Handle [label = MouseClick]; -/// DeployedConstantRActive -> Discarded [label = TransformLoss]; -/// DeployedConstantRActive -> DeployedConstantRHide [label = TurnedOff]; -/// DeployedConstantRHide -> DeployedConstantRActive [label = TurnedOn]; -/// DeployedConstantRActive -> DeployedConstantRHover [label = HoverEnter]; -/// DeployedConstantRActive -> DeployedConstantRLocked [label = LeaveSelectMode]; -/// DeployedConstantRLocked -> DeployedConstantRActive [label = EnterSelectMode]; -/// -/// Start -> DeployedConstantTHover [label = DragHorizontalTemplateWithPolarCoordinates]; -/// DeployedConstantTHover -> DeployedConstantTActive [label = HoverLeave]; -/// DeployedConstantTHover -> Handle [label = MouseClick]; -/// DeployedConstantTActive -> Discarded [label = TransformLoss]; -/// DeployedConstantTActive -> DeployedConstantTHide [label = TurnedOff]; -/// DeployedConstantTHide -> DeployedConstantTActive [label = TurnedOn]; -/// DeployedConstantTActive -> DeployedConstantTHover [label = HoverEnter]; -/// DeployedConstantTActive -> DeployedConstantTLocked [label = LeaveSelectMode]; -/// DeployedConstantTLocked -> DeployedConstantTActive [label = EnterSelectMode]; -/// -/// Start -> DeployedConstantXHover [label = DragHorizontalTemplateWithCartesianCoordinates]; -/// DeployedConstantXHover -> DeployedConstantXActive [label = HoverLeave]; -/// DeployedConstantXHover -> Handle [label = MouseClick]; -/// DeployedConstantXActive -> Discarded [label = TransformLoss]; -/// DeployedConstantXActive -> DeployedConstantXHide [label = TurnedOff]; -/// DeployedConstantXHide -> DeployedConstantXActive [label = TurnedOn]; -/// DeployedConstantXActive -> DeployedConstantXHover [label = HoverEnter]; -/// DeployedConstantXActive -> DeployedConstantXLocked [label = LeaveSelectMode]; -/// DeployedConstantXLocked -> DeployedConstantXActive [label = EnterSelectMode]; -/// -/// Start -> DeployedConstantYHover [label = DragVerticalTemplateWithCartesianCoordinates]; -/// DeployedConstantYHover -> DeployedConstantYActive [label = HoverLeave]; -/// DeployedConstantYHover -> Handle [label = MouseClick]; -/// DeployedConstantYActive -> Discarded [label = TransformLoss]; -/// DeployedConstantYActive -> DeployedConstantYHide [label = TurnedOff]; -/// DeployedConstantYHide -> DeployedConstantYActive [label = TurnedOn]; -/// DeployedConstantYActive -> DeployedConstantYHover [label = HoverEnter]; -/// DeployedConstantYActive -> DeployedConstantYLocked [label = LeaveSelectMode]; -/// DeployedConstantYLocked -> DeployedConstantYActive [label = EnterSelectMode]; -/// -/// Start -> TemplateHorizontalBottomLurking [label = InitializeWithTransform]; -/// Start -> TemplateHorizontalBottomHide [label = InitializeWithoutTransform]; -/// Start -> TemplateHorizontalBottomHide [label = EndOfTemplateHorizontalBottomDrag]; -/// TemplateHorizontalBottomLurking -> TemplateHorizontalBottomHover [label = HoverEnter]; -/// TemplateHorizontalBottomHover -> TemplateHorizontalBottomLurking [label = HoverLeave]; -/// TemplateHorizontalBottomHover -> Handle [label = MouseClick]; -/// TemplateHorizontalBottomLurking -> TemplateHorizontalBottomHide [label = TurnedOff]; -/// TemplateHorizontalBottomHide -> TemplateHorizontalBottomLurking [label = TurnedOn]; -/// -/// Start -> TemplateHorizontalTopLurking [label = InitializeWithTransform]; -/// Start -> TemplateHorizontalTopHide [label = InitializeWithoutTransform]; -/// Start -> TemplateHorizontalTopHide [label = EndOfTemplateHorizontalTopDrag]; -/// TemplateHorizontalTopLurking -> TemplateHorizontalTopHover [label = HoverEnter]; -/// TemplateHorizontalTopHover -> TemplateHorizontalTopLurking [label = HoverLeave]; -/// TemplateHorizontalTopHover -> Handle [label = MouseClick]; -/// TemplateHorizontalTopLurking -> TemplateHorizontalTopHide [label = TurnedOff]; -/// TemplateHorizontalTopHide -> TemplateHorizontalTopLurking [label = TurnedOn]; -/// -/// Start -> TemplateVerticalLeftLurking [label = InitializeWithTransform]; -/// Start -> TemplateVerticalLeftHide [label = InitializeWithoutTransform]; -/// Start -> TemplateVerticalLeftHide [label = EndOfTemplateVerticalLeftDrag]; -/// TemplateVerticalLeftLurking -> TemplateVerticalLeftHover [label = HoverEnter]; -/// TemplateVerticalLeftHover -> TemplateVerticalLeftLurking [label = HoverLeave]; -/// TemplateVerticalLeftHover -> Handle [label = MouseClick]; -/// TemplateVerticalLeftLurking -> TemplateVerticalLeftHide [label = TurnedOff]; -/// TemplateVerticalLeftHide -> TemplateVerticalLeftLurking [label = TurnedOn]; -/// -/// Start -> TemplateVerticalRightLurking [label = InitializeWithTransform]; -/// Start -> TemplateVerticalRightHide [label = InitializeWithoutTransform]; -/// Start -> TemplateVerticalRightHide [label = EndOfTemplateVerticalRightDrag]; -/// TemplateVerticalRightLurking -> TemplateVerticalRightHover [label = HoverEnter]; -/// TemplateVerticalRightHover -> TemplateVerticalRightLurking [label = HoverLeave]; -/// TemplateVerticalRightHover -> Handle [label = MouseClick]; -/// TemplateVerticalRightLurking -> TemplateVerticalRightHide [label = TurnedOff]; -/// TemplateVerticalRightHide -> TemplateVerticalRightLurking [label = TurnedOn]; -/// -/// Handle -> Discarded [label = MouseRelease]; -/// -/// } -/// \enddot -class GuidelineStateContext -{ -public: - /// Single constructor. - GuidelineStateContext (GuidelineAbstract &guideline, - Guidelines &guidelines, - GuidelineState guidelineStateInitial); - virtual ~GuidelineStateContext(); - - /// True/false if coordinates are cartesian/polar - bool cartesian() const; - - /// Color to be used for guidelines - ColorPalette color () const; - - /// Factory method for creating a new Guideline - GuidelineAbstract *createGuideline (GuidelineState stateInitial) const; - - /// Allow/skip painting of the owner Guideline. This prevents display of selection markings on - /// otherwise-invisible handle Guideline - bool doPaint () const; - - /// Guideline has been dragged off screen so remove it - void draggedOffScreen (); - - /// Guideline that owns this context class - GuidelineAbstract &guideline (); - - /// DigitizeState change so active status may (or may not) be toggled - void handleActiveChange (bool active); - - /// If transparent then make visible when hover starts - void handleHoverEnterEvent (); - - /// If previously transparent before hover enter then make transparent again - void handleHoverLeaveEvent (); - - /// At the start of dragging, convert the template Guideline into an invisible handle and - /// visible slaved deployed Guideline - void handleMousePress (const QPointF &posScene); - - /// At the end of dragging, clone the Guideline that owns the state machine where these states live - void handleMouseRelease (const QPointF &posScene); - - /// User toggled Guideline visibility - void handleVisibleChange (bool visibile); - - /// Return ellipse representing constant range, that passes through the specified point - EllipseParameters pointToEllipse (const QPointF &posScreen) const; - - /// Return line parallel to an axis line, that passes through the specified point - QLineF pointToLine (const QPointF &poscreen) const; - - /// Get method for current cursor coordinate when object was last created/dragged - QPointF posCursorGraph () const; - - /// Request a state transition - void requestStateTransition (GuidelineState guidelineState); - - /// Pass the current cursor coordinate to the state so it can save the relevant coordinate for - /// later adjustement when the transformation changes - void setPosCursorGraph (const QPointF &posGraph); - - /// Pass replacement Guideline state from template Guidelines to handle Guideline - void setStateReplacement (GuidelineState stateReplacement); - - /// State as a string for debugging only - QString state () const; - - /// States listed as a string for debugging only - QString stateDump () const; - - /// Get method for replacement state - GuidelineState stateReplacement () const; - - /// Return copy of transformation owned by MainWindow - Transformation transformation () const; - - /// Update given Transformation in GuidelineStateContext - void updateWithLatestTransformation (); - -private: - GuidelineStateContext(); - - /// Transition if requested - void transitionIfRequested (); - - GuidelineAbstract &m_guideline; - Guidelines &m_guidelines; - - QVector m_states; - GuidelineState m_currentState; - GuidelineState m_nextState; - - GuidelineState m_stateReplacement; - - QPointF m_posCursorGraph; -}; - -#endif // GUIDELINE_STATE_CONTEXT_H diff --git a/src/Guideline/GuidelineStateDeployedAbstract.cpp b/src/Guideline/GuidelineStateDeployedAbstract.cpp deleted file mode 100644 index 1368f60c..00000000 --- a/src/Guideline/GuidelineStateDeployedAbstract.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GraphicsScene.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedAbstract.h" -#include "Logger.h" -#include -#include "Transformation.h" -#include "ZValues.h" - -GuidelineStateDeployedAbstract::GuidelineStateDeployedAbstract (GuidelineStateContext &context) : - GuidelineStateAbstractBase (context) -{ -} - -GuidelineStateDeployedAbstract::~GuidelineStateDeployedAbstract () -{ -} - -void GuidelineStateDeployedAbstract::beginCommon (GuidelineFormat::HoverOption hoverOption) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateDeployedAbstract::begin"; - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemZValue (Z_VALUE_GUIDELINE_DEPLOYED); - context().guideline().setGraphicsItemVisible (true); - // ItemIsSelectable is overkill, and in special cases adds ugly selected dashes - context().guideline().setGraphicsItemFlags (QGraphicsItem::ItemIsFocusable | - QGraphicsItem::ItemIsMovable); - context().guideline().setGraphicsItemAcceptHoverEvents (true); // Give feedback when user hovers - context().guideline().setGraphicsItemPen (hoverOption == GuidelineFormat::HOVER_ON ? - guidelineFormat.colorDeployedHover () : - guidelineFormat.colorDeployedNonHover (), - hoverOption == GuidelineFormat::HOVER_ON ? - guidelineFormat.lineWidthHover () : - guidelineFormat.lineWidthNonHover ()); -} - -void GuidelineStateDeployedAbstract::end () -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateDeployedAbstract::end"; -} - -void GuidelineStateDeployedAbstract::handleMouseRelease (const QPointF & /* posScene */) -{ - // Noop -} - -CoordsType GuidelineStateDeployedAbstract::lastCoordsType () const -{ - return m_lastCoordsType; -} - -void GuidelineStateDeployedAbstract::saveLastCoordsType () -{ - m_lastCoordsType = context().transformation().modelCoords().coordsType(); -} diff --git a/src/Guideline/GuidelineStateDeployedAbstract.h b/src/Guideline/GuidelineStateDeployedAbstract.h deleted file mode 100644 index 03000d6c..00000000 --- a/src/Guideline/GuidelineStateDeployedAbstract.h +++ /dev/null @@ -1,44 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_ABSTRACT_H -#define GUIDELINE_STATE_DEPLOYED_ABSTRACT_H - -#include "CoordsType.h" -#include "GuidelineFormat.h" -#include "GuidelineStateAbstractBase.h" -#include - -/// Abstract class for deployed states -class GuidelineStateDeployedAbstract : public GuidelineStateAbstractBase -{ -public: - /// Single constructor. - GuidelineStateDeployedAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedAbstract(); - - virtual void end (); - virtual void handleMouseRelease (const QPointF &posScene); - - /// Coordinates type associated with the last time Transformation matrix was used - CoordsType lastCoordsType () const; - - /// Save coordinates type associated with the current Transformation matrix - void saveLastCoordsType (); - -protected: - - /// Initialization common to all states - void beginCommon (GuidelineFormat::HoverOption hoverOption); - -private: - - /// Track coordinates type (cartesian or polar) used with last Transformation. If there - /// is a transition than we need to throw all deployed Guidelines - CoordsType m_lastCoordsType; -}; - -#endif // GUIDELINE_STATE_DEPLOYED_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateDeployedConstantRAbstract.cpp b/src/Guideline/GuidelineStateDeployedConstantRAbstract.cpp deleted file mode 100644 index 469a73fc..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRAbstract.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineEllipse.h" -#include "GuidelineProjectorConstantR.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantRAbstract.h" -#include "Logger.h" -#include -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantRAbstract::GuidelineStateDeployedConstantRAbstract (GuidelineStateContext &context) : - GuidelineStateDeployedAbstract (context) -{ - saveLastCoordsType (); -} - -GuidelineStateDeployedConstantRAbstract::~GuidelineStateDeployedConstantRAbstract () -{ -} - -EllipseParameters GuidelineStateDeployedConstantRAbstract::pointToEllipse (const QPointF &posScreen) const -{ - GuidelineProjectorConstantR projector; - - return projector.fromPosScreen (context().transformation(), - sceneRect (), - posScreen); -} - -QLineF GuidelineStateDeployedConstantRAbstract::pointToLine (const QPointF & /* posScreen */) const -{ - return QLineF (0, 0, 0, 0); -} - -void GuidelineStateDeployedConstantRAbstract::updateWithLatestTransformation () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantRAbstract::updateWithLatestTransformation"; - - if (!context().transformation().transformIsDefined() || - context().transformation().modelCoords().coordsType() != lastCoordsType ()) { - // Discard this Guideline immediately since the transformation just transitioned to undefined, - // or cartesian/polar mode has just toggled - context().requestStateTransition(GUIDELINE_STATE_DISCARDED); - } else { - - QPointF posScreen; - context().transformation().transformRawGraphToScreen (context().posCursorGraph(), - posScreen); - - GuidelineEllipse *ellipse = dynamic_cast (&context().guideline()); - ellipse->updateGeometry (posScreen); - - } - - saveLastCoordsType (); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantRAbstract.h b/src/Guideline/GuidelineStateDeployedConstantRAbstract.h deleted file mode 100644 index 5cace61e..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRAbstract.h +++ /dev/null @@ -1,29 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ABSTRACT_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ABSTRACT_H - -#include "GuidelineStateDeployedAbstract.h" - -/// Compute geometry for deployed constant range Guideline -class GuidelineStateDeployedConstantRAbstract : public GuidelineStateDeployedAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantRAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantRAbstract(); - - virtual EllipseParameters pointToEllipse (const QPointF &posScreen) const; - virtual QLineF pointToLine (const QPointF &posScreen) const; - virtual void updateWithLatestTransformation (); - -private: - GuidelineStateDeployedConstantRAbstract(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateDeployedConstantRActive.cpp b/src/Guideline/GuidelineStateDeployedConstantRActive.cpp deleted file mode 100644 index ced31eb2..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRActive.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantRActive.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantRActive::GuidelineStateDeployedConstantRActive (GuidelineStateContext &context) : - GuidelineStateDeployedConstantRAbstract (context) -{ -} - -GuidelineStateDeployedConstantRActive::~GuidelineStateDeployedConstantRActive () -{ -} - -void GuidelineStateDeployedConstantRActive::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantRActive::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantRHide - - beginCommon (GuidelineFormat::HOVER_OFF); -} - -bool GuidelineStateDeployedConstantRActive::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantRActive::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantRActive::end"; -} - -void GuidelineStateDeployedConstantRActive::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantRActive::handleHoverEnterEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER); -} - -void GuidelineStateDeployedConstantRActive::handleHoverLeaveEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER -} - -void GuidelineStateDeployedConstantRActive::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantRActive::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HIDE); - } -} - -QString GuidelineStateDeployedConstantRActive::state () const -{ - return ("GuidelineStateDeployedConstantRActive"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantRActive.h b/src/Guideline/GuidelineStateDeployedConstantRActive.h deleted file mode 100644 index 41737db3..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRActive.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE_H - -#include "GuidelineStateDeployedConstantRAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE -class GuidelineStateDeployedConstantRActive : public GuidelineStateDeployedConstantRAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantRActive(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantRActive(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantRActive(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE_H diff --git a/src/Guideline/GuidelineStateDeployedConstantRHide.cpp b/src/Guideline/GuidelineStateDeployedConstantRHide.cpp deleted file mode 100644 index 02e1ba54..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRHide.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantRHide.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantRHide::GuidelineStateDeployedConstantRHide (GuidelineStateContext &context) : - GuidelineStateDeployedConstantRAbstract (context) -{ -} - -GuidelineStateDeployedConstantRHide::~GuidelineStateDeployedConstantRHide () -{ -} - -void GuidelineStateDeployedConstantRHide::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantRHide::begin"; - - beginCommon (GuidelineFormat::HOVER_OFF); - - context().guideline().setGraphicsItemVisible (false); // Stop hover and painting (doPoint only stops painting) -} - -bool GuidelineStateDeployedConstantRHide::doPaint () const -{ - return false; -} - -void GuidelineStateDeployedConstantRHide::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantRHide::end"; -} - -void GuidelineStateDeployedConstantRHide::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantRHide::handleHoverEnterEvent () -{ - // Noop -} - -void GuidelineStateDeployedConstantRHide::handleHoverLeaveEvent () -{ - // Noop -} - -void GuidelineStateDeployedConstantRHide::handleMousePress (const QPointF & /* posScene */) -{ -} - -void GuidelineStateDeployedConstantRHide::handleVisibleChange (bool visible) -{ - if (visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE); - } -} - -QString GuidelineStateDeployedConstantRHide::state () const -{ - return ("GuidelineStateDeployedConstantRHide"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantRHide.h b/src/Guideline/GuidelineStateDeployedConstantRHide.h deleted file mode 100644 index 0abe9336..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRHide.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HIDE_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HIDE_H - -#include "GuidelineStateDeployedConstantRAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R -class GuidelineStateDeployedConstantRHide : public GuidelineStateDeployedConstantRAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantRHide(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantRHide(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantRHide(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HIDE_H diff --git a/src/Guideline/GuidelineStateDeployedConstantRHover.cpp b/src/Guideline/GuidelineStateDeployedConstantRHover.cpp deleted file mode 100644 index d8608fc8..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRHover.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantRHover.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantRHover::GuidelineStateDeployedConstantRHover (GuidelineStateContext &context) : - GuidelineStateDeployedConstantRAbstract (context) -{ -} - -GuidelineStateDeployedConstantRHover::~GuidelineStateDeployedConstantRHover () -{ -} - -void GuidelineStateDeployedConstantRHover::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantRHover::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantRHide - - beginCommon (GuidelineFormat::HOVER_ON); -} - -bool GuidelineStateDeployedConstantRHover::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantRHover::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantRHover::end"; -} - -void GuidelineStateDeployedConstantRHover::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantRHover::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE -} - -void GuidelineStateDeployedConstantRHover::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE); -} - -void GuidelineStateDeployedConstantRHover::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantRHover::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HIDE); - } -} - -QString GuidelineStateDeployedConstantRHover::state () const -{ - return ("GuidelineStateDeployedConstantRHover"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantRHover.h b/src/Guideline/GuidelineStateDeployedConstantRHover.h deleted file mode 100644 index 89bab88e..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRHover.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER_H - -#include "GuidelineStateDeployedConstantRAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER -class GuidelineStateDeployedConstantRHover : public GuidelineStateDeployedConstantRAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantRHover(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantRHover(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantRHover(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER_H diff --git a/src/Guideline/GuidelineStateDeployedConstantRLocked.cpp b/src/Guideline/GuidelineStateDeployedConstantRLocked.cpp deleted file mode 100644 index 3e20c0e5..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRLocked.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantRLocked.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantRLocked::GuidelineStateDeployedConstantRLocked (GuidelineStateContext &context) : - GuidelineStateDeployedConstantRAbstract (context) -{ -} - -GuidelineStateDeployedConstantRLocked::~GuidelineStateDeployedConstantRLocked () -{ -} - -void GuidelineStateDeployedConstantRLocked::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantRLocked::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantRHide - - beginCommon (GuidelineFormat::HOVER_ON); -} - -bool GuidelineStateDeployedConstantRLocked::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantRLocked::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantRLocked::end"; -} - -void GuidelineStateDeployedConstantRLocked::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantRLocked::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE -} - -void GuidelineStateDeployedConstantRLocked::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE); -} - -void GuidelineStateDeployedConstantRLocked::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_LOCKED, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantRLocked::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HIDE); - } -} - -QString GuidelineStateDeployedConstantRLocked::state () const -{ - return ("GuidelineStateDeployedConstantRLocked"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantRLocked.h b/src/Guideline/GuidelineStateDeployedConstantRLocked.h deleted file mode 100644 index 1ce80618..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantRLocked.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_R_LOCKED_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_R_LOCKED_H - -#include "GuidelineStateDeployedConstantRAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_R_LOCKED -class GuidelineStateDeployedConstantRLocked : public GuidelineStateDeployedConstantRAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantRLocked(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantRLocked(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantRLocked(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_R_LOCKED_H diff --git a/src/Guideline/GuidelineStateDeployedConstantTAbstract.cpp b/src/Guideline/GuidelineStateDeployedConstantTAbstract.cpp deleted file mode 100644 index 2760acc4..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTAbstract.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineLine.h" -#include "GuidelineProjectorConstantT.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantTAbstract.h" -#include "Logger.h" -#include -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantTAbstract::GuidelineStateDeployedConstantTAbstract (GuidelineStateContext &context) : - GuidelineStateDeployedAbstract (context) -{ - saveLastCoordsType (); -} - -GuidelineStateDeployedConstantTAbstract::~GuidelineStateDeployedConstantTAbstract () -{ -} - -EllipseParameters GuidelineStateDeployedConstantTAbstract::pointToEllipse (const QPointF & /* posScreen */) const -{ - return EllipseParameters(); -} - -QLineF GuidelineStateDeployedConstantTAbstract::pointToLine (const QPointF &posScreen) const -{ - GuidelineProjectorConstantT projector; - - return projector.fromPosScreen (context().transformation(), - sceneRect (), - posScreen); -} - -void GuidelineStateDeployedConstantTAbstract::updateWithLatestTransformation () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantTAbstract::updateWithLatestTransformation"; - - if (!context().transformation().transformIsDefined() || - context().transformation().modelCoords().coordsType() != lastCoordsType ()) { - // Discard this Guideline immediately since the transformation just transitioned to undefined, - // or cartesian/polar mode has just toggled - context().requestStateTransition(GUIDELINE_STATE_DISCARDED); - } else { - - GuidelineProjectorConstantT projector; - - GuidelineLine *line = dynamic_cast (&context().guideline()); - line->setLine (projector.fromCoordinateT (context().transformation(), - sceneRect (), - context().posCursorGraph().x ())); - } - - saveLastCoordsType (); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantTAbstract.h b/src/Guideline/GuidelineStateDeployedConstantTAbstract.h deleted file mode 100644 index b5f451db..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTAbstract.h +++ /dev/null @@ -1,29 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ABSTRACT_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ABSTRACT_H - -#include "GuidelineStateDeployedAbstract.h" - -/// Compute geometry for deployed constant theta Guideline -class GuidelineStateDeployedConstantTAbstract : public GuidelineStateDeployedAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantTAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantTAbstract(); - - virtual EllipseParameters pointToEllipse (const QPointF &posScreen) const; - virtual QLineF pointToLine (const QPointF &posScreen) const; - virtual void updateWithLatestTransformation (); - -private: - GuidelineStateDeployedConstantTAbstract(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateDeployedConstantTActive.cpp b/src/Guideline/GuidelineStateDeployedConstantTActive.cpp deleted file mode 100644 index 6d37e06e..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTActive.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantTActive.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantTActive::GuidelineStateDeployedConstantTActive (GuidelineStateContext &context) : - GuidelineStateDeployedConstantTAbstract (context) -{ -} - -GuidelineStateDeployedConstantTActive::~GuidelineStateDeployedConstantTActive () -{ -} - -void GuidelineStateDeployedConstantTActive::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantTActive::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantTHide - - beginCommon (GuidelineFormat::HOVER_OFF); -} - -bool GuidelineStateDeployedConstantTActive::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantTActive::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantTActive::end"; -} - -void GuidelineStateDeployedConstantTActive::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantTActive::handleHoverEnterEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER); -} - -void GuidelineStateDeployedConstantTActive::handleHoverLeaveEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER -} - -void GuidelineStateDeployedConstantTActive::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantTActive::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HIDE); - } -} - -QString GuidelineStateDeployedConstantTActive::state () const -{ - return ("GuidelineStateDeployedConstantTActive"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantTActive.h b/src/Guideline/GuidelineStateDeployedConstantTActive.h deleted file mode 100644 index 51bc06da..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTActive.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE_H - -#include "GuidelineStateDeployedConstantTAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE -class GuidelineStateDeployedConstantTActive : public GuidelineStateDeployedConstantTAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantTActive(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantTActive(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantTActive(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE_H diff --git a/src/Guideline/GuidelineStateDeployedConstantTHide.cpp b/src/Guideline/GuidelineStateDeployedConstantTHide.cpp deleted file mode 100644 index 2eadaefe..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTHide.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantTHide.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantTHide::GuidelineStateDeployedConstantTHide (GuidelineStateContext &context) : - GuidelineStateDeployedConstantTAbstract (context) -{ -} - -GuidelineStateDeployedConstantTHide::~GuidelineStateDeployedConstantTHide () -{ -} - -void GuidelineStateDeployedConstantTHide::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantTHide::begin"; - - beginCommon (GuidelineFormat::HOVER_OFF); - - context().guideline().setGraphicsItemVisible (false); // Stop hover and painting (doPoint only stops painting) -} - -bool GuidelineStateDeployedConstantTHide::doPaint () const -{ - return false; -} - -void GuidelineStateDeployedConstantTHide::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantTHide::end"; -} - -void GuidelineStateDeployedConstantTHide::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantTHide::handleHoverEnterEvent () -{ - // Noop -} - -void GuidelineStateDeployedConstantTHide::handleHoverLeaveEvent () -{ - // Noop -} - -void GuidelineStateDeployedConstantTHide::handleMousePress (const QPointF & /* posScene */) -{ -} - -void GuidelineStateDeployedConstantTHide::handleVisibleChange (bool visible) -{ - if (visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE); - } -} - -QString GuidelineStateDeployedConstantTHide::state () const -{ - return ("GuidelineStateDeployedConstantTHide"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantTHide.h b/src/Guideline/GuidelineStateDeployedConstantTHide.h deleted file mode 100644 index a04b453a..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTHide.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HIDE_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HIDE_H - -#include "GuidelineStateDeployedConstantTAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T -class GuidelineStateDeployedConstantTHide : public GuidelineStateDeployedConstantTAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantTHide(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantTHide(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantTHide(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HIDE_H diff --git a/src/Guideline/GuidelineStateDeployedConstantTHover.cpp b/src/Guideline/GuidelineStateDeployedConstantTHover.cpp deleted file mode 100644 index 4f173b4b..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTHover.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantTHover.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantTHover::GuidelineStateDeployedConstantTHover (GuidelineStateContext &context) : - GuidelineStateDeployedConstantTAbstract (context) -{ -} - -GuidelineStateDeployedConstantTHover::~GuidelineStateDeployedConstantTHover () -{ -} - -void GuidelineStateDeployedConstantTHover::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantTHover::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantTHide - - beginCommon (GuidelineFormat::HOVER_ON); -} - -bool GuidelineStateDeployedConstantTHover::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantTHover::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantTHover::end"; -} - -void GuidelineStateDeployedConstantTHover::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantTHover::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE -} - -void GuidelineStateDeployedConstantTHover::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE); -} - -void GuidelineStateDeployedConstantTHover::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantTHover::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HIDE); - } -} - -QString GuidelineStateDeployedConstantTHover::state () const -{ - return ("GuidelineStateDeployedConstantTHover"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantTHover.h b/src/Guideline/GuidelineStateDeployedConstantTHover.h deleted file mode 100644 index 0ee528fc..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTHover.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER_H - -#include "GuidelineStateDeployedConstantTAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T -class GuidelineStateDeployedConstantTHover : public GuidelineStateDeployedConstantTAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantTHover(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantTHover(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantTHover(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER_H diff --git a/src/Guideline/GuidelineStateDeployedConstantTLocked.cpp b/src/Guideline/GuidelineStateDeployedConstantTLocked.cpp deleted file mode 100644 index 3d34ea41..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTLocked.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantTLocked.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantTLocked::GuidelineStateDeployedConstantTLocked (GuidelineStateContext &context) : - GuidelineStateDeployedConstantTAbstract (context) -{ -} - -GuidelineStateDeployedConstantTLocked::~GuidelineStateDeployedConstantTLocked () -{ -} - -void GuidelineStateDeployedConstantTLocked::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantTLocked::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantTHide - - beginCommon (GuidelineFormat::HOVER_ON); -} - -bool GuidelineStateDeployedConstantTLocked::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantTLocked::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantTLocked::end"; -} - -void GuidelineStateDeployedConstantTLocked::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantTLocked::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE -} - -void GuidelineStateDeployedConstantTLocked::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE); -} - -void GuidelineStateDeployedConstantTLocked::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_LOCKED, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantTLocked::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HIDE); - } -} - -QString GuidelineStateDeployedConstantTLocked::state () const -{ - return ("GuidelineStateDeployedConstantTLocked"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantTLocked.h b/src/Guideline/GuidelineStateDeployedConstantTLocked.h deleted file mode 100644 index e72ff7bf..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantTLocked.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_T_LOCKED_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_T_LOCKED_H - -#include "GuidelineStateDeployedConstantTAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_T -class GuidelineStateDeployedConstantTLocked : public GuidelineStateDeployedConstantTAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantTLocked(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantTLocked(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantTLocked(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_T_LOCKED_H diff --git a/src/Guideline/GuidelineStateDeployedConstantXAbstract.cpp b/src/Guideline/GuidelineStateDeployedConstantXAbstract.cpp deleted file mode 100644 index 79733d65..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXAbstract.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineLine.h" -#include "GuidelineProjectorConstantX.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantXAbstract.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantXAbstract::GuidelineStateDeployedConstantXAbstract (GuidelineStateContext &context) : - GuidelineStateDeployedAbstract (context) -{ - saveLastCoordsType (); -} - -GuidelineStateDeployedConstantXAbstract::~GuidelineStateDeployedConstantXAbstract () -{ -} - -EllipseParameters GuidelineStateDeployedConstantXAbstract::pointToEllipse (const QPointF & /* posScreen */) const -{ - return EllipseParameters(); -} - -QLineF GuidelineStateDeployedConstantXAbstract::pointToLine (const QPointF &posScreen) const -{ - GuidelineProjectorConstantX projector; - - return projector.fromPosScreen (context().transformation(), - sceneRect (), - posScreen); -} - -void GuidelineStateDeployedConstantXAbstract::updateWithLatestTransformation () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXAbstract::updateWithLatestTransformation"; - - if (!context().transformation().transformIsDefined() || - context().transformation().modelCoords().coordsType() != lastCoordsType ()) { - // Discard this Guideline immediately since the transformation just transitioned to undefined, - // or cartesian/polar mode has just toggled - context().requestStateTransition(GUIDELINE_STATE_DISCARDED); - } else { - - GuidelineProjectorConstantX projector; - - GuidelineLine *line = dynamic_cast (&context().guideline()); - line->setLine (projector.fromCoordinateX (context().transformation(), - sceneRect (), - context().posCursorGraph ().x())); - } - - saveLastCoordsType (); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantXAbstract.h b/src/Guideline/GuidelineStateDeployedConstantXAbstract.h deleted file mode 100644 index af452d86..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXAbstract.h +++ /dev/null @@ -1,29 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ABSTRACT_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ABSTRACT_H - -#include "GuidelineStateDeployedAbstract.h" - -/// Compute geometry for deployed constant x Guideline -class GuidelineStateDeployedConstantXAbstract : public GuidelineStateDeployedAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantXAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantXAbstract(); - - virtual EllipseParameters pointToEllipse (const QPointF &posScreen) const; - virtual QLineF pointToLine (const QPointF &posScreen) const; - virtual void updateWithLatestTransformation (); - -private: - GuidelineStateDeployedConstantXAbstract(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateDeployedConstantXActive.cpp b/src/Guideline/GuidelineStateDeployedConstantXActive.cpp deleted file mode 100644 index aaa36928..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXActive.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantXActive.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantXActive::GuidelineStateDeployedConstantXActive (GuidelineStateContext &context) : - GuidelineStateDeployedConstantXAbstract (context) -{ -} - -GuidelineStateDeployedConstantXActive::~GuidelineStateDeployedConstantXActive () -{ -} - -void GuidelineStateDeployedConstantXActive::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXActive::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantXHide - - beginCommon (GuidelineFormat::HOVER_OFF); -} - -bool GuidelineStateDeployedConstantXActive::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantXActive::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXActive::end"; -} - -void GuidelineStateDeployedConstantXActive::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantXActive::handleHoverEnterEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER); -} - -void GuidelineStateDeployedConstantXActive::handleHoverLeaveEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER -} - -void GuidelineStateDeployedConstantXActive::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantXActive::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HIDE); - } -} - -QString GuidelineStateDeployedConstantXActive::state () const -{ - return ("GuidelineStateDeployedConstantXActive"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantXActive.h b/src/Guideline/GuidelineStateDeployedConstantXActive.h deleted file mode 100644 index 9f4b08c4..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXActive.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE_H - -#include "GuidelineStateDeployedConstantXAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE -class GuidelineStateDeployedConstantXActive : public GuidelineStateDeployedConstantXAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantXActive(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantXActive(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantXActive(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE_H diff --git a/src/Guideline/GuidelineStateDeployedConstantXHide.cpp b/src/Guideline/GuidelineStateDeployedConstantXHide.cpp deleted file mode 100644 index 5c06ddb8..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXHide.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantXHide.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantXHide::GuidelineStateDeployedConstantXHide (GuidelineStateContext &context) : - GuidelineStateDeployedConstantXAbstract (context) -{ -} - -GuidelineStateDeployedConstantXHide::~GuidelineStateDeployedConstantXHide () -{ -} - -void GuidelineStateDeployedConstantXHide::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXHide::begin"; - - beginCommon (GuidelineFormat::HOVER_OFF); - - context().guideline().setGraphicsItemVisible (false); // Stop hover and painting (doPoint only stops painting) -} - -bool GuidelineStateDeployedConstantXHide::doPaint () const -{ - return false; -} - -void GuidelineStateDeployedConstantXHide::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXHide::end"; -} - -void GuidelineStateDeployedConstantXHide::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantXHide::handleHoverEnterEvent () -{ - // Noop -} - -void GuidelineStateDeployedConstantXHide::handleHoverLeaveEvent () -{ - // Noop -} - -void GuidelineStateDeployedConstantXHide::handleMousePress (const QPointF & /* posScene */) -{ -} - -void GuidelineStateDeployedConstantXHide::handleVisibleChange (bool visible) -{ - if (visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE); - } -} - -QString GuidelineStateDeployedConstantXHide::state () const -{ - return ("GuidelineStateDeployedConstantXHide"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantXHide.h b/src/Guideline/GuidelineStateDeployedConstantXHide.h deleted file mode 100644 index 1cd41f3e..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXHide.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HIDE_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HIDE_H - -#include "GuidelineStateDeployedConstantXAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X -class GuidelineStateDeployedConstantXHide : public GuidelineStateDeployedConstantXAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantXHide(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantXHide(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantXHide(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HIDE_H diff --git a/src/Guideline/GuidelineStateDeployedConstantXHover.cpp b/src/Guideline/GuidelineStateDeployedConstantXHover.cpp deleted file mode 100644 index 6876682a..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXHover.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantXHover.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantXHover::GuidelineStateDeployedConstantXHover (GuidelineStateContext &context) : - GuidelineStateDeployedConstantXAbstract (context) -{ -} - -GuidelineStateDeployedConstantXHover::~GuidelineStateDeployedConstantXHover () -{ -} - -void GuidelineStateDeployedConstantXHover::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXHover::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantXHide - - beginCommon (GuidelineFormat::HOVER_ON); -} - -bool GuidelineStateDeployedConstantXHover::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantXHover::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXHover::end"; -} - -void GuidelineStateDeployedConstantXHover::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantXHover::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE -} - -void GuidelineStateDeployedConstantXHover::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE); -} - -void GuidelineStateDeployedConstantXHover::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantXHover::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HIDE); - } -} - -QString GuidelineStateDeployedConstantXHover::state () const -{ - return ("GuidelineStateDeployedConstantXHover"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantXHover.h b/src/Guideline/GuidelineStateDeployedConstantXHover.h deleted file mode 100644 index 365022c4..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXHover.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER_H - -#include "GuidelineStateDeployedConstantXAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X -class GuidelineStateDeployedConstantXHover : public GuidelineStateDeployedConstantXAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantXHover(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantXHover(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantXHover(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER_H diff --git a/src/Guideline/GuidelineStateDeployedConstantXLocked.cpp b/src/Guideline/GuidelineStateDeployedConstantXLocked.cpp deleted file mode 100644 index d8e55435..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXLocked.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantXLocked.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantXLocked::GuidelineStateDeployedConstantXLocked (GuidelineStateContext &context) : - GuidelineStateDeployedConstantXAbstract (context) -{ -} - -GuidelineStateDeployedConstantXLocked::~GuidelineStateDeployedConstantXLocked () -{ -} - -void GuidelineStateDeployedConstantXLocked::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXLocked::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantXHide - - beginCommon (GuidelineFormat::HOVER_ON); -} - -bool GuidelineStateDeployedConstantXLocked::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantXLocked::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXLocked::end"; -} - -void GuidelineStateDeployedConstantXLocked::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantXLocked::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE -} - -void GuidelineStateDeployedConstantXLocked::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE); -} - -void GuidelineStateDeployedConstantXLocked::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_LOCKED, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantXLocked::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HIDE); - } -} - -QString GuidelineStateDeployedConstantXLocked::state () const -{ - return ("GuidelineStateDeployedConstantXLocked"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantXLocked.h b/src/Guideline/GuidelineStateDeployedConstantXLocked.h deleted file mode 100644 index 93580ec3..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantXLocked.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_X_LOCKED_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_X_LOCKED_H - -#include "GuidelineStateDeployedConstantXAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_X -class GuidelineStateDeployedConstantXLocked : public GuidelineStateDeployedConstantXAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantXLocked(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantXLocked(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantXLocked(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_X_LOCKED_H diff --git a/src/Guideline/GuidelineStateDeployedConstantYAbstract.cpp b/src/Guideline/GuidelineStateDeployedConstantYAbstract.cpp deleted file mode 100644 index 51a4710e..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYAbstract.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineLine.h" -#include "GuidelineProjectorConstantY.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantYAbstract.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantYAbstract::GuidelineStateDeployedConstantYAbstract (GuidelineStateContext &context) : - GuidelineStateDeployedAbstract (context) -{ - saveLastCoordsType (); -} - -GuidelineStateDeployedConstantYAbstract::~GuidelineStateDeployedConstantYAbstract () -{ -} - -EllipseParameters GuidelineStateDeployedConstantYAbstract::pointToEllipse (const QPointF & /* posScreen */) const -{ - return EllipseParameters(); -} - -QLineF GuidelineStateDeployedConstantYAbstract::pointToLine (const QPointF &posScreen) const -{ - GuidelineProjectorConstantY projector; - - return projector.fromPosScreen (context().transformation(), - sceneRect (), - posScreen); -} - -void GuidelineStateDeployedConstantYAbstract::updateWithLatestTransformation () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantYAbstract::updateWithLatestTransformation"; - - if (!context().transformation().transformIsDefined() || - context().transformation().modelCoords().coordsType() != lastCoordsType ()) { - // Discard this Guideline immediately since the transformation just transitioned to undefined, - // or cartesian/polar mode has just toggled - context().requestStateTransition(GUIDELINE_STATE_DISCARDED); - } else { - - GuidelineProjectorConstantY projector; - - GuidelineLine *line = dynamic_cast (&context().guideline()); - line->setLine (projector.fromCoordinateY (context().transformation(), - sceneRect (), - context().posCursorGraph ().y())); - } - - saveLastCoordsType (); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantYAbstract.h b/src/Guideline/GuidelineStateDeployedConstantYAbstract.h deleted file mode 100644 index 03819456..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYAbstract.h +++ /dev/null @@ -1,29 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ABSTRACT_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ABSTRACT_H - -#include "GuidelineStateDeployedAbstract.h" - -/// Compute geometry for deployed constant y Guideline -class GuidelineStateDeployedConstantYAbstract : public GuidelineStateDeployedAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantYAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantYAbstract(); - - virtual EllipseParameters pointToEllipse (const QPointF &posScreen) const; - virtual QLineF pointToLine (const QPointF &posScreen) const; - virtual void updateWithLatestTransformation (); - -private: - GuidelineStateDeployedConstantYAbstract(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateDeployedConstantYActive.cpp b/src/Guideline/GuidelineStateDeployedConstantYActive.cpp deleted file mode 100644 index 1c243e35..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYActive.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantYActive.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantYActive::GuidelineStateDeployedConstantYActive (GuidelineStateContext &context) : - GuidelineStateDeployedConstantYAbstract (context) -{ -} - -GuidelineStateDeployedConstantYActive::~GuidelineStateDeployedConstantYActive () -{ -} - -void GuidelineStateDeployedConstantYActive::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantYActive::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantYHide - - beginCommon (GuidelineFormat::HOVER_OFF); -} - -bool GuidelineStateDeployedConstantYActive::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantYActive::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantYActive::end"; -} - -void GuidelineStateDeployedConstantYActive::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantYActive::handleHoverEnterEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER); -} - -void GuidelineStateDeployedConstantYActive::handleHoverLeaveEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER -} - -void GuidelineStateDeployedConstantYActive::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantYActive::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HIDE); - } -} - -QString GuidelineStateDeployedConstantYActive::state () const -{ - return ("GuidelineStateDeployedConstantYActive"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantYActive.h b/src/Guideline/GuidelineStateDeployedConstantYActive.h deleted file mode 100644 index 02fa2873..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYActive.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE_H - -#include "GuidelineStateDeployedConstantYAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE -class GuidelineStateDeployedConstantYActive : public GuidelineStateDeployedConstantYAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantYActive(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantYActive(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantYActive(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE_H diff --git a/src/Guideline/GuidelineStateDeployedConstantYHide.cpp b/src/Guideline/GuidelineStateDeployedConstantYHide.cpp deleted file mode 100644 index 3ca61aac..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYHide.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantYHide.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantYHide::GuidelineStateDeployedConstantYHide (GuidelineStateContext &context) : - GuidelineStateDeployedConstantYAbstract (context) -{ -} - -GuidelineStateDeployedConstantYHide::~GuidelineStateDeployedConstantYHide () -{ -} - -void GuidelineStateDeployedConstantYHide::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantYHide::begin"; - - beginCommon (GuidelineFormat::HOVER_OFF); - - context().guideline().setGraphicsItemVisible (false); // Stop hover and painting (doPoint only stops painting) -} - -bool GuidelineStateDeployedConstantYHide::doPaint () const -{ - return false; -} - -void GuidelineStateDeployedConstantYHide::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantYHide::end"; -} - -void GuidelineStateDeployedConstantYHide::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantYHide::handleHoverEnterEvent () -{ - // Noop -} - -void GuidelineStateDeployedConstantYHide::handleHoverLeaveEvent () -{ - // Noop -} - -void GuidelineStateDeployedConstantYHide::handleMousePress (const QPointF & /* posScene */) -{ -} - -void GuidelineStateDeployedConstantYHide::handleVisibleChange (bool visible) -{ - if (visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE); - } -} - -QString GuidelineStateDeployedConstantYHide::state () const -{ - return ("GuidelineStateDeployedConstantYHide"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantYHide.h b/src/Guideline/GuidelineStateDeployedConstantYHide.h deleted file mode 100644 index 923f6d9a..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYHide.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HIDE_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HIDE_H - -#include "GuidelineStateDeployedConstantYAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y -class GuidelineStateDeployedConstantYHide : public GuidelineStateDeployedConstantYAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantYHide(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantYHide(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantYHide(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HIDE_H diff --git a/src/Guideline/GuidelineStateDeployedConstantYHover.cpp b/src/Guideline/GuidelineStateDeployedConstantYHover.cpp deleted file mode 100644 index e7b5a1c6..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYHover.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantYHover.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantYHover::GuidelineStateDeployedConstantYHover (GuidelineStateContext &context) : - GuidelineStateDeployedConstantYAbstract (context) -{ -} - -GuidelineStateDeployedConstantYHover::~GuidelineStateDeployedConstantYHover () -{ -} - -void GuidelineStateDeployedConstantYHover::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantYHover::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantYHide - - beginCommon (GuidelineFormat::HOVER_ON); -} - -bool GuidelineStateDeployedConstantYHover::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantYHover::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantYHover::end"; -} - -void GuidelineStateDeployedConstantYHover::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantYHover::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE -} - -void GuidelineStateDeployedConstantYHover::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE); -} - -void GuidelineStateDeployedConstantYHover::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantYHover::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HIDE); - } -} - -QString GuidelineStateDeployedConstantYHover::state () const -{ - return ("GuidelineStateDeployedConstantYHover"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantYHover.h b/src/Guideline/GuidelineStateDeployedConstantYHover.h deleted file mode 100644 index b857dd2a..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYHover.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER_H - -#include "GuidelineStateDeployedConstantYAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER -class GuidelineStateDeployedConstantYHover : public GuidelineStateDeployedConstantYAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantYHover(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantYHover(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantYHover(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER_H diff --git a/src/Guideline/GuidelineStateDeployedConstantYLocked.cpp b/src/Guideline/GuidelineStateDeployedConstantYLocked.cpp deleted file mode 100644 index 6f1074dc..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYLocked.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDeployedConstantYLocked.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateDeployedConstantYLocked::GuidelineStateDeployedConstantYLocked (GuidelineStateContext &context) : - GuidelineStateDeployedConstantYAbstract (context) -{ -} - -GuidelineStateDeployedConstantYLocked::~GuidelineStateDeployedConstantYLocked () -{ -} - -void GuidelineStateDeployedConstantYLocked::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantYLocked::begin"; - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible from GuidelineStateDeployedConstantYHide - - beginCommon (GuidelineFormat::HOVER_ON); -} - -bool GuidelineStateDeployedConstantYLocked::doPaint () const -{ - return true; -} - -void GuidelineStateDeployedConstantYLocked::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantYLocked::end"; -} - -void GuidelineStateDeployedConstantYLocked::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDeployedConstantYLocked::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE -} - -void GuidelineStateDeployedConstantYLocked::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE); -} - -void GuidelineStateDeployedConstantYLocked::handleMousePress (const QPointF &posScene) -{ - handleMousePressCommon (posScene, - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_LOCKED, - GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateDeployedConstantYLocked::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HIDE); - } -} - -QString GuidelineStateDeployedConstantYLocked::state () const -{ - return ("GuidelineStateDeployedConstantYLocked"); -} diff --git a/src/Guideline/GuidelineStateDeployedConstantYLocked.h b/src/Guideline/GuidelineStateDeployedConstantYLocked.h deleted file mode 100644 index b931663f..00000000 --- a/src/Guideline/GuidelineStateDeployedConstantYLocked.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_LOCKED_H -#define GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_LOCKED_H - -#include "GuidelineStateDeployedConstantYAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_LOCKED -class GuidelineStateDeployedConstantYLocked : public GuidelineStateDeployedConstantYAbstract -{ -public: - /// Single constructor. - GuidelineStateDeployedConstantYLocked(GuidelineStateContext &context); - virtual ~GuidelineStateDeployedConstantYLocked(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - -private: - GuidelineStateDeployedConstantYLocked(); - -}; - -#endif // GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_LOCKED_H diff --git a/src/Guideline/GuidelineStateDiscarded.cpp b/src/Guideline/GuidelineStateDiscarded.cpp deleted file mode 100644 index adeffdad..00000000 --- a/src/Guideline/GuidelineStateDiscarded.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateAbstractBase.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateDiscarded.h" -#include "Logger.h" -#include -#include "ZValues.h" - -GuidelineStateDiscarded::GuidelineStateDiscarded (GuidelineStateContext &context) : - GuidelineStateAbstractBase (context) -{ -} - -GuidelineStateDiscarded::~GuidelineStateDiscarded () -{ -} - -void GuidelineStateDiscarded::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDiscarded::begin"; - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemZValue (Z_VALUE_GUIDELINE_DISCARDED); - context().guideline().setGraphicsItemVisible (false); // - context().guideline().setGraphicsItemAcceptHoverEvents (false); - context().guideline().setGraphicsItemPen (guidelineFormat.colorHidden (), - guidelineFormat.lineWidthNonHover ()); -} - -bool GuidelineStateDiscarded::doPaint () const -{ - return false; -} - -void GuidelineStateDiscarded::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDiscarded::end"; -} - -void GuidelineStateDiscarded::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateDiscarded::handleHoverEnterEvent () -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandle::handleHoverEnterEvent"; - - // Noop. Never called since hover only works when visible -} - -void GuidelineStateDiscarded::handleHoverLeaveEvent () -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandle::handleHoverEnterEvent"; - - // Noop. Never called since hover only works when visible -} - -void GuidelineStateDiscarded::handleMousePress (const QPointF & /* posScene */) -{ - // Noop -} - -void GuidelineStateDiscarded::handleMouseRelease (const QPointF & /* posScene */) -{ - // Noop -} - -void GuidelineStateDiscarded::handleVisibleChange (bool /* visible */) -{ -} - -EllipseParameters GuidelineStateDiscarded::pointToEllipse (const QPointF & /* poscreen */) const -{ - return EllipseParameters(); -} - -QLineF GuidelineStateDiscarded::pointToLine (const QPointF & /* posGraph */) const -{ - return QLineF (0, 0, 0, 0); -} - -QString GuidelineStateDiscarded::state () const -{ - return ("GuidelineStateDiscarded"); -} - -void GuidelineStateDiscarded::updateWithLatestTransformation () -{ - // Noop -} diff --git a/src/Guideline/GuidelineStateDiscarded.h b/src/Guideline/GuidelineStateDiscarded.h deleted file mode 100644 index f36de3c2..00000000 --- a/src/Guideline/GuidelineStateDiscarded.h +++ /dev/null @@ -1,39 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_DISCARDED_H -#define GUIDELINE_STATE_DISCARDED_H - -#include "GuidelineStateAbstractBase.h" - -/// Implements guideline behavior for GUIDELINE_STATE_DISCARDED -class GuidelineStateDiscarded : public GuidelineStateAbstractBase -{ -public: - /// Single constructor. - GuidelineStateDiscarded(GuidelineStateContext &context); - virtual ~GuidelineStateDiscarded(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleMouseRelease (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual EllipseParameters pointToEllipse (const QPointF &posScreen) const; - virtual QLineF pointToLine (const QPointF &poscreen) const; - virtual QString state () const; - virtual void updateWithLatestTransformation (); - -private: - GuidelineStateDiscarded(); - -}; - -#endif // GUIDELINE_STATE_DISCARDED_H diff --git a/src/Guideline/GuidelineStateHandle.cpp b/src/Guideline/GuidelineStateHandle.cpp deleted file mode 100644 index 8d6ded04..00000000 --- a/src/Guideline/GuidelineStateHandle.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "EngaugeAssert.h" -#include "GraphicsScene.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateHandle.h" -#include "Logger.h" -#include -#include "ZValues.h" - -GuidelineStateHandle::GuidelineStateHandle (GuidelineStateContext &context) : - GuidelineStateAbstractBase (context) -{ -} - -GuidelineStateHandle::~GuidelineStateHandle () -{ -} - -void GuidelineStateHandle::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateHandle::begin"; - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemZValue (Z_VALUE_GUIDELINE_HANDLE); - context().guideline().setGraphicsItemVisible (true); - // ItemIsSelectable is overkill, and in special cases adds ugly selected dashes - context().guideline().setGraphicsItemFlags (QGraphicsItem::ItemIsFocusable | - QGraphicsItem::ItemIsMovable); - context().guideline().setGraphicsItemAcceptHoverEvents (false); - context().guideline().setGraphicsItemPen (guidelineFormat.colorHidden (), - guidelineFormat.lineWidthNonHover ()); -} - -bool GuidelineStateHandle::doPaint () const -{ - return false; -} - -void GuidelineStateHandle::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateHandle::end"; -} - -void GuidelineStateHandle::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateHandle::handleHoverEnterEvent () -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandle::handleHoverEnterEvent"; - - // Noop -} - -void GuidelineStateHandle::handleHoverLeaveEvent () -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandle::handleHoverEnterEvent"; - - // Noop -} - -void GuidelineStateHandle::handleMousePress (const QPointF & /* posScene */) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandle::handleMousePress"; - - // Noop -} - -void GuidelineStateHandle::handleMouseRelease (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandle::handleMouseRelease"; - - context().guideline().detachVisibleGuideline (posScene); - - // This is the replacement template Guideline - GuidelineAbstract *guidelineReplacement = context().createGuideline (context().stateReplacement ()); - guidelineReplacement->setGraphicsItemAcceptHoverEvents (true); - - // Go dark. This is not a significant memory leak (versus immediately deleting this object) - // since the Guideline states are extremely lightweight (few bytes), and there are so few of - // them (max expected to be well below 100). Plus, whenever the scene is closed (on exit or - // before loading a new Document) all Guidelines get deleted - context().requestStateTransition (GUIDELINE_STATE_DISCARDED); -} - -void GuidelineStateHandle::handleVisibleChange (bool /* visible */) -{ -} - -EllipseParameters GuidelineStateHandle::pointToEllipse (const QPointF & /* poscreen */) const -{ - return EllipseParameters(); -} - -QLineF GuidelineStateHandle::pointToLine (const QPointF & /* posGraph */) const -{ - return QLineF (0, 0, 0, 0); -} - -QString GuidelineStateHandle::state () const -{ - return ("GuidelineStateHandle"); -} - -void GuidelineStateHandle::updateWithLatestTransformation () -{ - // Noop -} diff --git a/src/Guideline/GuidelineStateHandle.h b/src/Guideline/GuidelineStateHandle.h deleted file mode 100644 index 01019316..00000000 --- a/src/Guideline/GuidelineStateHandle.h +++ /dev/null @@ -1,42 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_HANDLE_H -#define GUIDELINE_STATE_HANDLE_H - -#include "GuidelineStateAbstractBase.h" - -/// State for an invisible handle which was previously a template but morphed -/// into an invisible handle that the user is dragging. At the end of the drag -/// this disappears. Since the Guideline in this state is invisible we do not -/// have to worry about rotating this to be parallel with an axis. A visible -/// deployed Guideline is dragged along with this handle. We have total freedom -/// to rotated and/or move (and in the range isocontour case even bend) the -/// slaved deployed Guideline during the dragging -class GuidelineStateHandle : public GuidelineStateAbstractBase -{ -public: - /// Single constructor. - GuidelineStateHandle(GuidelineStateContext &context); - virtual ~GuidelineStateHandle(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleActiveChange (bool active); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleMouseRelease (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual EllipseParameters pointToEllipse (const QPointF &posScreen) const; - virtual QLineF pointToLine (const QPointF &poscreen) const; - virtual QString state () const; - virtual void updateWithLatestTransformation (); - -}; - -#endif // GUIDELINE_STATE_HANDLE_H diff --git a/src/Guideline/GuidelineStateTemplateAbstract.cpp b/src/Guideline/GuidelineStateTemplateAbstract.cpp deleted file mode 100644 index ec350d39..00000000 --- a/src/Guideline/GuidelineStateTemplateAbstract.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GraphicsScene.h" -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateAbstract.h" -#include "Logger.h" -#include -#include "ZValues.h" - -GuidelineStateTemplateAbstract::GuidelineStateTemplateAbstract (GuidelineStateContext &context) : - GuidelineStateAbstractBase (context) -{ -} - -GuidelineStateTemplateAbstract::~GuidelineStateTemplateAbstract () -{ -} - -void GuidelineStateTemplateAbstract::beginCommon (const QLineF &line) -{ - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemZValue (Z_VALUE_GUIDELINE_TEMPLATE); - // ItemIsSelectable is overkill, and in special cases adds ugly selected dashes - context().guideline().setGraphicsItemFlags (QGraphicsItem::ItemIsFocusable | - QGraphicsItem::ItemIsMovable); - context().guideline().setGraphicsItemAcceptHoverEvents (true); - - context().guideline().setGraphicsItemLine (line); -} - -void GuidelineStateTemplateAbstract::handleActiveChange (bool /* active */) -{ -} - -void GuidelineStateTemplateAbstract::handleMouseRelease (const QPointF & /* posScene */) -{ - // Noop -} - -EllipseParameters GuidelineStateTemplateAbstract::pointToEllipse (const QPointF & /* poscreen */) const -{ - return EllipseParameters(); -} - -QLineF GuidelineStateTemplateAbstract::pointToLine (const QPointF & /* posGraph */) const -{ - return QLineF (0, 0, 0, 0); -} diff --git a/src/Guideline/GuidelineStateTemplateAbstract.h b/src/Guideline/GuidelineStateTemplateAbstract.h deleted file mode 100644 index 6cb4b487..00000000 --- a/src/Guideline/GuidelineStateTemplateAbstract.h +++ /dev/null @@ -1,33 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_ABSTRACT_H -#define GUIDELINE_STATE_TEMPLATE_ABSTRACT_H - -#include "GuidelineStateAbstractBase.h" -#include - -/// Abstract class for template states -class GuidelineStateTemplateAbstract : public GuidelineStateAbstractBase -{ -public: - /// Single constructor. - GuidelineStateTemplateAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateAbstract(); - - /// Initialization of graphics item for all template Guidelines - void beginCommon (const QLineF &line); - - virtual void handleActiveChange (bool active); - virtual void handleMouseRelease (const QPointF &posScene); - virtual EllipseParameters pointToEllipse (const QPointF &posScreen) const; - virtual QLineF pointToLine (const QPointF &poscreen) const; - -protected: - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.cpp b/src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.cpp deleted file mode 100644 index c491e329..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateHorizontalBottomAbstract.h" -#include "Logger.h" -#include - -GuidelineStateTemplateHorizontalBottomAbstract::GuidelineStateTemplateHorizontalBottomAbstract (GuidelineStateContext &context) : - GuidelineStateTemplateAbstract (context) -{ -} - -GuidelineStateTemplateHorizontalBottomAbstract::~GuidelineStateTemplateHorizontalBottomAbstract () -{ -} - -QLineF GuidelineStateTemplateHorizontalBottomAbstract::templateHomeLine (const QRectF &sceneRect) -{ - return QLineF (sceneRect.bottomLeft(), - sceneRect.bottomRight()); -} diff --git a/src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.h b/src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.h deleted file mode 100644 index aeb0d22b..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalBottomAbstract.h +++ /dev/null @@ -1,28 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_ABSTRACT_H -#define GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_ABSTRACT_H - -#include "GuidelineStateTemplateAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM -class GuidelineStateTemplateHorizontalBottomAbstract : public GuidelineStateTemplateAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateHorizontalBottomAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateHorizontalBottomAbstract(); - - /// Returns the geometry of a template guideline. This is static so sceneRect must be passed in as an argument - static QLineF templateHomeLine (const QRectF &sceneRect); - -private: - GuidelineStateTemplateHorizontalBottomAbstract(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateTemplateHorizontalBottomHide.cpp b/src/Guideline/GuidelineStateTemplateHorizontalBottomHide.cpp deleted file mode 100644 index 450a48b5..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalBottomHide.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateHorizontalBottomHide.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateTemplateHorizontalBottomHide::GuidelineStateTemplateHorizontalBottomHide (GuidelineStateContext &context) : - GuidelineStateTemplateHorizontalBottomAbstract (context) -{ -} - -GuidelineStateTemplateHorizontalBottomHide::~GuidelineStateTemplateHorizontalBottomHide () -{ -} - -void GuidelineStateTemplateHorizontalBottomHide::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalBottomHide::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (false); // Stop hover and painting (doPoint only stops painting) -} - -bool GuidelineStateTemplateHorizontalBottomHide::doPaint () const -{ - return false; -} - -void GuidelineStateTemplateHorizontalBottomHide::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalBottomHide::end"; -} - -void GuidelineStateTemplateHorizontalBottomHide::handleHoverEnterEvent () -{ - // Noop -} - -void GuidelineStateTemplateHorizontalBottomHide::handleHoverLeaveEvent () -{ - // Noop -} - -void GuidelineStateTemplateHorizontalBottomHide::handleMousePress (const QPointF & /* posScene */) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateHorizontalBottomHide::handleMousePress"; -} - -void GuidelineStateTemplateHorizontalBottomHide::handleVisibleChange (bool visible) -{ - if (visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING); - } -} - -QString GuidelineStateTemplateHorizontalBottomHide::state () const -{ - return ("GuidelineStateTemplateHorizontalBottomHide"); -} - -void GuidelineStateTemplateHorizontalBottomHide::updateWithLatestTransformation () -{ - if (context().transformation().transformIsDefined()) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING); - } -} diff --git a/src/Guideline/GuidelineStateTemplateHorizontalBottomHide.h b/src/Guideline/GuidelineStateTemplateHorizontalBottomHide.h deleted file mode 100644 index b0b58602..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalBottomHide.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HIDE_H -#define GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HIDE_H - -#include "GuidelineStateTemplateHorizontalBottomAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM -class GuidelineStateTemplateHorizontalBottomHide : public GuidelineStateTemplateHorizontalBottomAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateHorizontalBottomHide(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateHorizontalBottomHide(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateHorizontalBottomHide(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HIDE_H diff --git a/src/Guideline/GuidelineStateTemplateHorizontalBottomHover.cpp b/src/Guideline/GuidelineStateTemplateHorizontalBottomHover.cpp deleted file mode 100644 index a0f11465..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalBottomHover.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateHorizontalBottomHover.h" -#include "Logger.h" -#include - -GuidelineStateTemplateHorizontalBottomHover::GuidelineStateTemplateHorizontalBottomHover (GuidelineStateContext &context) : - GuidelineStateTemplateHorizontalBottomAbstract (context) -{ -} - -GuidelineStateTemplateHorizontalBottomHover::~GuidelineStateTemplateHorizontalBottomHover () -{ -} - -void GuidelineStateTemplateHorizontalBottomHover::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalBottomHover::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible(false) from Hide class - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemPen (guidelineFormat.colorDeployedHover (), - guidelineFormat.lineWidthHover ()); // Show -} - -bool GuidelineStateTemplateHorizontalBottomHover::doPaint () const -{ - return true; -} - -void GuidelineStateTemplateHorizontalBottomHover::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalBottomHover::end"; -} - -void GuidelineStateTemplateHorizontalBottomHover::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_TEMPLATE_CONSTANT_Y_BOTTOM_LURKING or - // GUIDELINE_STATE_TEMPLATE_CONSTANT_R_BOTTOM_LURKING -} - -void GuidelineStateTemplateHorizontalBottomHover::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING); -} - -void GuidelineStateTemplateHorizontalBottomHover::handleMousePress (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateHorizontalBottomHover::handleMousePress"; - - GuidelineState stateNew = context().cartesian() ? - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER : - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER; - - handleMousePressCommon (posScene, - stateNew, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING); -} - -void GuidelineStateTemplateHorizontalBottomHover::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HIDE); - } -} - -QString GuidelineStateTemplateHorizontalBottomHover::state () const -{ - return ("GuidelineStateTemplateHorizontalBottomHover"); -} - -void GuidelineStateTemplateHorizontalBottomHover::updateWithLatestTransformation () -{ - // Noop -} diff --git a/src/Guideline/GuidelineStateTemplateHorizontalBottomHover.h b/src/Guideline/GuidelineStateTemplateHorizontalBottomHover.h deleted file mode 100644 index 86ac344d..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalBottomHover.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HOVER_H -#define GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HOVER_H - -#include "GuidelineStateTemplateHorizontalBottomAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM -class GuidelineStateTemplateHorizontalBottomHover : public GuidelineStateTemplateHorizontalBottomAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateHorizontalBottomHover(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateHorizontalBottomHover(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateHorizontalBottomHover(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HOVER_H diff --git a/src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.cpp b/src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.cpp deleted file mode 100644 index f63144d1..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateHorizontalBottomLurking.h" -#include "Logger.h" -#include -#include "Transformation.h" - -GuidelineStateTemplateHorizontalBottomLurking::GuidelineStateTemplateHorizontalBottomLurking (GuidelineStateContext &context) : - GuidelineStateTemplateHorizontalBottomAbstract (context) -{ -} - -GuidelineStateTemplateHorizontalBottomLurking::~GuidelineStateTemplateHorizontalBottomLurking () -{ -} - -void GuidelineStateTemplateHorizontalBottomLurking::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalBottomLurking::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible(false) from Hide class - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemPen (guidelineFormat.colorHidden (), - guidelineFormat.lineWidthHover ()); // Hide until hover entry -} - -bool GuidelineStateTemplateHorizontalBottomLurking::doPaint () const -{ - return true; -} - -void GuidelineStateTemplateHorizontalBottomLurking::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalBottomLurking::end"; -} - -void GuidelineStateTemplateHorizontalBottomLurking::handleHoverEnterEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HOVER); -} - -void GuidelineStateTemplateHorizontalBottomLurking::handleHoverLeaveEvent () -{ - // This event would have been handled by GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HOVER -} - -void GuidelineStateTemplateHorizontalBottomLurking::handleMousePress (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateHorizontalBottomLurking::handleMousePress"; - - GuidelineState stateNew = context().cartesian() ? - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE : - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE; - - handleMousePressCommon (posScene, - stateNew, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING); -} - -void GuidelineStateTemplateHorizontalBottomLurking::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HIDE); - } -} - -QString GuidelineStateTemplateHorizontalBottomLurking::state () const -{ - return ("GuidelineStateTemplateHorizontalBottomLurking"); -} - -void GuidelineStateTemplateHorizontalBottomLurking::updateWithLatestTransformation () -{ - if (!context().transformation().transformIsDefined()) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HIDE); - } -} diff --git a/src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.h b/src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.h deleted file mode 100644 index b2605aee..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalBottomLurking.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING_H -#define GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING_H - -#include "GuidelineStateTemplateHorizontalBottomAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM -class GuidelineStateTemplateHorizontalBottomLurking : public GuidelineStateTemplateHorizontalBottomAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateHorizontalBottomLurking(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateHorizontalBottomLurking(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateHorizontalBottomLurking(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING_H diff --git a/src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.cpp b/src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.cpp deleted file mode 100644 index f9d77906..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateHorizontalTopAbstract.h" -#include "Logger.h" - -GuidelineStateTemplateHorizontalTopAbstract::GuidelineStateTemplateHorizontalTopAbstract (GuidelineStateContext &context) : - GuidelineStateTemplateAbstract (context) -{ -} - -GuidelineStateTemplateHorizontalTopAbstract::~GuidelineStateTemplateHorizontalTopAbstract () -{ -} - -QLineF GuidelineStateTemplateHorizontalTopAbstract::templateHomeLine (const QRectF &sceneRect) -{ - return QLineF (sceneRect.topLeft(), - sceneRect.topRight()); -} diff --git a/src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.h b/src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.h deleted file mode 100644 index 757fd094..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalTopAbstract.h +++ /dev/null @@ -1,28 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_ABSTRACT_H -#define GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_ABSTRACT_H - -#include "GuidelineStateTemplateAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP -class GuidelineStateTemplateHorizontalTopAbstract : public GuidelineStateTemplateAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateHorizontalTopAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateHorizontalTopAbstract(); - - /// Returns the geometry of a template guideline - static QLineF templateHomeLine (const QRectF &sceneRect); - -private: - GuidelineStateTemplateHorizontalTopAbstract(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateTemplateHorizontalTopHide.cpp b/src/Guideline/GuidelineStateTemplateHorizontalTopHide.cpp deleted file mode 100644 index 79edd138..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalTopHide.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateHorizontalTopHide.h" -#include "Logger.h" -#include "Transformation.h" - -GuidelineStateTemplateHorizontalTopHide::GuidelineStateTemplateHorizontalTopHide (GuidelineStateContext &context) : - GuidelineStateTemplateHorizontalTopAbstract (context) -{ -} - -GuidelineStateTemplateHorizontalTopHide::~GuidelineStateTemplateHorizontalTopHide () -{ -} - -void GuidelineStateTemplateHorizontalTopHide::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalTopHide::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (false); // Stop hover and painting (doPoint only stops painting) -} - -bool GuidelineStateTemplateHorizontalTopHide::doPaint () const -{ - return false; -} - -void GuidelineStateTemplateHorizontalTopHide::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalTopHide::end"; -} - -void GuidelineStateTemplateHorizontalTopHide::handleHoverEnterEvent () -{ - // Noop -} - -void GuidelineStateTemplateHorizontalTopHide::handleHoverLeaveEvent () -{ - // Noop -} - -void GuidelineStateTemplateHorizontalTopHide::handleMousePress (const QPointF & /* posScene */) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateHorizontalTopHide::handleMousePress"; -} - -void GuidelineStateTemplateHorizontalTopHide::handleVisibleChange (bool visible) -{ - if (visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING); - } -} - -QString GuidelineStateTemplateHorizontalTopHide::state () const -{ - return ("GuidelineStateTemplateHorizontalTopHide"); -} - -void GuidelineStateTemplateHorizontalTopHide::updateWithLatestTransformation () -{ - if (context().transformation().transformIsDefined()) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING); - } -} diff --git a/src/Guideline/GuidelineStateTemplateHorizontalTopHide.h b/src/Guideline/GuidelineStateTemplateHorizontalTopHide.h deleted file mode 100644 index 6111b4f7..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalTopHide.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HIDE_H -#define GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HIDE_H - -#include "GuidelineStateTemplateHorizontalTopAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP -class GuidelineStateTemplateHorizontalTopHide : public GuidelineStateTemplateHorizontalTopAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateHorizontalTopHide(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateHorizontalTopHide(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateHorizontalTopHide(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HIDE_H diff --git a/src/Guideline/GuidelineStateTemplateHorizontalTopHover.cpp b/src/Guideline/GuidelineStateTemplateHorizontalTopHover.cpp deleted file mode 100644 index bde84814..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalTopHover.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateHorizontalTopHover.h" -#include "Logger.h" - -GuidelineStateTemplateHorizontalTopHover::GuidelineStateTemplateHorizontalTopHover (GuidelineStateContext &context) : - GuidelineStateTemplateHorizontalTopAbstract (context) -{ -} - -GuidelineStateTemplateHorizontalTopHover::~GuidelineStateTemplateHorizontalTopHover () -{ -} - -void GuidelineStateTemplateHorizontalTopHover::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalTopHover::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible(false) from Hide class - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemPen (guidelineFormat.colorDeployedHover (), - guidelineFormat.lineWidthHover ()); // Show -} - -bool GuidelineStateTemplateHorizontalTopHover::doPaint () const -{ - return true; -} - -void GuidelineStateTemplateHorizontalTopHover::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalTopHover::end"; -} - -void GuidelineStateTemplateHorizontalTopHover::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING -} - -void GuidelineStateTemplateHorizontalTopHover::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING); -} - -void GuidelineStateTemplateHorizontalTopHover::handleMousePress (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateHorizontalTopHover::handleMousePress"; - - GuidelineState stateNew = context().cartesian() ? - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_HOVER : - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER; - - handleMousePressCommon (posScene, - stateNew, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING); -} - -void GuidelineStateTemplateHorizontalTopHover::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HIDE); - } -} - -QString GuidelineStateTemplateHorizontalTopHover::state () const -{ - return ("GuidelineStateTemplateHorizontalTopHover"); -} - -void GuidelineStateTemplateHorizontalTopHover::updateWithLatestTransformation () -{ - // Noop -} diff --git a/src/Guideline/GuidelineStateTemplateHorizontalTopHover.h b/src/Guideline/GuidelineStateTemplateHorizontalTopHover.h deleted file mode 100644 index a843c1b4..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalTopHover.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HOVER_H -#define GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HOVER_H - -#include "GuidelineStateTemplateHorizontalTopAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP -class GuidelineStateTemplateHorizontalTopHover : public GuidelineStateTemplateHorizontalTopAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateHorizontalTopHover(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateHorizontalTopHover(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateHorizontalTopHover(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HOVER_H diff --git a/src/Guideline/GuidelineStateTemplateHorizontalTopLurking.cpp b/src/Guideline/GuidelineStateTemplateHorizontalTopLurking.cpp deleted file mode 100644 index 55bcb02a..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalTopLurking.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateHorizontalTopLurking.h" -#include "Logger.h" -#include "Transformation.h" - -GuidelineStateTemplateHorizontalTopLurking::GuidelineStateTemplateHorizontalTopLurking (GuidelineStateContext &context) : - GuidelineStateTemplateHorizontalTopAbstract (context) -{ -} - -GuidelineStateTemplateHorizontalTopLurking::~GuidelineStateTemplateHorizontalTopLurking () -{ -} - -void GuidelineStateTemplateHorizontalTopLurking::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalTopLurking::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible(false) from Hide class - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemPen (guidelineFormat.colorHidden (), - guidelineFormat.lineWidthHover ()); // Hide until hover entry -} - -bool GuidelineStateTemplateHorizontalTopLurking::doPaint () const -{ - return true; -} - -void GuidelineStateTemplateHorizontalTopLurking::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateHorizontalTopLurking::end"; -} - -void GuidelineStateTemplateHorizontalTopLurking::handleHoverEnterEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HOVER); -} - -void GuidelineStateTemplateHorizontalTopLurking::handleHoverLeaveEvent () -{ - // This event would have been handled by GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HOVER -} - -void GuidelineStateTemplateHorizontalTopLurking::handleMousePress (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateHorizontalTopLurking::handleMousePress"; - - GuidelineState stateNew = context().cartesian() ? - GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE : - GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE; - - handleMousePressCommon (posScene, - stateNew, - GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING); -} - -void GuidelineStateTemplateHorizontalTopLurking::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HIDE); - } -} - -QString GuidelineStateTemplateHorizontalTopLurking::state () const -{ - return ("GuidelineStateTemplateHorizontalTopLurking"); -} - -void GuidelineStateTemplateHorizontalTopLurking::updateWithLatestTransformation () -{ - if (!context().transformation().transformIsDefined()) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HIDE); - } -} diff --git a/src/Guideline/GuidelineStateTemplateHorizontalTopLurking.h b/src/Guideline/GuidelineStateTemplateHorizontalTopLurking.h deleted file mode 100644 index ee33de79..00000000 --- a/src/Guideline/GuidelineStateTemplateHorizontalTopLurking.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING_H -#define GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING_H - -#include "GuidelineStateTemplateHorizontalTopAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP -class GuidelineStateTemplateHorizontalTopLurking : public GuidelineStateTemplateHorizontalTopAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateHorizontalTopLurking(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateHorizontalTopLurking(); - - virtual void begin (); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateHorizontalTopLurking(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING_H diff --git a/src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.cpp b/src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.cpp deleted file mode 100644 index 0d42ba2b..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateVerticalLeftAbstract.h" -#include "Logger.h" - -GuidelineStateTemplateVerticalLeftAbstract::GuidelineStateTemplateVerticalLeftAbstract (GuidelineStateContext &context) : - GuidelineStateTemplateAbstract (context) -{ -} - -GuidelineStateTemplateVerticalLeftAbstract::~GuidelineStateTemplateVerticalLeftAbstract () -{ -} - -QLineF GuidelineStateTemplateVerticalLeftAbstract::templateHomeLine (const QRectF &sceneRect) -{ - return QLineF (sceneRect.bottomLeft(), - sceneRect.topLeft()); -} diff --git a/src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.h b/src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.h deleted file mode 100644 index e2a10e37..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalLeftAbstract.h +++ /dev/null @@ -1,28 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_ABSTRACT_H -#define GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_ABSTRACT_H - -#include "GuidelineStateTemplateAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT -class GuidelineStateTemplateVerticalLeftAbstract : public GuidelineStateTemplateAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateVerticalLeftAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateVerticalLeftAbstract(); - - /// Returns the geometry of a template guideline - static QLineF templateHomeLine (const QRectF &sceneRect); - -private: - GuidelineStateTemplateVerticalLeftAbstract(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateTemplateVerticalLeftHide.cpp b/src/Guideline/GuidelineStateTemplateVerticalLeftHide.cpp deleted file mode 100644 index fbe96e16..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalLeftHide.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateVerticalLeftHide.h" -#include "Logger.h" -#include "Transformation.h" - -GuidelineStateTemplateVerticalLeftHide::GuidelineStateTemplateVerticalLeftHide (GuidelineStateContext &context) : - GuidelineStateTemplateVerticalLeftAbstract (context) -{ -} - -GuidelineStateTemplateVerticalLeftHide::~GuidelineStateTemplateVerticalLeftHide () -{ -} - -void GuidelineStateTemplateVerticalLeftHide::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalLeftHide::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (false); // Stop hover and painting (doPoint only stops painting) -} - -bool GuidelineStateTemplateVerticalLeftHide::doPaint () const -{ - return false; -} - -void GuidelineStateTemplateVerticalLeftHide::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalLeftHide::end"; -} - -void GuidelineStateTemplateVerticalLeftHide::handleHoverEnterEvent () -{ - // Noop -} - -void GuidelineStateTemplateVerticalLeftHide::handleHoverLeaveEvent () -{ - // Noop -} - -void GuidelineStateTemplateVerticalLeftHide::handleMousePress (const QPointF & /* posScene */) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateVerticalLeftHide::handleMousePress"; -} - -void GuidelineStateTemplateVerticalLeftHide::handleVisibleChange (bool visible) -{ - if (visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING); - } -} - -QString GuidelineStateTemplateVerticalLeftHide::state () const -{ - return ("GuidelineStateTemplateVerticalLeftHide"); -} - -void GuidelineStateTemplateVerticalLeftHide::updateWithLatestTransformation () -{ - if (context().transformation().transformIsDefined()) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING); - } -} diff --git a/src/Guideline/GuidelineStateTemplateVerticalLeftHide.h b/src/Guideline/GuidelineStateTemplateVerticalLeftHide.h deleted file mode 100644 index e221ebe9..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalLeftHide.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HIDE_H -#define GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HIDE_H - -#include "GuidelineStateTemplateVerticalLeftAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT -class GuidelineStateTemplateVerticalLeftHide : public GuidelineStateTemplateVerticalLeftAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateVerticalLeftHide(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateVerticalLeftHide(); - - virtual void begin(); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateVerticalLeftHide(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HIDE_H diff --git a/src/Guideline/GuidelineStateTemplateVerticalLeftHover.cpp b/src/Guideline/GuidelineStateTemplateVerticalLeftHover.cpp deleted file mode 100644 index b6f19712..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalLeftHover.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateVerticalLeftHover.h" -#include "Logger.h" - -GuidelineStateTemplateVerticalLeftHover::GuidelineStateTemplateVerticalLeftHover (GuidelineStateContext &context) : - GuidelineStateTemplateVerticalLeftAbstract (context) -{ -} - -GuidelineStateTemplateVerticalLeftHover::~GuidelineStateTemplateVerticalLeftHover () -{ -} - -void GuidelineStateTemplateVerticalLeftHover::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalLeftHover::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible(false) from Hide class - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemPen (guidelineFormat.colorDeployedHover (), - guidelineFormat.lineWidthHover ()); // Show -} - -bool GuidelineStateTemplateVerticalLeftHover::doPaint () const -{ - return true; -} - -void GuidelineStateTemplateVerticalLeftHover::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalLeftHover::end"; -} - -void GuidelineStateTemplateVerticalLeftHover::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING -} - -void GuidelineStateTemplateVerticalLeftHover::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING); -} - -void GuidelineStateTemplateVerticalLeftHover::handleMousePress (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateVerticalLeftHover::handleMousePress"; - - GuidelineState stateNew = context().cartesian() ? - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER : - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER; - - handleMousePressCommon (posScene, - stateNew, - GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING); -} - -void GuidelineStateTemplateVerticalLeftHover::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HIDE); - } -} - -QString GuidelineStateTemplateVerticalLeftHover::state () const -{ - return ("GuidelineStateTemplateVerticalLeftHover"); -} - -void GuidelineStateTemplateVerticalLeftHover::updateWithLatestTransformation () -{ - // Noop -} diff --git a/src/Guideline/GuidelineStateTemplateVerticalLeftHover.h b/src/Guideline/GuidelineStateTemplateVerticalLeftHover.h deleted file mode 100644 index cacd5e42..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalLeftHover.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HOVER_H -#define GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HOVER_H - -#include "GuidelineStateTemplateVerticalLeftAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT -class GuidelineStateTemplateVerticalLeftHover : public GuidelineStateTemplateVerticalLeftAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateVerticalLeftHover(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateVerticalLeftHover(); - - virtual void begin(); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateVerticalLeftHover(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HOVER_H diff --git a/src/Guideline/GuidelineStateTemplateVerticalLeftLurking.cpp b/src/Guideline/GuidelineStateTemplateVerticalLeftLurking.cpp deleted file mode 100644 index 88d93510..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalLeftLurking.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateVerticalLeftLurking.h" -#include "Logger.h" -#include "Transformation.h" - -GuidelineStateTemplateVerticalLeftLurking::GuidelineStateTemplateVerticalLeftLurking (GuidelineStateContext &context) : - GuidelineStateTemplateVerticalLeftAbstract (context) -{ -} - -GuidelineStateTemplateVerticalLeftLurking::~GuidelineStateTemplateVerticalLeftLurking () -{ -} - -void GuidelineStateTemplateVerticalLeftLurking::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalLeftLurking::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible(false) from Hide class - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemPen (guidelineFormat.colorHidden (), - guidelineFormat.lineWidthHover ()); // Hide until hover entry -} - -bool GuidelineStateTemplateVerticalLeftLurking::doPaint () const -{ - return true; -} - -void GuidelineStateTemplateVerticalLeftLurking::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalLeftLurking::end"; -} - -void GuidelineStateTemplateVerticalLeftLurking::handleHoverEnterEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HOVER); -} - -void GuidelineStateTemplateVerticalLeftLurking::handleHoverLeaveEvent () -{ - // This event would have been handled by GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HOVER -} - -void GuidelineStateTemplateVerticalLeftLurking::handleMousePress (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateVerticalLeftLurking::handleMousePress"; - - GuidelineState stateNew = context().cartesian() ? - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE : - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE; - - handleMousePressCommon (posScene, - stateNew, - GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING); -} - -void GuidelineStateTemplateVerticalLeftLurking::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HIDE); - } -} - -QString GuidelineStateTemplateVerticalLeftLurking::state () const -{ - return ("GuidelineStateTemplateVerticalLeftLurking"); -} - -void GuidelineStateTemplateVerticalLeftLurking::updateWithLatestTransformation () -{ - if (!context().transformation().transformIsDefined()) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HIDE); - } -} diff --git a/src/Guideline/GuidelineStateTemplateVerticalLeftLurking.h b/src/Guideline/GuidelineStateTemplateVerticalLeftLurking.h deleted file mode 100644 index db5345b1..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalLeftLurking.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING_H -#define GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING_H - -#include "GuidelineStateTemplateVerticalLeftAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT -class GuidelineStateTemplateVerticalLeftLurking : public GuidelineStateTemplateVerticalLeftAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateVerticalLeftLurking(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateVerticalLeftLurking(); - - virtual void begin(); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateVerticalLeftLurking(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING_H diff --git a/src/Guideline/GuidelineStateTemplateVerticalRightAbstract.cpp b/src/Guideline/GuidelineStateTemplateVerticalRightAbstract.cpp deleted file mode 100644 index ef908fef..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalRightAbstract.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateVerticalRightAbstract.h" -#include "Logger.h" - -GuidelineStateTemplateVerticalRightAbstract::GuidelineStateTemplateVerticalRightAbstract (GuidelineStateContext &context) : - GuidelineStateTemplateAbstract (context) -{ -} - -GuidelineStateTemplateVerticalRightAbstract::~GuidelineStateTemplateVerticalRightAbstract () -{ -} - -QLineF GuidelineStateTemplateVerticalRightAbstract::templateHomeLine (const QRectF &sceneRect) -{ - return QLineF (sceneRect.bottomRight(), - sceneRect.topRight()); -} diff --git a/src/Guideline/GuidelineStateTemplateVerticalRightAbstract.h b/src/Guideline/GuidelineStateTemplateVerticalRightAbstract.h deleted file mode 100644 index cec9f1bc..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalRightAbstract.h +++ /dev/null @@ -1,28 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_ABSTRACT_H -#define GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_ABSTRACT_H - -#include "GuidelineStateTemplateAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT -class GuidelineStateTemplateVerticalRightAbstract : public GuidelineStateTemplateAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateVerticalRightAbstract(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateVerticalRightAbstract(); - - /// Returns the geometry of a template guideline - static QLineF templateHomeLine (const QRectF &sceneRect); - -private: - GuidelineStateTemplateVerticalRightAbstract(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_ABSTRACT_H diff --git a/src/Guideline/GuidelineStateTemplateVerticalRightHide.cpp b/src/Guideline/GuidelineStateTemplateVerticalRightHide.cpp deleted file mode 100644 index 013a8b9a..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalRightHide.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateVerticalRightHide.h" -#include "Logger.h" -#include "Transformation.h" - -GuidelineStateTemplateVerticalRightHide::GuidelineStateTemplateVerticalRightHide (GuidelineStateContext &context) : - GuidelineStateTemplateVerticalRightAbstract (context) -{ -} - -GuidelineStateTemplateVerticalRightHide::~GuidelineStateTemplateVerticalRightHide () -{ -} - -void GuidelineStateTemplateVerticalRightHide::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalRightHide::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (false); // Stop hover and painting (doPoint only stops painting) -} - -bool GuidelineStateTemplateVerticalRightHide::doPaint () const -{ - return false; -} - -void GuidelineStateTemplateVerticalRightHide::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalRightHide::end"; -} - -void GuidelineStateTemplateVerticalRightHide::handleHoverEnterEvent () -{ - // Noop -} - -void GuidelineStateTemplateVerticalRightHide::handleHoverLeaveEvent () -{ - // Noop -} - -void GuidelineStateTemplateVerticalRightHide::handleMousePress (const QPointF & /* posScene */) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateVerticalRightHide::handleMousePress"; -} - -void GuidelineStateTemplateVerticalRightHide::handleVisibleChange (bool visible) -{ - if (visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING); - } -} - -QString GuidelineStateTemplateVerticalRightHide::state () const -{ - return ("GuidelineStateTemplateVerticalRightHide"); -} - -void GuidelineStateTemplateVerticalRightHide::updateWithLatestTransformation () -{ - if (context().transformation().transformIsDefined()) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING); - } -} diff --git a/src/Guideline/GuidelineStateTemplateVerticalRightHide.h b/src/Guideline/GuidelineStateTemplateVerticalRightHide.h deleted file mode 100644 index 66b08038..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalRightHide.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HIDE_H -#define GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HIDE_H - -#include "GuidelineStateTemplateVerticalRightAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT -class GuidelineStateTemplateVerticalRightHide : public GuidelineStateTemplateVerticalRightAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateVerticalRightHide(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateVerticalRightHide(); - - virtual void begin(); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateVerticalRightHide(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HIDE_H diff --git a/src/Guideline/GuidelineStateTemplateVerticalRightHover.cpp b/src/Guideline/GuidelineStateTemplateVerticalRightHover.cpp deleted file mode 100644 index f87b0011..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalRightHover.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateVerticalRightHover.h" -#include "Logger.h" - -GuidelineStateTemplateVerticalRightHover::GuidelineStateTemplateVerticalRightHover (GuidelineStateContext &context) : - GuidelineStateTemplateVerticalRightAbstract (context) -{ -} - -GuidelineStateTemplateVerticalRightHover::~GuidelineStateTemplateVerticalRightHover () -{ -} - -void GuidelineStateTemplateVerticalRightHover::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalRightHover::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible(false) from Hide class - - GuidelineFormat guidelineFormat (context().color()); - - context().guideline().setGraphicsItemPen (guidelineFormat.colorDeployedHover (), - guidelineFormat.lineWidthHover ()); // Show -} - -bool GuidelineStateTemplateVerticalRightHover::doPaint () const -{ - return true; -} - -void GuidelineStateTemplateVerticalRightHover::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalRightHover::end"; -} - -void GuidelineStateTemplateVerticalRightHover::handleHoverEnterEvent () -{ - // This event would have been handled by GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING -} - -void GuidelineStateTemplateVerticalRightHover::handleHoverLeaveEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING); -} - -void GuidelineStateTemplateVerticalRightHover::handleMousePress (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateVerticalRightHover::handleMousePress"; - - GuidelineState stateNew = context().cartesian() ? - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_HOVER : - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_HOVER; - - handleMousePressCommon (posScene, - stateNew, - GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING); -} - -void GuidelineStateTemplateVerticalRightHover::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HIDE); - } -} - -QString GuidelineStateTemplateVerticalRightHover::state () const -{ - return ("GuidelineStateTemplateVerticalRightHover"); -} - -void GuidelineStateTemplateVerticalRightHover::updateWithLatestTransformation () -{ - // Noop -} diff --git a/src/Guideline/GuidelineStateTemplateVerticalRightHover.h b/src/Guideline/GuidelineStateTemplateVerticalRightHover.h deleted file mode 100644 index b0ad21fa..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalRightHover.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HOVER_H -#define GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HOVER_H - -#include "GuidelineStateTemplateVerticalRightAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT -class GuidelineStateTemplateVerticalRightHover : public GuidelineStateTemplateVerticalRightAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateVerticalRightHover(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateVerticalRightHover(); - - virtual void begin(); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateVerticalRightHover(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HOVER_H diff --git a/src/Guideline/GuidelineStateTemplateVerticalRightLurking.cpp b/src/Guideline/GuidelineStateTemplateVerticalRightLurking.cpp deleted file mode 100644 index d22344a1..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalRightLurking.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "GuidelineAbstract.h" -#include "GuidelineFormat.h" -#include "GuidelineStateContext.h" -#include "GuidelineStateTemplateVerticalRightLurking.h" -#include "Logger.h" -#include "Transformation.h" - -GuidelineStateTemplateVerticalRightLurking::GuidelineStateTemplateVerticalRightLurking (GuidelineStateContext &context) : - GuidelineStateTemplateVerticalRightAbstract (context) -{ -} - -GuidelineStateTemplateVerticalRightLurking::~GuidelineStateTemplateVerticalRightLurking () -{ -} - -void GuidelineStateTemplateVerticalRightLurking::begin () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalRightLurking::begin"; - - GuidelineStateTemplateAbstract::beginCommon (templateHomeLine(sceneRect ())); - - context().guideline().setGraphicsItemVisible (true); // Undo setVisible(false) from Hide class - - GuidelineFormat guidelineFormat (context().color ()); - - context().guideline().setGraphicsItemPen (guidelineFormat.colorHidden (), - guidelineFormat.lineWidthHover ()); // Hide until hover entry -} - -bool GuidelineStateTemplateVerticalRightLurking::doPaint () const -{ - return true; -} - -void GuidelineStateTemplateVerticalRightLurking::end () -{ - LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateTemplateVerticalRightLurking::end"; -} - -void GuidelineStateTemplateVerticalRightLurking::handleHoverEnterEvent () -{ - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HOVER); -} - -void GuidelineStateTemplateVerticalRightLurking::handleHoverLeaveEvent () -{ - // This event would have been handled by GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HOVER -} - -void GuidelineStateTemplateVerticalRightLurking::handleMousePress (const QPointF &posScene) -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateTemplateVerticalRightLurking::handleMousePress"; - - GuidelineState stateNew = context().cartesian() ? - GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE : - GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE; - - handleMousePressCommon (posScene, - stateNew, - GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING); -} - -void GuidelineStateTemplateVerticalRightLurking::handleVisibleChange (bool visible) -{ - if (!visible) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HIDE); - } -} - -QString GuidelineStateTemplateVerticalRightLurking::state () const -{ - return ("GuidelineStateTemplateVerticalRightLurking"); -} - -void GuidelineStateTemplateVerticalRightLurking::updateWithLatestTransformation () -{ - if (!context().transformation().transformIsDefined()) { - context().requestStateTransition(GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HIDE); - } -} diff --git a/src/Guideline/GuidelineStateTemplateVerticalRightLurking.h b/src/Guideline/GuidelineStateTemplateVerticalRightLurking.h deleted file mode 100644 index 5440f3c6..00000000 --- a/src/Guideline/GuidelineStateTemplateVerticalRightLurking.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING_H -#define GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING_H - -#include "GuidelineStateTemplateVerticalRightAbstract.h" - -/// Implements guideline behavior for GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT -class GuidelineStateTemplateVerticalRightLurking : public GuidelineStateTemplateVerticalRightAbstract -{ -public: - /// Single constructor. - GuidelineStateTemplateVerticalRightLurking(GuidelineStateContext &context); - virtual ~GuidelineStateTemplateVerticalRightLurking(); - - virtual void begin(); - virtual bool doPaint () const; - virtual void end (); - virtual void handleHoverEnterEvent (); - virtual void handleHoverLeaveEvent (); - virtual void handleMousePress (const QPointF &posScene); - virtual void handleVisibleChange (bool visible); - virtual QString state () const; - virtual void updateWithLatestTransformation(); - -private: - GuidelineStateTemplateVerticalRightLurking(); - -}; - -#endif // GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING_H diff --git a/src/Guideline/Guidelines.cpp b/src/Guideline/Guidelines.cpp deleted file mode 100644 index fc563e49..00000000 --- a/src/Guideline/Guidelines.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#include "CmdMediator.h" -#include "Document.h" -#include "DocumentModelCoords.h" -#include "EngaugeAssert.h" -#include "GuidelineAbstract.h" -#include "GuidelineEllipse.h" -#include "GuidelineLine.h" -#include "Guidelines.h" -#include "Logger.h" -#include "MainWindow.h" -#include "MainWindowModel.h" -#include -#include -#include -#include -#include - -Guidelines::Guidelines (MainWindow &mainWindow) : - m_mainWindow (mainWindow) -{ -} - -Guidelines::~Guidelines () -{ - clear (); -} - -void Guidelines::clear () -{ - QGraphicsScene *scene = nullptr; - - GuidelineContainerPrivate::iterator itr; - for (itr = m_guidelineContainer.begin(); itr != m_guidelineContainer.end(); itr++) { - GuidelineAbstract *guideline = *itr; - - if (scene == nullptr) { - scene = &guideline->scene(); - } - - guideline->removeFromScene (scene); - } - - m_guidelineContainer.clear (); -} - -ColorPalette Guidelines::color () const -{ - return m_mainWindow.modelMainWindow().guidelineColor(); -} - -CoordsType Guidelines::coordsType () const -{ - return m_mainWindow.cmdMediator()->document().modelCoords().coordsType(); -} - -GuidelineAbstract *Guidelines::createGuideline (GuidelineState stateInitial) -{ - // This method is used to create non-template Guidelines after the template Guidelines - // have been created. We grab the scene from the first Guideline in the list - ENGAUGE_ASSERT (m_guidelineContainer.size () > 0); - - GuidelineAbstract *guidelineFirst = m_guidelineContainer.at (0); - QGraphicsScene &scene = guidelineFirst->scene (); - - // Map of states that get an ellipse - QMap guidelineStatesWithEllipse; - guidelineStatesWithEllipse [GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE] = true; - guidelineStatesWithEllipse [GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HIDE] = true; - guidelineStatesWithEllipse [GUIDELINE_STATE_DEPLOYED_CONSTANT_R_HOVER] = true; - - GuidelineAbstract *guideline = nullptr; - - if (guidelineStatesWithEllipse.contains (stateInitial)) { - - guideline = new GuidelineEllipse (scene, - *this, - stateInitial); - - } else { - - guideline = new GuidelineLine (scene, - *this, - stateInitial); - - } - - ENGAUGE_CHECK_PTR (guideline); - - registerGuideline (guideline); - - return guideline; -} - -void Guidelines::handleActiveChange (bool active) -{ - GuidelineContainerPrivate::iterator itr; - for (itr = m_guidelineContainer.begin(); itr != m_guidelineContainer.end(); itr++) { - GuidelineAbstract *guideline = *itr; - - guideline->handleActiveChange (active); - } -} - -void Guidelines::handleVisibleChange (bool visible) -{ - GuidelineContainerPrivate::iterator itr; - for (itr = m_guidelineContainer.begin(); itr != m_guidelineContainer.end(); itr++) { - GuidelineAbstract *guideline = *itr; - - guideline->handleVisibleChange (visible); - } -} - -void Guidelines::initialize (QGraphicsScene &scene) -{ - GuidelineState stateVerticalLeft = GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_LURKING; - GuidelineState stateVerticalRight = GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_LURKING; - GuidelineState stateHorizontalTop = GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_LURKING; - GuidelineState stateHorizontalBottom = GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_LURKING; - - if (!transformation().transformIsDefined()) { - stateVerticalLeft = GUIDELINE_STATE_TEMPLATE_VERTICAL_LEFT_HIDE; - stateVerticalRight = GUIDELINE_STATE_TEMPLATE_VERTICAL_RIGHT_HIDE; - stateHorizontalTop = GUIDELINE_STATE_TEMPLATE_HORIZONTAL_TOP_HIDE; - stateHorizontalBottom = GUIDELINE_STATE_TEMPLATE_HORIZONTAL_BOTTOM_HIDE; - } - - registerGuideline (new GuidelineLine (scene, - *this, - stateVerticalLeft)); - registerGuideline (new GuidelineLine (scene, - *this, - stateVerticalRight)); - registerGuideline (new GuidelineLine (scene, - *this, - stateHorizontalTop)); - registerGuideline (new GuidelineLine (scene, - *this, - stateHorizontalBottom)); -} - -void Guidelines::registerGuideline (GuidelineAbstract *guideline) -{ - m_guidelineContainer.push_back (guideline); -} - -QString Guidelines::stateDump () const -{ - // Sort the entries - QStringList sorted; - GuidelineContainerPrivate::const_iterator itrSort; - for (itrSort = m_guidelineContainer.begin(); itrSort != m_guidelineContainer.end(); itrSort++) { - GuidelineAbstract *guideline = *itrSort; - - sorted << guideline->state(); - } - - qSort (sorted.begin(), - sorted.end()); - - // Convert entries to output text - QString out; - QTextStream str (&out); - - str << "Guidelines::stateDump:\n"; - - QStringList::const_iterator itrOut; - for (itrOut = sorted.begin(); itrOut != sorted.end(); itrOut++) { - QString entry = *itrOut; - - str << " " << entry << "\n"; - } - - return out; -} - -Transformation Guidelines::transformation() const -{ - return m_mainWindow.transformation (); -} - -void Guidelines::updateColor () -{ - GuidelineContainerPrivate::const_iterator itr; - for (itr = m_guidelineContainer.begin(); itr != m_guidelineContainer.end(); itr++) { - GuidelineAbstract *guideline = *itr; - - guideline->updateColor (); - } -} - -void Guidelines::updateWithLatestTransformation () -{ - GuidelineContainerPrivate::iterator itr; - for (itr = m_guidelineContainer.begin(); itr != m_guidelineContainer.end(); itr++) { - GuidelineAbstract *guideline = *itr; - guideline->updateWithLatestTransformation (); - } -} diff --git a/src/Guideline/Guidelines.h b/src/Guideline/Guidelines.h deleted file mode 100644 index fbcb48cb..00000000 --- a/src/Guideline/Guidelines.h +++ /dev/null @@ -1,78 +0,0 @@ -/****************************************************************************************************** - * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * - * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * - * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * - ******************************************************************************************************/ - -#ifndef GUIDELINES_H -#define GUIDELINES_H - -#include "ColorPalette.h" -#include "CoordsType.h" -#include "GuidelineState.h" -#include -#include -#include "Transformation.h" - -class DocumentModelCoords; -class GuidelineAbstract; -class MainWindow; -class QGraphicsScene; - -typedef QList GuidelineContainerPrivate; - -/// This class contains all Guideline objects -class Guidelines -{ -public: - /// Single constructor. - Guidelines(MainWindow &mainWindow); - ~Guidelines(); - - /// Remove guidelines since the current Document is about to be closed - void clear (); - - /// Color to be used for guidelines - ColorPalette color () const; - - /// Return cartesian or polar - CoordsType coordsType () const; - - /// Factory method for creating a new Guideline - GuidelineAbstract *createGuideline (GuidelineState stateInitial); - - /// DigitizeState change so active status may (or may not) be toggled - void handleActiveChange (bool active); - - /// User toggled guideline visibility - void handleVisibleChange (bool visible); - - /// Load the presupplied template guidelines at the four boundaries after the scene has been loaded. - /// We do not set the initial state as a function of external conditions since during loading those - /// conditions are not predictable - void initialize (QGraphicsScene &scene); - - /// States listed as a string for debugging only - QString stateDump () const; - - /// Return copy of transformation owned by MainWindow - Transformation transformation () const; - - /// Force a color update - void updateColor (); - - /// Update transformation. This is called after a command has been executed - void updateWithLatestTransformation (); - -private: - Guidelines(); - - /// Add a new Guideline to the global list maintained by this class - void registerGuideline (GuidelineAbstract *guideline); - - GuidelineContainerPrivate m_guidelineContainer; // Save for easy removal later - - MainWindow &m_mainWindow; -}; - -#endif // GUIDELINES_H diff --git a/src/engauge_test_template.pro b/src/engauge_test_template.pro index 61540cf9..d732531f 100644 --- a/src/engauge_test_template.pro +++ b/src/engauge_test_template.pro @@ -302,59 +302,6 @@ HEADERS += \ Grid/GridLog.h \ Grid/GridRemoval.h \ Grid/GridTriangleFill.h \ - Guideline/GuidelineAbstract.h \ - Guideline/GuidelineEllipse.h \ - Guideline/GuidelineFormat.h \ - Guideline/GuidelineLine.h \ - Guideline/GuidelineProjectorAbstract.h \ - Guideline/GuidelineProjectorConstantR.h \ - Guideline/GuidelineProjectorConstantT.h \ - Guideline/GuidelineProjectorConstantX.h \ - Guideline/GuidelineProjectorConstantY.h \ - Guideline/Guidelines.h \ - Guideline/GuidelineState.h \ - Guideline/GuidelineStateAbstractBase.h \ - Guideline/GuidelineStateContext.h \ - Guideline/GuidelineStateDeployedAbstract.h \ - Guideline/GuidelineStateDeployedConstantRAbstract.h \ - Guideline/GuidelineStateDeployedConstantRActive.h \ - Guideline/GuidelineStateDeployedConstantRHide.h \ - Guideline/GuidelineStateDeployedConstantRHover.h \ - Guideline/GuidelineStateDeployedConstantRLocked.h \ - Guideline/GuidelineStateDeployedConstantTAbstract.h \ - Guideline/GuidelineStateDeployedConstantTActive.h \ - Guideline/GuidelineStateDeployedConstantTHide.h \ - Guideline/GuidelineStateDeployedConstantTHover.h \ - Guideline/GuidelineStateDeployedConstantTLocked.h \ - Guideline/GuidelineStateDeployedConstantXAbstract.h \ - Guideline/GuidelineStateDeployedConstantXActive.h \ - Guideline/GuidelineStateDeployedConstantXHide.h \ - Guideline/GuidelineStateDeployedConstantXHover.h \ - Guideline/GuidelineStateDeployedConstantXLocked.h \ - Guideline/GuidelineStateDeployedConstantYAbstract.h \ - Guideline/GuidelineStateDeployedConstantYActive.h \ - Guideline/GuidelineStateDeployedConstantYHide.h \ - Guideline/GuidelineStateDeployedConstantYHover.h \ - Guideline/GuidelineStateDeployedConstantYLocked.h \ - Guideline/GuidelineStateDiscarded.h \ - Guideline/GuidelineStateHandle.h \ - Guideline/GuidelineStateTemplateAbstract.h \ - Guideline/GuidelineStateTemplateHorizontalBottomAbstract.h \ - Guideline/GuidelineStateTemplateHorizontalBottomHide.h \ - Guideline/GuidelineStateTemplateHorizontalBottomHover.h \ - Guideline/GuidelineStateTemplateHorizontalBottomLurking.h \ - Guideline/GuidelineStateTemplateHorizontalTopAbstract.h \ - Guideline/GuidelineStateTemplateHorizontalTopHide.h \ - Guideline/GuidelineStateTemplateHorizontalTopHover.h \ - Guideline/GuidelineStateTemplateHorizontalTopLurking.h \ - Guideline/GuidelineStateTemplateVerticalLeftAbstract.h \ - Guideline/GuidelineStateTemplateVerticalLeftHide.h \ - Guideline/GuidelineStateTemplateVerticalLeftHover.h \ - Guideline/GuidelineStateTemplateVerticalLeftLurking.h \ - Guideline/GuidelineStateTemplateVerticalRightAbstract.h \ - Guideline/GuidelineStateTemplateVerticalRightHide.h \ - Guideline/GuidelineStateTemplateVerticalRightHover.h \ - Guideline/GuidelineStateTemplateVerticalRightLurking.h \ Help/HelpBrowser.h \ Help/HelpWindow.h \ Import/ImportCropping.h \ @@ -706,58 +653,6 @@ SOURCES += \ Grid/GridLog.cpp \ Grid/GridRemoval.cpp \ Grid/GridTriangleFill.cpp \ - Guideline/GuidelineAbstract.cpp \ - Guideline/GuidelineEllipse.cpp \ - Guideline/GuidelineFormat.cpp \ - Guideline/GuidelineLine.cpp \ - Guideline/GuidelineProjectorAbstract.cpp \ - Guideline/GuidelineProjectorConstantR.cpp \ - Guideline/GuidelineProjectorConstantT.cpp \ - Guideline/GuidelineProjectorConstantX.cpp \ - Guideline/GuidelineProjectorConstantY.cpp \ - Guideline/Guidelines.cpp \ - Guideline/GuidelineStateAbstractBase.cpp \ - Guideline/GuidelineStateContext.cpp \ - Guideline/GuidelineStateDeployedAbstract.cpp \ - Guideline/GuidelineStateDeployedConstantRAbstract.cpp \ - Guideline/GuidelineStateDeployedConstantRActive.cpp \ - Guideline/GuidelineStateDeployedConstantRHide.cpp \ - Guideline/GuidelineStateDeployedConstantRHover.cpp \ - Guideline/GuidelineStateDeployedConstantRLocked.cpp \ - Guideline/GuidelineStateDeployedConstantTAbstract.cpp \ - Guideline/GuidelineStateDeployedConstantTActive.cpp \ - Guideline/GuidelineStateDeployedConstantTHide.cpp \ - Guideline/GuidelineStateDeployedConstantTHover.cpp \ - Guideline/GuidelineStateDeployedConstantTLocked.cpp \ - Guideline/GuidelineStateDeployedConstantXAbstract.cpp \ - Guideline/GuidelineStateDeployedConstantXActive.cpp \ - Guideline/GuidelineStateDeployedConstantXHide.cpp \ - Guideline/GuidelineStateDeployedConstantXHover.cpp \ - Guideline/GuidelineStateDeployedConstantXLocked.cpp \ - Guideline/GuidelineStateDeployedConstantYAbstract.cpp \ - Guideline/GuidelineStateDeployedConstantYActive.cpp \ - Guideline/GuidelineStateDeployedConstantYHide.cpp \ - Guideline/GuidelineStateDeployedConstantYHover.cpp \ - Guideline/GuidelineStateDeployedConstantYLocked.cpp \ - Guideline/GuidelineStateDiscarded.cpp \ - Guideline/GuidelineStateHandle.cpp \ - Guideline/GuidelineStateTemplateAbstract.cpp \ - Guideline/GuidelineStateTemplateHorizontalBottomAbstract.cpp \ - Guideline/GuidelineStateTemplateHorizontalBottomHide.cpp \ - Guideline/GuidelineStateTemplateHorizontalBottomHover.cpp \ - Guideline/GuidelineStateTemplateHorizontalBottomLurking.cpp \ - Guideline/GuidelineStateTemplateHorizontalTopAbstract.cpp \ - Guideline/GuidelineStateTemplateHorizontalTopHide.cpp \ - Guideline/GuidelineStateTemplateHorizontalTopHover.cpp \ - Guideline/GuidelineStateTemplateHorizontalTopLurking.cpp \ - Guideline/GuidelineStateTemplateVerticalLeftAbstract.cpp \ - Guideline/GuidelineStateTemplateVerticalLeftHide.cpp \ - Guideline/GuidelineStateTemplateVerticalLeftHover.cpp \ - Guideline/GuidelineStateTemplateVerticalLeftLurking.cpp \ - Guideline/GuidelineStateTemplateVerticalRightAbstract.cpp \ - Guideline/GuidelineStateTemplateVerticalRightHide.cpp \ - Guideline/GuidelineStateTemplateVerticalRightHover.cpp \ - Guideline/GuidelineStateTemplateVerticalRightLurking.cpp \ Help/HelpBrowser.cpp \ Help/HelpWindow.cpp \ Import/ImportCroppingUtilBase.cpp \ @@ -879,7 +774,6 @@ INCLUDEPATH += Background \ Ghosts \ Graphics \ Grid \ - Guideline \ Help \ img \ Import \ diff --git a/src/main/MainWindow.cpp b/src/main/MainWindow.cpp index 78972433..5cc987c7 100644 --- a/src/main/MainWindow.cpp +++ b/src/main/MainWindow.cpp @@ -162,7 +162,6 @@ MainWindow::MainWindow(const QString &errorReportFile, m_fileCmdScript (nullptr), m_isErrorReportRegressionTest (isRegressionTest), m_timerRegressionFileCmdScript(nullptr), - m_guidelines (*this), m_fittingCurve (nullptr), m_isExportOnly (isExportOnly), m_isExtractImageOnly (isExtractImageOnly), @@ -255,7 +254,6 @@ MainWindow::~MainWindow() delete m_dlgSettingsSegments; delete m_fileCmdScript; m_gridLines.clear (); - m_guidelines.clear (); } void MainWindow::addDockWindow (QDockWidget *dockWidget, @@ -829,32 +827,6 @@ void MainWindow::ghostsDestroy () m_ghosts = nullptr; } -bool MainWindow::guidelinesAreVisible () const -{ - return (guidelinesVisibilityCanBeEnabled () && - m_actionViewGuidelines->isChecked()); -} - -bool MainWindow::guidelinesVisibilityCanBeEnabled () const -{ - // Rules - // 1) We want guidelines to be available as soon as possible since users would probably never know about them otherwise, - // so action should be checked - // 2) We do not want to show guidelines until the transformation is working, since to show them earlier would probably mean - // they are aligned along the screen axes - but then when the transformation is working it would be impossible to - // meaningfully convert the old guidelines into the graph reference frame (unless the graph and screen axes happen - // to be parallel which is rarely the case). Note that m_actionViewGuidelines is disabled when the transformation - // is not defined - // 3) If transform is defined then file should also be, but we check to make sure - return (!m_currentFile.isEmpty() && - transformIsDefined()); -} - -void MainWindow::handleGuidelinesActiveChange (bool active) -{ - m_guidelines.handleActiveChange (active); -} - void MainWindow::handlerFileExtractImage () { LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::handlerFileExtractImage"; @@ -1568,8 +1540,6 @@ void MainWindow::setPixmap (const QString &curveSelected, m_cmdMediator->document().modelColorFilter(), pixmap, curveSelected); - - m_guidelines.initialize (*m_scene); } void MainWindow::settingsRead (bool isReset) @@ -2352,7 +2322,6 @@ void MainWindow::slotFileClose() setWindowTitle (engaugeWindowTitle ()); m_gridLines.clear(); - m_guidelines.clear(); updateControls(); } } @@ -2998,13 +2967,6 @@ void MainWindow::slotViewGroupStatus(QAction *action) } } -void MainWindow::slotViewGuidelines () -{ - LOG4CPP_DEBUG_S ((*mainCat)) << "MainWindow::slotViewGuidelines"; - - m_guidelines.handleVisibleChange (guidelinesAreVisible ()); -} - void MainWindow::slotViewToolBarBackground () { LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::slotViewToolBarBackground"; @@ -3426,7 +3388,6 @@ void MainWindow::updateControls () m_actionViewGridLines->setEnabled (false); m_actionViewGridLines->setChecked (false); } - m_actionViewGuidelines->setEnabled (guidelinesVisibilityCanBeEnabled ()); m_actionViewBackground->setEnabled (!m_currentFile.isEmpty()); m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->browserIsEmpty()); m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ()); @@ -3744,7 +3705,6 @@ void MainWindow::updateSettingsMainWindow() updateWindowTitle(); updateFittingWindow(); // Forward the drag and drop choice updateGeometryWindow(); // Forward the drag and drop choice - m_guidelines.updateColor (); } void MainWindow::updateSettingsMainWindow(const MainWindowModel &modelMainWindow) @@ -3803,8 +3763,6 @@ void MainWindow::updateTransformationAndItsDependencies() // Grid display is also affected by new transformation above, if there was a transition into defined state // in which case that transition triggered the initialization of the grid display parameters updateGridLines(); - - m_guidelines.updateWithLatestTransformation (); } void MainWindow::updateViewedCurves () diff --git a/src/main/MainWindow.h b/src/main/MainWindow.h index e349fe3d..e4834294 100644 --- a/src/main/MainWindow.h +++ b/src/main/MainWindow.h @@ -13,7 +13,6 @@ #include "DocumentAxesPointsRequired.h" #include "FittingCurveCoefficients.h" #include "GridLines.h" -#include "Guidelines.h" #include "MainWindowModel.h" #include #include @@ -160,12 +159,6 @@ class MainWindow : public QMainWindow /// Catch secret keypresses virtual bool eventFilter(QObject *, QEvent *); - - /// True/false if guidelines are visible. Selectability is handled elsewhere - bool guidelinesAreVisible () const; - - /// Handle Guidelines active status toggle - void handleGuidelinesActiveChange (bool active); /// Background image that has been filtered for the current curve. This asserts if a curve-specific image is not being shown QImage imageFiltered () const; @@ -348,7 +341,6 @@ private slots: void slotViewGroupBackground(QAction*); void slotViewGroupCurves(QAction*); void slotViewGroupStatus(QAction*); - void slotViewGuidelines (); void slotViewToolBarBackground (); void slotViewToolBarChecklistGuide (); void slotViewToolBarCoordSystem (); @@ -404,7 +396,6 @@ private slots: void filePaste (ImportType importType); /// Same steps as fileImport but with import from clipboard void ghostsCreate (); /// Create the ghosts for seeing all coordinate systems at once void ghostsDestroy (); /// Destroy the ghosts for seeing all coordinate systems at once - bool guidelinesVisibilityCanBeEnabled () const; /// True/false if guidelines can be activated by guidelines view action void handlerFileExtractImage (); /// Analog to slotFileExport but for image extract. Maybe converted to slot in future void loadCoordSystemListFromCmdMediator(); /// Update the combobox that has the CoordSystem list void loadCurveListFromCmdMediator(); /// Update the combobox that has the curve names. @@ -519,7 +510,6 @@ private slots: QAction *m_actionViewSettingsViews; QAction *m_actionViewToolTips; QAction *m_actionViewGridLines; - QAction *m_actionViewGuidelines; QMenu *m_menuViewBackground; QActionGroup *m_groupBackground; QAction *m_actionViewBackgroundNone; @@ -679,10 +669,6 @@ private slots: // Grid lines GridLines m_gridLines; - // Guidelines that are effectively invisible until cursor gets to outermost pixels in scene (and view if zoomed out - // enough that there is no scroll bar) - Guidelines m_guidelines; - // Map to/from/between zoom enumerations. These eliminate the need for switch statements QMap m_zoomMapFromInitial; QMap m_zoomMapToAction; diff --git a/src/main/MainWindowModel.cpp b/src/main/MainWindowModel.cpp index bb2c8fda..3305c104 100644 --- a/src/main/MainWindowModel.cpp +++ b/src/main/MainWindowModel.cpp @@ -27,7 +27,6 @@ bool DEFAULT_DRAG_DROP_EXPORT = false; // False value allows intuitive copy-and- int DEFAULT_SIGNIFICANT_DIGITS = 7; bool DEFAULT_SMALL_DIALOGS = false; bool DEFAULT_IMAGE_REPLACE_RENAMES_DOCUMENT = true; // Pre-version 11.3 behavior -ColorPalette DEFAULT_GUIDELINE_COLOR = COLOR_PALETTE_GREEN; // Bright so it gets noticed MainWindowModel::MainWindowModel() : m_zoomControl (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS), @@ -40,8 +39,7 @@ MainWindowModel::MainWindowModel() : m_smallDialogs (DEFAULT_SMALL_DIALOGS), m_dragDropExport (DEFAULT_DRAG_DROP_EXPORT), m_significantDigits (DEFAULT_SIGNIFICANT_DIGITS), - m_imageReplaceRenamesDocument (DEFAULT_IMAGE_REPLACE_RENAMES_DOCUMENT), - m_guidelineColor (DEFAULT_GUIDELINE_COLOR) + m_imageReplaceRenamesDocument (DEFAULT_IMAGE_REPLACE_RENAMES_DOCUMENT) { // Locale member variable m_locale is initialized to default locale when default constructor is called } @@ -58,8 +56,7 @@ MainWindowModel::MainWindowModel(const MainWindowModel &other) : m_smallDialogs (other.smallDialogs()), m_dragDropExport (other.dragDropExport()), m_significantDigits (other.significantDigits()), - m_imageReplaceRenamesDocument (other.imageReplaceRenamesDocument()), - m_guidelineColor (other.guidelineColor()) + m_imageReplaceRenamesDocument (other.imageReplaceRenamesDocument()) { } @@ -77,7 +74,6 @@ MainWindowModel &MainWindowModel::operator=(const MainWindowModel &other) m_dragDropExport = other.dragDropExport(); m_significantDigits = other.significantDigits(); m_imageReplaceRenamesDocument = other.imageReplaceRenamesDocument(); - m_guidelineColor = other.guidelineColor(); return *this; } @@ -87,11 +83,6 @@ bool MainWindowModel::dragDropExport() const return m_dragDropExport; } -ColorPalette MainWindowModel::guidelineColor() const -{ - return m_guidelineColor; -} - double MainWindowModel::highlightOpacity() const { return m_highlightOpacity; @@ -169,7 +160,6 @@ void MainWindowModel::printStream(QString indentation, str << indentation << "dragDropExport=" << (m_dragDropExport ? "yes" : "no") << "\n"; str << indentation << "significantDigits=" << m_significantDigits << "\n"; str << indentation << "imageReplaceRenamesDocument=" << (m_imageReplaceRenamesDocument ? "yes" : "no") << "\n"; - str << indentation << "guidelineColor=" << colorPaletteToString (m_guidelineColor).toLatin1().data() << "\n"; } void MainWindowModel::saveXml(QXmlStreamWriter &writer) const @@ -185,11 +175,6 @@ void MainWindowModel::setDragDropExport(bool dragDropExport) m_dragDropExport = dragDropExport; } -void MainWindowModel::setGuidelineColor(ColorPalette guidelineColor) -{ - m_guidelineColor = guidelineColor; -} - void MainWindowModel::setHighlightOpacity(double highlightOpacity) { m_highlightOpacity = highlightOpacity; diff --git a/src/main/MainWindowModel.h b/src/main/MainWindowModel.h index 2f1bec14..82b3614a 100644 --- a/src/main/MainWindowModel.h +++ b/src/main/MainWindowModel.h @@ -22,7 +22,6 @@ extern bool DEFAULT_DRAG_DROP_EXPORT; extern int DEFAULT_SIGNIFICANT_DIGITS; extern bool DEFAULT_SMALL_DIALOGS; extern bool DEFAULT_IMAGE_REPLACE_RENAMES_DOCUMENT; -extern ColorPalette DEFAULT_GUIDELINE_COLOR; /// Model for DlgSettingsMainWindow. Unlike the other models (DocumentModel*) this data is not saved and /// loaded within the document, so no xml or working with the Document class is involved. Also, there is @@ -43,9 +42,6 @@ class MainWindowModel : public DocumentModelAbstractBase /// Get method for drag and drop export bool dragDropExport () const; - /// Get method for guideline color - ColorPalette guidelineColor () const; - /// Get method for highlight opacity double highlightOpacity() const; @@ -78,9 +74,6 @@ class MainWindowModel : public DocumentModelAbstractBase /// Set method for drag and drop export void setDragDropExport (bool dragDropExport); - /// Set method for guideline color - void setGuidelineColor (ColorPalette guidelineColor); - /// Set method for highlight opacity void setHighlightOpacity (double highlightOpacity); @@ -144,7 +137,6 @@ class MainWindowModel : public DocumentModelAbstractBase bool m_dragDropExport; int m_significantDigits; bool m_imageReplaceRenamesDocument; - ColorPalette m_guidelineColor; }; #endif // MAIN_WINDOW_MODEL_H diff --git a/src/util/ZValues.cpp b/src/util/ZValues.cpp index db20484d..b295d475 100644 --- a/src/util/ZValues.cpp +++ b/src/util/ZValues.cpp @@ -9,8 +9,4 @@ const int Z_VALUE_BACKGROUND = 0; const int Z_VALUE_CURVE = 200; const int Z_VALUE_CURVE_ENDPOINT = 201; -const int Z_VALUE_GUIDELINE_DEPLOYED = 302; -const int Z_VALUE_GUIDELINE_DISCARDED = 300; -const int Z_VALUE_GUIDELINE_HANDLE = 303; -const int Z_VALUE_GUIDELINE_TEMPLATE = 301; const int Z_VALUE_POINT = 400; diff --git a/src/util/ZValues.h b/src/util/ZValues.h index 69fe6380..86302a06 100644 --- a/src/util/ZValues.h +++ b/src/util/ZValues.h @@ -12,10 +12,6 @@ extern const int Z_VALUE_BACKGROUND; extern const int Z_VALUE_CURVE; extern const int Z_VALUE_CURVE_ENDPOINT; extern const int Z_VALUE_GRID; -extern const int Z_VALUE_GUIDELINE_DEPLOYED; -extern const int Z_VALUE_GUIDELINE_DISCARDED; -extern const int Z_VALUE_GUIDELINE_HANDLE; -extern const int Z_VALUE_GUIDELINE_TEMPLATE; extern const int Z_VALUE_POINT; #endif // Z_VALUES_H