Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
ioporder.c File Reference
#include "bauhaus/bauhaus.h"
#include "common/colorspaces.h"
#include "common/darktable.h"
#include "common/debug.h"
#include "common/history.h"
#include "common/iop_order.h"
#include "control/signal.h"
#include "develop/develop.h"
#include "develop/format.h"
#include "develop/imageop.h"
#include "develop/pixelpipe_hb.h"
#include "dtgtk/button.h"
#include "dtgtk/paint.h"
#include "dtgtk/togglebutton.h"
#include "gui/gtk.h"
#include "gui/presets.h"
#include "libs/lib.h"
#include <gtk/gtk.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
+ Include dependency graph for ioporder.c:

Data Structures

struct  dt_ioporder_graph_node_t
 
struct  dt_lib_ioporder_t
 

Macros

#define DT_IOPORDER_GRAPH_NODE_WIDTH   DT_PIXEL_APPLY_DPI(260)
 
#define DT_IOPORDER_GRAPH_NODE_STEP   DT_PIXEL_APPLY_DPI(300)
 
#define DT_IOPORDER_GRAPH_LEFT_MARGIN   DT_PIXEL_APPLY_DPI(60)
 
#define DT_IOPORDER_GRAPH_TOP_MARGIN   DT_PIXEL_APPLY_DPI(68)
 
#define DT_IOPORDER_GRAPH_MIN_WIDTH   DT_PIXEL_APPLY_DPI(640)
 
#define DT_IOPORDER_GRAPH_HEIGHT   DT_PIXEL_APPLY_DPI(540)
 
#define DT_IOPORDER_BAND_HEIGHT   DT_PIXEL_APPLY_DPI(26)
 
#define DT_IOPORDER_MASK_ARROW_OFFSET   DT_PIXEL_APPLY_DPI(12)
 
#define DT_IOPORDER_MASK_BOTTOM_MARGIN   DT_PIXEL_APPLY_DPI(56)
 

Typedefs

typedef enum dt_ioporder_dnd_target_t dt_ioporder_dnd_target_t
 
typedef enum dt_ioporder_runtime_band_kind_t dt_ioporder_runtime_band_kind_t
 
typedef struct dt_ioporder_graph_node_t dt_ioporder_graph_node_t
 
typedef struct dt_lib_ioporder_t dt_lib_ioporder_t
 

Enumerations

enum  dt_ioporder_dnd_target_t { DT_IOPORDER_DND_TARGET_NODE = 0 }
 
enum  dt_ioporder_runtime_band_kind_t {
  DT_IOPORDER_RUNTIME_BAND_NONE = 0 ,
  DT_IOPORDER_RUNTIME_BAND_UNAVAILABLE ,
  DT_IOPORDER_RUNTIME_BAND_RAW ,
  DT_IOPORDER_RUNTIME_BAND_SENSOR_RGB ,
  DT_IOPORDER_RUNTIME_BAND_PIPELINE_RGB ,
  DT_IOPORDER_RUNTIME_BAND_DISPLAY_RGB ,
  DT_IOPORDER_RUNTIME_BAND_LAB ,
  DT_IOPORDER_RUNTIME_BAND_OTHER
}
 

Functions

static void _ioporder_drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time, gpointer user_data)
 Handle drag-data export for the graph node drag and drop.
 
static void _ioporder_drag_begin (GtkWidget *widget, GdkDragContext *context, gpointer user_data)
 Track the module being dragged from the graph.
 
static void _ioporder_drag_end (GtkWidget *widget, GdkDragContext *context, gpointer user_data)
 Reset drag feedback when the source drag ends.
 
static gboolean _ioporder_drag_motion (GtkWidget *widget, GdkDragContext *dc, gint x, gint y, guint time, gpointer user_data)
 Validate the potential drop target while dragging across graph nodes.
 
static gboolean _ioporder_drag_drop (GtkWidget *widget, GdkDragContext *dc, gint x, gint y, guint time, gpointer user_data)
 Request the drag payload when dropping on a graph node.
 
static void _ioporder_drag_leave (GtkWidget *widget, GdkDragContext *dc, guint time, gpointer user_data)
 Clear drop feedback when leaving a graph node during drag.
 
static void _ioporder_drag_data_received (GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *selection_data, guint info, guint time, gpointer user_data)
 Commit a module reorder after dropping on another graph node.
 
static void _ioporder_free_graph_node (gpointer data)
 Release one graph node descriptor.
 
static void _ioporder_popup_destroy (GtkWidget *widget, gpointer user_data)
 Drop cached popup widget pointers once GTK destroys the popup.
 
static gboolean _ioporder_module_in_history (const dt_iop_module_t *module)
 Return TRUE when a module already exists in history.
 
static gboolean _ioporder_module_is_graph_visible (const dt_iop_module_t *module)
 Apply the active-pipe visibility policy used by modulegroups.
 
static dt_dev_pixelpipe_iop_t_ioporder_get_preview_piece (dt_iop_module_t *module)
 Map a module instance to its preview-pipe piece.
 
static const char * _ioporder_type_to_string (const dt_iop_buffer_type_t datatype)
 Return a human-readable datatype string for a pixel descriptor.
 
static const char * _ioporder_colorspace_to_string (const dt_iop_colorspace_type_t cst)
 Return a human-readable colorspace string for a pixel descriptor.
 
