Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
export.c File Reference
#include "widgets/bauhaus.h"
#include "common/paths.h"
#include "database/preset_repository.h"
#include "common/act_on.h"
#include "control/jobs/control_jobs.h"
#include "common/collection.h"
#include "colorprofiles/colorspaces.h"
#include "system/macros.h"
#include "system/mem_alloc.h"
#include "common/module_versioning.h"
#include "common/file_location.h"
#include "imageio/imageio_module.h"
#include "common/styles.h"
#include "common/conf.h"
#include "control/control.h"
#include "control/signal.h"
#include "gui/application.h"
#include "widgets/accelerators.h"
#include "libs/lib.h"
#include "libs/lib_api.h"
#include <gdk/gdkkeysyms.h>
#include "widgets/container.h"
#include "widgets/dialog.h"
#include "widgets/label.h"
#include <gtk/gtk.h>
#include <limits.h>
#include <stdlib.h>
#include <glib.h>
+ Include dependency graph for export.c:

Go to the source code of this file.

Data Structures

struct  dt_lib_export_t
 

Macros

#define EXPORT_MAX_IMAGE_SIZE   UINT16_MAX
 
#define CONFIG_PREFIX   "plugins/lighttable/export/"
 
#define INCH_TO_CM   (2.54f)
 
#define CONF_PRINT_WIDTH   CONFIG_PREFIX "print_width"
 
#define CONF_PRINT_HEIGHT   CONFIG_PREFIX "print_height"
 

Typedefs

typedef struct dt_lib_export_t dt_lib_export_t
 
typedef enum dt_dimensions_type_t dt_dimensions_type_t
 

Enumerations

enum  dt_dimensions_type_t {
  DT_DIMENSIONS_PIXELS = 0 ,
  DT_DIMENSIONS_CM = 1 ,
  DT_DIMENSIONS_INCH = 2 ,
  DT_DIMENSIONS_SCALE = 3 ,
  DT_DIMENSIONS_ORIGINAL = 4
}
 

Functions

char * dt_lib_export_metadata_configuration_dialog (char *list, const gboolean ondisk)
 
static void _update_formats_combobox (dt_lib_export_t *d)
 
static void _update_dimensions (dt_lib_export_t *d)
 
static void _get_max_output_dimension (dt_lib_export_t *d, uint32_t *width, uint32_t *height)
 
static void _print_size_display (dt_lib_export_t *d)
 
static dt_dimensions_type_t _dimensions_type (void)
 
static int _print_dpi (void)
 
static float _print_unit_in_cm (const dt_dimensions_type_t d_type)
 
static uint32_t _cm_to_pixels (const float cm, const int dpi)
 
static void _print_size_from_pixels (const uint32_t width, const uint32_t height)
 
static void _ensure_print_size_conf (void)
 
static void _resolve_export_size (int *max_width, int *max_height, double *scale_factor)
 
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)
 
static void _update (dt_lib_module_t *self)
 
static void _image_selection_changed_callback (gpointer instance, dt_lib_module_t *self)
 
static void _collection_updated_callback (gpointer instance, dt_collection_change_t query_change, dt_collection_properties_t changed_property, gpointer imgs, int next, dt_lib_module_t *self)
 
static gboolean _is_int (const double value)
 
static void _scale_optim ()
 
static void _export_button_clicked (GtkWidget *widget, dt_lib_export_t *d)
 
static void _scale_changed (GtkEntry *spin, dt_lib_export_t *d)
 
static gboolean _size_entry_reset_click (GtkEntry *entry, const GdkEventButton *event, gpointer reset_text)
 
static void _size_in_px_update (dt_lib_export_t *d)
 
void _set_dimensions (dt_lib_export_t *d, uint32_t max_width, uint32_t max_height)
 
void _size_update_display (dt_lib_export_t *self)
 
void gui_reset (dt_lib_module_t *self)
 
