QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RMixedOperation.h
Go to the documentation of this file.
1
20#ifndef RMIXEDOPERATION_H
21#define RMIXEDOPERATION_H
22
23#include "operations_global.h"
24
25#include <QList>
26#include <QSharedPointer>
27#include <QFlags>
28
29#include "ROperation.h"
30
31class RDocument;
32class RObject;
33class RTransaction;
34
43public:
44 enum Mode {
45 NoMode = 0x0,
46 UseCurrentAttributes = 0x1,
47 Delete = 0x2,
48 ForceNew = 0x4,
49 EndCycle = 0x8
50 };
51 Q_DECLARE_FLAGS(Modes, Mode)
52
53public:
54 RMixedOperation(bool undoable = true);
55 virtual ~RMixedOperation() {
56 RDebug::decCounter("RMixedOperation");
57 }
58
59 QSharedPointer<RObject> addObject(const QSharedPointer<RObject>& obj,
60 bool useCurrentAttributes = true, bool forceNew=false);
61 void deleteObject(const QSharedPointer<RObject>& obj);
62 void endCycle();
63
64 virtual RTransaction apply(RDocument& document, bool preview = false);
65
66// int getPreviewCounter() const {
67// return previewCounter;
68// }
69
70// void setLimitPreview(bool on) {
71// limitPreview = on;
72// }
73
74protected:
75 void setMode(RMixedOperation::Modes& modes, RMixedOperation::Mode mode, bool on = true);
76 bool getMode(const RMixedOperation::Modes& modes, RMixedOperation::Mode mode) const;
77
78private:
79 QList<QPair<QSharedPointer<RObject>, Modes> > list;
80// int previewCounter;
81// bool limitPreview;
82};
83
84Q_DECLARE_OPERATORS_FOR_FLAGS(RMixedOperation::Modes)
87
88#endif
Q_DECLARE_METATYPE(RMath *)
Deletes all selected entities of the current document.
Definition Delete.js:11
static void decCounter(const QString &id=RDEFAULT_QSTRING)
Definition RDebug.cpp:131
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
Implementation of an operation that adds, modifies and deletes entities.
Definition RMixedOperation.h:42
Mode
Definition RMixedOperation.h:44
virtual ~RMixedOperation()
Definition RMixedOperation.h:55
QList< QPair< QSharedPointer< RObject >, Modes > > list
Definition RMixedOperation.h:79
Abstract base class for all objects.
Definition RObject.h:64
This abstract class is an interface for all operation implementations.
Definition ROperation.h:45
virtual RTransaction apply(RDocument &document, bool preview=false)=0
Applies this operation to selection in the given document.
Transaction implementation.
Definition RTransaction.h:73
void deleteObject(void obj)
Deletes the given RObject from the drawing.
Definition simple_create.js:216
void addObject(void obj)
Adds the given RObject to the drawing.
Definition simple_create.js:97
#define QCADOPERATIONS_EXPORT
Definition operations_global.h:10