static gchar * _ioporder_raw_flags_to_string (const dt_iop_buffer_dsc_t *dsc)
 Format the RAW-specific flags carried by a pixel descriptor.
 
static gchar * _ioporder_descriptor_to_text (const char *prefix, const dt_iop_buffer_dsc_t *dsc, const char *display_colorspace)
 Build the descriptor list shown below each module node.
 
static dt_ioporder_runtime_band_kind_t _ioporder_runtime_band_kind (const gboolean raw_input, const gboolean colorin_crossed, const dt_iop_module_t *module, const dt_iop_buffer_dsc_t *dsc, const gboolean after_module)
 Classify one runtime descriptor into a stable band kind.
 
static const char * _ioporder_runtime_band_label (const dt_ioporder_runtime_band_kind_t kind, const dt_iop_buffer_dsc_t *dsc)
 Return the user-visible label for one runtime band kind.
 
static void _ioporder_runtime_band_color (const dt_ioporder_runtime_band_kind_t kind, GdkRGBA *color)
 Pick the color used by the colorspace lifecycle band.
 
static gboolean _ioporder_same_runtime_profile (const dt_iop_order_iccprofile_info_t *profile_a, const dt_iop_order_iccprofile_info_t *profile_b)
 Compare two profile descriptors for lifecycle segment merging.
 
static const dt_iop_order_iccprofile_info_t_ioporder_runtime_band_profile_info (const gboolean raw_input, const gboolean colorin_crossed, const dt_iop_module_t *module, const dt_iop_buffer_dsc_t *dsc, const gboolean after_module)
 Pick the RGB profile metadata that matches one runtime band segment.
 
static gchar * _ioporder_runtime_band_text (const char *label, const dt_iop_order_iccprofile_info_t *profile_info)
 Build the text shown in one colorspace-band segment.
 
static gchar * _ioporder_get_current_order_name (dt_lib_module_t *self)
 Retrieve the display name of the current pipeline order.
 
static void _ioporder_refresh_toolbar (dt_lib_module_t *self)
 Refresh the preset combo and status label in the popup toolbar.
 
static void _ioporder_clear_graph (dt_lib_ioporder_t *d)
 Destroy every node widget and free the node descriptors.
 
static void _ioporder_set_enable_button_icon (GtkWidget *widget, dt_iop_module_t *module)
 Apply the same enable-button icon policy used by module headers.
 
static void _ioporder_node_toggle_enable (GtkToggleButton *togglebutton, gpointer user_data)
 Proxy the module enable state through the real darkroom header widget.
 
static void _ioporder_node_toggle_mask (GtkToggleButton *togglebutton, gpointer user_data)
 Proxy raster/drawn mask preview toggling through the real module header.
 
static void _ioporder_node_show_presets (GtkButton *button, gpointer user_data)
 Open the standard module preset popup from a graph node.
 
static dt_ioporder_graph_node_t_ioporder_create_graph_node (dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece, const char *display_in, const char *display_out)
 Create one interactive graph node mirroring a module header.
 
static dt_ioporder_graph_node_t_ioporder_create_endpoint_node (const char *label)
 Create a compact endpoint node used for the graph boundaries.
 
static void _ioporder_rebuild_graph (dt_lib_module_t *self)
 Refresh the full graph contents from the current darkroom pipeline.
 
static void _ioporder_draw_rounded_rect (cairo_t *cr, const double x, const double y, const double width, const double height, const double radius)
 Draw a filled rounded rectangle.
 
static void _ioporder_draw_label (GtkWidget *widget, cairo_t *cr, const double x, const double y, const char *text)
 Draw a short label with the widget font on the graph background.
 
static void _ioporder_draw_sequence_arrow (cairo_t *cr, const double x1, const double y1, const double x2, const double y2)
 Draw a straight sequence arrow between two consecutive module nodes.
 
static void _ioporder_draw_mask_arrow (GtkWidget *widget, cairo_t *cr, const double sx, const double sy, const double dx, const double dy)
 Draw a curved raster-mask dependency arrow between two nodes.
 
static gboolean _ioporder_graph_draw (GtkWidget *widget, cairo_t *cr, gpointer user_data)
 Paint the graph background, runtime bands, fences, and arrows.
 
static void _ioporder_add_preset (GtkButton *button, gpointer user_data)
 Save the current pipeline order as a named preset.
 
static void _ioporder_reset_order (GtkButton *button, gpointer user_data)
 Reset the current order to the default v3.0 order.
 
static void _ioporder_apply_preset (GtkComboBox *combo, gpointer user_data)
 Apply the preset selected in the popup toolbar combo box.
 
static void _ioporder_init_popup (dt_lib_module_t *self)
 Build the popup window lazily on first use.
 
void show_popup (dt_lib_module_t *self)
 Open the popup window owned by the ioporder lib.
 
static void _ioporder_refresh_callback (gpointer instance, gpointer user_data)
 Central refresh callback for develop-side state changes.
 
static void _ioporder_presets_changed_callback (gpointer instance, gpointer module_name, gpointer user_data)
 Refresh the preset toolbar when ioporder presets change.
 
const char * name (struct dt_lib_module_t *self)
 
const char ** views (dt_lib_module_t *self)
 
uint32_t container (dt_lib_module_t *self)
 
int expandable (dt_lib_module_t *self)
 
int position ()
 
void gui_init (dt_lib_module_t *self)
 