static void set_format_by_name (dt_lib_export_t *d, const char *name)
 
static void _format_changed (GtkWidget *widget, dt_lib_export_t *d)
 
static void _validate_dimensions (dt_lib_export_t *d)
 
static void set_storage_by_name (dt_lib_export_t *d, const char *name)
 
static void _storage_changed (GtkWidget *widget, dt_lib_export_t *d)
 
static void _profile_changed (GtkWidget *widget, dt_lib_export_t *d)
 
static void _dimensions_type_changed (GtkWidget *widget, dt_lib_export_t *d)
 
static void _width_changed (GtkEditable *entry, gpointer user_data)
 
static void _print_size_changed (GtkEntry *entry, const char *key, dt_lib_export_t *d)
 
static void _print_width_changed (GtkEditable *entry, gpointer user_data)
 
static void _height_changed (GtkEditable *entry, gpointer user_data)
 
static void _print_height_changed (GtkEditable *entry, gpointer user_data)
 
static void _print_dpi_changed (GtkWidget *widget, gpointer user_data)
 
static void _callback_bool (GtkWidget *widget, gpointer user_data)
 
static void _intent_changed (GtkWidget *widget, dt_lib_export_t *d)
 
static void _style_changed (GtkWidget *widget, dt_lib_export_t *d)
 
int position ()
 
static void _on_storage_list_changed (gpointer instance, dt_lib_module_t *self)
 
static void _lib_export_styles_changed_callback (gpointer instance, gpointer user_data)
 
void _menuitem_preferences (GtkMenuItem *menuitem, dt_lib_module_t *self)
 
void set_preferences (void *menu, dt_lib_module_t *self)
 
void gui_init (dt_lib_module_t *self)
 
void gui_cleanup (dt_lib_module_t *self)
 
void init_presets (dt_lib_module_t *self)
 
void * legacy_params (dt_lib_module_t *self, const void *const old_params, const size_t old_params_size, const int old_version, int *new_version, size_t *new_size)
 
void * get_params (dt_lib_module_t *self, int *size)
 
static const char * _blob_string (const char **buf, const char *const end)
 
int set_params (dt_lib_module_t *self, const void *params, int size)
 

Macro Definition Documentation

◆ CONF_PRINT_HEIGHT

#define CONF_PRINT_HEIGHT   CONFIG_PREFIX "print_height"

Definition at line 143 of file export.c.

◆ CONF_PRINT_WIDTH

#define CONF_PRINT_WIDTH   CONFIG_PREFIX "print_width"

Definition at line 142 of file export.c.

◆ CONFIG_PREFIX

#define CONFIG_PREFIX   "plugins/lighttable/export/"

Definition at line 98 of file export.c.

◆ EXPORT_MAX_IMAGE_SIZE

#define EXPORT_MAX_IMAGE_SIZE   UINT16_MAX

Definition at line 97 of file export.c.

◆ INCH_TO_CM

#define INCH_TO_CM   (2.54f)

Definition at line 135 of file export.c.

Typedef Documentation

◆ dt_dimensions_type_t

◆ dt_lib_export_t

Enumeration Type Documentation

◆ dt_dimensions_type_t

Enumerator
DT_DIMENSIONS_PIXELS 
DT_DIMENSIONS_CM 
DT_DIMENSIONS_INCH 
DT_DIMENSIONS_SCALE 
DT_DIMENSIONS_ORIGINAL 

Definition at line 117 of file export.c.

Function Documentation

◆ _blob_string()

static const char * _blob_string ( const char **  buf,
const char *const  end 
)
static

Definition at line 1820 of file export.c.

References IS_NULL_PTR.

Referenced by set_params().

◆ _callback_bool()

static void _callback_bool ( GtkWidget *  widget,
gpointer  user_data 
)
static

Definition at line 879 of file export.c.

References dt_bauhaus_combobox_get(), dt_conf_set_bool(), and key.

