![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "common/darktable.h"#include "common/debug.h"#include "common/folder_survey.h"#include "common/history_merge.h"#include "common/image.h"#include "common/styles.h"#include "control/conf.h"#include "control/control.h"#include "gui/gtk.h"#include "libs/lib.h"#include "libs/lib_api.h"#include "views/view.h"
Include dependency graph for studio_style.c:Go to the source code of this file.
Data Structures | |
| struct | dt_lib_studio_style_t |
Typedefs | |
| typedef enum dt_studio_pool_cols_t | dt_studio_pool_cols_t |
| typedef enum dt_studio_styles_cols_t | dt_studio_styles_cols_t |
| typedef struct dt_lib_studio_style_t | dt_lib_studio_style_t |
Enumerations | |
| enum | dt_studio_pool_cols_t { POOL_COL_NAME = 0 , POOL_NUM_COLS } |
| enum | dt_studio_styles_cols_t { STYLES_COL_NAME = 0 , STYLES_COL_FULLNAME , STYLES_NUM_COLS } |
Functions | |
| const char * | name (dt_lib_module_t *self) |
| const char ** | views (dt_lib_module_t *self) |
| uint32_t | container (dt_lib_module_t *self) |
| int | position () |
| static gboolean | _studio_style_pool_contains (dt_lib_studio_style_t *d, const char *name) |
| static void | _studio_style_save (dt_lib_studio_style_t *d) |
| Persist the pool, in order, to conf. | |
| static void | _studio_style_rebuild_pool_ui (dt_lib_studio_style_t *d) |
| Rebuild the pool treeview, in order, from d->pool. | |
| static void | _studio_style_prune_pool (dt_lib_studio_style_t *d, GList *all_styles) |
| Drop pool entries whose style no longer exists. | |
| static gboolean | _studio_style_get_node_for_name (GtkTreeModel *model, const gboolean root, GtkTreeIter *iter, const gchar *segment_name) |
| Find, or create as a child of the last found/created sibling, the tree node for one "|"-separated path segment. Mirrors libs/styles.c's own category tree builder so both style browsers behave identically. | |
| static void | _studio_style_populate_styles_tree (dt_lib_studio_style_t *d) |
| Rebuild the styles tree from every available style, grouping category segments split on "|" in the style name, and prune the pool of any name that no longer matches one. | |
| static void | _studio_style_name_cell_data_func (GtkTreeViewColumn *column, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) |
| Gray a leaf's name when its style is already in the pool. Computed live at render time (not stored in the model), mirroring libs/history.c's _lib_history_view_cell_set_foreground for the same reason: cell renderers are not separate CSS nodes, so the theme cannot do this via :disabled. | |
| static void | _studio_style_add_cell_data_func (GtkTreeViewColumn *column, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) |
| Show the add icon only on leaves, swapping in a pre-dimmed pixbuf when the leaf's style is already in the pool. Computed live at render time for the same reason as _studio_style_name_cell_data_func above. | |
| static void | _studio_style_pool_action_click (dt_lib_studio_style_t *d, GtkTreePath *path, GtkTreeViewColumn *column) |
| Apply the up/down/remove action for the pool row under a click, identified by which icon column was hit. | |
| static gboolean | _studio_style_pool_button_pressed (GtkWidget *treeview, GdkEventButton *event, gpointer user_data) |
| Left click on a pool row's up/down/remove icon column. | |
| static gboolean | _studio_style_pool_query_tooltip (GtkWidget *treeview, gint x, gint y, gboolean keyboard_tip, GtkTooltip *tooltip, gpointer user_data) |
| static gboolean | _studio_style_add_click (dt_lib_studio_style_t *d, GtkWidget *treeview, GtkTreePath *path) |
| Add the style leaf under a click to the end of the pool. | |
| static gboolean | _studio_style_styles_button_pressed (GtkWidget *treeview, GdkEventButton *event, gpointer user_data) |
| static gboolean | _studio_style_styles_query_tooltip (GtkWidget *treeview, gint x, gint y, gboolean keyboard_tip, GtkTooltip *tooltip, gpointer user_data) |
| static void | _studio_style_apply_callback (GtkWidget *widget, gpointer user_data) |
| Re-apply the pool, in order, to the displayed image. | |
| static void | _studio_style_changed_callback (gpointer instance, gpointer user_data) |
| static void | _studio_style_load_pool (dt_lib_studio_style_t *d) |
| Load the persisted, ordered pool from conf, once at startup. | |
| static GtkTreeViewColumn * | _studio_style_add_name_column (GtkWidget *treeview, const int name_model_col, GtkCellRenderer **out_renderer) |
| Append the text column carrying the row's display name. Packed with expand=TRUE so any later-appended icon columns stay flush right. | |
| static GtkTreeViewColumn * | _studio_style_add_icon_column (GtkWidget *treeview, const char *icon_name, GtkCellRenderer **out_renderer) |
| Append one fixed-width icon column, for per-row action clicks handled by column identity (see the *_button_pressed handlers above). | |
| static GdkPixbuf * | _studio_style_load_icon (const char *icon_name, const double alpha) |
| Load a themed icon at the menu icon size, optionally pre-blended to a lower alpha. Used for the styles tree's add icon: unlike a "sensitive" binding, a literal alpha blend is guaranteed to render dimmed regardless of theme/CSS quirks around cell renderers (see the struct comment above). | |
| void | gui_init (dt_lib_module_t *self) |
| void | gui_cleanup (dt_lib_module_t *self) |
| typedef struct dt_lib_studio_style_t dt_lib_studio_style_t |
| typedef enum dt_studio_pool_cols_t dt_studio_pool_cols_t |
Studio Capture: style module. "Pool" is the ordered treeview of styles actually applied, on import (first entry replaces the fresh history, the rest stack on top) or via the manual apply button. "Styles" below it is a tree of every available style, grouped into categories split on "|" in the style name (same convention as the library's own style panel). Both treeviews carry per-row action icons in dedicated columns (up/down/remove on pool rows, add on style leaves), matching the click-by-column pattern already used for mask group rows in develop/blend_gui.c.
| typedef enum dt_studio_styles_cols_t dt_studio_styles_cols_t |
Studio Capture: style module. "Pool" is the ordered treeview of styles actually applied, on import (first entry replaces the fresh history, the rest stack on top) or via the manual apply button. "Styles" below it is a tree of every available style, grouped into categories split on "|" in the style name (same convention as the library's own style panel). Both treeviews carry per-row action icons in dedicated columns (up/down/remove on pool rows, add on style leaves), matching the click-by-column pattern already used for mask group rows in develop/blend_gui.c.
| Enumerator | |
|---|---|
| POOL_COL_NAME | |
| POOL_NUM_COLS | |
Definition at line 40 of file studio_style.c.
| Enumerator | |
|---|---|
| STYLES_COL_NAME | |
| STYLES_COL_FULLNAME | |
| STYLES_NUM_COLS | |
Definition at line 46 of file studio_style.c.
|
static |
Show the add icon only on leaves, swapping in a pre-dimmed pixbuf when the leaf's style is already in the pool. Computed live at render time for the same reason as _studio_style_name_cell_data_func above.
Definition at line 260 of file studio_style.c.
References _studio_style_pool_contains(), d, dt_free, FALSE, IS_NULL_PTR, model, STYLES_COL_FULLNAME, and TRUE.
Referenced by gui_init().
|
static |
Add the style leaf under a click to the end of the pool.
Definition at line 371 of file studio_style.c.
References _studio_style_pool_contains(), _studio_style_rebuild_pool_ui(), _studio_style_save(), d, dt_free, FALSE, IS_NULL_PTR, model, STYLES_COL_FULLNAME, and TRUE.
Referenced by _studio_style_styles_button_pressed().
|
static |
Append one fixed-width icon column, for per-row action clicks handled by column identity (see the *_button_pressed handlers above).
Definition at line 517 of file studio_style.c.
References DT_PIXEL_APPLY_DPI, and FALSE.
Referenced by gui_init().
|
static |
Append the text column carrying the row's display name. Packed with expand=TRUE so any later-appended icon columns stay flush right.
Definition at line 499 of file studio_style.c.
References TRUE.
Referenced by gui_init().
Re-apply the pool, in order, to the displayed image.
Definition at line 428 of file studio_style.c.
References d, darktable, dt_control_log(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_HISTORY_MERGE_APPEND, dt_hm_batch_state_cleanup(), dt_image_history_changed(), DT_SIGNAL_DEVELOP_HISTORY_CHANGE, dt_styles_apply_to_image_merge(), dt_styles_get_id_by_name(), dt_view_active_images_get_first(), IS_NULL_PTR, darktable_t::signals, TRUE, and UNKNOWN_IMAGE.
Referenced by gui_init().
|
static |
Definition at line 472 of file studio_style.c.
References _studio_style_populate_styles_tree(), _studio_style_rebuild_pool_ui(), _studio_style_save(), and d.
Referenced by gui_cleanup(), and gui_init().
|
static |
Find, or create as a child of the last found/created sibling, the tree node for one "|"-separated path segment. Mirrors libs/styles.c's own category tree builder so both style browsers behave identically.
Definition at line 160 of file studio_style.c.
References dt_free, FALSE, model, STYLES_COL_NAME, and TRUE.
Referenced by _studio_style_populate_styles_tree().
|
static |
Load a themed icon at the menu icon size, optionally pre-blended to a lower alpha. Used for the styles tree's add icon: unlike a "sensitive" binding, a literal alpha blend is guaranteed to render dimmed regardless of theme/CSS quirks around cell renderers (see the struct comment above).
Definition at line 537 of file studio_style.c.
References height, IS_NULL_PTR, and width.
Referenced by gui_init().
|
static |
Load the persisted, ordered pool from conf, once at startup.
Definition at line 483 of file studio_style.c.
References d, dt_conf_get_string(), DT_FOLDER_SURVEY_STYLES_CONF_KEY, DT_FOLDER_SURVEY_STYLES_SEPARATOR, and dt_free.
Referenced by gui_init().
|
static |
Gray a leaf's name when its style is already in the pool. Computed live at render time (not stored in the model), mirroring libs/history.c's _lib_history_view_cell_set_foreground for the same reason: cell renderers are not separate CSS nodes, so the theme cannot do this via :disabled.
Definition at line 240 of file studio_style.c.
References _studio_style_pool_contains(), d, dt_free, FALSE, IS_NULL_PTR, model, STYLES_COL_FULLNAME, and TRUE.
Referenced by gui_init().
|
static |
Apply the up/down/remove action for the pool row under a click, identified by which icon column was hit.
Definition at line 285 of file studio_style.c.
References _studio_style_rebuild_pool_ui(), _studio_style_save(), d, dt_free, and IS_NULL_PTR.
Referenced by _studio_style_pool_button_pressed().
|
static |
Left click on a pool row's up/down/remove icon column.
Definition at line 329 of file studio_style.c.
References _studio_style_pool_action_click(), d, FALSE, and IS_NULL_PTR.
Referenced by gui_init().
|
static |
Definition at line 95 of file studio_style.c.
References d, FALSE, name, and TRUE.
Referenced by _studio_style_add_cell_data_func(), _studio_style_add_click(), and _studio_style_name_cell_data_func().
|
static |
Definition at line 347 of file studio_style.c.
References d, FALSE, IS_NULL_PTR, tooltip, TRUE, and x.
Referenced by gui_init().
|
static |
Rebuild the styles tree from every available style, grouping category segments split on "|" in the style name, and prune the pool of any name that no longer matches one.
Definition at line 201 of file studio_style.c.
References _studio_style_get_node_for_name(), _studio_style_prune_pool(), d, dt_style_free(), dt_styles_get_list(), k, dt_style_t::name, store(), STYLES_COL_FULLNAME, STYLES_COL_NAME, and STYLES_NUM_COLS.
Referenced by _studio_style_changed_callback(), and gui_init().
|
static |
Drop pool entries whose style no longer exists.
Definition at line 137 of file studio_style.c.
References d, dt_free, and FALSE.
Referenced by _studio_style_populate_styles_tree().
|
static |
Rebuild the pool treeview, in order, from d->pool.
Definition at line 121 of file studio_style.c.
References d, POOL_COL_NAME, POOL_NUM_COLS, and store().
Referenced by _studio_style_add_click(), _studio_style_changed_callback(), _studio_style_pool_action_click(), and gui_init().
|
static |
Persist the pool, in order, to conf.
Definition at line 105 of file studio_style.c.
References d, dt_conf_set_string(), DT_FOLDER_SURVEY_STYLES_CONF_KEY, DT_FOLDER_SURVEY_STYLES_SEPARATOR, and TRUE.
Referenced by _studio_style_add_click(), _studio_style_changed_callback(), and _studio_style_pool_action_click().
|
static |
Definition at line 392 of file studio_style.c.
References _studio_style_add_click(), d, FALSE, and IS_NULL_PTR.
Referenced by gui_init().
|
static |
Definition at line 409 of file studio_style.c.
References d, FALSE, tooltip, TRUE, and x.
Referenced by gui_init().
| uint32_t container | ( | dt_lib_module_t * | self | ) |
Definition at line 85 of file studio_style.c.
References DT_UI_CONTAINER_PANEL_LEFT_CENTER.
| void gui_cleanup | ( | dt_lib_module_t * | self | ) |
Definition at line 630 of file studio_style.c.
References _studio_style_changed_callback(), d, darktable, dt_lib_module_t::data, DT_DEBUG_CONTROL_SIGNAL_DISCONNECT, dt_free_gpointer(), IS_NULL_PTR, and darktable_t::signals.
| void gui_init | ( | dt_lib_module_t * | self | ) |
Definition at line 559 of file studio_style.c.
References _studio_style_add_cell_data_func(), _studio_style_add_icon_column(), _studio_style_add_name_column(), _studio_style_apply_callback(), _studio_style_changed_callback(), _studio_style_load_icon(), _studio_style_load_pool(), _studio_style_name_cell_data_func(), _studio_style_pool_button_pressed(), _studio_style_pool_query_tooltip(), _studio_style_populate_styles_tree(), _studio_style_rebuild_pool_ui(), _studio_style_styles_button_pressed(), _studio_style_styles_query_tooltip(), d, darktable, dt_lib_module_t::data, DT_DEBUG_CONTROL_SIGNAL_CONNECT, DT_GUI_BOX_SPACING, DT_SIGNAL_STYLE_CHANGED, DT_UI_RESIZE_DYNAMIC, dt_ui_scroll_wrap(), FALSE, POOL_COL_NAME, darktable_t::signals, STYLES_COL_NAME, TRUE, and dt_lib_module_t::widget.
| const char * name | ( | dt_lib_module_t * | self | ) |
Definition at line 74 of file studio_style.c.
| int position | ( | ) |
Definition at line 90 of file studio_style.c.
| const char ** views | ( | dt_lib_module_t * | self | ) |
Definition at line 79 of file studio_style.c.
References v.