void gui_cleanup (dt_lib_module_t *self)
 
void gui_reset (dt_lib_module_t *self)
 
void init_presets (dt_lib_module_t *self)
 
int set_params (dt_lib_module_t *self, const void *params, int size)
 
voidget_params (dt_lib_module_t *self, int *size)
 
gboolean preset_autoapply (dt_lib_module_t *self)
 

Variables

static const GtkTargetEntry _ioporder_target_list []
 
static const guint _ioporder_target_count = G_N_ELEMENTS(_ioporder_target_list)
 

Macro Definition Documentation

◆ DT_IOPORDER_BAND_HEIGHT

#define DT_IOPORDER_BAND_HEIGHT   DT_PIXEL_APPLY_DPI(26)

◆ DT_IOPORDER_GRAPH_HEIGHT

#define DT_IOPORDER_GRAPH_HEIGHT   DT_PIXEL_APPLY_DPI(540)

◆ DT_IOPORDER_GRAPH_LEFT_MARGIN

#define DT_IOPORDER_GRAPH_LEFT_MARGIN   DT_PIXEL_APPLY_DPI(60)

◆ DT_IOPORDER_GRAPH_MIN_WIDTH

#define DT_IOPORDER_GRAPH_MIN_WIDTH   DT_PIXEL_APPLY_DPI(640)

◆ DT_IOPORDER_GRAPH_NODE_STEP

#define DT_IOPORDER_GRAPH_NODE_STEP   DT_PIXEL_APPLY_DPI(300)

◆ DT_IOPORDER_GRAPH_NODE_WIDTH

#define DT_IOPORDER_GRAPH_NODE_WIDTH   DT_PIXEL_APPLY_DPI(260)

◆ DT_IOPORDER_GRAPH_TOP_MARGIN

#define DT_IOPORDER_GRAPH_TOP_MARGIN   DT_PIXEL_APPLY_DPI(68)

◆ DT_IOPORDER_MASK_ARROW_OFFSET

#define DT_IOPORDER_MASK_ARROW_OFFSET   DT_PIXEL_APPLY_DPI(12)

◆ DT_IOPORDER_MASK_BOTTOM_MARGIN

#define DT_IOPORDER_MASK_BOTTOM_MARGIN   DT_PIXEL_APPLY_DPI(56)

Typedef Documentation

◆ dt_ioporder_dnd_target_t

◆ dt_ioporder_graph_node_t

◆ dt_ioporder_runtime_band_kind_t

◆ dt_lib_ioporder_t

Enumeration Type Documentation

◆ dt_ioporder_dnd_target_t

Enumerator
DT_IOPORDER_DND_TARGET_NODE 

◆ dt_ioporder_runtime_band_kind_t

Enumerator
DT_IOPORDER_RUNTIME_BAND_NONE 
DT_IOPORDER_RUNTIME_BAND_UNAVAILABLE 
DT_IOPORDER_RUNTIME_BAND_RAW 
DT_IOPORDER_RUNTIME_BAND_SENSOR_RGB 
DT_IOPORDER_RUNTIME_BAND_PIPELINE_RGB 
DT_IOPORDER_RUNTIME_BAND_DISPLAY_RGB 
DT_IOPORDER_RUNTIME_BAND_LAB 
DT_IOPORDER_RUNTIME_BAND_OTHER 

Function Documentation

◆ _ioporder_add_preset()

static void _ioporder_add_preset ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _ioporder_apply_preset()

static void _ioporder_apply_preset ( GtkComboBox *  combo,
gpointer  user_data 
)
static

Apply the preset selected in the popup toolbar combo box.

Parameters
comboPreset selection combo box.
user_dataThe ioporder lib module.

References _ioporder_rebuild_graph(), d, darktable, dt_lib_module_t::data, darktable_t::develop, dt_iop_gui_commit_iop_order_change(), dt_lib_presets_apply(), FALSE, dt_lib_module_t::plugin_name, and TRUE.

Referenced by _ioporder_init_popup().

◆ _ioporder_clear_graph()

static void _ioporder_clear_graph ( dt_lib_ioporder_t d)
static

Destroy every node widget and free the node descriptors.

Parameters
dPopup runtime state.

References _ioporder_free_graph_node(), d, and IS_NULL_PTR.

Referenced by _ioporder_rebuild_graph(), and gui_cleanup().

◆ _ioporder_colorspace_to_string()

static const char * _ioporder_colorspace_to_string ( const dt_iop_colorspace_type_t  cst)
static

Return a human-readable colorspace string for a pixel descriptor.

Parameters
cstDescriptor colorspace enum.
Returns
Static human-readable colorspace string.

References IOP_CS_HSL, IOP_CS_JZCZHZ, IOP_CS_LAB, IOP_CS_LCH, IOP_CS_NONE, IOP_CS_RAW, IOP_CS_RGB, and IOP_CS_RGB_DISPLAY.

Referenced by _ioporder_runtime_band_label().

◆ _ioporder_create_endpoint_node()

static dt_ioporder_graph_node_t * _ioporder_create_endpoint_node ( const char *  label)
static

Create a compact endpoint node used for the graph boundaries.

Endpoint nodes represent the pipeline source and sink, so they stay smaller, non-interactive, and visually distinct from module header replicas.

Parameters
labelUser-visible endpoint label.
Returns
Newly-allocated endpoint node descriptor.

