Use VAbstractPattern in tools.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-06-16 18:01:17 +03:00
parent 67dbe7409f
commit fab30e999f
10 changed files with 23 additions and 22 deletions

View File

@ -131,7 +131,7 @@ void VDrawTool::SaveDialogChange()
SaveDialog(newDomElement); SaveDialog(newDomElement);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id); SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(saveOptions); qApp->getUndoStack()->push(saveOptions);
} }
else else
@ -182,7 +182,7 @@ void VDrawTool::SaveOption(QSharedPointer<VGObject> &obj)
SaveOptions(newDomElement, obj); SaveOptions(newDomElement, obj);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id); SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(saveOptions); qApp->getUndoStack()->push(saveOptions);
} }
else else

View File

@ -136,7 +136,7 @@ void VToolPoint::NameChangePosition(const QPointF &pos)
void VToolPoint::UpdateNamePosition(qreal mx, qreal my) void VToolPoint::UpdateNamePosition(qreal mx, qreal my)
{ {
MoveLabel *moveLabel = new MoveLabel(doc, mx, my, id, this->scene()); MoveLabel *moveLabel = new MoveLabel(doc, mx, my, id, this->scene());
connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveLabel); qApp->getUndoStack()->push(moveLabel);
} }

View File

@ -146,7 +146,7 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
QPointF newPos = value.toPointF(); QPointF newPos = value.toPointF();
MoveSPoint *moveSP = new MoveSPoint(doc, newPos.x(), newPos.y(), id, this->scene()); MoveSPoint *moveSP = new MoveSPoint(doc, newPos.x(), newPos.y(), id, this->scene());
connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSP); qApp->getUndoStack()->push(moveSP);
} }
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);

View File

@ -253,7 +253,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
} }
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene()); MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSpl); qApp->getUndoStack()->push(moveSpl);
} }
@ -416,7 +416,7 @@ void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
VSpline spl = VSpline(spline->GetP1(), p2, p3, spline->GetP4(), spline->GetKcurve()); VSpline spl = VSpline(spline->GetP1(), p2, p3, spline->GetP4(), spline->GetKcurve());
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene()); MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSpl); qApp->getUndoStack()->push(moveSpl);
} }

View File

@ -211,7 +211,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
UpdateControlPoints(spl, newSplPath, indexSpline); UpdateControlPoints(spl, newSplPath, indexSpline);
MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene()); MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene());
connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSplPath); qApp->getUndoStack()->push(moveSplPath);
} }
@ -493,7 +493,7 @@ void VToolSplinePath::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
UpdateControlPoints(spl, newSplPath, indexSpline); UpdateControlPoints(spl, newSplPath, indexSpline);
MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene()); MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene());
connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveSplPath); qApp->getUndoStack()->push(moveSplPath);
} }

View File

