![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include <locale.h>
#include "common/darktable.h"
#include "common/file_location.h"
#include "common/grealpath.h"
#include "common/utility.h"
#include "gui/gtk.h"
#include <math.h>
#include <glib/gi18n.h>
#include <sys/stat.h>
#include <ctype.h>
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>
Macros | |
#define | OSD_COORDINATES_CHR_N "N" |
#define | OSD_COORDINATES_CHR_S "S" |
#define | OSD_COORDINATES_CHR_E "E" |
#define | OSD_COORDINATES_CHR_W "W" |
Functions | |
size_t | safe_strlen (const char *str) |
check if the string is empty or NULL before calling strlen() | |
gchar * | dt_util_dstrcat (gchar *str, const gchar *format,...) |
guint | dt_util_str_occurence (const gchar *haystack, const gchar *needle) |
gchar * | dt_util_str_replace (const gchar *string, const gchar *pattern, const gchar *substitute) |
gchar * | dt_util_glist_to_str (const gchar *separator, GList *items) |
GList * | dt_util_glist_uniq (GList *items) |
gchar * | dt_util_fix_path (const gchar *path) |
size_t | dt_utf8_strlcpy (char *dest, const char *src, size_t n) |
gboolean | dt_util_test_image_file (const char *filename) |
gboolean | dt_util_test_writable_dir (const char *path) |
gboolean | dt_util_dir_exist (const char *dir) |
gboolean | dt_util_is_dir_empty (const char *dirname) |
gchar * | dt_util_foo_to_utf8 (const char *string) |
static void | easter (int Y, int *month, int *day) |
dt_logo_season_t | dt_util_get_logo_season (void) |
static cairo_surface_t * | _util_get_svg_img (gchar *logo, const float size) |
cairo_surface_t * | dt_util_get_logo (const float size) |
cairo_surface_t * | dt_util_get_logo_text (const float size) |
gchar * | dt_util_latitude_str (float latitude) |
gchar * | dt_util_longitude_str (float longitude) |
gchar * | dt_util_elevation_str (float elevation) |
double | dt_util_gps_string_to_number (const gchar *input) |
gboolean | dt_util_gps_rationale_to_number (const double r0_1, const double r0_2, const double r1_1, const double r1_2, const double r2_1, const double r2_2, char sign, double *result) |
gboolean | dt_util_gps_elevation_to_number (const double r_1, const double r_2, char sign, double *result) |
gchar * | dt_util_normalize_path (const gchar *_input) |
gchar * | dt_util_path_get_dirname (const gchar *filename) |
GDateTime * | dt_util_get_file_datetime (const char *const path) |
guint | dt_util_string_count_char (const char *text, const char needle) |
void | dt_util_str_to_loc_numbers_format (char *data) |
GList * | dt_util_str_to_glist (const gchar *separator, const gchar *text) |
char * | dt_util_format_exposure (const float exposuretime) |
char * | dt_read_file (const char *const filename, size_t *filesize) |
void | dt_copy_file (const char *const sourcefile, const char *dst) |
void | dt_copy_resource_file (const char *src, const char *dst) |
RsvgDimensionData | dt_get_svg_dimension (RsvgHandle *svg) |
void | dt_render_svg (RsvgHandle *svg, cairo_t *cr, double width, double height, double offset_x, double offset_y) |
gboolean | dt_has_same_path_basename (const char *filename1, const char *filename2) |
char * | dt_copy_filename_extension (const char *filename1, const char *filename2) |
gchar * | dt_str_replace (const char *string, const char *search, const char *replace) |
gchar * | dt_cleanup_separators (gchar *string) |
gchar * | dt_util_remove_whitespace (const gchar *path) |
Variables | |
static const char * | OSD_ELEVATION_ASL = N_("above sea level") |
static const char * | OSD_ELEVATION_BSL = N_("below sea level") |
#define OSD_COORDINATES_CHR_E "E" |
#define OSD_COORDINATES_CHR_N "N" |
#define OSD_COORDINATES_CHR_S "S" |
#define OSD_COORDINATES_CHR_W "W" |
|
static |
References darktable, dimension(), dt_cairo_image_surface_create_for_data(), dt_get_svg_dimension(), dt_loc_get_datadir(), dt_render_svg(), error(), factor, darktable_t::gui, MAX, PATH_MAX, dt_gui_gtk_t::ppd, and size.
Referenced by dt_util_get_logo(), and dt_util_get_logo_text().
gchar * dt_cleanup_separators | ( | gchar * | string | ) |
References dt_str_replace().
Referenced by _path_cleanup().
void dt_copy_file | ( | const char *const | sourcefile, |
const char * | dst | ||
) |
Referenced by dt_copy_resource_file(), and write_image().
char * dt_copy_filename_extension | ( | const char * | filename1, |
const char * | filename2 | ||
) |
void dt_copy_resource_file | ( | const char * | src, |
const char * | dst | ||
) |
References dt_copy_file(), dt_loc_get_datadir(), and PATH_MAX.
Referenced by finalize_store().
RsvgDimensionData dt_get_svg_dimension | ( | RsvgHandle * | svg | ) |
References dimension(), height, and width.
Referenced by _util_get_svg_img(), and process().
gboolean dt_has_same_path_basename | ( | const char * | filename1, |
const char * | filename2 | ||
) |
char * dt_read_file | ( | const char *const | filename, |
size_t * | filesize | ||
) |
Referenced by dt_exif_xmp_write(), dt_pdf_add_icc(), and load_profile_from_dir().
void dt_render_svg | ( | RsvgHandle * | svg, |
cairo_t * | cr, | ||
double | width, | ||
double | height, | ||
double | offset_x, | ||
double | offset_y | ||
) |
Referenced by _util_get_svg_img(), and process().
gchar * dt_str_replace | ( | const char * | string, |
const char * | search, | ||
const char * | replace | ||
) |
Referenced by dt_cleanup_separators().
size_t dt_utf8_strlcpy | ( | char * | dest, |
const char * | src, | ||
size_t | n | ||
) |
dt_utf8_strlcpy: @dest: buffer to fill with characters from @src @src: UTF-8 encoded string
: size of @dest
Like the BSD-standard strlcpy() function, but is careful not to truncate in the middle of a character. The @src string must be valid UTF-8 encoded text. (Use g_utf8_validate() on all text before trying to use UTF-8 utility functions with it.)
Return value: strlen(src) Implementation by Philip Page, see https://bugzilla.gnome.org/show_bug.cgi?id=520116
Referenced by _get_profiles(), and gui_init().
gboolean dt_util_dir_exist | ( | const char * | dir | ) |
returns true if the path represents directories
Referenced by _import_copy_file(), and dt_collection_load_filmroll().
gchar * dt_util_dstrcat | ( | gchar * | str, |
const gchar * | format, | ||
... | |||
) |
Referenced by _conf_get_path(), _dt_collection_set_selq_pre_sort(), _event_dnd_received(), _get_base_value(), _get_current_configuration(), _get_tb_added_metadata_string_values(), _get_tb_added_tag_string_values(), _get_tb_removed_metadata_string_values(), _get_tb_removed_tag_string_values(), _get_xmp_tags(), _image_update_group_tooltip(), _init_treeview(), _locations_tree_update(), _metadata_view_update_values(), _new_button_clicked(), _pop_menu_dictionary_create_tag(), _row_tooltip_setup(), _set_matching_tag_visibility(), dt_cleanup_synonyms(), dt_collection_get_extended_where(), dt_collection_get_sort_query(), dt_collection_split_operator_datetime(), dt_collection_update(), dt_collection_update_query(), dt_exif_set_exiv2_taglist(), dt_history_hash_write_from_history(), dt_iop_set_darktable_iop_table(), dt_lib_export_metadata_configuration_dialog(), dt_lib_export_metadata_get_conf(), dt_selection_deselect_list(), dt_selection_select_list(), dt_set_xmp_dt_metadata(), dt_tag_add_synonym(), dt_tag_get_images_from_list(), dt_tag_get_subtags(), dt_tag_remove_list(), get_params(), get_query_string(), Lch_to_color_name(), list_view(), panels_get_panel_path(), and tree_view().
gchar * dt_util_elevation_str | ( | float | elevation | ) |
References OSD_ELEVATION_ASL, and OSD_ELEVATION_BSL.
Referenced by _metadata_view_update_values().
gchar * dt_util_fix_path | ( | const gchar * | path | ) |
fixes the given path by replacing a possible tilde with the correct home directory
References dt_loc_get_home_dir().
Referenced by dt_loc_init_generic(), films_new(), import_images(), and store().
gchar * dt_util_foo_to_utf8 | ( | const char * | string | ) |
returns a valid UTF-8 string for the given char array. has to be freed with g_free().
Referenced by _exif_decode_iptc_data(), and _sanitize_db().
char * dt_util_format_exposure | ( | const float | exposuretime | ) |
GDateTime * dt_util_get_file_datetime | ( | const char *const | path | ) |
Referenced by _init_expansion().
cairo_surface_t * dt_util_get_logo | ( | const float | size | ) |
References _util_get_svg_img(), DT_LOGO_SEASON_NONE, dt_util_get_logo_season(), and size.
Referenced by size_allocate_callback().
dt_logo_season_t dt_util_get_logo_season | ( | void | ) |
returns the dt logo season to use right now
References DT_LOGO_SEASON_EASTER, DT_LOGO_SEASON_HALLOWEEN, DT_LOGO_SEASON_NONE, DT_LOGO_SEASON_XMAS, and easter().
Referenced by dt_util_get_logo().
cairo_surface_t * dt_util_get_logo_text | ( | const float | size | ) |
References _util_get_svg_img(), and size.
gchar * dt_util_glist_to_str | ( | const gchar * | separator, |
GList * | items | ||
) |
generate a string from the elements of the list, separated by separator. the result has to be freed.
References items.
Referenced by _event_dnd_get(), _get_base_value(), _save_last_tag_used(), dt_history_get_items_as_string(), dt_styles_get_item_list_as_string(), dt_tag_import(), get_query_string(), and store().
GList * dt_util_glist_uniq | ( | GList * | items | ) |
take a list of strings and remove all duplicates. the result will be sorted.
References items.
Referenced by dt_tag_get_list(), and dt_tag_get_list_export().
gboolean dt_util_gps_elevation_to_number | ( | const double | r_1, |
const double | r_2, | ||
char | sign, | ||
double * | result | ||
) |
References FALSE, sign(), and TRUE.
Referenced by _exif_decode_exif_data(), and _exif_decode_xmp_data().
gboolean dt_util_gps_rationale_to_number | ( | const double | r0_1, |
const double | r0_2, | ||
const double | r1_1, | ||
const double | r1_2, | ||
const double | r2_1, | ||
const double | r2_2, | ||
char | sign, | ||
double * | result | ||
) |
References FALSE, sign(), and TRUE.
Referenced by _exif_decode_exif_data().
double dt_util_gps_string_to_number | ( | const gchar * | input | ) |
Referenced by _exif_decode_xmp_data(), and _lrop().
gboolean dt_util_is_dir_empty | ( | const char * | dirname | ) |
gchar * dt_util_latitude_str | ( | float | latitude | ) |
References OSD_COORDINATES_CHR_N, and OSD_COORDINATES_CHR_S.
Referenced by _lib_location_place_widget_new(), _metadata_view_update_values(), _toast_log_lat_lon(), and _variables_get_latitude().
gchar * dt_util_longitude_str | ( | float | longitude | ) |
References OSD_COORDINATES_CHR_E, and OSD_COORDINATES_CHR_W.
Referenced by _lib_location_place_widget_new(), _metadata_view_update_values(), _toast_log_lat_lon(), and _variables_get_longitude().
gchar * dt_util_normalize_path | ( | const gchar * | _input | ) |
gchar * dt_util_path_get_dirname | ( | const gchar * | filename | ) |
Referenced by _import_job(), and update_preview_cb().
gchar * dt_util_remove_whitespace | ( | const gchar * | path | ) |
Referenced by _path_cleanup().
guint dt_util_str_occurence | ( | const gchar * | haystack, |
const gchar * | needle | ||
) |
count the number of occurrences of needle in haystack
Referenced by dt_util_str_replace().
gchar * dt_util_str_replace | ( | const gchar * | string, |
const gchar * | pattern, | ||
const gchar * | substitute | ||
) |
replace all occurrences of pattern by substitute. the returned value has to be freed after use.
References dt_util_str_occurence().
Referenced by _get_base_value(), _string_escape(), _string_substitute(), _variable_get_value(), button_clicked(), button_clicked(), dt_bauhaus_combobox_from_params(), dt_bauhaus_slider_from_params(), dt_bauhaus_toggle_from_params(), dt_gui_load_theme(), and dt_image_camera_missing_sample_message().
GList * dt_util_str_to_glist | ( | const gchar * | separator, |
const gchar * | text | ||
) |
generate a GList from the elements of a string, separated by separator. the result has to be freed.
Referenced by _apply_preferences(), _save_last_tag_used(), dt_control_export_job_run(), dt_gui_preferences_enum(), dt_ioppr_deserialize_text_iop_order_list(), dt_lib_export_metadata_configuration_dialog(), dt_lib_export_metadata_set_conf(), get_query_string(), and list_match_string().
void dt_util_str_to_loc_numbers_format | ( | char * | data | ) |
Referenced by dt_get_printer_info().
guint dt_util_string_count_char | ( | const char * | text, |
const char | needle | ||
) |
returns the number of occurence of character in a text.
Referenced by dt_tag_get_subtags().
gboolean dt_util_test_image_file | ( | const char * | filename | ) |
returns true if a file is regular, has read access and a filesize > 0
References FALSE.
Referenced by _image_import_internal(), dt_image_find_xmps(), generate_cache(), generate_thumbnail_cache(), and preload_image_cache().
gboolean dt_util_test_writable_dir | ( | const char * | path | ) |
returns true if the path represents a directory with write access
Referenced by _import_copy_file(), and generate_cache().
|
static |
Referenced by dt_util_get_logo_season().
size_t safe_strlen | ( | const char * | str | ) |
check if the string is empty or NULL before calling strlen()
str |
Referenced by dt_control_merge_hdr_job_run(), and dt_import_duplicate_get_dest_name().
|
static |
Referenced by dt_util_elevation_str().
|
static |
Referenced by dt_util_elevation_str().