~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to krita/plugins/tools/tool_transform2/tool_transform_commands.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  tool_transform_commands.h - part of Krita
 
3
 *
 
4
 *  Copyright (c) 2010 Marc Pegon <pe.marc@free.fr>
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; either version 2 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef TOOL_TRANSFORM_COMMANDS_H_
 
22
#define TOOL_TRANSFORM_COMMANDS_H_
 
23
 
 
24
#include "kis_tool_transform.h"
 
25
#include <kis_transaction.h>
 
26
#include <KoToolManager.h>
 
27
 
 
28
/**
 
29
 * There are 2 command classes associated with the transform tool,
 
30
 * because there are 2 different actions which should be committed
 
31
 * to the Undo Stack : when the user changes the arguments of
 
32
 * the transformation, i.e. the preview is modified (TransformCmd),
 
33
 * and when the user applies the transformation, i.e. the paintDevice
 
34
 * is modified (ApplyTransformCmd)
 
35
*/
 
36
 
 
37
class ApplyTransformCmdData : public KisSelectedTransactionData
 
38
{
 
39
public:
 
40
    ApplyTransformCmdData(KisToolTransform *tool, ToolTransformArgs::TransfMode mode, KisNodeSP node);
 
41
    virtual ~ApplyTransformCmdData();
 
42
 
 
43
public:
 
44
    virtual void redo();
 
45
    virtual void undo();
 
46
    ToolTransformArgs::TransfMode mode() const;
 
47
private:
 
48
    KisToolTransform *m_tool;
 
49
    ToolTransformArgs::TransfMode m_mode;
 
50
};
 
51
 
 
52
 
 
53
class ApplyTransformCmd : public KisTransaction
 
54
{
 
55
public:
 
56
    ApplyTransformCmd(KisToolTransform *tool, ToolTransformArgs::TransfMode mode, KisNodeSP node);
 
57
};
 
58
 
 
59
class TransformCmd : public QUndoCommand
 
60
{
 
61
public:
 
62
    TransformCmd(KisToolTransform *tool, const ToolTransformArgs &args, KisSelectionSP origSel, QPoint startPos, QPoint endPos, QImage *origImg, QImage *origSelectionImg);
 
63
    virtual ~TransformCmd();
 
64
 
 
65
public:
 
66
    virtual void redo();
 
67
    virtual void undo();
 
68
    void transformArgs(ToolTransformArgs &args) const;
 
69
    KisSelectionSP origSelection(QPoint &startPos, QPoint &endPos) const;
 
70
    void origPreviews(QImage *&origImg, QImage *&origSelectionImg) const;
 
71
private:
 
72
    ToolTransformArgs m_args;
 
73
    KisToolTransform *m_tool;
 
74
    KisSelectionSP m_origSelection;
 
75
    QPoint m_originalTopLeft;
 
76
    QPoint m_originalBottomRight;
 
77
    QImage *m_origImg, *m_origSelectionImg;
 
78
};
 
79
 
 
80
#endif // TOOL_TRANSFORM_COMMANDS_H_