@ -111,13 +111,13 @@ const QString VAbstractTool::ColorYellow = QStringLiteral("yellow");
* @param id object id in container. * @param id object id in container.
* @param parent parent object. * @param parent parent object.
*/ */
VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent) VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), vis(nullptr) :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), vis(nullptr)
{ {
SCASSERT(doc != nullptr); SCASSERT(doc != nullptr);
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange); connect(this, &VAbstractTool::toolhaveChange, this->doc, &VAbstractPattern::haveLiteChange);
connect(this->doc, &VPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile); connect(this->doc, &VAbstractPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile);
connect(this, &VAbstractTool::LiteUpdateTree, this->doc, &VPattern::LiteParseTree); connect(this, &VAbstractTool::LiteUpdateTree, this->doc, &VAbstractPattern::LiteParseTree);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -141,7 +141,7 @@ void VAbstractTool::DeleteTool(bool ask)
} }
} }
DelTool *delTool = new DelTool(doc, id); DelTool *delTool = new DelTool(doc, id);
connect(delTool, &DelTool::NeedFullParsing, doc, &VPattern::NeedFullParsing); connect(delTool, &DelTool::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
qApp->getUndoStack()->push(delTool); qApp->getUndoStack()->push(delTool);
} }
} }
@ -333,7 +333,7 @@ const QStringList VAbstractTool::StylesList()
* @param toolType tool type * @param toolType tool type
* @param doc dom document container * @param doc dom document container
*/ */
void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VPattern *doc) void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc)
{ {
QVector<VToolRecord> *history = doc->getHistory(); QVector<VToolRecord> *history = doc->getHistory();
VToolRecord record = VToolRecord(id, toolType, doc->GetNameActivPP()); VToolRecord record = VToolRecord(id, toolType, doc->GetNameActivPP());

View File

@ -30,7 +30,7 @@
#define VABSTRACTTOOL_H #define VABSTRACTTOOL_H
#include "vdatatool.h" #include "vdatatool.h"
#include "../xml/vpattern.h" #include "../../libs/ifc/xml/vabstractpattern.h"
#include "../core/vapplication.h" #include "../core/vapplication.h"
#include "../libs/vwidgets/vmaingraphicsscene.h" #include "../libs/vwidgets/vmaingraphicsscene.h"
#include "../visualization/visualization.h" #include "../visualization/visualization.h"
@ -51,7 +51,7 @@ class VAbstractTool: public VDataTool
{ {
Q_OBJECT Q_OBJECT
public: public:
VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr); VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr);
virtual ~VAbstractTool(); virtual ~VAbstractTool();
quint32 getId() const; quint32 getId() const;
static const QString AttrType; static const QString AttrType;
@ -124,7 +124,7 @@ public:
static const QStringList Colors(); static const QStringList Colors();
static QMap<QString, QString> ColorsList(); static QMap<QString, QString> ColorsList();
static void AddRecord(const quint32 id, const Tool &toolType, VPattern *doc); static void AddRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc);
const VContainer *getData() const; const VContainer *getData() const;
@ -153,7 +153,7 @@ signals:
void LiteUpdateTree(const Document &parse); void LiteUpdateTree(const Document &parse);
protected: protected:
/** @brief doc dom document container */ /** @brief doc dom document container */
VPattern *doc; VAbstractPattern *doc;
/** @brief id object id. */ /** @brief id object id. */
const quint32 id; const quint32 id;

View File

@ -264,7 +264,7 @@ void VToolDetail::FullUpdateFromGuiOk(int result)
VDetail oldDet = VAbstractTool::data.GetDetail(id); VDetail oldDet = VAbstractTool::data.GetDetail(id);
SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene());
connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(saveCommand); qApp->getUndoStack()->push(saveCommand);
} }
delete dialog; delete dialog;
@ -335,7 +335,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
QPointF newPos = value.toPointF(); QPointF newPos = value.toPointF();
MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id, this->scene()); MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id, this->scene());
connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VPattern::LiteParseTree); connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveDet); qApp->getUndoStack()->push(moveDet);
} }

View File

@ -53,7 +53,7 @@ void AddToCalc::undo()
doc->setCursor(cursor); doc->setCursor(cursor);
QDomElement calcElement; QDomElement calcElement;
if (doc->GetActivNodeElement(VPattern::TagCalculation, calcElement)) if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement))
{ {
QDomElement domElement = doc->elementById(nodeId); QDomElement domElement = doc->elementById(nodeId);
if (domElement.isElement()) if (domElement.isElement())
@ -93,7 +93,7 @@ void AddToCalc::redo()
doc->setCursor(cursor); doc->setCursor(cursor);
QDomElement calcElement; QDomElement calcElement;
if (doc->GetActivNodeElement(VPattern::TagCalculation, calcElement)) if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement))
{ {
if (cursor <= 0) if (cursor <= 0)
{ {

View File

@ -205,6 +205,7 @@ signals:
void SetCurrentPP(const QString &patterPiece); void SetCurrentPP(const QString &patterPiece);
public slots: public slots:
virtual void LiteParseTree(const Document &parse)=0;
void haveLiteChange(); void haveLiteChange();
void ShowHistoryTool(quint32 id, bool enable); void ShowHistoryTool(quint32 id, bool enable);
void NeedFullParsing(); void NeedFullParsing();