Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HUndoManager.h

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: 23405ab4ac64a7a6ab8a61d6312726640a4f1f75 $
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) { UNREFERENCED(setupOnly); }
00057     virtual void Redo(bool setupOnly = false) { UNREFERENCED(setupOnly); }
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 private:
00241 
00242     struct vdlist_s *           m_pUndoItemList;            
00243     struct vdlist_cursor_s *    m_CurrentItem;              
00244 };
00245 
00246 #ifdef H_PACK_8
00247 #pragma pack(pop)
00248 #endif
00249 
00250 #endif
00251 
00252 
00253 
00254