Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
history_actions.c File Reference
#include "common/history_actions.h"
#include "history/notify.h"
#include "common/collection.h"
#include "common/xmp_sidecar.h"
#include "history/history.h"
#include "history/history_snapshot.h"
#include "common/image.h"
#include "caches/image_cache.h"
#include "common/styles.h"
#include "common/undo.h"
#include "common/conf.h"
#include "develop/dev_history.h"
#include "develop/develop.h"
#include "develop/imageop.h"
+ Include dependency graph for history_actions.c:

Go to the source code of this file.

Data Structures

struct  _paste_action_ctx_t
 
struct  dt_history_load_params_t
 
struct  dt_history_delete_params_t
 
struct  dt_history_style_params_t
 

Typedefs

typedef gboolean(* dt_history_action_fn) (const int32_t imgid, void *user_data)
 
typedef struct _paste_action_ctx_t _paste_action_ctx_t
 
typedef struct dt_history_load_params_t dt_history_load_params_t
 
typedef struct dt_history_delete_params_t dt_history_delete_params_t
 
typedef struct dt_history_style_params_t dt_history_style_params_t
 

Functions

dt_history_copy_item_tdt_history_copy_paste_get (void)
 The history clipboard: what "copy history" put there, for "paste" to read.
 
static void _history_action_finalize_list (const GList *list, const gboolean changed)
 
static gboolean _history_action_on_list_with_undo (const GList *list, dt_history_action_fn action, void *user_data, const gboolean use_undo)
 
static gboolean _history_action_on_list (const GList *list, dt_history_action_fn action, void *user_data)
 
static GList * _get_user_mod_list (dt_develop_t *dev_src, GList *ops, gboolean copy_full)
 Build a module list to copy based on selected history indices.
 
static int _history_copy_and_paste_on_image_merge (int32_t imgid, int32_t dest_imgid, GList *ops, const gboolean copy_full, const dt_history_merge_strategy_t mode, const gboolean copy_iop_order, dt_hm_batch_state_t *batch)
 Copy/merge history between images using the merge pipeline.
 
gboolean dt_history_copy_and_paste_on_image (const int32_t imgid, const int32_t dest_imgid, GList *ops, const gboolean copy_full, const dt_history_merge_strategy_t mode, const gboolean copy_iop_order, dt_hm_batch_state_t *batch)
 
gboolean dt_history_copy (int32_t imgid)
 
static gboolean _history_paste_apply (const int32_t imgid, void *user_data)
 
gboolean dt_history_paste_on_image (const int32_t imgid)
 
gboolean dt_history_paste_on_list (const GList *list)
 
static gboolean _history_paste_parts_apply (const int32_t imgid, void *user_data)
 
gboolean dt_history_paste_parts_on_image (const int32_t imgid)
 
gboolean dt_history_paste_parts_on_list (const GList *list)
 
static gboolean _history_compress_apply (const int32_t imgid, void *user_data)
 
void dt_history_compress_on_image (const int32_t imgid)
 
int dt_history_compress_on_list (const GList *imgs)
 
static gboolean _history_load_and_apply_apply (const int32_t imgid, void *user_data)
 
int dt_history_load_and_apply (const int32_t imgid, gchar *filename, int history_only)
 
int dt_history_load_and_apply_on_image (int32_t imgid, gchar *filename, int history_only)
 
int dt_history_load_and_apply_on_list (gchar *filename, const GList *list)
 
static gboolean _history_delete_apply (const int32_t imgid, void *user_data)
 
gboolean dt_history_delete_on_list (const GList *list, gboolean undo)
 
static gboolean _history_style_apply (const int32_t imgid, void *user_data)
 
gboolean dt_history_style_on_image (const int32_t imgid, const char *name, const gboolean duplicate)
 
gboolean dt_history_style_on_list (const GList *list, const char *name, const gboolean duplicate)
 

Variables

static dt_history_copy_item_t _copy_paste = { 0 }
 

Typedef Documentation

◆ _paste_action_ctx_t

◆ dt_history_action_fn

typedef gboolean(* dt_history_action_fn) (const int32_t imgid, void *user_data)

Definition at line 56 of file history_actions.c.

◆ dt_history_delete_params_t

◆ dt_history_load_params_t

◆ dt_history_style_params_t

Function Documentation

◆ _get_user_mod_list()

static GList * _get_user_mod_list ( dt_develop_t dev_src,
GList *  ops,
gboolean  copy_full 
)
static

Build a module list to copy based on selected history indices.

When ops is NULL, builds a list from the full history depending on copy_full.

Parameters
dev_srcSource develop context.
opsOptional list of history indices (as GPOINTER_TO_UINT).
copy_fullWhether to include disabled/default items.
Returns
Newly-allocated list of modules to copy.

Definition at line 91 of file history_actions.c.

References DT_DEBUG_HISTORY, DT_DEBUG_PARAMS, dt_dev_history_get_first_item_by_module(), dt_history_module_skip_copy(), dt_iop_is_hidden(), dt_print(), dt_develop_t::history, dt_develop_t::iop, dt_iop_module_t::multi_priority, dt_dev_history_item_t::num, and dt_iop_module_t::op.

Referenced by _history_copy_and_paste_on_image_merge().

◆ _history_action_finalize_list()

static void _history_action_finalize_list ( const GList *  list,
const gboolean  changed 
)
static

◆ _history_action_on_list()

static gboolean _history_action_on_list ( const GList *  list,
dt_history_action_fn  action,
void user_data 
)
static

◆ _history_action_on_list_with_undo()

