00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 00010 #ifndef _HUNDOMANAGER_H 00011 #define _HUNDOMANAGER_H 00012 00013 #ifdef H_PACK_8 00014 #pragma pack(push) 00015 #pragma pack(8) 00016 #endif 00017 00018 00019 #include "HTools.h" 00020 #include "HEventListener.h" 00021 00022 class HEventListener; 00023 class HBaseView; 00024 00025 00031 class MVO_API HUndoItem 00032 { 00033 public: 00037 HUndoItem() { ; } 00038 virtual ~HUndoItem() { ; } 00039 00045 virtual void Undo(bool setupOnly = false) { UNREFERENCED(setupOnly); } 00051 virtual void Redo(bool setupOnly = false) { UNREFERENCED(setupOnly); } 00052 00056 virtual const char * GetName() { return "HUndoItem"; } 00057 00058 }; 00059 00060 00064 class MVO_API HUndoItemCamera : public HUndoItem 00065 { 00066 public: 00071 HUndoItemCamera(HBaseView *view); 00072 virtual ~HUndoItemCamera() { ; } 00073 00080 virtual void Undo(bool setupOnly = false); 00087 virtual void Redo(bool setupOnly = false); 00088 00092 virtual HCamera * GetCamera() { return &m_Camera; } 00093 00097 virtual const char * GetName() { return "HUndoItemCamera"; } 00098 protected: 00099 HCamera m_Camera; 00100 HBaseView *m_pView; 00101 }; 00102 00103 00108 class MVO_API HUndoItemMatrix : public HUndoItem 00109 { 00110 public: 00114 HUndoItemMatrix(HBaseView *view, int num_items, HC_KEY *keys, float *matrices); 00115 virtual ~HUndoItemMatrix(); 00116 00124 virtual void Undo(bool setupOnly = false); 00131 virtual void Redo(bool setupOnly = false); 00132 00136 virtual int GetCount() { return m_Count; } 00137 00141 virtual HC_KEY * GetKey() { return m_SegmentKey; } 00142 virtual void GetKey(HC_KEY *keys); 00143 00148 virtual float * GetMatrix() { return m_Matrix; } 00149 virtual void GetMatrix(float *m); 00150 00154 virtual const char * GetName() { return "HUndoItemMatrix"; } 00155 protected: 00156 int m_Count; 00157 float *m_Matrix; 00158 HC_KEY *m_SegmentKey; 00159 HBaseView *m_pView; 00160 }; 00161 00162 00163 00168 class MVO_API HUndoManager 00169 { 00170 public: 00174 HUndoManager(); 00175 virtual ~HUndoManager(); 00176 00184 int Undo(int steps = 1, bool testOnly = false, bool setupOnly = false); 00192 int Redo(int steps = 1, bool testOnly = false, bool setupOnly = false); 00193 00200 void AddUndoItem(HUndoItem *item); 00201 00205 void Flush(); 00206 00210 HUndoItem * Peek(); 00211 00215 void Reset(HBaseView *view); 00216 00220 void BeginUndoItemIteration(); 00221 00227 HUndoItem *GetNextUndoItem(); 00228 00232 void EndUndoItemIteration(); 00233 00234 private: 00235 00236 struct vdlist_s * m_pUndoItemList; 00237 struct vdlist_cursor_s * m_CurrentItem; 00238 }; 00239 00240 #ifdef H_PACK_8 00241 #pragma pack(pop) 00242 #endif 00243 00244 #endif 00245 00246 00247 00248