1 /******************************************************************* 2 3 Part of the Fritzing project - http://fritzing.org 4 Copyright (c) 2007-2014 Fachhochschule Potsdam - http://fh-potsdam.de 5 6 Fritzing 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 3 of the License, or 9 (at your option) any later version. 10 11 Fritzing 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 Fritzing. If not, see <http://www.gnu.org/licenses/>. 18 19 ******************************************************************** 20 21 $Revision: 6570 $: 22 $Author: irascibl@gmail.com $: 23 $Date: 2012-10-16 06:25:29 +0200 (Di, 16. Okt 2012) $ 24 25 ********************************************************************/ 26 27 #ifndef PECOMMANDS_H 28 #define PECOMMANDS_H 29 30 #include "../commands.h" 31 #include "peutils.h" 32 33 34 ///////////////////////////////////////////// 35 36 class PEBaseCommand : public BaseCommand 37 { 38 39 public: 40 PEBaseCommand(class PEMainWindow *, QUndoCommand* parent); 41 ~PEBaseCommand(); 42 43 QString getParamString() const; 44 45 protected: 46 class PEMainWindow * m_peMainWindow; 47 }; 48 49 ///////////////////////////////////////////// 50 51 class ChangeMetadataCommand : public PEBaseCommand 52 { 53 public: 54 ChangeMetadataCommand(class PEMainWindow *, const QString & name, const QString & oldValue, const QString & newValue, QUndoCommand *parent); 55 void undo(); 56 void redo(); 57 58 protected: 59 QString getParamString() const; 60 61 protected: 62 QString m_name; 63 QString m_oldValue; 64 QString m_newValue; 65 }; 66 67 ///////////////////////////////////////////// 68 69 class ChangeConnectorMetadataCommand : public PEBaseCommand 70 { 71 public: 72 ChangeConnectorMetadataCommand(class PEMainWindow *, ConnectorMetadata * oldcm, ConnectorMetadata * newcm, QUndoCommand *parent); 73 void undo(); 74 void redo(); 75 76 protected: 77 QString getParamString() const; 78 79 protected: 80 ConnectorMetadata m_oldcm; 81 ConnectorMetadata m_newcm; 82 }; 83 84 ///////////////////////////////////////////// 85 86 class ChangeFzpCommand : public PEBaseCommand 87 { 88 public: 89 ChangeFzpCommand(class PEMainWindow *, const QString & oldFzpFile, const QString & newFzpFile, QUndoCommand *parent); 90 void undo(); 91 void redo(); 92 93 protected: 94 QString getParamString() const; 95 96 protected: 97 QString m_oldFzpFile; 98 QString m_newFzpFile; 99 }; 100 101 ///////////////////////////////////////////// 102 103 class ChangeTagsCommand : public PEBaseCommand 104 { 105 public: 106 ChangeTagsCommand(class PEMainWindow *, const QStringList & oldTabs, const QStringList & newTags, QUndoCommand *parent); 107 void undo(); 108 void redo(); 109 110 protected: 111 QString getParamString() const; 112 113 protected: 114 QStringList m_old; 115 QStringList m_new; 116 }; 117 118 ///////////////////////////////////////////// 119 120 class ChangePropertiesCommand : public PEBaseCommand 121 { 122 public: 123 ChangePropertiesCommand(class PEMainWindow *, const QHash<QString, QString> & oldProps, const QHash<QString, QString> & newProps, QUndoCommand *parent); 124 void undo(); 125 void redo(); 126 127 protected: 128 QString getParamString() const; 129 130 protected: 131 QHash<QString, QString> m_old; 132 QHash<QString, QString> m_new; 133 }; 134 135 ///////////////////////////////////////////// 136 137 class ChangeSvgCommand : public PEBaseCommand 138 { 139 public: 140 ChangeSvgCommand(class PEMainWindow *, SketchWidget *, const QString & oldFilename, const QString & newFilename, QUndoCommand *parent); 141 void undo(); 142 void redo(); 143 144 protected: 145 QString getParamString() const; 146 147 protected: 148 QString m_oldFilename; 149 QString m_newFilename; 150 }; 151 152 ///////////////////////////////////////////// 153 154 class RelocateConnectorSvgCommand : public PEBaseCommand 155 { 156 public: 157 RelocateConnectorSvgCommand(class PEMainWindow *, SketchWidget *, const QString & id, const QString & terminalID, const QString & oldGorn, const QString & oldGornTerminal, const QString & newGorn, const QString & newGornTerminal, QUndoCommand *parent); 158 void undo(); 159 void redo(); 160 161 protected: 162 QString getParamString() const; 163 164 protected: 165 QString m_id; 166 QString m_terminalID; 167 QString m_oldGorn; 168 QString m_oldGornTerminal; 169 QString m_newGorn; 170 QString m_newGornTerminal; 171 }; 172 173 ///////////////////////////////////////////// 174 175 class MoveTerminalPointCommand : public PEBaseCommand 176 { 177 public: 178 MoveTerminalPointCommand(class PEMainWindow *, SketchWidget *, const QString & id, QSizeF size, QPointF oldLocation, QPointF newLocation, QUndoCommand *parent); 179 void undo(); 180 void redo(); 181 182 protected: 183 QString getParamString() const; 184 185 protected: 186 QString m_id; 187 QSizeF m_size; 188 QPointF m_oldLocation; 189 QPointF m_newLocation; 190 }; 191 192 ///////////////////////////////////////////// 193 194 class RemoveBusConnectorCommand : public PEBaseCommand 195 { 196 public: 197 RemoveBusConnectorCommand(class PEMainWindow *, const QString & busID, const QString & connectorID, bool inverted, QUndoCommand *parent); 198 void undo(); 199 void redo(); 200 201 protected: 202 QString getParamString() const; 203 204 protected: 205 QString m_busID; 206 QString m_connectorID; 207 bool m_inverted; 208 }; 209 210 ///////////////////////////////////////////// 211 212 class ChangeSMDCommand : public PEBaseCommand 213 { 214 public: 215 ChangeSMDCommand(class PEMainWindow *, const QString & before, const QString & after, const QString & oldFilename, const QString & newFilename, QUndoCommand *parent); 216 void undo(); 217 void redo(); 218 219 protected: 220 QString getParamString() const; 221 222 protected: 223 QString m_before; 224 QString m_after; 225 QString m_oldFilename; 226 QString m_newFilename; 227 }; 228 229 ///////////////////////////////////////////// 230 231 232 #endif // PECOMMANDS_H 233