1 /* 2 * changewangcolordata.h 3 * Copyright 2017, Benjamin Trotter <bdtrotte@ucsc.edu> 4 * 5 * This file is part of Tiled. 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the Free 9 * Software Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 * more details. 16 * 17 * You should have received a copy of the GNU General Public License along with 18 * this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #pragma once 22 23 #include <QUndoCommand> 24 25 #include <QColor> 26 27 namespace Tiled { 28 29 class WangColor; 30 31 class TilesetDocument; 32 33 class ChangeWangColorName : public QUndoCommand 34 { 35 public: 36 ChangeWangColorName(TilesetDocument *tilesetDocument, 37 WangColor *wangColor, 38 const QString &newName); 39 40 void undo() override; 41 void redo() override; 42 43 private: 44 TilesetDocument *mTilesetDocument; 45 WangColor *mWangColor; 46 QString mOldName; 47 QString mNewName; 48 }; 49 50 class ChangeWangColorImage : public QUndoCommand 51 { 52 public: 53 ChangeWangColorImage(TilesetDocument *tilesetDocument, 54 WangColor *wangColor, 55 int newImageId, 56 QUndoCommand *parent = nullptr); 57 58 void undo() override; 59 void redo() override; 60 61 private: 62 TilesetDocument *mTilesetDocument; 63 WangColor *mWangColor; 64 int mOldImageId; 65 int mNewImageId; 66 }; 67 68 class ChangeWangColorColor : public QUndoCommand 69 { 70 public: 71 ChangeWangColorColor(TilesetDocument *tilesetDocument, 72 WangColor *wangColor, 73 const QColor &newColor); 74 75 void undo() override; 76 void redo() override; 77 78 private: 79 TilesetDocument *mTilesetDocument; 80 WangColor *mWangColor; 81 QColor mOldColor; 82 QColor mNewColor; 83 }; 84 85 class ChangeWangColorProbability : public QUndoCommand 86 { 87 public: 88 ChangeWangColorProbability(TilesetDocument *tilesetDocument, 89 WangColor *wangColor, 90 qreal newProbability); 91 92 void undo() override; 93 void redo() override; 94 95 private: 96 TilesetDocument *mTilesetDocument; 97 WangColor *mWangColor; 98 qreal mOldProbability; 99 qreal mNewProbability; 100 }; 101 102 } // namespace Tiled 103