Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dev_history.c File Reference
#include "common/darktable.h"
#include "common/undo.h"
#include "common/history_snapshot.h"
#include "common/image_cache.h"
#include "develop/dev_history.h"
#include "develop/blend.h"
#include "develop/imageop.h"
#include "develop/masks.h"
#include "gui/presets.h"
#include <glib.h>
+ Include dependency graph for dev_history.c:

Macros

#define AUTO_SAVE_TIMEOUT   15000
 

Functions

static void _process_history_db_entry (dt_develop_t *dev, sqlite3_stmt *stmt, const int32_t imgid, int *legacy_params, gboolean presets)
 
static dt_dev_history_item_t_search_history_by_module (dt_develop_t *dev, dt_iop_module_t *module)
 
static dt_dev_history_item_t_search_history_by_op (dt_develop_t *dev, dt_iop_module_t *module)
 
const dt_dev_history_item_t_get_last_history_item_for_module (dt_develop_t *dev, struct dt_iop_module_t *module)
 
static void _fill_used_forms (GList *forms_list, int formid, int *used, int nb)
 
int dt_history_merge_module_into_history (dt_develop_t *dev_dest, dt_develop_t *dev_src, dt_iop_module_t *mod_src, GList **_modules_used)
 
static int _history_copy_and_paste_on_image_merge (int32_t imgid, int32_t dest_imgid, GList *ops, const gboolean copy_full)
 
gboolean dt_history_copy_and_paste_on_image (const int32_t imgid, const int32_t dest_imgid, GList *ops, const gboolean copy_iop_order, const gboolean copy_full)
 
GList * dt_history_duplicate (GList *hist)
 
static dt_iop_module_t_find_mask_manager (dt_develop_t *dev)
 
static void _remove_history_leaks (dt_develop_t *dev)
 
gboolean dt_dev_add_history_item_ext (dt_develop_t *dev, struct dt_iop_module_t *module, gboolean enable, gboolean force_new_item, gboolean no_image, gboolean include_masks)
 Append a new history item on dev->history, at dev->history_end position. If history items exist after dev->history_end, they will be removed under certain conditions.
 
uint64_t dt_dev_history_get_hash (dt_develop_t *dev)
 Get the integrity checksum of the whole history stack.
 
int dt_dev_history_auto_save (dt_develop_t *dev)
 Write history to DB and XMP only if the integrety hash has changed since first reading history, or since prior saving point. Callback function meant to be used with g_timeout, or standalone.
 
void dt_dev_add_history_item_real (dt_develop_t *dev, dt_iop_module_t *module, gboolean enable)
 
void dt_dev_free_history_item (gpointer data)
 
void dt_dev_history_free_history (dt_develop_t *dev)
 
void dt_dev_reload_history_items (dt_develop_t *dev)
 
static void _dt_dev_modules_reload_defaults (dt_develop_t *dev)
 
static void _history_to_module (const dt_dev_history_item_t *const hist, dt_iop_module_t *module)
 
void dt_dev_pop_history_items_ext (dt_develop_t *dev)
 
void dt_dev_pop_history_items (dt_develop_t *dev)
 
static void _cleanup_history (const int32_t imgid)
 
guint dt_dev_mask_history_overload (GList *dev_history, guint threshold)
 
static void _warn_about_history_overuse (GList *dev_history, int32_t imgid)
 
void dt_dev_write_history_end_ext (const int history_end, const int32_t imgid)
 
int dt_dev_write_history_item (const int32_t imgid, dt_dev_history_item_t *h, int32_t num)
 
void dt_dev_write_history_ext (dt_develop_t *dev, const int32_t imgid)
 
void dt_dev_write_history (dt_develop_t *dev)
 
static gboolean _dev_auto_apply_presets (dt_develop_t *dev, int32_t imgid)
 
char * _print_validity (gboolean state)
 
static void _insert_default_modules (dt_develop_t *dev, dt_iop_module_t *module, const int32_t imgid, gboolean is_inited)
 
static gboolean _init_default_history (dt_develop_t *dev, const int32_t imgid)
 
static void _find_so_for_history_entry (dt_develop_t *dev, dt_dev_history_item_t *hist)
 
static void _sync_blendop_params (dt_dev_history_item_t *hist, const void *blendop_params, const int bl_length, const int blendop_version, int *legacy_params)
 
static int _sync_params (dt_dev_history_item_t *hist, const void *module_params, const int param_length, const int modversion, int *legacy_params, const char *preset_name)
 
void dt_dev_read_history_ext (dt_develop_t *dev, const int32_t imgid, gboolean no_image)
 
void dt_dev_invalidate_history_module (GList *list, dt_iop_module_t *module)
 
gboolean dt_history_module_skip_copy (const int flags)
 
gboolean _module_leaves_no_history (dt_iop_module_t *module)
 
void dt_dev_history_compress (dt_develop_t *dev)
 Compress an history from a loaded pipeline, aka simply take a snapshot of all modules parameters. This assumes the history end is properly set, which always happens after calling _pop_history_item.
 

Macro Definition Documentation

◆ AUTO_SAVE_TIMEOUT

#define AUTO_SAVE_TIMEOUT   15000

Function Documentation

◆ _cleanup_history()

static void _cleanup_history ( const int32_t  imgid)
static

◆ _dev_auto_apply_presets()

◆ _dt_dev_modules_reload_defaults()

