29#include <glib/gi18n.h>
30#include <glib/gstdio.h>
37#define DOC_SCREENSHOT_FILENAME_ALLOWED \
38 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_."
41#define DOC_SCREENSHOT_PREVIEW_SIZE 360
44#define DOC_SCREENSHOT_MAP_FILE "screenshots.map"
63#define DOC_SCREENSHOT_SELECTION_CONF_KEY "doc_screenshot/selection"
64#define DOC_SCREENSHOT_SEPARATOR "\x1f"
158 for(gchar **label =
labels; *label; label++)
249 (
double)area->width, (
double)area->height);
296 .height =
cell.height };
297 return area->width > 0;
377 gboolean text =
FALSE;
427 for(
int line = 0; lines[line]; line++)
458 const char *text =
NULL;
549 gtk_tree_store_set(
_g.store, &
placeholder,
COL_CHECKED,
FALSE,
COL_LABEL,
"…",
COL_PAGE,
"",
COL_TARGET,
NULL,
609 for(gint c = 0; c < columns; c++)
715 entry->
fill = source;
734 gtk_tree_store_set(
_g.store, section,
COL_CHECKED,
FALSE,
COL_LABEL, title,
COL_PAGE,
"",
COL_TARGET,
NULL,
797 for(gint level = 0; level < depth; level++)
841 for(gchar **label =
labels; *label; label++)
1095 gchar *label =
NULL;
1115 gchar *label =
NULL;
1163 gchar *label =
NULL;
1245 "-- %d skipped (not displayed), %d failed"),
1306 "reloaded whenever the folder changes."),
GtkWidget * dt_gui_main_window(void)
struct dt_ui_t * dt_gui_get_ui(void)
const char * extension(dt_imageio_module_data_t *data)
const char * dt_bauhaus_widget_get_label(GtkWidget *widget)
#define DT_IS_BAUHAUS_WIDGET(obj)
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
gchar * dt_conf_get_string(const char *name)
Read the stored string for name as a private copy.
void dt_conf_set_string(const char *name, const char *val)
static gboolean _is_application_window(GtkWindow *window)
#define DOC_SCREENSHOT_MAP_FILE
gchar * directory
documentation root given after –doc, or NULL
static gboolean _find_row(const char *chain, GtkTreeIter *found)
@ COL_CHECKED
the capture check box
@ COL_PAGE
illustration this widget stands for, from the map. "" when unmapped
@ COL_CAPTURABLE
there is a target, so a check box is worth showing at all
@ COL_ROW
the tree view item this row captures. NULL when it captures a whole widget
@ COL_LABEL
displayed name, also the key into the widget-to-page map
@ COL_ENABLED
the target is currently displayed. Always TRUE on a section header
static int _write_surface(cairo_surface_t *surface, const char *filename)
void dt_gui_doc_screenshot_window_show(void)
static void _populate(GtkWidget *widget, gpointer user_data)
#define DOC_SCREENSHOT_SELECTION_CONF_KEY
GtkWidget * geometry
its size, under the preview
GHashTable * names
GtkWidget* -> the name the application knows it by.
#define DOC_SCREENSHOT_FILENAME_ALLOWED
static gchar * _localized_path(const char *relative, const char *code)
void dt_gui_doc_screenshot_register_source(const char *section, dt_gui_doc_screenshot_source_t source)
GtkTreeStore * store
its model, owned by the view
static gboolean _capture_row(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
void dt_gui_doc_screenshot_set_directory(const char *path)
static void _on_select(GtkButton *button, gpointer user_data)
static gchar * _widget_label(GtkWidget *widget, const int index)
void dt_gui_doc_screenshot_enable(void)
static gboolean _select_row(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
GtkWidget * preview
what the selected row actually captures
static gboolean _widget_has_text(GtkWidget *widget)
static void _collect_expanded(GtkTreeView *view, GtkTreePath *path, gpointer user_data)
@ DOC_SCREENSHOT_SELECT_MAPPED
check exactly the displayed rows the map names
@ DOC_SCREENSHOT_SELECT_NONE
clear everything, displayed or not
@ DOC_SCREENSHOT_SELECT_ALL
check every displayed row
static gboolean _tree_row_area(GtkTreeView *view, GtkTreeRowReference *row, GdkRectangle *area)
static void _load_selection(void)
static void _load_pages(void)
static gint _compare_window_titles(gconstpointer a, gconstpointer b)
#define DOC_SCREENSHOT_PREVIEW_SIZE
GHashTable * selected
set of checked row labels, mirrored to conf on every change
static void _append_tree_rows(GtkTreeIter *parent, GtkTreeView *view, GtkTreeRowReference *under)
GtkWidget * folder
destination folder chooser
static void _append_section(const char *title, GtkTreeIter *section)
static void _append_placeholder(GtkTreeIter *parent)
gboolean dt_gui_doc_screenshot_enabled(void)
void dt_gui_doc_screenshot_add_target(void *inventory, GtkWidget *widget, const char *name)
static void _save_selection(void)
static gchar * _label_chain(GtkTreePath *path)
static cairo_surface_t * _render_area(GtkWidget *widget, const GdkRectangle *area)
static void _append_tree_row(GtkTreeIter *parent, GtkTreeView *view, GtkTreeModel *model, GtkTreeIter *item, const int index)
static GtkWidget * _unwrap(GtkWidget *widget)
static void _on_destroy(GtkWidget *widget, gpointer user_data)
static const char * _first_text(GtkWidget *widget)
gboolean enabled
–doc was passed on the command line
GtkWidget * status
result of the last capture
static int _save_target_as_image(GtkWidget *target, GtkTreeRowReference *row, const char *filename)
static GList * _application_windows(void)
GHashTable * pages
row label -> path of the illustration, relative to the destination
static void _on_row_expanded(GtkTreeView *view, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data)
static void _on_toggled(GtkCellRendererToggle *renderer, gchar *path_string, gpointer user_data)
static cairo_surface_t * _render_target(GtkWidget *target, GtkTreeRowReference *row)
static gchar * _tree_row_text(GtkTreeView *view, GtkTreeModel *model, GtkTreeIter *item)
GtkWidget * view
the tree view
#define DOC_SCREENSHOT_SEPARATOR
static void _on_capture(GtkButton *button, gpointer user_data)
static void _append_row(GtkTreeIter *parent, GtkWidget *target, const char *label_override, const int index)
static void _on_row_selected(GtkTreeSelection *selection, gpointer user_data)
void(* dt_gui_doc_screenshot_source_t)(void *inventory)
const dt_collection_sort_t items[]
const char * dt_l10n_get_current_code(dt_l10n_t *l10n)
struct dt_l10n_t * dt_l10n_get_global(void)
_lib_location_type_t type
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
static const dt_aligned_pixel_simd_t value
const char * code
language code inserted before the extension
GHashTable * used
base file name -> how many rows already claimed it
int skipped
checked, but its widget is not on screen right now
dt_gui_doc_screenshot_source_t fill
GtkWidget * panels[DT_UI_PANEL_SIZE]
GtkWidget * dt_ui_center_base(dt_ui_t *ui)