Referenced by gui_init().

◆ _cm_to_pixels()

static uint32_t _cm_to_pixels ( const float  cm,
const int  dpi 
)
static

Definition at line 162 of file export.c.

References INCH_TO_CM.

Referenced by _resolve_export_size().

◆ _collection_updated_callback()

static void _collection_updated_callback ( gpointer  instance,
dt_collection_change_t  query_change,
dt_collection_properties_t  changed_property,
gpointer  imgs,
int  next,
dt_lib_module_t *  self 
)
static

Definition at line 253 of file export.c.

References _update().

Referenced by gui_cleanup(), and gui_init().

◆ _dimensions_type()

static dt_dimensions_type_t _dimensions_type ( void  )
static

◆ _dimensions_type_changed()

◆ _ensure_print_size_conf()

static void _ensure_print_size_conf ( void  )
static

◆ _export_button_clicked()

◆ _format_changed()

static void _format_changed ( GtkWidget *  widget,
dt_lib_export_t *  d 
)
static

Definition at line 640 of file export.c.

References _format_changed(), d, dt_bauhaus_combobox_get_text(), name, and set_format_by_name().

Referenced by _format_changed(), and gui_init().

◆ _get_max_output_dimension()

static void _get_max_output_dimension ( dt_lib_export_t *  d,
uint32_t *  width,
uint32_t *  height 
)
static

get the max output dimension supported by combination of storage and format..

Definition at line 648 of file export.c.

References CONFIG_PREFIX, dt_conf_get_string_const(), dt_imageio_get_format_by_name(), dt_imageio_get_storage_by_name(), height, and width.

Referenced by _update_dimensions().

◆ _height_changed()

static void _height_changed ( GtkEditable *  entry,
gpointer  user_data 
)
static

Definition at line 850 of file export.c.

References CONFIG_PREFIX, d, dt_conf_set_int(), dt_gui_widgets_suppressed(), and height.

Referenced by gui_init().

◆ _image_selection_changed_callback()

static void _image_selection_changed_callback ( gpointer  instance,
dt_lib_module_t *  self 
)
static

Definition at line 248 of file export.c.

References _update().

Referenced by gui_cleanup(), and gui_init().

◆ _intent_changed()

static void _intent_changed ( GtkWidget *  widget,
dt_lib_export_t *  d 
)
static

Definition at line 885 of file export.c.

References CONFIG_PREFIX, dt_bauhaus_combobox_get(), and dt_conf_set_int().

Referenced by gui_init().

◆ _is_int()

static gboolean _is_int ( const double  value)
static

Definition at line 261 of file export.c.

References double(), and value.

Referenced by _scale_optim().

◆ _lib_export_styles_changed_callback()

static void _lib_export_styles_changed_callback ( gpointer  instance,
gpointer  user_data 
)
static

◆ _menuitem_preferences()

void _menuitem_preferences ( GtkMenuItem *  menuitem,
dt_lib_module_t *  self 
)

◆ _on_storage_list_changed()

◆ _print_dpi()

static int _print_dpi ( void  )
static

◆ _print_dpi_changed()

static void _print_dpi_changed ( GtkWidget *  widget,
gpointer  user_data 
)
static

Definition at line 865 of file export.c.

References _size_in_px_update(), CONFIG_PREFIX, d, dt_conf_set_int(), and dt_gui_widgets_suppressed().

Referenced by gui_init().

◆ _print_height_changed()

static void _print_height_changed ( GtkEditable *  entry,
gpointer  user_data 
)
static

Definition at line 859 of file export.c.

References _print_size_changed(), CONF_PRINT_HEIGHT, and dt_gui_widgets_suppressed().

Referenced by gui_init().

◆ _print_size_changed()

static void _print_size_changed ( GtkEntry *  entry,
const char *  key,
dt_lib_export_t *  d 
)
static

◆ _print_size_display()

◆ _print_size_from_pixels()

