api->retract_undo() added to Magic API; used by Filled Polygon

New API function which rolls back the Undo buffer (which is snapshotted
upon a mousedown event ahead of calling the Magic tool's `_click()`
function.)  Dangerous; use sparingly!

Filled Polygon uses this to prevent partially-created (aka unfinished
aka incomplete) polygons -- the preview lines and control points -- from
being recorded and wasting space in the Undo history, or reappearing
upon Redo.

TODO - Other tools (e.g., Clone) would certainly benefit from this.
TODO - Needs more testing to help identify any bugs/issues introduced
by this!
TODO - Magic API docs need updating.

This is probably a sufficient solution that will make
https://sourceforge.net/p/tuxpaint/feature-requests/246/,
'"Overlay" surface in Magic API', unnecessary.
This commit is contained in:
Bill Kendrick 2024-06-01 01:35:50 -07:00
parent 2e9f4b7f42
commit 01afb5846c
5 changed files with 63 additions and 20 deletions

View file

@ -4,7 +4,7 @@
# Various contributors (see AUTHORS.txt)
# https://tuxpaint.org/
# June 14, 2002 - February 29, 2024
# June 14, 2002 - June 1, 2024
# The version number, for release:
@ -24,7 +24,7 @@ else
VER_DATE=$(shell date "+%Y-%m-%d")
endif
MAGIC_API_VERSION:=0x00000009
MAGIC_API_VERSION:=0x0000000A
# Need to know the OS
SYSNAME:=$(shell uname -s)