Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GuidelineDragCommandFactory Class Reference

Determine if inputs that were collected after a Guideline drag should result in a Cmd to move or Cmd to delete, and then generate the appropriate Cmd. More...

#include <GuidelineDragCommandFactory.h>

Collaboration diagram for GuidelineDragCommandFactory:
Collaboration graph

Public Member Functions

 GuidelineDragCommandFactory ()
 Single constructor.
 
CmdAbstractcreateAfterDrag (MainWindow &mainWindow, Document &document, double newValue, const DocumentModelGuidelines &modelGuidelinesDocument, const QString &identifier, bool draggedOffscreen)
 Create delete or move Cmd.
 

Detailed Description

Determine if inputs that were collected after a Guideline drag should result in a Cmd to move or Cmd to delete, and then generate the appropriate Cmd.

Definition at line 21 of file GuidelineDragCommandFactory.h.

Constructor & Destructor Documentation

◆ GuidelineDragCommandFactory()

GuidelineDragCommandFactory::GuidelineDragCommandFactory ( )

Single constructor.

Definition at line 18 of file GuidelineDragCommandFactory.cpp.

19{
20}

Member Function Documentation

◆ createAfterDrag()

CmdAbstract * GuidelineDragCommandFactory::createAfterDrag ( MainWindow & mainWindow,
Document & document,
double newValue,
const DocumentModelGuidelines & modelGuidelinesDocument,
const QString & identifier,
bool draggedOffscreen )

Create delete or move Cmd.

The selected Cmd will act on the document Guidelines to make that set consistent with the displayed Guidelines (which includes the just-moved Guideline)

Definition at line 22 of file GuidelineDragCommandFactory.cpp.

28{
29 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineDragCommandFactory::GuidelineDragCommandFactory";
30
33
34 // So which Guideline moved?
35 double valueBefore = valueForIdentifier (modelGuidelinesDocument,
36 identifier);
37
38 // What type was the Guideline?
39 bool isXT = isXTForIdentifier (modelGuidelinesDocument,
40 identifier);
41
42 CmdAbstract *cmd = nullptr;
43
44 if (draggedOffscreen) {
45
46 // Delete
47 if (isXT) {
48 cmd = new CmdGuidelineRemoveXT(mainWindow,
49 document,
50 identifier,
52 } else {
53 cmd = new CmdGuidelineRemoveYR(mainWindow,
54 document,
55 identifier,
57 }
58 } else {
59
60 // Move
61 if (isXT) {
62 cmd = new CmdGuidelineMoveXT(mainWindow,
63 document,
64 identifier,
67 } else {
68 cmd = new CmdGuidelineMoveYR(mainWindow,
69 document,
70 identifier,
73 }
74 }
75
76 return cmd;
77}
const int INNER_RADIUS_MIN
QMap< QString, double > GuidelineValues
log4cpp::Category * mainCat
Definition Logger.cpp:14
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition CmdAbstract.h:20
Command for moving one X/T Guideline value.
Command for moving one Y/R Guideline value.
Command for removing one X/T Guideline value.
Command for removing one Y/R Guideline value.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

The documentation for this class was generated from the following files: