demotool/syncedit.hh

53 lines
1.2 KiB
C++

#pragma once
#include "sync.hh"
#include "undo.hh"
/*= GENERAL STRUCTURE FOR SYNC EDITOR UNDOS ====================================*/
class T_UndoSyncChanges : public A_UndoAction
{
protected:
struct T_CurveChange_
{
T_String inputId;
T_Optional< T_SyncCurve > before;
T_Optional< T_SyncCurve > after;
explicit T_CurveChange_( T_SyncCurve before ) noexcept
: inputId{ before.name } ,
before{ std::move( before ) } ,
after{ }
{}
T_CurveChange_( const bool ,
T_SyncCurve after ) noexcept
: inputId{ after.name } , before{ } ,
after{ std::move( after ) }
{}
T_CurveChange_( T_SyncCurve before ,
T_SyncCurve after ) noexcept
: inputId{ before.name } ,
before{ std::move( before ) } ,
after{ std::move( after ) }
{}
};
T_AutoArray< T_CurveChange_ , 4 , 32 > changes_;
public:
T_UndoSyncChanges( ) noexcept = default;
DEF_MOVE( T_UndoSyncChanges );
NO_COPY( T_UndoSyncChanges );
void undo( ) const noexcept override;
void redo( ) const noexcept override;
T_UndoSyncChanges& curveCreation(
T_SyncCurve curve ) noexcept;
T_UndoSyncChanges& curveDeletion(
T_SyncCurve curve ) noexcept;
T_UndoSyncChanges& curveReplacement(
T_SyncCurve before ,
T_SyncCurve after ) noexcept;
};