00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id$ 00013 // 00014 00015 00016 #ifndef _HUNDOMANAGER_H 00017 #define _HUNDOMANAGER_H 00018 00019 #ifdef H_PACK_8 00020 #pragma pack(push) 00021 #pragma pack(8) 00022 #endif 00023 00024 00025 #include "HTools.h" 00026 #include "HEventListener.h" 00027 00028 class HEventListener; 00029 class HBaseView; 00030 00031 00037 class MVO_API HUndoItem 00038 { 00039 public: 00043 HUndoItem() { ; } 00044 virtual ~HUndoItem() { ; }; 00045 00051 virtual void Undo(bool setuponly = false) { ; }; 00057 virtual void Redo(bool setuponly = false) { ; }; 00058 00062 virtual const char * GetName() { return "HUndoItem"; }; 00063 00064 }; 00065 00066 00070 class MVO_API HUndoItemCamera : public HUndoItem 00071 { 00072 public: 00077 HUndoItemCamera(HBaseView *view); 00078 virtual ~HUndoItemCamera() { ; }; 00079 00086 virtual void Undo(bool setuponly = false); 00093 virtual void Redo(bool setuponly = false); 00094 00098 virtual HCamera * GetCamera() { return &m_Camera; }; 00099 00103 virtual const char * GetName() { return "HUndoItemCamera"; }; 00104 protected: 00105 HCamera m_Camera; 00106 HBaseView *m_pView; 00107 }; 00108 00109 00114 class MVO_API HUndoItemMatrix : public HUndoItem 00115 { 00116 public: 00120 HUndoItemMatrix(HBaseView *view, int num_items, HC_KEY *keys, float *matrices); 00121 virtual ~HUndoItemMatrix(); 00122 00130 virtual void Undo(bool setuponly = false); 00137 virtual void Redo(bool setuponly = false); 00138 00142 virtual int GetCount() { return m_Count; }; 00143 00147 virtual HC_KEY * GetKey() { return m_SegmentKey; }; 00148 virtual void GetKey(HC_KEY *keys); 00149 00154 virtual float * GetMatrix() { return m_Matrix; }; 00155 virtual void GetMatrix(float *m); 00156 00160 virtual const char * GetName() { return "HUndoItemMatrix"; }; 00161 protected: 00162 int m_Count; 00163 float *m_Matrix; 00164 HC_KEY *m_SegmentKey; 00165 HBaseView *m_pView; 00166 }; 00167 00168 00169 00174 class MVO_API HUndoManager 00175 { 00176 public: 00180 HUndoManager(); 00181 virtual ~HUndoManager(); 00182 00190 int Undo(int steps = 1, bool testOnly = false, bool setuponly = false); 00198 int Redo(int steps = 1, bool testOnly = false, bool setuponly = false); 00199 00206 void AddUndoItem(HUndoItem *item); 00207 00211 void Flush(); 00212 00216 HUndoItem * Peek(); 00217 00221 void Reset(HBaseView *view); 00222 00226 void BeginUndoItemIteration(); 00227 00233 HUndoItem *GetNextUndoItem(); 00234 00238 void EndUndoItemIteration(); 00239 00240 00241 private: 00242 00243 00244 struct vlist_s * m_pUndoItemList; 00246 HUndoItem * m_pCurrentItem; 00247 HUndoItem * m_pFirstItem; 00248 HUndoItem * m_pLastItem; 00249 HUndoItem * m_pTempUndoItem; 00250 00251 }; 00252 00253 #ifdef H_PACK_8 00254 #pragma pack(pop) 00255 #endif 00256 00257 #endif 00258 00259 00260 00261