Skip to content

WIP: Multi-step undo port from pd vanilla

Partial port of the extended Pdvanilla undo system to PurrData

Ported:

g_undo.h
  • Define enum 't_undo_type' for undo types
  • Change t_undo_action 'type' attribute from int to 't_undo_type'
g_undo.c
  • Join the four big switches inside canvas_undo_undo/redo/rebranch/free into a unique switch inside the new canvas_undo_doit function. Action to be performed is passed as a paramenter.
  • Replace the four mentioned switch with the new function
  • Add support for atomic (and nested) multi-step sequences in canvas_undo_undo and canvas_undo_redo using the new types SEQUENCE_START/END as checkpoints.

Not ported:

  • New undo queue/attibutes container, 't_undo'
  • New queue location at glist/gl_privatedata/undo (a t_undo element)
  • Query and modification procedures for this new storage method/location
  • Combined action+undo_add methods. Example: canvas_connect_with_undo, ...
  • Special paste undo action constructor: canvas_undo_set_pastebinbuf
  • Change canvas_undo_add 'type' paramenter from int to t_undo_type.

Usage

canvas_undo_add(canvas, UNDO_SEQUENCE_START, "name", 0);
/* Basic undo actions */
canvas_undo_add(canvas, UNDO_SEQUENCE_END, "name", 0);

Merge request reports