00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef UNDO_H
00020 #define UNDO_H
00021
00022 #include <qlist.h>
00023 #include <qstringlist.h>
00024 #include "GTransition.h"
00025 #include "GState.h"
00026 #include "GITransition.h"
00027
00028 class Project;
00029
00034 enum UndoAction {AddState, AddTransition, ChangeState, ChangeTransition,
00035 ChangeTransitions, MoveMultiple,
00036 DeleteSelection, DeleteState, DeleteTransition,
00037 ChangeInitialTransition, SetInitialState, SetEndStates,
00038 ChangeMachine, Paste};
00039
00044 struct dtlist {
00046 dtlist() {tlist.setAutoDelete(FALSE); rlist.setAutoDelete(FALSE); };
00048 QList<GTransition> tlist;
00050 QList<GTransition> rlist;
00051 };
00052
00053
00058 class Undo
00059 {
00060 public:
00061 Undo(Project*);
00062 ~Undo();
00063
00065 void setAction(int a) { action=a; };
00067 int getAction() { return action; };
00069 void setModified(bool m) { modified=m; };
00071 bool getModified() { return modified; };
00073 void setState(GState* s) { state=s; };
00075 GState* getState() { return state; };
00077 void setState2(GState* s) { state2=s; };
00079 GState* getState2() { return state2; };
00081 void setInitialState(GState* s) { istate=s; };
00083 GState* getInitialState() { return istate; };
00085 void setTransition(GTransition* t) { transition = t; };
00087 GTransition* getTransition() { return transition; };
00089 void setTransition2(GTransition* t) { transition2 = t; };
00091 GTransition* getTransition2() { return transition2; };
00093 void setInitialTransition(GITransition* t) { itrans= t; };
00095 GITransition* getInitialTransition() { return itrans; };
00097 void setInitialTransition2(GITransition* t) { itrans2 = t; };
00099 GITransition* getInitialTransition2() { return itrans2; };
00101 void getMovedBy(double& x, double& y) { x=movedbyx; y=movedbyy; };
00103 void setMovedBy(double x, double y) { movedbyx=x; movedbyy=y; };
00104 void getMachineInfo(Machine*& m, QString& n, int& t, int& nb, QStringList& olistm,
00105 int& ni, QStringList& ilist, int& no, QStringList& olist, QFont& sf, QFont& tf,
00106 int& at);
00107 void setMachineInfo(Machine* m, QString n, int t, int nb, QStringList olistm, int ni,
00108 QStringList ilist, int no, QStringList olist, QFont sf, QFont tf, int at);
00110 void setNumBits(int nb) { numbits=nb; };
00112 int getNumBits() { return numbits; };
00114 void setNumInputs(int ni) {numin = ni; };
00116 int getNumInputs() { return numin; };
00118 void setNumOutputs(int no) {numout = no; };
00120 int getNumOutputs() { return numout; };
00121
00122
00124 Project* getProject() { return project; };
00126 QList<GTransition>* getCopyList() { return ©list; };
00128 QList<GState>* getSList() { return &slist; };
00130 QList<GState>* getSList2() { return &slist2; };
00132 QList<GTransition>* getTList() { return &tlist; };
00134 QList<GTransition>* getTList2() { return &tlist2; };
00135
00136 public:
00138 QList<dtlist>* getDoubleTList() { return &doubletlist; };
00139
00140 private:
00142 int action;
00144 Project* project;
00146 bool modified;
00148 GState* state;
00150 GState* state2;
00152 GState* istate;
00154 GTransition* transition;
00156 GTransition* transition2;
00158 GITransition *itrans;
00160 GITransition *itrans2;
00162 QList<GTransition> copylist;
00164 QList<GState> slist;
00166 QList<GState> slist2;
00168 QList<GTransition> tlist;
00170 QList<GTransition> tlist2;
00172 QList<dtlist> doubletlist;
00174 double movedbyx;
00176 double movedbyy;
00177
00179 Machine* machine;
00181 QString mname;
00183 int type;
00185 int numin;
00187 int numout;
00189 int numbits;
00191 QFont sfont;
00193 QFont tfont;
00195 int arrowtype;
00197 QStringList strlist1;
00199 QStringList strlist2;
00201 QStringList strlist3;
00202 };
00203
00204 #endif