static void _print_size_from_pixels ( const uint32_t  width,
const uint32_t  height 
)
static

◆ _print_unit_in_cm()

static float _print_unit_in_cm ( const dt_dimensions_type_t  d_type)
static

Definition at line 157 of file export.c.

References DT_DIMENSIONS_INCH, and INCH_TO_CM.

Referenced by _print_size_changed(), and _print_size_display().

◆ _print_width_changed()

static void _print_width_changed ( GtkEditable *  entry,
gpointer  user_data 
)
static

Definition at line 844 of file export.c.

References _print_size_changed(), CONF_PRINT_WIDTH, and dt_gui_widgets_suppressed().

Referenced by gui_init().

◆ _profile_changed()

◆ _resolve_export_size()

◆ _scale_changed()

static void _scale_changed ( GtkEntry *  spin,
dt_lib_export_t *  d 
)
static

Definition at line 393 of file export.c.

References CONFIG_PREFIX, dt_conf_set_string(), i, IS_NULL_PTR, MIN, and value.

Referenced by gui_init().

◆ _scale_optim()

static void _scale_optim ( )
static

◆ _set_dimensions()

void _set_dimensions ( dt_lib_export_t *  d,
uint32_t  max_width,
uint32_t  max_height 
)

◆ _size_entry_reset_click()

static gboolean _size_entry_reset_click ( GtkEntry *  entry,
const GdkEventButton *  event,
gpointer  reset_text 
)
static

Definition at line 458 of file export.c.

References FALSE, and TRUE.

Referenced by gui_init().

◆ _size_in_px_update()

◆ _size_update_display()

◆ _storage_changed()

static void _storage_changed ( GtkWidget *  widget,
dt_lib_export_t *  d 
)
static

Definition at line 758 of file export.c.

References _storage_changed(), d, dt_bauhaus_combobox_get_text(), name, and set_storage_by_name().

Referenced by _storage_changed(), and gui_init().

◆ _style_changed()

static void _style_changed ( GtkWidget *  widget,
dt_lib_export_t *  d 
)
static

◆ _update()

◆ _update_dimensions()

static void _update_dimensions ( dt_lib_export_t *  d)
static

Sets the max dimensions based upon what storage and format supports

Definition at line 688 of file export.c.

References _get_max_output_dimension(), _validate_dimensions(), d, and EXPORT_MAX_IMAGE_SIZE.

Referenced by set_format_by_name().

◆ _update_formats_combobox()

static void _update_formats_combobox ( dt_lib_export_t *  d)
static

Updates the combo box and shows only the supported formats of current selected storage module

Definition at line 909 of file export.c.

References CONFIG_PREFIX, d, dt_bauhaus_combobox_add(), dt_bauhaus_combobox_clear(), dt_conf_get_string_const(), dt_imageio_get_global(), dt_imageio_get_storage_by_name(), FALSE, and TRUE.

Referenced by set_storage_by_name().

◆ _validate_dimensions()

static void _validate_dimensions ( dt_lib_export_t *  d)
static

Definition at line 675 of file export.c.

References _set_dimensions(), CONFIG_PREFIX, d, dt_conf_get_int(), height, and width.

Referenced by _update_dimensions().

◆ _width_changed()

static void _width_changed ( GtkEditable *  entry,
gpointer  user_data 
)
static

Definition at line 827 of file export.c.

References CONFIG_PREFIX, d, dt_conf_set_int(), dt_gui_widgets_suppressed(), and width.

Referenced by gui_init().

◆ container()

uint32_t container ( dt_lib_module_t *  self)

Definition at line 228 of file export.c.

References DT_UI_CONTAINER_SIZE.

◆ dt_lib_export_metadata_configuration_dialog()

◆ get_params()

