![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"
#include "common/darktable.h"
#include "common/debug.h"
#include "common/file_location.h"
#include "common/presets.h"
#include "control/control.h"
#include "develop/blend.h"
#include "develop/develop.h"
#include "gui/gtk.h"
#include "gui/guides.h"
#include "gui/presets.h"
#include <assert.h>
#include <stdlib.h>
Functions | |
void | dt_gui_presets_init () |
void | dt_gui_presets_add_generic (const char *name, dt_dev_operation_t op, const int32_t version, const void *params, const int32_t params_size, const int32_t enabled, const dt_develop_blend_colorspace_t blend_cst) |
void | dt_gui_presets_add_with_blendop (const char *name, dt_dev_operation_t op, const int32_t version, const void *params, const int32_t params_size, const void *blend_params, const int32_t enabled) |
static gchar * | _get_active_preset_name (dt_iop_module_t *module, int *writeprotect) |
static void | _menuitem_delete_preset (GtkMenuItem *menuitem, dt_iop_module_t *module) |
static void | _edit_preset_final_callback (dt_gui_presets_edit_dialog_t *g) |
static void | _edit_preset_response (GtkDialog *dialog, gint response_id, dt_gui_presets_edit_dialog_t *g) |
void | dt_gui_presets_confirm_and_delete (GtkWidget *parent_dialog, const char *name, const char *module_name, int rowid) |
static void | _check_buttons_activated (GtkCheckButton *button, dt_gui_presets_edit_dialog_t *g) |
static void | _presets_show_edit_dialog (dt_gui_presets_edit_dialog_t *g, gboolean allow_name_change, gboolean allow_desc_change, gboolean allow_remove) |
void | dt_gui_presets_show_iop_edit_dialog (const char *name_in, dt_iop_module_t *module, GCallback final_callback, gpointer data, gboolean allow_name_change, gboolean allow_desc_change, gboolean allow_remove, GtkWindow *parent) |
void | dt_gui_presets_show_edit_dialog (const char *name_in, const char *module_name, int rowid, GCallback final_callback, gpointer data, gboolean allow_name_change, gboolean allow_desc_change, gboolean allow_remove, GtkWindow *parent) |
static void | _edit_preset (const char *name_in, dt_iop_module_t *module) |
static void | _menuitem_edit_preset (GtkMenuItem *menuitem, dt_iop_module_t *module) |
static void | _menuitem_update_preset (GtkMenuItem *menuitem, dt_iop_module_t *module) |
static void | _menuitem_new_preset (GtkMenuItem *menuitem, dt_iop_module_t *module) |
void | dt_gui_presets_apply_preset (const gchar *name, dt_iop_module_t *module) |
static void | _menuitem_pick_preset (GtkMenuItem *menuitem, dt_iop_module_t *module) |
gboolean | dt_gui_presets_autoapply_for_module (dt_iop_module_t *module) |
static gboolean | _menuitem_button_released_preset (GtkMenuItem *menuitem, GdkEventButton *event, dt_iop_module_t *module) |
static void | _gui_presets_popup_menu_show_internal (dt_dev_operation_t op, int32_t version, dt_iop_params_t *params, int32_t params_size, dt_develop_blend_params_t *bl_params, dt_iop_module_t *module, const dt_image_t *image, void(*pick_callback)(GtkMenuItem *, void *), void *callback_data) |
void | dt_gui_presets_popup_menu_show_for_params (dt_dev_operation_t op, int32_t version, void *params, int32_t params_size, void *blendop_params, const dt_image_t *image, void(*pick_callback)(GtkMenuItem *, void *), void *callback_data) |
void | dt_gui_presets_popup_menu_show_for_module (dt_iop_module_t *module) |
void | dt_gui_presets_update_mml (const char *name, dt_dev_operation_t op, const int32_t version, const char *maker, const char *model, const char *lens) |
void | dt_gui_presets_update_iso (const char *name, dt_dev_operation_t op, const int32_t version, const float min, const float max) |
void | dt_gui_presets_update_av (const char *name, dt_dev_operation_t op, const int32_t version, const float min, const float max) |
void | dt_gui_presets_update_tv (const char *name, dt_dev_operation_t op, const int32_t version, const float min, const float max) |
void | dt_gui_presets_update_fl (const char *name, dt_dev_operation_t op, const int32_t version, const float min, const float max) |
void | dt_gui_presets_update_ldr (const char *name, dt_dev_operation_t op, const int32_t version, const int ldrflag) |
void | dt_gui_presets_update_autoapply (const char *name, dt_dev_operation_t op, const int32_t version, const int autoapply) |
void | dt_gui_presets_update_filter (const char *name, dt_dev_operation_t op, const int32_t version, const int filter) |
Variables | |
const int | dt_gui_presets_exposure_value_cnt = 24 |
const float | dt_gui_presets_exposure_value [] |
const char * | dt_gui_presets_exposure_value_str [] |
const int | dt_gui_presets_aperture_value_cnt = 19 |
const float | dt_gui_presets_aperture_value [] = { 0, 0.5, 0.7, 1.0, 1.4, 2.0, 2.8, 4.0, 5.6, 8.0, 11.0, 16.0, 22.0, 32.0, 45.0, 64.0, 90.0, 128.0, FLT_MAX } |
const char * | dt_gui_presets_aperture_value_str [] |
static const char * | _gui_presets_format_value_str [5] = { N_("non-raw"), N_("raw"), N_("HDR"), N_("monochrome"), N_("color") } |
static const int | _gui_presets_format_flag [5] = { FOR_LDR, FOR_RAW, FOR_HDR, FOR_NOT_MONO, FOR_NOT_COLOR } |
|
static |
Referenced by _presets_show_edit_dialog().
|
static |
References _edit_preset_final_callback(), _get_active_preset_name(), darktable, dt_control_log(), dt_gui_presets_show_iop_edit_dialog(), dt_ui_main_window(), FALSE, darktable_t::gui, name, TRUE, and dt_gui_gtk_t::ui.
Referenced by _menuitem_edit_preset(), and _menuitem_new_preset().
|
static |
References dt_gui_store_last_preset().
Referenced by _edit_preset().
|
static |
References _gui_presets_format_flag, darktable, darktable_t::db, dt_bauhaus_combobox_get(), dt_conf_get_folder_to_file_chooser(), dt_conf_set_folder_from_file_chooser(), dt_control_log(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_BLOB, DT_DEBUG_SQLITE3_BIND_DOUBLE, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_develop_blend_version(), dt_gui_presets_aperture_value, dt_gui_presets_confirm_and_delete(), dt_gui_presets_exposure_value, dt_lib_presets_remove(), dt_osx_disallow_fullscreen(), DT_PRESETS_FOR_NOT, dt_presets_save_to_file(), name, and void().
Referenced by _presets_show_edit_dialog().
|
static |
References dt_iop_module_t::blend_params, darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_iop_module_t::enabled, MIN, name, dt_iop_module_t::op, dt_iop_module_t::params, and dt_iop_module_t::params_size.
Referenced by _edit_preset(), and _menuitem_delete_preset().
|
static |
References _menuitem_button_released_preset(), _menuitem_delete_preset(), _menuitem_edit_preset(), _menuitem_new_preset(), _menuitem_update_preset(), dt_image_t::camera_alias, dt_image_t::camera_maker, darktable, darktable_t::db, dt_iop_module_t::default_blendop_params, dt_iop_module_t::default_params, dt_conf_get_bool(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_DOUBLE, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_gui_add_class(), dt_image_is_hdr(), dt_image_is_rawprepare_supported(), dt_image_monochrome_flags(), dt_iop_module_t::enabled, dt_image_t::exif_aperture, dt_image_t::exif_exposure, dt_image_t::exif_focal_length, dt_image_t::exif_iso, dt_image_t::exif_lens, dt_image_t::exif_maker, dt_image_t::exif_model, FALSE, FOR_HDR, FOR_LDR, FOR_NOT_COLOR, FOR_NOT_MONO, FOR_RAW, darktable_t::gui, dt_gui_gtk_t::last_preset, MIN, name, dt_iop_module_t::params_size, params_size(), pick_callback(), dt_gui_gtk_t::presets_popup_menu, and TRUE.
Referenced by dt_gui_presets_popup_menu_show_for_module(), and dt_gui_presets_popup_menu_show_for_params().
|
static |
References _menuitem_pick_preset(), dt_iop_gui_duplicate(), dt_iop_gui_rename_module(), FALSE, and IOP_FLAGS_ONE_INSTANCE.
Referenced by _gui_presets_popup_menu_show_internal().
|
static |
|
static |
References _edit_preset().
Referenced by _gui_presets_popup_menu_show_internal().
|
static |
References _edit_preset(), dt_lib_presets_remove(), and dt_iop_module_t::op.
Referenced by _gui_presets_popup_menu_show_internal().
|
static |
References dt_gui_presets_apply_preset(), and name.
Referenced by _menuitem_button_released_preset().
|
static |
References dt_iop_module_t::blend_params, darktable, darktable_t::db, dt_conf_get_bool(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_BLOB, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_develop_blend_version(), dt_osx_disallow_fullscreen(), dt_ui_main_window(), dt_iop_module_t::enabled, darktable_t::gui, name, dt_iop_module_t::op, dt_iop_module_t::params, dt_iop_module_t::params_size, and dt_gui_gtk_t::ui.
Referenced by _gui_presets_popup_menu_show_internal().
|
static |
References _check_buttons_activated(), _edit_preset_response(), _gui_presets_format_flag, _gui_presets_format_value_str, darktable_t::bauhaus, darktable, darktable_t::db, dt_accels_disconnect_on_text_input(), dt_bauhaus_combobox_add(), dt_bauhaus_combobox_new(), dt_bauhaus_combobox_set(), dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, DT_GUI_MODULE, dt_gui_presets_aperture_value, dt_gui_presets_aperture_value_cnt, dt_gui_presets_aperture_value_str, dt_gui_presets_exposure_value, dt_gui_presets_exposure_value_cnt, dt_gui_presets_exposure_value_str, dt_osx_disallow_fullscreen(), DT_PIXEL_APPLY_DPI, DT_PRESETS_FOR_NOT, dt_presets_module_can_autoapply(), FALSE, and TRUE.
Referenced by dt_gui_presets_show_edit_dialog(), and dt_gui_presets_show_iop_edit_dialog().
void dt_gui_presets_add_generic | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const void * | params, | ||
const int32_t | params_size, | ||
const int32_t | enabled, | ||
const dt_develop_blend_colorspace_t | blend_cst | ||
) |
add or replace a generic (i.e. non-exif specific) preset for this operation.
References dt_develop_blend_init_blend_parameters(), dt_gui_presets_add_with_blendop(), name, and params_size().
Referenced by init_presets(), and set_presets().
void dt_gui_presets_add_with_blendop | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const void * | params, | ||
const int32_t | params_size, | ||
const void * | blend_params, | ||
const int32_t | enabled | ||
) |
same as add_generic but also supply blendop parameters for the presets.
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_BLOB, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_develop_blend_version(), name, and params_size().
Referenced by add_preset(), and dt_gui_presets_add_generic().
void dt_gui_presets_apply_preset | ( | const gchar * | name, |
dt_iop_module_t * | module | ||
) |
apply a preset to the current module
References dt_iop_module_t::blend_params, darktable, darktable_t::db, dt_iop_module_t::default_blendop_params, darktable_t::develop, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_dev_add_history_item, dt_develop_blend_legacy_params(), dt_develop_blend_version(), dt_gui_store_last_preset(), dt_iop_commit_blend_params(), dt_iop_gui_update(), FALSE, name, dt_iop_module_t::op, dt_iop_module_t::params, dt_iop_module_t::params_size, and dt_iop_module_t::widget.
Referenced by _menuitem_pick_preset(), and dt_gui_presets_autoapply_for_module().
gboolean dt_gui_presets_autoapply_for_module | ( | dt_iop_module_t * | module | ) |
apply any auto presets that are appropriate for the current module
References dt_image_t::camera_alias, dt_image_t::camera_maker, darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_DOUBLE, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_gui_presets_apply_preset(), dt_image_is_hdr(), dt_image_is_matrix_correction_supported(), dt_image_is_rawprepare_supported(), dt_image_monochrome_flags(), dt_image_t::exif_aperture, dt_image_t::exif_exposure, dt_image_t::exif_focal_length, dt_image_t::exif_iso, dt_image_t::exif_lens, dt_image_t::exif_maker, dt_image_t::exif_model, FALSE, FOR_HDR, FOR_LDR, FOR_NOT_COLOR, FOR_NOT_MONO, FOR_RAW, name, dt_iop_module_t::op, and TRUE.
Referenced by _gui_reset_callback().
void dt_gui_presets_confirm_and_delete | ( | GtkWidget * | parent_dialog, |
const char * | name, | ||
const char * | module_name, | ||
int | rowid | ||
) |
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_osx_disallow_fullscreen(), and name.
Referenced by _edit_preset_response(), and tree_key_press_presets().
void dt_gui_presets_init | ( | ) |
create a db table with presets for all operations.
References darktable, darktable_t::db, dt_database_get(), and DT_DEBUG_SQLITE3_EXEC.
Referenced by dt_gui_gtk_init(), and dt_init().
void dt_gui_presets_popup_menu_show_for_module | ( | dt_iop_module_t * | module | ) |
show the popup menu for the given module, with default behavior.
References _gui_presets_popup_menu_show_internal(), dt_iop_module_t::blend_params, dt_iop_module_t::dev, dt_develop_t::image_storage, dt_iop_module_t::op, dt_iop_module_t::params, and dt_iop_module_t::params_size.
Referenced by _presets_popup_callback().
void dt_gui_presets_popup_menu_show_for_params | ( | dt_dev_operation_t | op, |
int32_t | version, | ||
void * | params, | ||
int32_t | params_size, | ||
void * | blendop_params, | ||
const dt_image_t * | image, | ||
void(*)(GtkMenuItem *, void *) | pick_callback, | ||
void * | callback_data | ||
) |
show a popup menu without initialized module.
References _gui_presets_popup_menu_show_internal(), params_size(), and pick_callback().
void dt_gui_presets_show_edit_dialog | ( | const char * | name_in, |
const char * | module_name, | ||
int | rowid, | ||
GCallback | final_callback, | ||
gpointer | data, | ||
gboolean | allow_name_change, | ||
gboolean | allow_desc_change, | ||
gboolean | allow_remove, | ||
GtkWindow * | parent | ||
) |
References _presets_show_edit_dialog(), darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, and DT_DEBUG_SQLITE3_PREPARE_V2.
Referenced by edit_preset(), and edit_preset().
void dt_gui_presets_show_iop_edit_dialog | ( | const char * | name_in, |
dt_iop_module_t * | module, | ||
GCallback | final_callback, | ||
gpointer | data, | ||
gboolean | allow_name_change, | ||
gboolean | allow_desc_change, | ||
gboolean | allow_remove, | ||
GtkWindow * | parent | ||
) |
References _presets_show_edit_dialog(), and dt_iop_module_t::op.
Referenced by _edit_preset().
void dt_gui_presets_update_autoapply | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const int | autoapply | ||
) |
set auto apply property of preset.
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, and name.
Referenced by init_presets(), and set_presets().
void dt_gui_presets_update_av | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const float | min, | ||
const float | max | ||
) |
void dt_gui_presets_update_filter | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const int | filter | ||
) |
set filter mode. if 1, the preset will only show for matching images.
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, and name.
Referenced by init_presets(), and set_presets().
void dt_gui_presets_update_fl | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const float | min, | ||
const float | max | ||
) |
void dt_gui_presets_update_iso | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const float | min, | ||
const float | max | ||
) |
update ranges for iso, aperture, exposure, and focal length, respectively.
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_DOUBLE, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, and name.
Referenced by init_presets(), and set_presets().
void dt_gui_presets_update_ldr | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const int | ldrflag | ||
) |
update ldr flag: 0-don't care, 1-low dynamic range, 2-raw
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, and name.
Referenced by init_presets(), and set_presets().
void dt_gui_presets_update_mml | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const char * | maker, | ||
const char * | model, | ||
const char * | lens | ||
) |
update match strings for maker, model, lens.
References darktable, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, maker, model, and name.
Referenced by init_presets(), and set_presets().
void dt_gui_presets_update_tv | ( | const char * | name, |
dt_dev_operation_t | op, | ||
const int32_t | version, | ||
const float | min, | ||
const float | max | ||
) |
|
static |
Referenced by _edit_preset_response(), and _presets_show_edit_dialog().
|
static |
Referenced by _presets_show_edit_dialog().
const float dt_gui_presets_aperture_value[] = { 0, 0.5, 0.7, 1.0, 1.4, 2.0, 2.8, 4.0, 5.6, 8.0, 11.0, 16.0, 22.0, 32.0, 45.0, 64.0, 90.0, 128.0, FLT_MAX } |
Referenced by _edit_preset_response(), _presets_show_edit_dialog(), and tree_insert_presets().
const int dt_gui_presets_aperture_value_cnt = 19 |
Referenced by _presets_show_edit_dialog(), and tree_insert_presets().
const char* dt_gui_presets_aperture_value_str[] |
Referenced by _presets_show_edit_dialog(), and tree_insert_presets().
const float dt_gui_presets_exposure_value[] |
Referenced by _edit_preset_response(), _presets_show_edit_dialog(), and tree_insert_presets().
const int dt_gui_presets_exposure_value_cnt = 24 |
Referenced by _presets_show_edit_dialog(), and tree_insert_presets().
const char* dt_gui_presets_exposure_value_str[] |
Referenced by _presets_show_edit_dialog(), and tree_insert_presets().