References dt_capitalize_label(), dt_gui_add_class(), DT_PIXEL_APPLY_DPI, dt_ioporder_graph_node_t::endpoint_label, dt_ioporder_graph_node_t::event_box, dt_ioporder_graph_node_t::header, dt_ioporder_graph_node_t::is_endpoint, dt_ioporder_graph_node_t::title, and TRUE.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_create_graph_node()

◆ _ioporder_descriptor_to_text()

static gchar * _ioporder_descriptor_to_text ( const char *  prefix,
const dt_iop_buffer_dsc_t dsc,
const char *  display_colorspace 
)
static

Build the descriptor list shown below each module node.

We keep the runtime contract explicit as a short title followed by one item per property so users can scan the in/out descriptors independently.

Parameters
prefixUser-visible list title such as "In" or "Out".
dscDescriptor to format.
display_colorspaceUser-visible runtime lifecycle label.
Returns
Newly-allocated user-visible descriptor list.

References _ioporder_raw_flags_to_string(), _ioporder_type_to_string(), dt_iop_buffer_dsc_t::channels, dt_iop_buffer_dsc_t::datatype, dt_free, IS_NULL_PTR, and dt_iop_buffer_dsc_t::processed_maximum.

Referenced by _ioporder_create_graph_node().

◆ _ioporder_drag_begin()

static void _ioporder_drag_begin ( GtkWidget widget,
GdkDragContext *  context,
gpointer  user_data 
)
static

Track the module being dragged from the graph.

Parameters
widgetSource node widget.
contextDrag context.
user_dataThe ioporder lib module.

References d, and dt_lib_module_t::data.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_drag_data_get()

static void _ioporder_drag_data_get ( GtkWidget widget,
GdkDragContext *  context,
GtkSelectionData *  selection_data,
guint  info,
guint  time,
gpointer  user_data 
)
static

Handle drag-data export for the graph node drag and drop.

Parameters
widgetSource node widget.
contextDrag context.
selection_dataDrag payload.
infoTarget info id.
timeEvent timestamp.
user_dataThe ioporder lib module.

References TRUE, and value.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_drag_data_received()

static void _ioporder_drag_data_received ( GtkWidget widget,
GdkDragContext *  dc,
gint  x,
gint  y,
GtkSelectionData *  selection_data,
guint  info,
guint  time,
gpointer  user_data 
)
static

Commit a module reorder after dropping on another graph node.

This mirrors darkroom's reorder flow: update the order list, reorder the visible expander widgets, rebuild the pipe, append history, and raise the module-moved signal.

Parameters
widgetDrop target node widget.
dcDrag context.
xLocal X coordinate.
yLocal Y coordinate.
selection_dataDrag payload.
infoTarget info id.
timeEvent timestamp.
user_dataThe ioporder lib module.

References _ioporder_rebuild_graph(), d, dt_lib_module_t::data, dt_iop_gui_move_module_after(), dt_iop_gui_move_module_before(), FALSE, dt_iop_module_t::iop_order, and TRUE.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_drag_drop()

static gboolean _ioporder_drag_drop ( GtkWidget widget,
GdkDragContext *  dc,
gint  x,
gint  y,
guint  time,
gpointer  user_data 
)
static

Request the drag payload when dropping on a graph node.

Parameters
widgetDestination node widget.
dcDrag context.
xLocal X coordinate.
yLocal Y coordinate.
timeEvent timestamp.
user_dataThe ioporder lib module.
Returns
Always TRUE because data retrieval continues asynchronously.

References TRUE.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_drag_end()

static void _ioporder_drag_end ( GtkWidget widget,
GdkDragContext *  context,
gpointer  user_data 
)
static

Reset drag feedback when the source drag ends.

Parameters
widgetSource node widget.
contextDrag context.
user_dataThe ioporder lib module.

References d, and dt_lib_module_t::data.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_drag_leave()

static void _ioporder_drag_leave ( GtkWidget widget,
GdkDragContext *  dc,
guint  time,
gpointer  user_data 
)
static

Clear drop feedback when leaving a graph node during drag.

Parameters
widgetDestination node widget.
dcDrag context.
timeEvent timestamp.
user_dataThe ioporder lib module.

References d, and dt_lib_module_t::data.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_drag_motion()

static gboolean _ioporder_drag_motion ( GtkWidget widget,
GdkDragContext *  dc,
gint  x,
gint  y,
guint  time,
gpointer  user_data 
)
static

Validate the potential drop target while dragging across graph nodes.

Parameters
widgetDestination node widget under the pointer.
dcDrag context.
xLocal X coordinate.
yLocal Y coordinate.
timeEvent timestamp.
user_dataThe ioporder lib module.
Returns
TRUE when the drop target is valid.

References d, darktable, dt_lib_module_t::data, darktable_t::develop, dt_ioppr_check_can_move_after_iop(), dt_ioppr_check_can_move_before_iop(), FALSE, dt_develop_t::iop, and dt_iop_module_t::iop_order.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_draw_label()

static void _ioporder_draw_label ( GtkWidget widget,
cairo_t *  cr,
const double  x,
const double  y,
const char *  text 
)
static

Draw a short label with the widget font on the graph background.

Parameters
widgetReference widget used to create the layout.
crCairo context.
xLeft coordinate.
yTop coordinate.
textText to draw.

References IS_NULL_PTR, and x.

Referenced by _ioporder_graph_draw().