void * get_params ( dt_lib_module_t *  self,
int *  size 
)
Todo:
: also the web preset has to be applied twice to be known as preset! (other dimension magic going on
Todo:
: get this stuff from gui and not from conf, so it will be sanity-checked (you can never delete an

Definition at line 1696 of file export.c.

References _resolve_export_size(), CONFIG_PREFIX, d, dt_lib_module_t::data, DT_COLORSPACE_FILE, dt_conf_get_bool(), dt_conf_get_int(), dt_conf_get_string(), dt_free, dt_imageio_get_format(), dt_imageio_get_storage(), FALSE, IS_NULL_PTR, params, dt_imageio_module_format_t::plugin_name, dt_imageio_module_storage_t::plugin_name, size, dt_imageio_module_data_t::style, and TRUE.

◆ gui_cleanup()

◆ gui_init()

void gui_init ( dt_lib_module_t *  self)

Definition at line 988 of file export.c.

References _callback_bool(), _collection_updated_callback(), _dimensions_type_changed(), _ensure_print_size_conf(), _export_button_clicked(), _format_changed(), _height_changed(), _image_selection_changed_callback(), _intent_changed(), _lib_export_styles_changed_callback(), _on_storage_list_changed(), _print_dpi_changed(), _print_height_changed(), _print_width_changed(), _profile_changed(), _scale_changed(), _size_entry_reset_click(), _size_update_display(), _storage_changed(), _style_changed(), _width_changed(), CONFIG_PREFIX, d, dt_lib_module_t::data, dt_accels_disconnect_on_text_input(), dt_action_button_new(), dt_bauhaus_combobox_add(), dt_bauhaus_combobox_new(), DT_BAUHAUS_COMBOBOX_NEW_FULL, dt_bauhaus_combobox_set(), dt_bauhaus_combobox_set_from_text(), dt_bauhaus_get_global(), dt_bauhaus_widget_set_label(), DT_COLORSPACE_NONE, dt_colorspaces_enumerate_profiles(), dt_colorspaces_profile_index(), dt_conf_get_bool(), dt_conf_get_int(), dt_conf_get_string(), dt_conf_get_string_const(), dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_CONNECT, dt_free, dt_free_align, DT_GUI_BOX_SPACING, dt_gui_flow_box_as_layout(), DT_GUI_MODULE, dt_imageio_get_format_by_name(), dt_imageio_get_global(), dt_imageio_get_index_of_format(), dt_imageio_get_index_of_storage(), dt_imageio_get_storage_by_name(), dt_lib_export_metadata_get_conf(), dt_loc_get_datadir(), dt_loc_get_user_config_dir(), DT_PATH_MAX, DT_PRIMARY_MASK, DT_PROFILE_ROLE_OUTPUT, DT_SIGNAL_COLLECTION_CHANGED, DT_SIGNAL_IMAGEIO_STORAGE_CHANGE, DT_SIGNAL_SELECTION_CHANGED, DT_SIGNAL_STYLE_CHANGED, dt_ui_section_label_new(), FALSE, IS_NULL_PTR, k, dt_colorprofile_desc_t::name, dt_lib_module_t::timeout_handle, tooltip, TRUE, and dt_lib_module_t::widget.

◆ gui_reset()

◆ init_presets()

◆ legacy_params()

void * legacy_params ( dt_lib_module_t *  self,
const void *const  old_params,
const size_t  old_params_size,
const int  old_version,
int *  new_version,
size_t *  new_size 
)

◆ name()

const char * name ( struct dt_lib_module_t *  self)

Definition at line 216 of file export.c.

◆ position()

int position ( )

Definition at line 904 of file export.c.

◆ set_format_by_name()

◆ set_params()

◆ set_preferences()

void set_preferences ( void *  menu,
dt_lib_module_t *  self 
)

Definition at line 981 of file export.c.

References _menuitem_preferences().

◆ set_storage_by_name()

◆ views()

const char ** views ( dt_lib_module_t *  self)

Definition at line 221 of file export.c.

References v.