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
|
|
|
|
|
|
|
|
#include <QUndoCommand>
|
|
|
|
#include <QDomElement>
|
2015-04-01 14:51:54 +02:00
|
|
|
|
2015-06-18 19:23:24 +02:00
|
|
|
#include "../../vmisc/logging.h"
|
|
|
|
#include "../../ifc/xml/vabstractpattern.h"
|
2014-08-04 15:37:36 +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,
|
2014-06-14 08:37:25 +02:00
|
|
|
MoveDetail,
|
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,
|
|
|
|
RotationMoveLabel
|
2014-06-11 19:12:46 +02:00
|
|
|
};
|
|
|
|
|
2014-07-16 14:37:38 +02:00
|
|
|
class VPattern;
|
2016-03-08 18:49:16 +01:00
|
|
|
class VNodeDetail;
|
2014-07-16 14:37:38 +02:00
|
|
|
|
|
|
|
class VUndoCommand : public QObject, public QUndoCommand
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-06-16 10:30:25 +02:00
|
|
|
VUndoCommand(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = 0);
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual ~VUndoCommand() Q_DECL_OVERRIDE;
|
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
|
|
|
|
|
|
|
void IncrementReferences(const QVector<VNodeDetail> &nodes) const;
|
|
|
|
void DecrementReferences(const QVector<VNodeDetail> &nodes) const;
|
2014-07-16 14:37:38 +02:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VUndoCommand)
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VUNDOCOMMAND_H
|