2014-06-11 19:12:46 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
2014-07-16 14:37:38 +02:00
|
|
|
** @file vundocommand.h
|
2014-06-11 19:12:46 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2014-07-16 14:37:38 +02:00
|
|
|
** @date 16 7, 2014
|
2014-06-11 19:12:46 +02:00
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2014-06-11 19:12:46 +02:00
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
2014-07-16 14:37:38 +02:00
|
|
|
#ifndef VUNDOCOMMAND_H
|
|
|
|
#define VUNDOCOMMAND_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
2014-07-16 14:37:38 +02:00
|
|
|
#include <QDomElement>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QUndoCommand>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
2015-04-01 14:51:54 +02:00
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "../ifc/xml/vabstractpattern.h"
|
2016-08-09 15:55:46 +02:00
|
|
|
#include "../vmisc/logging.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
|
2014-11-24 14:03:34 +01:00
|
|
|
Q_DECLARE_LOGGING_CATEGORY(vUndo)
|
|
|
|
|
2014-06-11 19:12:46 +02:00
|
|
|
enum class UndoCommand: char { AddPatternPiece,
|
|
|
|
AddToCalc,
|
|
|
|
MoveSpline,
|
|
|
|
MoveSplinePath,
|
|
|
|
MoveSPoint,
|
2014-06-12 15:38:28 +02:00
|
|
|
SaveToolOptions,
|
2014-06-13 12:29:23 +02:00
|
|
|
SaveDetailOptions,
|
2016-11-09 13:11:58 +01:00
|
|
|
SavePieceOptions,
|
2016-11-28 09:47:36 +01:00
|
|
|
SavePiecePathOptions,
|
2016-11-09 12:06:05 +01:00
|
|
|
MovePiece,
|
2014-06-14 15:10:16 +02:00
|
|
|
DeleteTool,
|
2014-07-17 14:41:48 +02:00
|
|
|
DeletePatternPiece,
|
2014-12-25 12:33:27 +01:00
|
|
|
RenamePP,
|
2015-06-24 16:30:07 +02:00
|
|
|
MoveLabel,
|
2016-05-13 15:50:30 +02:00
|
|
|
MoveDoubleLabel,
|
2016-06-26 13:36:12 +02:00
|
|
|
RotationMoveLabel,
|
2016-11-09 14:53:22 +01:00
|
|
|
TogglePieceInLayout
|
2014-06-11 19:12:46 +02:00
|
|
|
};
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
class VPattern;
|
2014-07-16 14:37:38 +02:00
|
|
|
|
|
|
|
class VUndoCommand : public QObject, public QUndoCommand
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-07-05 18:35:34 +02:00
|
|
|
VUndoCommand(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = nullptr);
|
2017-08-03 14:25:14 +02:00
|
|
|
virtual ~VUndoCommand() =default;
|
2014-07-16 14:37:38 +02:00
|
|
|
signals:
|
|
|
|
void ClearScene();
|
|
|
|
void NeedFullParsing();
|
2014-08-04 15:37:36 +02:00
|
|
|
void NeedLiteParsing(const Document &parse);
|
2014-07-16 14:37:38 +02:00
|
|
|
protected:
|
2014-11-10 15:49:39 +01:00
|
|
|
QDomElement xml;
|
2015-06-16 10:30:25 +02:00
|
|
|
VAbstractPattern *doc;
|
2014-11-10 15:49:39 +01:00
|
|
|
quint32 nodeId;
|
|
|
|
bool redoFlag;
|
|
|
|
virtual void RedoFullParsing();
|
|
|
|
void UndoDeleteAfterSibling(QDomNode &parentNode, const quint32 &siblingId) const;
|
2016-03-08 18:49:16 +01:00
|
|
|
|
2016-11-25 15:12:33 +01:00
|
|
|
void IncrementReferences(const QVector<quint32> &nodes) const;
|
|
|
|
void DecrementReferences(const QVector<quint32> &nodes) const;
|
|
|
|
|
|
|
|
void IncrementReferences(const QVector<CustomSARecord> &nodes) const;
|
|
|
|
void DecrementReferences(const QVector<CustomSARecord> &nodes) const;
|
|
|
|
|
2016-11-09 13:11:58 +01:00
|
|
|
void IncrementReferences(const QVector<VPieceNode> &nodes) const;
|
2016-11-08 11:54:33 +01:00
|
|
|
void DecrementReferences(const QVector<VPieceNode> &nodes) const;
|
2017-09-20 11:10:57 +02:00
|
|
|
|
|
|
|
QDomElement GetDestinationObject(quint32 idTool, quint32 idPoint) const;
|
2014-07-16 14:37:38 +02:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VUndoCommand)
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VUNDOCOMMAND_H
|