static void _dt_dev_modules_reload_defaults ( dt_develop_t dev)
inlinestatic

◆ _fill_used_forms()

static void _fill_used_forms ( GList *  forms_list,
int  formid,
int *  used,
int  nb 
)
static

◆ _find_mask_manager()

static dt_iop_module_t * _find_mask_manager ( dt_develop_t dev)
static

References dt_develop_t::iop.

◆ _find_so_for_history_entry()

◆ _get_last_history_item_for_module()

const dt_dev_history_item_t * _get_last_history_item_for_module ( dt_develop_t dev,
struct dt_iop_module_t module 
)

◆ _history_copy_and_paste_on_image_merge()

◆ _history_to_module()

◆ _init_default_history()

◆ _insert_default_modules()

◆ _module_leaves_no_history()

gboolean _module_leaves_no_history ( dt_iop_module_t module)

◆ _print_validity()

char * _print_validity ( gboolean  state)

◆ _process_history_db_entry()

◆ _remove_history_leaks()

◆ _search_history_by_module()

static dt_dev_history_item_t * _search_history_by_module ( dt_develop_t dev,
dt_iop_module_t module 
)
static

◆ _search_history_by_op()

static dt_dev_history_item_t * _search_history_by_op ( dt_develop_t dev,
dt_iop_module_t module 
)
static

◆ _sync_blendop_params()

static void _sync_blendop_params ( dt_dev_history_item_t hist,
const void blendop_params,
const int  bl_length,
const int  blendop_version,
int *  legacy_params 
)
static

◆ _sync_params()

static int _sync_params ( dt_dev_history_item_t hist,
const void module_params,
const int  param_length,
const int  modversion,
int *  legacy_params,
const char *  preset_name 
)
static

◆ _warn_about_history_overuse()

static void _warn_about_history_overuse ( GList *  dev_history,
int32_t  imgid 
)
static

◆ dt_dev_add_history_item_ext()

gboolean dt_dev_add_history_item_ext ( struct dt_develop_t dev,
struct dt_iop_module_t module,
gboolean  enable,
gboolean  force_new_item,
gboolean  no_image,
gboolean  include_masks 
)

◆ dt_dev_add_history_item_real()

◆ dt_dev_free_history_item()

◆ dt_dev_history_auto_save()

int dt_dev_history_auto_save ( struct dt_develop_t dev)

Write history to DB and XMP only if the integrety hash has changed since first reading history, or since prior saving point. Callback function meant to be used with g_timeout, or standalone.

Parameters
dev
Returns
int

References dt_develop_t::auto_save_timeout, dt_times_t::clock, dt_control_save_xmp(), dt_dev_history_get_hash(), dt_dev_write_history_ext(), dt_get_times(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_show_times(), dt_toast_log(), dt_develop_t::history_hash, dt_develop_t::history_mutex, dt_image_t::id, and dt_develop_t::image_storage.

Referenced by _export_button_clicked(), dt_dev_add_history_item_real(), and leave().

◆ dt_dev_history_compress()

void dt_dev_history_compress ( struct dt_develop_t dev)

Compress an history from a loaded pipeline, aka simply take a snapshot of all modules parameters. This assumes the history end is properly set, which always happens after calling _pop_history_item.

Parameters
dev

References _module_leaves_no_history(), dt_dev_add_history_item_ext(), dt_dev_history_free_history(), dt_dev_reload_history_items(), dt_dev_write_history(), dt_dev_write_history_ext(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_develop_t::history_mutex, dt_image_t::id, dt_develop_t::image_storage, dt_develop_t::iop, and TRUE.

Referenced by _lib_history_truncate().

◆ dt_dev_history_free_history()

void dt_dev_history_free_history ( struct dt_develop_t dev)

Free the whole GList of dt_dev_history_item_t attached to dev->history

References dt_dev_free_history_item(), and dt_develop_t::history.

Referenced by dt_dev_history_compress(), dt_dev_reload_history_items(), and leave().

◆ dt_dev_history_get_hash()

uint64_t dt_dev_history_get_hash ( struct dt_develop_t dev)

Get the integrity checksum of the whole history stack.

Parameters
dev
Returns
uint64_t

References DT_DEBUG_HISTORY, dt_dev_get_history_end(), dt_hash(), dt_print(), dt_dev_history_item_t::hash, and dt_develop_t::history.

Referenced by dt_dev_history_auto_save(), and dt_dev_read_history_ext().

◆ dt_dev_invalidate_history_module()

void dt_dev_invalidate_history_module ( GList *  list,
struct dt_iop_module_t module 
)
Todo:
: why is that needed ?

Referenced by _history_invalidate_cb().

◆ dt_dev_mask_history_overload()

guint dt_dev_mask_history_overload ( GList *  dev_history,
guint  threshold 
)

◆ dt_dev_pop_history_items()

◆ dt_dev_pop_history_items_ext()

◆ dt_dev_read_history_ext()

◆ dt_dev_reload_history_items()

◆ dt_dev_write_history()

◆ dt_dev_write_history_end_ext()

void dt_dev_write_history_end_ext ( const int  history_end,
const int32_t  imgid 
)

◆ dt_dev_write_history_ext()

◆ dt_dev_write_history_item()

◆ dt_history_copy_and_paste_on_image()

◆ dt_history_duplicate()

◆ dt_history_merge_module_into_history()

◆ dt_history_module_skip_copy()

gboolean dt_history_module_skip_copy ( const int  flags)