34#ifndef DOXYGEN_SHOULD_IGNORE_THIS
58 bool _explicitrequired;
59 bool _currentisexplicit;
63 bool _suspendedisexplicit;
64 bool _suspendedisrunning;
67 static std::map<_state_ptr, FCUndoController> _sessionundocontrollers;
70 const char*
ClassName()
const override {
return "FCUndoController"; }
74 _currentisexplicit(false), _isrunning(false),
75 _suspendedisexplicit(false), _issuspended(false), _suspendedisrunning(false)
86#ifdef PDK_FRAMEWORK_LUAFRIENDLY
92 auto it = _sessionundocontrollers.find(_LUACODE(_GetBaseLuaState(S)) _NOLUACODE(S));
93 if (it != _sessionundocontrollers.end())
105#ifdef PDK_FRAMEWORK_LUAFRIENDLY
111 auto [newval, _] = _sessionundocontrollers.emplace(_LUACODE(_GetBaseLuaState(S)) _NOLUACODE(S),
FCUndoController());
112 newval->second._sandboxmode = sandboxmode;
113 newval->second._explicitrequired = explicitrequired;
114 return newval->second;
120 auto it = _sessionundocontrollers.find(_LUACODE(_GetBaseLuaState(S)) _NOLUACODE(S));
121 if (it != _sessionundocontrollers.end())
122 _sessionundocontrollers.erase(S);
129 _utransid = undoString._StartFinaleEdit();
130 _lastundostring = undoString;
131 _currentisexplicit = isexplicit;
141 if (savecurrent && _utransid && !_sandboxmode && (!_explicitrequired || _currentisexplicit))
144 FX_CancelFinaleEdit();
148 _currentisexplicit =
false;
158 _suspendedundostring = _lastundostring;
159 _suspendedisexplicit = _currentisexplicit;
160 _suspendedisrunning = _isrunning;
172 if (!_issuspended || _suspendedisrunning)
174 if (_issuspended && ! _suspendedundostring.
IsEmpty())
175 StartUndo(_suspendedundostring, savecurrent, _suspendedisexplicit);
179 _issuspended =
false;
180 _suspendedisrunning =
false;
181 _suspendedisexplicit =
false;
182 _suspendedundostring.
Clear();
Base class for the Finale Framework classes.
Definition ff_base.h:71
__FCBase()
The constructor.
Definition ff_base.h:278
The base class for the block handler. Intented for inheritance for use with the FCUndoController util...
Definition ff_undo.h:20
virtual bool Execute()=0
Virtual method that will be called by FCUndoController::Execute.
FCUndoController * GetOwner()
Returns the executing owner.
Definition ff_undo.h:43
Class that provides storage for text. This is to achieve platform-transparent text handling,...
Definition ff_base.h:1877
void Clear()
Creates an empty string.
Definition ff_base.h:2391
bool IsEmpty() const
Returns true if the string is empty.
Definition ff_base.h:3179
Class that handles Undo records for modeless plug-in interfaces.
Definition ff_undo.h:54
bool GetRequireExplicitUndo() const
Return if explicit undo blocks are required.
Definition ff_undo.h:212
bool GetCurrentIsExplicitUndo() const
Return currently running undo block is explicit.
Definition ff_undo.h:218
void SuspendUndo(bool savecurrent=false)
Suspends an undo session by ending it and saving all current info so that it can be resumed....
Definition ff_undo.h:154
bool GetSandboxMode() const
Return current sandbox mode.
Definition ff_undo.h:209
static FCUndoController & CreateUndoController(bool sandboxmode, bool explicitrequired, _state_ptr S=nullptr)
Creates an undo block for the specified session. If it already exists, then the session parameters ar...
Definition ff_undo.h:108
bool AddSession(const FCString *pUndoString, bool storecurrentblock)
Starts a new Undo/Redo block within a running Execute() session.
Definition finaleframework.cpp:37078
static FCUndoController & GetUndoController(_state_ptr S=nullptr)
Gets the undo block for the session, creating it if there is not already one,.
Definition ff_undo.h:89
const FCString & GetLastUndoString() const
returns the last undo string on this block.
Definition ff_undo.h:79
bool Execute(__FCUndoBlockHandler *pHandler, const FCString *pUndoString)
Executes the code within an undoable edit record.
Definition finaleframework.cpp:37062
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_undo.h:70
void EndUndo(bool savecurrent=false)
Ends an undo session.
Definition ff_undo.h:137
void ResumeUndo(bool savecurrent=false)
Resumes an undo session by starting a session with saved info from the previous call to SuspendUndo....
Definition ff_undo.h:170
FCUndoController()
the constructor
Definition ff_undo.h:73
bool IsRunning() const
Return whether undo block is currently running.
Definition ff_undo.h:215
static void RemoveUndoBlock(_state_ptr S)
Clears out the undo block for the specified session. See comments at GetUndoController for more infor...
Definition ff_undo.h:118
bool StartUndo(const FCString &undoString, bool savecurrent=false, bool isexplicit=true)
Starts an undo session.
Definition ff_undo.h:126