![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "develop/imageop_gui.h"#include "widgets/widget_settings.h"#include "develop/dev_history_gui.h"#include "develop/blend_gui.h"#include "develop/dev_history.h"#include "develop/gui_throttle.h"#include "develop/develop.h"#include "develop/imageop.h"#include "develop/masks_gui.h"#include "develop/pixelpipe_hb.h"#include "system/macros.h"#include <gtk/gtk.h>Go to the source code of this file.
Data Structures | |
| struct | dt_dev_pending_commit_t |
Typedefs | |
| typedef struct dt_dev_pending_commit_t | dt_dev_pending_commit_t |
Functions | |
| static void | _history_gui_refresh (dt_develop_t *dev) |
| static void | _undo_restore_gui (dt_develop_t *dev, const int mask_edit_mode, const int request_mask_display) |
| void | dt_dev_history_gui_update (dt_develop_t *dev) |
| Apply history-loaded params to module GUIs. | |
| static gboolean | _drain_pending_commits (gpointer user_data) |
| static gboolean | _request_is_switch (void) |
| static void | _queue_pending_commit (dt_develop_t *dev, dt_iop_module_t *module, const gboolean enable) |
| void | dt_dev_history_commit_item_from_gui (dt_develop_t *dev, dt_iop_module_t *module, const gboolean enable) |
| Commit one history item from a GUI control now, after the commits queued before it. | |
| void | dt_dev_history_flush_pending_commits (dt_develop_t *dev) |
Run every history commit still queued for dev, now. | |
| void | dt_dev_history_drop_pending_commits (dt_develop_t *dev) |
Discard every history commit still queued for dev, without running it. | |
| void | dt_dev_add_history_item_real (dt_develop_t *dev, dt_iop_module_t *module, gboolean enable, gboolean redraw) |
| Thread-safe wrapper around dt_dev_add_history_item_ext(). | |
| static void | _commit_gui (dt_develop_t *dev, dt_iop_module_t *module) |
| void | dt_dev_history_gui_init (void) |
| Install the history engine's GUI handlers. Called once from dt_init() beside the other handler installs – safe under ansel-cli too, because every handler fires only for a dev with a focused GUI module, which a headless dev never has. | |
Variables | |
| static GQueue | _pending_commits = G_QUEUE_INIT |
| static guint | _pending_commit_source = 0 |
| static guint32 | _last_choice_time = 0 |
| typedef struct dt_dev_pending_commit_t dt_dev_pending_commit_t |
|
static |
Definition at line 352 of file dev_history_gui.c.
References dev, dt_dev_get_thumbnail_size(), dt_gui_freeze_begin, dt_gui_freeze_end, dt_iop_gui_set_enable_button(), dt_iop_module_t::modify_roi_in, and dt_iop_module_t::modify_roi_out.
Referenced by dt_dev_history_gui_init().
|
static |
Definition at line 186 of file dev_history_gui.c.
References _pending_commit_source, _pending_commits, dt_dev_pending_commit_t::dev, dt_dev_history_commit_item_now(), dt_free, dt_dev_pending_commit_t::enable, dt_dev_pending_commit_t::module, dt_dev_pending_commit_t::switched, and void().
Referenced by _queue_pending_commit(), and dt_dev_history_flush_pending_commits().
|
static |
Definition at line 36 of file dev_history_gui.c.
References dev, dt_dev_history_refresh_nodes_ext(), dt_dev_masks_list_change(), dt_dev_signal_modules_moved(), dt_gui_freeze_begin, dt_gui_freeze_end, dt_iop_gui_cleanup_module(), dt_iop_gui_init(), dt_iop_gui_set_expander(), dt_iop_gui_update(), dt_iop_is_hidden(), dt_iop_request_focus(), dt_pthread_rwlock_unlock(), dt_pthread_rwlock_wrlock(), dt_iop_module_gui_t::expander, dt_iop_module_t::gui, IS_NULL_PTR, and dt_iop_module_gui_t::widget.
Referenced by _undo_restore_gui(), and dt_dev_history_gui_update().
|
static |
Definition at line 231 of file dev_history_gui.c.
References _drain_pending_commits(), _pending_commit_source, _pending_commits, _request_is_switch(), dev, dt_dev_pending_commit_t::dev, dt_dev_history_commit_item_now(), dt_gui_throttle_get_timeout_ms(), dt_dev_pending_commit_t::enable, enable(), IS_NULL_PTR, dt_dev_pending_commit_t::module, and dt_dev_pending_commit_t::switched.
Referenced by dt_dev_add_history_item_real().
|
static |
Definition at line 215 of file dev_history_gui.c.
References _last_choice_time, dt_gui_throttle_get_user_timeout_ms(), dt_gui_widgets_choice_announced(), IS_NULL_PTR, and type.
Referenced by _queue_pending_commit(), and dt_dev_history_commit_item_from_gui().
|
static |
Definition at line 95 of file dev_history_gui.c.
References _history_gui_refresh(), dev, DT_DEV_PIXELPIPE_DISPLAY_MASK, dt_iop_gui_update_blendif(), dt_masks_set_edit_mode(), IS_NULL_PTR, and dt_iop_gui_blend_data_t::showmask.
Referenced by dt_dev_history_gui_init().
| void dt_dev_add_history_item_real | ( | struct dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| gboolean | enable, | ||
| gboolean | redraw ) |
Thread-safe wrapper around dt_dev_add_history_item_ext().
Locks history mutex, invalidates pipelines, triggers recomputation and saves history. This is the typical entry point for GUI actions.
| dev | Develop context. |
| module | Module instance. |
| enable | Enable state. |
| redraw | Whether to force a GUI redraw. |
Definition at line 342 of file dev_history_gui.c.
References _queue_pending_commit(), dev, dt_masks_form_exit_creation(), enable(), and void().
| void dt_dev_history_commit_item_from_gui | ( | struct dt_develop_t * | dev, |
| struct dt_iop_module_t * | module, | ||
| gboolean | enable ) |
Commit one history item from a GUI control now, after the commits queued before it.
For a choice made in a GUI control that must land before the next statement, where dt_dev_add_history_item() would be wrong (it ends the shape creation session the edit belongs to): a shape tool setting. A shape drawn or edited on the canvas is not a choice and commits with dt_dev_history_commit_item_now(..., FALSE), even when a key ends it. It flushes the pending commits, so the edits queued before it keep their order, then commits with the switched rule of the queue: a key press, a combobox choice or a check box click keeps the outputs of the state it replaces (see dt_dev_history_commit_item_now()). GUI thread only.
Definition at line 270 of file dev_history_gui.c.
References _request_is_switch(), dev, dt_dev_history_commit_item_now(), dt_dev_history_flush_pending_commits(), and enable().
Referenced by dt_iop_gui_changed(), and rt_select_algorithm_callback().
| void dt_dev_history_drop_pending_commits | ( | struct dt_develop_t * | dev | ) |
Discard every history commit still queued for dev, without running it.
Last-resort counterpart to dt_dev_history_flush_pending_commits(), for a dev already too far torn down to commit to. Prefer the flush wherever the edit can still be saved.
| dev | the develop context, or NULL to drop every pending request. |
Definition at line 313 of file dev_history_gui.c.
References _pending_commit_source, _pending_commits, dev, dt_dev_pending_commit_t::dev, dt_free, and IS_NULL_PTR.
Referenced by cleanup(), and dt_dev_cleanup().
| void dt_dev_history_flush_pending_commits | ( | struct dt_develop_t * | dev | ) |
Run every history commit still queued for dev, now.
dt_dev_add_history_item_real() queues its commit rather than running it, so that a slider drag or a combobox scroll does not run one per step. A queued request IS the user's last edit, so it is run here, not discarded.
Any code about to tear down dev's pipe nodes, iop list or history MUST call this while dev is still whole – it is the last moment at which committing is safe, and a request draining after teardown is the darkroom race described in CLAUDE.md, which crashes far from where it is caused.
| dev | the develop context, or NULL to flush every pending request. |
Definition at line 277 of file dev_history_gui.c.
References _drain_pending_commits(), _pending_commit_source, _pending_commits, dev, dt_dev_pending_commit_t::dev, dt_dev_history_commit_item_now(), dt_free, dt_gui_throttle_get_timeout_ms(), dt_dev_pending_commit_t::enable, IS_NULL_PTR, dt_dev_pending_commit_t::module, and dt_dev_pending_commit_t::switched.
Referenced by _delayed_history_commit(), dt_dev_history_commit_item_from_gui(), dt_iop_gui_duplicate(), dt_masks_gui_form_save_creation(), and leave().
Install the history engine's GUI handlers. Called once from dt_init() beside the other handler installs – safe under ansel-cli too, because every handler fires only for a dev with a focused GUI module, which a headless dev never has.
Definition at line 366 of file dev_history_gui.c.
References _commit_gui(), _undo_restore_gui(), dt_dev_history_set_commit_gui_handler(), and dt_dev_history_set_undo_restore_gui_handler().
Referenced by gui_init().
| void dt_dev_history_gui_update | ( | struct dt_develop_t * | dev | ) |
Apply history-loaded params to module GUIs.
Ensures module instances shown in the GUI match the history state.
| dev | Develop context. |
Definition at line 115 of file dev_history_gui.c.
References _history_gui_refresh(), dev, and dt_masks_form_exit_creation().
Referenced by _darkroom_image_loaded_callback(), _history_apply_history_end(), dt_apply_dev_history_update(), dt_ioppr_migrate_iop_order(), and dt_lightroom_import().
|
static |
Definition at line 183 of file dev_history_gui.c.
Referenced by _request_is_switch().
|
static |
Definition at line 182 of file dev_history_gui.c.
Referenced by _drain_pending_commits(), _queue_pending_commit(), dt_dev_history_drop_pending_commits(), and dt_dev_history_flush_pending_commits().
|
static |
Definition at line 181 of file dev_history_gui.c.
Referenced by _drain_pending_commits(), _queue_pending_commit(), dt_dev_history_drop_pending_commits(), and dt_dev_history_flush_pending_commits().