static gboolean _history_action_on_list_with_undo ( const GList *  list,
dt_history_action_fn  action,
void user_data,
const gboolean  use_undo 
)
static

◆ _history_compress_apply()

static gboolean _history_compress_apply ( const int32_t  imgid,
void user_data 
)
static

◆ _history_copy_and_paste_on_image_merge()

static int _history_copy_and_paste_on_image_merge ( int32_t  imgid,
int32_t  dest_imgid,
GList *  ops,
const gboolean  copy_full,
const dt_history_merge_strategy_t  mode,
const gboolean  copy_iop_order,
dt_hm_batch_state_t batch 
)
static

Copy/merge history between images using the merge pipeline.

Builds a source dev, resolves the module list, and dispatches to dt_history_merge().

Parameters
imgidSource image id.
dest_imgidDestination image id.
opsOptional list of history indices to copy.
copy_fullWhether to copy the full history.
modeMerge strategy.
Returns
0 on success, non-zero on failure.

Definition at line 162 of file history_actions.c.

References _get_user_mod_list(), dt_conf_get_bool(), dt_dev_cleanup(), dt_dev_init(), dt_dev_merge_history_into_image(), dt_dev_reload_history_items(), dt_dev_replace_history_on_image(), DT_HISTORY_MERGE_REPLACE, FALSE, and TRUE.

Referenced by dt_history_copy_and_paste_on_image().

◆ _history_delete_apply()

◆ _history_load_and_apply_apply()

◆ _history_paste_apply()

◆ _history_paste_parts_apply()

◆ _history_style_apply()

◆ dt_history_compress_on_image()

void dt_history_compress_on_image ( const int32_t  imgid)

Definition at line 322 of file history_actions.c.

References _history_compress_apply().

Referenced by compress_history_callback().

◆ dt_history_compress_on_list()

int dt_history_compress_on_list ( const GList *  imgs)

compress history stack

Definition at line 327 of file history_actions.c.

References _history_action_on_list(), and _history_compress_apply().

Referenced by compress_history_callback().

◆ dt_history_copy()

gboolean dt_history_copy ( int32_t  imgid)

copy history from imgid and pasts on selected images, merge or overwrite...

Definition at line 224 of file history_actions.c.

References dt_history_copy_item_t::copied_imageid, dt_history_copy_paste_get(), FALSE, and TRUE.

Referenced by copy_callback(), and dt_history_copy_parts().

◆ dt_history_copy_and_paste_on_image()

◆ dt_history_copy_paste_get()

dt_history_copy_item_t * dt_history_copy_paste_get ( void  )

The history clipboard: what "copy history" put there, for "paste" to read.

It used to be a dt_history_copy_item_t member of dt_view_manager_t, which made this file – the one that actually defines copy and paste – include views/view.h, layer 7, to reach its own state. The view manager never touched it. It is now file-static here, zero-initialised exactly as it was when the view manager was calloc'd, and handed out by this accessor.

Never NULL, and lives for the process. The GUI reaches it to drive the "paste parts" dialog, which is what items and selops are for.

Definition at line 43 of file history_actions.c.

References _copy_paste.

Referenced by _history_paste_apply(), _history_paste_parts_apply(), dt_history_copy(), dt_history_copy_parts(), dt_history_paste_on_list(), dt_history_paste_parts_on_list(), dt_history_paste_parts_prepare(), and paste_sensitive_callback().

◆ dt_history_delete_on_list()

gboolean dt_history_delete_on_list ( const GList *  list,
gboolean  undo 
)

delete historystack of selected images

Definition at line 426 of file history_actions.c.

References _history_action_on_list_with_undo(), and _history_delete_apply().

Referenced by delete_history_callback().

◆ dt_history_load_and_apply()

int dt_history_load_and_apply ( const int32_t  imgid,
gchar *  filename,
int  history_only 
)

load a dt file and applies to specified image

Definition at line 376 of file history_actions.c.

References _history_load_and_apply_apply().

Referenced by dt_history_load_and_apply_on_image(), and load_xmp_on_image().

◆ dt_history_load_and_apply_on_image()

int dt_history_load_and_apply_on_image ( int32_t  imgid,
gchar *  filename,
int  history_only 
)

◆ dt_history_load_and_apply_on_list()

int dt_history_load_and_apply_on_list ( gchar *  filename,
const GList *  list 
)

load a dt file and applies to selected images

Definition at line 387 of file history_actions.c.

References _history_action_on_list(), and _history_load_and_apply_apply().

Referenced by load_xmp_callback().

◆ dt_history_paste_on_image()

gboolean dt_history_paste_on_image ( const int32_t  imgid)

Definition at line 258 of file history_actions.c.

References _history_paste_apply().

◆ dt_history_paste_on_list()

gboolean dt_history_paste_on_list ( const GList *  list)

◆ dt_history_paste_parts_on_image()

gboolean dt_history_paste_parts_on_image ( const int32_t  imgid)

Definition at line 290 of file history_actions.c.

References _history_paste_parts_apply().

◆ dt_history_paste_parts_on_list()

◆ dt_history_style_on_image()

gboolean dt_history_style_on_image ( const int32_t  imgid,
const char *  name,
const gboolean  duplicate 
)

◆ dt_history_style_on_list()

gboolean dt_history_style_on_list ( const GList *  list,
const char *  name,
const gboolean  duplicate 
)

Variable Documentation

◆ _copy_paste

dt_history_copy_item_t _copy_paste = { 0 }
static

Definition at line 41 of file history_actions.c.

Referenced by dt_history_copy_paste_get().