File indexing completed on 2024-12-01 04:01:58
0001 /*************************************************************************** 0002 kimecommands.h - description 0003 ------------------- 0004 begin : Fri May 25 2001 0005 copyright : (C) 2001 by Jan Schäfer 0006 email : janschaefer@users.sourceforge.net 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef KIMECOMMANDS_H 0019 #define KIMECOMMANDS_H 0020 0021 #include "kimagemapeditor.h" 0022 0023 #include <QUndoStack> 0024 0025 class KImageMapEditor; 0026 class AreaSelection; 0027 0028 0029 0030 class CutCommand : public QUndoCommand 0031 0032 { 0033 public: 0034 CutCommand (KImageMapEditor * document, const AreaSelection & selection); 0035 ~CutCommand() override; 0036 0037 void redo() override; 0038 void undo() override; 0039 0040 protected: 0041 AreaSelection *_cutAreaSelection; 0042 KImageMapEditor* _document; 0043 bool _cutted; 0044 }; 0045 0046 /** 0047 * Does the same like the cut command 0048 * only have a different name in the Undo-History 0049 **/ 0050 class DeleteCommand : public CutCommand 0051 { 0052 public : 0053 DeleteCommand (KImageMapEditor * document, const AreaSelection & selection); 0054 }; 0055 0056 class PasteCommand : public QUndoCommand 0057 { 0058 public: 0059 PasteCommand (KImageMapEditor * document, const AreaSelection & selection); 0060 ~PasteCommand () override; 0061 0062 void redo() override; 0063 void undo() override; 0064 0065 protected: 0066 AreaSelection *_pasteAreaSelection; 0067 KImageMapEditor* _document; 0068 bool _pasted; 0069 bool _wasUndoed; 0070 0071 }; 0072 0073 class MoveCommand : public QUndoCommand 0074 { 0075 public: 0076 MoveCommand (KImageMapEditor *document, AreaSelection *a,const QPoint & oldPoint); 0077 ~MoveCommand () override; 0078 0079 void redo() override; 0080 void undo() override; 0081 0082 protected: 0083 QPoint _newPoint; 0084 QPoint _oldPoint; 0085 0086 KImageMapEditor* _document; 0087 AreaSelection *_areaSelection; 0088 //- Area *_oldArea; 0089 }; 0090 0091 class ResizeCommand : public QUndoCommand 0092 { 0093 public: 0094 ResizeCommand (KImageMapEditor *document, AreaSelection *a, Area *oldArea); 0095 ~ResizeCommand () override; 0096 0097 void redo() override; 0098 void undo() override; 0099 0100 protected: 0101 0102 KImageMapEditor* _document; 0103 AreaSelection *_areaSelection; 0104 Area *_oldArea; 0105 Area *_newArea; 0106 }; 0107 0108 class AddPointCommand : public QUndoCommand 0109 { 0110 public: 0111 AddPointCommand (KImageMapEditor *document, AreaSelection *a, const QPoint & p); 0112 ~AddPointCommand () override; 0113 0114 void redo() override; 0115 void undo() override; 0116 0117 protected: 0118 0119 KImageMapEditor* _document; 0120 AreaSelection *_areaSelection; 0121 QPoint _point; 0122 int _coordpos; 0123 }; 0124 0125 class RemovePointCommand : public QUndoCommand 0126 { 0127 public: 0128 RemovePointCommand (KImageMapEditor *document, AreaSelection *a, Area *oldArea); 0129 ~RemovePointCommand () override; 0130 0131 void redo() override; 0132 void undo() override; 0133 0134 protected: 0135 0136 KImageMapEditor* _document; 0137 AreaSelection *_areaSelection; 0138 Area *_oldArea; 0139 Area *_newArea; 0140 }; 0141 0142 0143 class CreateCommand : public QUndoCommand 0144 { 0145 public: 0146 CreateCommand (KImageMapEditor *document, Area *area); 0147 ~CreateCommand () override; 0148 0149 void redo() override; 0150 void undo() override; 0151 0152 protected: 0153 0154 KImageMapEditor* _document; 0155 Area *_area; 0156 bool _created; 0157 bool _wasUndoed; 0158 }; 0159 0160 0161 #endif