#include <EditableI.h>
Inheritance diagram for EditableI:
Public Methods | |
virtual DataBlockI * | create ()=0 |
Creates new datablock. | |
virtual DataBlockI * | create (EditableI *pOriginal)=0 |
Creates new datablock, with reference to the original. | |
virtual void | copy (EditableI *pEditable)=0 |
Deep copy from a data block. | |
virtual void | restore (EditableI *pEditable)=0 |
Shallow copy of a data block. | |
virtual EditableI * | duplicate () |
Duplicates editable. | |
virtual EditableI * | clone () |
Clones editable. | |
virtual EditableI * | get_original () const |
Returns original editable, if the editable is a clone, else returns 0. | |
virtual UndoC * | begin_editing (UndoC *pUndo) |
Starts new editing scope, returns current undo. | |
virtual void | end_editing (UndoC *pUndo) |
Ends current editing scope, set return previous undo. | |
virtual UndoC * | get_undo () |
Returns current undo. | |
virtual PajaTypes::uint32 | save (FileIO::SaveC *pSave)=0 |
Save editable to a Demopaja output stream. | |
virtual PajaTypes::uint32 | load (FileIO::LoadC *pLoad)=0 |
Load editable from a Demopaja input stream. | |
Protected Methods | |
EditableI () | |
Default constructor. | |
EditableI (EditableI *m_pOriginal) | |
Default constructor with reference to the original. | |
virtual | ~EditableI () |
Default destructor. |
Editable interfaces is used by all the objects which are editable. The interface defines set of methods which are used for example by the undo-system in Demopaja.
|
Default constructor.
|
|
Default constructor with reference to the original.
|
|
Default destructor.
|
|
Starts new editing scope, returns current undo.
Implemented by the system. If the class needs to store extra information which cannot be stored in the clone() method or a special flag needs to be set, override this method, but remember to call this memeber at the beginning of the overridden method! |
|
Clones editable. Makes a clone of the editable and returns it. The duplicated editable has to be released when it is no longer used. The restore() method is used to clone the data. Also the reference to the original data is saved. Used internally, usually from the begin_editing() method.
|
|
Deep copy from a data block.
Example Implementation void TGAImportC::copy( EditableI* pEditable ) { TGAImportC* pFile = (TGAImportC*)pBlock; m_i32Width = pFile->m_i32Width; m_i32Height = pFile->m_i32Height; m_i32Bpp = pFile->m_i32Bpp; m_sFileName = pFile->m_sFileName; // duplicate data delete m_pData; uint32 ui32DataSize = m_i32Width * m_i32Height * (m_i32Bpp / 8); m_pData = new uint8[ui32DataSize]; memcpy( m_pData, pFile->m_pData, ui32DataSize ); } Implemented in AutoGizmoC, ControllerC, EffectI, FileHandleC, FileListC, GizmoI, KeyC, FloatKeyC, FileKeyC, LayerC, ParamI, ParamIntC, ParamFloatC, ParamVector2C, ParamVector3C, ParamColorC, ParamTextC, ParamFileC, SceneC, and TimeSegmentC. |
|
Creates new datablock, with reference to the original.
Implemented in AutoGizmoC, ControllerC, FileHandleC, FileListC, KeyC, FloatKeyC, FileKeyC, LayerC, ParamIntC, ParamFloatC, ParamVector2C, ParamVector3C, ParamColorC, ParamTextC, ParamFileC, SceneC, and TimeSegmentC. |
|
Creates new datablock. The create method of data block class creates new instance of the same class the data block is. Example implementation: DataBlockI* TGAImportC::create() { return new TGAImportC; }
Implements DataBlockI. Implemented in AutoGizmoC, ControllerC, FileHandleC, FileListC, KeyC, FloatKeyC, FileKeyC, LayerC, ParamIntC, ParamFloatC, ParamVector2C, ParamVector3C, ParamColorC, ParamTextC, ParamFileC, SceneC, and TimeSegmentC. |
|
Duplicates editable. Makes a duplicate of the editable and returns it. The duplicated editable has to be released when it is no longer used. The copy() method is used to duplicate the data. |
|
Ends current editing scope, set return previous undo. The default implementation sets the given undo object as current undo object. This method is implemented by the system and used internally.
|
|
Returns original editable, if the editable is a clone, else returns 0. Every time a editable is cloned a reference to the orginal data is saved too. This methods enables to get the pointer to the original data. This methods is mainly used to determine if the released editable is a clone, hence no data will be released. Example usage: TGAImportC::~TGAImportC() { // Check if this editable is a clone. if( get_original() ) return; // It's clone, return. // Delete data delete m_pData; } |
|
Returns current undo. Returns current undo object bind by the last begin_editing() call. The return value can be NULL. Implemented by the system. |
|
Load editable from a Demopaja input stream.
Implemented in AutoGizmoC, ControllerC, EffectI, FileHandleC, FileListC, GizmoI, KeyC, FloatKeyC, FileKeyC, LayerC, ParamI, ParamIntC, ParamFloatC, ParamVector2C, ParamVector3C, ParamColorC, ParamTextC, ParamFileC, SceneC, and TimeSegmentC. |
|
Shallow copy of a data block. Restores the local data from the given data block. This method is used by the Demopaja undo system to restore data from a copy. This method should only do a shallow copy, that is, copy the variables which can be changed by the methods in the interface of the class. For example if a import plugin class should not copy the data, but only pointer to the data since there isnt any method in the interface which would change the data. If the data can be changed the copy() is called automatically by the system. Example: void TGAImportC::restore( EditableI* pEditable ) { TGAImportC* pFile = (TGAImportC*)pEditable; m_ui32TextureId = pFile->m_ui32TextureId; m_pData = pFile->m_pData; m_i32Width = pFile->m_i32Width; m_i32Height = pFile->m_i32Height; m_i32Bpp = pFile->m_i32Bpp; m_sFileName = pFile->m_sFileName; }
Implemented in AutoGizmoC, ControllerC, EffectI, FileHandleC, FileListC, GizmoI, KeyC, FloatKeyC, FileKeyC, LayerC, ParamI, ParamIntC, ParamFloatC, ParamVector2C, ParamVector3C, ParamColorC, ParamTextC, ParamFileC, SceneC, and TimeSegmentC. |
|
Save editable to a Demopaja output stream.
Implemented in AutoGizmoC, ControllerC, EffectI, FileHandleC, FileListC, GizmoI, KeyC, FloatKeyC, FileKeyC, LayerC, ParamI, ParamIntC, ParamFloatC, ParamVector2C, ParamVector3C, ParamColorC, ParamTextC, ParamFileC, SceneC, and TimeSegmentC. |