1 /************************************************************************
2  **
3  **  @file   toggledetailinlayout.h
4  **  @author Roman Telezhynskyi <dismine(at)gmail.com>
5  **  @date   25 6, 2016
6  **
7  **  @brief
8  **  @copyright
9  **  This source code is part of the Valentina project, a pattern making
10  **  program, whose allow create and modeling patterns of clothing.
11  **  Copyright (C) 2016 Valentina project
12  **  <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
13  **
14  **  Valentina is free software: you can redistribute it and/or modify
15  **  it under the terms of the GNU General Public License as published by
16  **  the Free Software Foundation, either version 3 of the License, or
17  **  (at your option) any later version.
18  **
19  **  Valentina is distributed in the hope that it will be useful,
20  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  **  GNU General Public License for more details.
23  **
24  **  You should have received a copy of the GNU General Public License
25  **  along with Valentina.  If not, see <http://www.gnu.org/licenses/>.
26  **
27  *************************************************************************/
28 
29 #ifndef TOGGLEDETAILINLAYOUT_H
30 #define TOGGLEDETAILINLAYOUT_H
31 
32 #include <qcompilerdetection.h>
33 #include <QMetaObject>
34 #include <QObject>
35 #include <QString>
36 #include <QtGlobal>
37 
38 #include "vundocommand.h"
39 
40 class TogglePieceInLayout : public VUndoCommand
41 {
42     Q_OBJECT
43 public:
44     TogglePieceInLayout(quint32 id, bool state, VContainer *data, VAbstractPattern *doc,
45                         QUndoCommand *parent = nullptr);
46     virtual ~TogglePieceInLayout() = default;
47     virtual void undo() override;
48     virtual void redo() override;
49 signals:
50     void Toggled(quint32 id);
51 private:
52     Q_DISABLE_COPY(TogglePieceInLayout)
53     quint32     m_id;
54     VContainer *m_data;
55     bool        m_oldState;
56     bool        m_newState;
57 
58     void Do(bool state);
59 };
60 
61 enum class ForceForbidFlippingType : qint8 {ForceFlipping, ForbidFlipping};
62 
63 class TogglePieceForceForbidFlipping : public VUndoCommand
64 {
65     Q_OBJECT
66 public:
67     TogglePieceForceForbidFlipping(quint32 id, bool state, ForceForbidFlippingType type, VContainer *data,
68                                    VAbstractPattern *doc, QUndoCommand *parent = nullptr);
69     virtual ~TogglePieceForceForbidFlipping() = default;
70     virtual void undo() override;
71     virtual void redo() override;
72 private:
73     Q_DISABLE_COPY(TogglePieceForceForbidFlipping)
74     quint32     m_id;
75     VContainer *m_data;
76     ForceForbidFlippingType m_type;
77     bool        m_oldForceState;
78     bool        m_newForceState;
79     bool        m_oldForbidState;
80     bool        m_newForbidState;
81 };
82 
83 #endif // TOGGLEDETAILINLAYOUT_H
84