From 3b099f0c4fbbd425f34eabb73eefd280fd4a43a4 Mon Sep 17 00:00:00 2001 From: Alexandre Bique Date: Fri, 13 Sep 2024 11:47:38 +0200 Subject: [PATCH] undo: simplify the interface --- include/clap/ext/draft/undo.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/clap/ext/draft/undo.h b/include/clap/ext/draft/undo.h index c28a9936..2b53bacc 100644 --- a/include/clap/ext/draft/undo.h +++ b/include/clap/ext/draft/undo.h @@ -41,11 +41,6 @@ extern "C" { /// and maybe an easier experience for the user because there's a single undo context versus one /// for the host and one for each plugin instance. -enum clap_undo_context_flags { - // While the host is within a change, it is impossible to perform undo or redo. - CLAP_UNDO_IS_WITHIN_CHANGE = 1 << 0, -}; - enum clap_undo_delta_properties_flags { // If not set, then all clap_undo_delta_properties's attributes become irrelevant. // If set, then the plugin will provide deltas in host->change_made(). @@ -102,6 +97,17 @@ typedef struct clap_plugin_undo { uint64_t flags, const char *undo_name, const char *redo_name); + + // if can_* is false then it invalidates the corresponding name. + // [main-thread] + void (CLAP_ABI *set_can_undo)(const clap_plugin_t *plugin, bool can_undo); + void (CLAP_ABI *set_can_redo)(const clap_plugin_t *plugin, bool can_redo); + + // name: null terminated string if an redo/undo step exists, null otherwise. + // [main-thread] + void (CLAP_ABI *set_undo_name)(const clap_plugin_t *plugin, const char *name); + void (CLAP_ABI *set_redo_name)(const clap_plugin_t *plugin, const char *name); + } clap_plugin_undo_t; typedef struct clap_host_undo {