Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::UndoRedoPreferenceHelper Namespace Reference

Shared access to the undo/redo preferences (node "/General/UndoRedo"). More...

Functions

MITKCORE_EXPORT IPreferences * GetPreferences ()
 Returns the "/General/UndoRedo" preferences node, or nullptr if the preferences service is unavailable. More...
 
MITKCORE_EXPORT int GetActiveLimit ()
 The currently configured undo limit (0 = unlimited). Falls back to mitk::DEFAULT_UNDO_REDO_LIMIT if nothing is stored. More...
 
MITKCORE_EXPORT int GetLastPositiveLimit ()
 The most recent positive (non-zero) limit the user chose. Falls back to mitk::DEFAULT_UNDO_REDO_LIMIT if nothing is stored. More...
 
MITKCORE_EXPORT void StoreLimit (int limit)
 Persists the active limit. Always writes "UndoLimit"; when limit is greater than 0 it also records it as "LastUndoLimit". No-op if the preferences service is unavailable. More...
 

Detailed Description

Shared access to the undo/redo preferences (node "/General/UndoRedo").

Used by the UndoController and by the Undo/Redo UI so the node path, the keys and the default all live in one place and cannot drift apart.

Two keys are used:

  • "UndoLimit" : the active limit; 0 means "unlimited". This is the value the UndoController reads on start-up.
  • "LastUndoLimit" : the most recent positive limit the user chose. Used to restore a sensible value when a limit is re-enabled after "unlimited".

Function Documentation

◆ GetActiveLimit()

MITKCORE_EXPORT int mitk::UndoRedoPreferenceHelper::GetActiveLimit ( )

The currently configured undo limit (0 = unlimited). Falls back to mitk::DEFAULT_UNDO_REDO_LIMIT if nothing is stored.

◆ GetLastPositiveLimit()

MITKCORE_EXPORT int mitk::UndoRedoPreferenceHelper::GetLastPositiveLimit ( )

The most recent positive (non-zero) limit the user chose. Falls back to mitk::DEFAULT_UNDO_REDO_LIMIT if nothing is stored.

◆ GetPreferences()

MITKCORE_EXPORT IPreferences* mitk::UndoRedoPreferenceHelper::GetPreferences ( )

Returns the "/General/UndoRedo" preferences node, or nullptr if the preferences service is unavailable.

◆ StoreLimit()

MITKCORE_EXPORT void mitk::UndoRedoPreferenceHelper::StoreLimit ( int  limit)

Persists the active limit. Always writes "UndoLimit"; when limit is greater than 0 it also records it as "LastUndoLimit". No-op if the preferences service is unavailable.