◆ _ioporder_draw_mask_arrow()

static void _ioporder_draw_mask_arrow ( GtkWidget widget,
cairo_t *  cr,
const double  sx,
const double  sy,
const double  dx,
const double  dy 
)
static

Draw a curved raster-mask dependency arrow between two nodes.

Parameters
widgetReference widget used to render the arrow annotation.
crCairo context.
sxSource X.
sySource Y.
dxDestination X.
dyDestination Y.

References _ioporder_draw_rounded_rect(), DT_IOPORDER_MASK_BOTTOM_MARGIN, DT_PIXEL_APPLY_DPI, dtgtk_cairo_paint_showmask(), M_PI, MAX, MIN, and void().

Referenced by _ioporder_graph_draw().

◆ _ioporder_draw_rounded_rect()

static void _ioporder_draw_rounded_rect ( cairo_t *  cr,
const double  x,
const double  y,
const double  width,
const double  height,
const double  radius 
)
static

Draw a filled rounded rectangle.

Parameters
crCairo context.
xLeft coordinate.
yTop coordinate.
widthRectangle width.
heightRectangle height.
radiusCorner radius.

References height, M_PI, MIN, r, width, and x.

Referenced by _ioporder_draw_mask_arrow(), and _ioporder_graph_draw().

◆ _ioporder_draw_sequence_arrow()

static void _ioporder_draw_sequence_arrow ( cairo_t *  cr,
const double  x1,
const double  y1,
const double  x2,
const double  y2 
)
static

Draw a straight sequence arrow between two consecutive module nodes.

Parameters
crCairo context.
x1Arrow start X.
y1Arrow start Y.
x2Arrow end X.
y2Arrow end Y.

References DT_PIXEL_APPLY_DPI, and M_PI.

Referenced by _ioporder_graph_draw().

◆ _ioporder_free_graph_node()

static void _ioporder_free_graph_node ( gpointer  data)
static

Release one graph node descriptor.

Widgets are destroyed separately when clearing the fixed container, so this helper only releases the bookkeeping fields owned by the node.

Parameters
dataNode descriptor to free.

References dt_free, dt_ioporder_graph_node_t::endpoint_label, and IS_NULL_PTR.

Referenced by _ioporder_clear_graph(), and _ioporder_popup_destroy().

◆ _ioporder_get_current_order_name()

static gchar * _ioporder_get_current_order_name ( dt_lib_module_t self)
static

Retrieve the display name of the current pipeline order.

Built-in orders use their public name while custom orders are matched against saved presets to surface a preset name when possible.

Parameters
selfThe ioporder lib module.
Returns
Newly-allocated current order name.

