PapersView.UndoHandler

g GObject.GInterface GObject.GInterface PapersView.UndoHandler PapersView.UndoHandler GObject.GInterface->PapersView.UndoHandler

Implementations:

PapersView.AnnotationsContext

Methods

free_action (data)

undo (data)

Virtual Methods

do_undo (data)

Properties

None

Signals

None

Fields

None

Class Details

class PapersView.UndoHandler
Bases:

GObject.GInterface

Structure:

PapersView.UndoHandlerInterface

This interface is implemented by objects (e.g. the annotation context) that aim to register actions that may be undone. Such actions must be registered into the undo context so as they are added to the undo stack with pps_undo_context_add_action. Then, when an action must be undone (e.g. the user pressed Ctrl+Z), the pps_undo_handler_undo interface method is called on the object. An action is represented by an arbitrary pointer. The object must free such pointers when the pps_undo_handler_free_action interface method is called.

For instance, the annotation context implements PpsUndoHandler. When an annotation is added, the annotation context creates a custom struct that represents this action, it contains (among other things) a pointer to the added PpsAnnotation. This action is added to the undo stack of the undo context. Then, if the user uses Ctrl+Z, the pps_undo_context_undo method is called, the addition action is taken from the undo stack and pps_undo_handler_undo is called on the annotation context and the addition action. Then, the implementation of this interface in the annotation context removes the annotation from the document. This removal entails that the annotation context adds a new action to the undo context (a struct that represents the removal of the annotation), and the undo context adds this action to the redo stack since this happens while undoing.

free_action(data)
Parameters:

data (object or None) –

undo(data)
Parameters:

data (object or None) –

do_undo(data) virtual
Parameters:

data (object or None) –