References d, darktable, dt_lib_module_t::data, darktable_t::db, darktable_t::develop, dt_database_get(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, dt_free_gpointer(), DT_IOP_ORDER_ANSEL_RAW, DT_IOP_ORDER_CUSTOM, dt_iop_order_string(), dt_ioppr_deserialize_iop_order_list(), dt_ioppr_get_iop_order_list_kind(), dt_ioppr_serialize_text_iop_order_list(), dt_develop_t::iop_order_list, IS_NULL_PTR, kind, and name.

Referenced by _ioporder_refresh_toolbar().

◆ _ioporder_get_preview_piece()

static dt_dev_pixelpipe_iop_t * _ioporder_get_preview_piece ( dt_iop_module_t module)
static

Map a module instance to its preview-pipe piece.

The runtime descriptors displayed under each node come from the preview pipe, so we scan the instantiated preview nodes and match them by module pointer.

Parameters
moduleModule whose runtime piece is requested.
Returns
Matching preview-pipe piece or NULL when unavailable.

References darktable, dt_dev_pixelpipe_iop_t::data, darktable_t::develop, IS_NULL_PTR, dt_dev_pixelpipe_t::nodes, and dt_develop_t::preview_pipe.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_graph_draw()

◆ _ioporder_init_popup()

static void _ioporder_init_popup ( dt_lib_module_t self)
static

Build the popup window lazily on first use.

The popup owns the toolbar and the scrollable graph surface and is kept alive for the whole darkroom session so updates only need to refresh its contents.

Parameters
selfThe ioporder lib module.

References _ioporder_add_preset(), _ioporder_apply_preset(), _ioporder_graph_draw(), _ioporder_popup_destroy(), _ioporder_rebuild_graph(), _ioporder_refresh_toolbar(), _ioporder_reset_order(), add_preset(), d, darktable, dt_lib_module_t::data, DT_IOPORDER_GRAPH_HEIGHT, DT_IOPORDER_GRAPH_MIN_WIDTH, DT_PIXEL_APPLY_DPI, dt_ui_main_window(), FALSE, darktable_t::gui, reset(), TRUE, and dt_gui_gtk_t::ui.

Referenced by show_popup().

◆ _ioporder_module_in_history()

static gboolean _ioporder_module_in_history ( const dt_iop_module_t module)
static

Return TRUE when a module already exists in history.

The graph uses the same active/history visibility policy as the active pipe tab, so we scan the history stack and look for the exact module instance.

Parameters
moduleModule to test.
Returns
TRUE when the module is present in history.

References darktable, darktable_t::develop, FALSE, dt_develop_t::history, IS_NULL_PTR, and TRUE.

Referenced by _ioporder_module_is_graph_visible().

◆ _ioporder_module_is_graph_visible()

static gboolean _ioporder_module_is_graph_visible ( const dt_iop_module_t module)
static

Apply the active-pipe visibility policy used by modulegroups.

We only show visible GUI modules that are currently enabled or that already appear in history, matching the darkroom pipeline tab.

Parameters
moduleModule to test.
Returns
TRUE when the module should appear in the graph.

References _ioporder_module_in_history(), dt_iop_is_hidden(), FALSE, and IS_NULL_PTR.

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_node_show_presets()

static void _ioporder_node_show_presets ( GtkButton *  button,
gpointer  user_data 
)
static

Open the standard module preset popup from a graph node.

Parameters
buttonProxy presets button clicked in the graph node.
user_dataNode descriptor.

References darktable, dt_gui_menu_popup(), dt_gui_presets_popup_menu_show_for_module(), DTGTK_BUTTON, dtgtk_button_set_active(), DTGTK_IS_BUTTON, FALSE, darktable_t::gui, and dt_gui_gtk_t::presets_popup_menu.

Referenced by _ioporder_create_graph_node().

◆ _ioporder_node_toggle_enable()

static void _ioporder_node_toggle_enable ( GtkToggleButton *  togglebutton,
gpointer  user_data 
)
static

Proxy the module enable state through the real darkroom header widget.

The proxy button keeps the graph UI consistent while delegating the actual state change to the existing module header callback chain.

Parameters
togglebuttonProxy enable button.
user_dataNode descriptor.

Referenced by _ioporder_create_graph_node().

◆ _ioporder_node_toggle_mask()

static void _ioporder_node_toggle_mask ( GtkToggleButton *  togglebutton,
gpointer  user_data 
)
static

Proxy raster/drawn mask preview toggling through the real module header.

Parameters
togglebuttonProxy mask-display button.
user_dataNode descriptor.

Referenced by _ioporder_create_graph_node().

◆ _ioporder_popup_destroy()

static void _ioporder_popup_destroy ( GtkWidget widget,
gpointer  user_data 
)
static

Drop cached popup widget pointers once GTK destroys the popup.

The popup is transient-for the main window and uses destroy-with-parent, so application shutdown may destroy it before the lib cleanup code runs. Keep the graph node bookkeeping cleanup local here while the widget ownership is still entirely on the GTK side, then invalidate every cached widget pointer so later teardown paths don't touch stale instances.

Parameters
widgetDestroyed popup window.
user_dataThe ioporder lib private state.

References _ioporder_free_graph_node(), d, and IS_NULL_PTR.

Referenced by _ioporder_init_popup().

◆ _ioporder_presets_changed_callback()

static void _ioporder_presets_changed_callback ( gpointer  instance,
gpointer  module_name,
gpointer  user_data 
)
static

Refresh the preset toolbar when ioporder presets change.

Parameters
instanceSignal instance.
module_namePlugin name carried by the preset-changed signal.
user_dataThe ioporder lib module.

References _ioporder_rebuild_graph(), _ioporder_refresh_toolbar(), d, dt_lib_module_t::data, and dt_lib_module_t::plugin_name.

Referenced by gui_cleanup(), and gui_init().

◆ _ioporder_raw_flags_to_string()

static gchar * _ioporder_raw_flags_to_string ( const dt_iop_buffer_dsc_t dsc)
static

Format the RAW-specific flags carried by a pixel descriptor.

Parameters
dscDescriptor to inspect.
Returns
Newly-allocated string describing RAW layout or passthrough state.

References dt_iop_buffer_dsc_t::cst, dt_iop_buffer_dsc_t::filters, IOP_CS_RAW, and IS_NULL_PTR.

Referenced by _ioporder_descriptor_to_text().

◆ _ioporder_rebuild_graph()

static void _ioporder_rebuild_graph ( dt_lib_module_t self)
static

Refresh the full graph contents from the current darkroom pipeline.

We rebuild the graph from scratch because the visible subset, runtime descriptors, mask links, and reorder boundaries all change together whenever the pipe changes.

Parameters
selfThe ioporder lib module.

References _ioporder_clear_graph(), _ioporder_create_endpoint_node(), _ioporder_create_graph_node(), _ioporder_drag_begin(), _ioporder_drag_data_get(), _ioporder_drag_data_received(), _ioporder_drag_drop(), _ioporder_drag_end(), _ioporder_drag_leave(), _ioporder_drag_motion(), _ioporder_get_preview_piece(), _ioporder_module_is_graph_visible(), _ioporder_refresh_toolbar(), _ioporder_runtime_band_kind(), _ioporder_runtime_band_label(), _ioporder_target_count, _ioporder_target_list, dt_iop_buffer_dsc_t::cst, d, darktable, dt_lib_module_t::data, darktable_t::develop, dt_image_t::dsc, dt_dev_pixelpipe_iop_t::dsc_in, dt_dev_pixelpipe_iop_t::dsc_out, DT_IOPORDER_GRAPH_HEIGHT, DT_IOPORDER_GRAPH_LEFT_MARGIN, DT_IOPORDER_GRAPH_MIN_WIDTH, DT_IOPORDER_GRAPH_NODE_STEP, DT_IOPORDER_GRAPH_NODE_WIDTH, DT_IOPORDER_GRAPH_TOP_MARGIN, DT_PIXEL_APPLY_DPI, dt_ui_main_window(), dt_ioporder_graph_node_t::event_box, FALSE, darktable_t::gui, dt_ioporder_graph_node_t::header, dt_develop_t::image_storage, dt_develop_t::iop, IOP_CS_RAW, IS_NULL_PTR, MAX, MIN, TRUE, dt_gui_gtk_t::ui, and x.

Referenced by _ioporder_apply_preset(), _ioporder_drag_data_received(), _ioporder_init_popup(), _ioporder_presets_changed_callback(), _ioporder_refresh_callback(), _ioporder_reset_order(), and show_popup().

◆ _ioporder_refresh_callback()

static void _ioporder_refresh_callback ( gpointer  instance,
gpointer  user_data 
)
static

Central refresh callback for develop-side state changes.

Parameters
instanceSignal instance.
user_dataThe ioporder lib module.

References _ioporder_rebuild_graph(), d, and dt_lib_module_t::data.

Referenced by gui_cleanup(), and gui_init().

◆ _ioporder_refresh_toolbar()

static void _ioporder_refresh_toolbar ( dt_lib_module_t self)
static

Refresh the preset combo and status label in the popup toolbar.

The combo is rebuilt from the preset table so it always exposes the latest saved pipeline-order presets and keeps the current order selected when it matches one of them.

Parameters
selfThe ioporder lib module.

References _ioporder_get_current_order_name(), d, darktable, dt_lib_module_t::data, darktable_t::db, dt_database_get(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, FALSE, IS_NULL_PTR, and TRUE.

Referenced by _ioporder_add_preset(), _ioporder_init_popup(), _ioporder_presets_changed_callback(), and _ioporder_rebuild_graph().

◆ _ioporder_reset_order()

static void _ioporder_reset_order ( GtkButton *  button,
gpointer  user_data 
)
static

Reset the current order to the default v3.0 order.

Parameters
buttonToolbar reset button.
user_dataThe ioporder lib module.

References _ioporder_rebuild_graph().

Referenced by _ioporder_init_popup().

◆ _ioporder_runtime_band_color()

static void _ioporder_runtime_band_color ( const dt_ioporder_runtime_band_kind_t  kind,
GdkRGBA *  color 
)
static

◆ _ioporder_runtime_band_kind()

static dt_ioporder_runtime_band_kind_t _ioporder_runtime_band_kind ( const gboolean  raw_input,
const gboolean  colorin_crossed,
const dt_iop_module_t module,
const dt_iop_buffer_dsc_t dsc,
const gboolean  after_module 
)
static

Classify one runtime descriptor into a stable band kind.

RAW pipelines become sensor RGB before colorin and working-pipeline RGB from colorin onwards. Display RGB is now carried explicitly by the runtime descriptor itself once colorout publishes it.

Parameters
raw_inputTRUE when the source image starts as RAW.
colorin_crossedTRUE when the graph already passed colorin.
moduleModule owning the runtime piece.
dscRuntime descriptor to classify.
after_moduleTRUE to classify the module output, FALSE for its input.
Returns
Stable band kind used for merging and coloring segments.

References dt_iop_buffer_dsc_t::cst, DT_IOPORDER_RUNTIME_BAND_DISPLAY_RGB, DT_IOPORDER_RUNTIME_BAND_LAB, DT_IOPORDER_RUNTIME_BAND_OTHER, DT_IOPORDER_RUNTIME_BAND_PIPELINE_RGB, DT_IOPORDER_RUNTIME_BAND_RAW, DT_IOPORDER_RUNTIME_BAND_SENSOR_RGB, DT_IOPORDER_RUNTIME_BAND_UNAVAILABLE, IOP_CS_LAB, IOP_CS_RAW, IOP_CS_RGB, IOP_CS_RGB_DISPLAY, IS_NULL_PTR, and dt_iop_module_t::op.

Referenced by _ioporder_graph_draw(), and _ioporder_rebuild_graph().

◆ _ioporder_runtime_band_label()

static const char * _ioporder_runtime_band_label ( const dt_ioporder_runtime_band_kind_t  kind,
const dt_iop_buffer_dsc_t dsc 
)
static

Return the user-visible label for one runtime band kind.

We derive labels from the stable enum so translated strings remain a pure UI concern and never drive segment merging or color decisions.

Parameters
kindStable runtime band kind.
dscRuntime descriptor, only used for fallback "other" colorspaces.
Returns
Static user-visible label.

References _ioporder_colorspace_to_string(), dt_iop_buffer_dsc_t::cst, DT_IOPORDER_RUNTIME_BAND_DISPLAY_RGB, DT_IOPORDER_RUNTIME_BAND_LAB, DT_IOPORDER_RUNTIME_BAND_NONE, DT_IOPORDER_RUNTIME_BAND_OTHER, DT_IOPORDER_RUNTIME_BAND_PIPELINE_RGB, DT_IOPORDER_RUNTIME_BAND_RAW, DT_IOPORDER_RUNTIME_BAND_SENSOR_RGB, DT_IOPORDER_RUNTIME_BAND_UNAVAILABLE, and kind.

Referenced by _ioporder_graph_draw(), and _ioporder_rebuild_graph().

◆ _ioporder_runtime_band_profile_info()

static const dt_iop_order_iccprofile_info_t * _ioporder_runtime_band_profile_info ( const gboolean  raw_input,
const gboolean  colorin_crossed,
const dt_iop_module_t module,
const dt_iop_buffer_dsc_t dsc,
const gboolean  after_module 
)
static

Pick the RGB profile metadata that matches one runtime band segment.

Runtime RGB segments can refer to the input profile before colorin, the work profile in pipeline RGB, or the output/display profile once colorout has produced display RGB.

Parameters
raw_inputTRUE when the source image starts as RAW.
colorin_crossedTRUE when the graph already passed colorin.
moduleModule owning the runtime piece.
dscRuntime descriptor to classify.
after_moduleTRUE to classify the module output, FALSE for its input.
Returns
Matching profile info or NULL when none applies.

References dt_iop_buffer_dsc_t::cst, darktable, darktable_t::develop, dt_iop_colorspace_is_rgb(), dt_ioppr_get_pipe_input_profile_info(), dt_ioppr_get_pipe_output_profile_info(), dt_ioppr_get_pipe_work_profile_info(), IOP_CS_RGB_DISPLAY, IS_NULL_PTR, dt_iop_module_t::op, dt_develop_t::preview_pipe, and void().

Referenced by _ioporder_graph_draw().

◆ _ioporder_runtime_band_text()

static gchar * _ioporder_runtime_band_text ( const char *  label,
const dt_iop_order_iccprofile_info_t profile_info 
)
static

Build the text shown in one colorspace-band segment.

When a runtime band is RGB-based and the pipe exposes ICC/profile metadata, we append the profile display name so the graph states both the lifecycle stage and the actual RGB basis.

Parameters
labelRuntime lifecycle label such as "pipeline RGB".
profile_infoMatching profile metadata.
Returns
Newly-allocated user-visible segment text.

References DT_COLORSPACE_NONE, dt_colorspaces_get_name(), dt_iop_order_iccprofile_info_t::filename, IS_NULL_PTR, and dt_iop_order_iccprofile_info_t::type.

Referenced by _ioporder_graph_draw().

◆ _ioporder_same_runtime_profile()

static gboolean _ioporder_same_runtime_profile ( const dt_iop_order_iccprofile_info_t profile_a,
const dt_iop_order_iccprofile_info_t profile_b 
)
static

Compare two profile descriptors for lifecycle segment merging.

RGB segments need to split when the attached profile metadata changes, even if the broad lifecycle kind stays the same. We only compare the fields that affect the label shown to the user.

Parameters
profile_aFirst profile descriptor or NULL.
profile_bSecond profile descriptor or NULL.
Returns
TRUE when both describe the same visible profile.

References FALSE, dt_iop_order_iccprofile_info_t::filename, IS_NULL_PTR, TRUE, and dt_iop_order_iccprofile_info_t::type.

Referenced by _ioporder_graph_draw().

◆ _ioporder_set_enable_button_icon()

static void _ioporder_set_enable_button_icon ( GtkWidget widget,
dt_iop_module_t module 
)
static

Apply the same enable-button icon policy used by module headers.

The real helper is private to imageop.c, so the graph node mirrors the same paint selection locally.

Parameters
widgetProxy enable button.
moduleModule represented by the proxy.

References dtgtk_cairo_paint_module_switch(), dtgtk_cairo_paint_module_switch_on(), DTGTK_IS_TOGGLEBUTTON, DTGTK_TOGGLEBUTTON, dtgtk_togglebutton_set_paint(), and dt_iop_module_t::hide_enable_button.

Referenced by _ioporder_create_graph_node().

◆ _ioporder_type_to_string()

static const char * _ioporder_type_to_string ( const dt_iop_buffer_type_t  datatype)
static

Return a human-readable datatype string for a pixel descriptor.

Parameters
datatypeDescriptor datatype enum.
Returns
Static human-readable datatype string.

References TYPE_FLOAT, TYPE_UINT16, TYPE_UINT8, and TYPE_UNKNOWN.

Referenced by _ioporder_descriptor_to_text().

◆ container()

uint32_t container ( dt_lib_module_t self)

◆ expandable()

int expandable ( dt_lib_module_t self)

◆ get_params()

◆ gui_cleanup()

◆ gui_init()

◆ gui_reset()

◆ init_presets()

◆ name()

const char * name ( struct dt_lib_module_t self)

◆ position()

int position ( )

◆ preset_autoapply()

gboolean preset_autoapply ( dt_lib_module_t self)

References TRUE.

◆ set_params()

◆ show_popup()

void show_popup ( dt_lib_module_t self)

Open the popup window owned by the ioporder lib.

The module is now headless in the side panels, so darkroom launches the popup explicitly through the lib API instead of proxying a hidden widget.

Parameters
selfThe ioporder lib module.

References _ioporder_init_popup(), _ioporder_rebuild_graph(), d, and dt_lib_module_t::data.

◆ views()

const char ** views ( dt_lib_module_t self)

References v.

Variable Documentation

◆ _ioporder_target_count

const guint _ioporder_target_count = G_N_ELEMENTS(_ioporder_target_list)
static

Referenced by _ioporder_rebuild_graph().

◆ _ioporder_target_list

const GtkTargetEntry _ioporder_target_list[]
static
Initial value:
= {
{ "ioporder-node", GTK_TARGET_SAME_APP, DT_IOPORDER_DND_TARGET_NODE }
}
@ DT_IOPORDER_DND_TARGET_NODE
Definition ioporder.c:65

Referenced by _ioporder_rebuild_graph().