40#include <glib/gstdio.h>
49#ifdef HAVE_HTTP_SERVER
50#include <libsoup/soup.h>
84#ifdef HAVE_HTTP_SERVER
96 static const char *
v[] = {
"darkroom",
"lighttable",
"studio_capture",
NULL };
195 "- [ ] Normalize illuminant & colors\n"
196 "- [ ] Normalize contrast & dynamic range\n"
197 "- [ ] Fix lens distortion and noise\n"
198 "- [ ] Enhance colors\n"
202 "- [Documentation](https://ansel.photos/en/doc)\n"
206 "- Shot: $(EXIF.YEAR)-$(EXIF.MONTH)-$(EXIF.DAY) $(EXIF.HOUR):$(EXIF.MINUTE)\n"
207 "- Imported: $(IMPORT.DATE)\n"
208 "- Last edited: $(CHANGE.DATE)\n"
209 "- Exported: $(EXPORT.DATE)\n"
211 "";
253 d->preview_render_width = allocation->width;
260 if(
d->completion_popover)
262 if(
d->completion_mark &&
d->edit_view)
266 d->completion_mark =
NULL;
335 gchar *
prefix = match + 2;
365 gchar *varname =
NULL;
423 if(
d->completion_mark)
440#if GTK_CHECK_VERSION(3, 22, 0)
541 d->completion_tree = completion_tree;
657 for(guint
i = 0;
i <
tags->len;
i++)
687 if(st &&
st->ordered)
st->index++;
691 if(st &&
st->ordered)
715 for(guint
i = 0;
i <
tags->len;
i++)
788 && (
lit[1] ==
' ' ||
lit[1] ==
'x' ||
lit[1] ==
'X'))
794 if(
lit[3] ==
' ') offset = 4;
849 const char *end =
strchr(url,
'?');
851 const char *
slash = end;
855 for(
const char *
p = end - 1;
p >
slash;
p--)
864 gchar *filename =
NULL;
865 if(
dot && (end -
dot) <= 8)
879#ifdef HAVE_HTTP_SERVER
891 if(session)
return session;
903 if(ok &&
fetch->self)
911#if LIBSOUP_VERSION_MAJOR >= 3
930 if(
fetch->path && data && len > 0)
945 msg->response_body->data,
955 const char *url,
const char *path)
980#if LIBSOUP_VERSION_MAJOR >= 3
1018 if(
d->image_dir)
return g_strdup(
d->image_dir);
1025 if(
d &&
d->preview_view)
1027 if(scale <= 0) scale = 1;
1039 const int dpad = (scale > 1) ? 3 : 2;
1062 if(margin > 0 &&
max_w > margin)
max_w -= margin;
1069 GtkBorder padding = { 0 }, border = { 0 };
1072 const int chrome = padding.left + padding.right + border.left + border.right;
1131#ifdef HAVE_HTTP_SERVER
1183 for(
const char *
p = text; *
p;
p++, off++)
1187 gsize next = off + 1;
1199 const char *
p = text;
1202 if(
p[0] ==
'!' &&
p[1] ==
'[')
1220 for(
const char *
q = s;
q < e;
q++)
1313 if(*
q ==
'\\' &&
q[1] !=
'\0')
1334 d->rendering =
TRUE;
1393 if(st->suppress_text)
break;
1442 if(level <= 1) tag =
tags.h1;
1443 else if(level == 2) tag =
tags.h2;
1470 st.tag_added =
TRUE;
1543 char local[128] = { 0 };
1596 if(!s || !e)
return;
1621 gint bx = 0, by = 0;
1623 (gint)event->x, (gint)event->y, &bx, &by);
1727 if(imgid <= 0)
return;
1740 if(imgid <= 0)
return FALSE;
1753 d->vars_params =
NULL;
1760 if(imgid <= 0)
return FALSE;
1761 if(
d->image_path &&
d->image_dir)
return TRUE;
1765 d->image_path =
NULL;
1766 d->image_dir =
NULL;
1777 if(image_path[0] ==
'\0')
return FALSE;
1781 return (
d->image_path &&
d->image_dir);
1859 d->save_timeout_id = 0;
1867 if(
d->save_timeout_id)
1870 d->save_timeout_id = 0;
1878 if(
d->loading)
return;
1881 if(
d->save_timeout_id)
1884 d->save_timeout_id = 0;
1954 if(
d->save_timeout_id)
1957 d->save_timeout_id = 0;
1961 const gboolean changed = (
old_imgid != imgid);
1970 const gboolean
has_img = (imgid > 0);
2004 params->token =
d->load_token;
2034 if(
img_id ==
d->imgid)
return;
2044 self->
data = (
void *)
d;
2048 d->height_setting =
g_strdup(
"plugins/darkroom/textnotes/text_height");
2115 d->preview_sw = preview_sw;
2147 if(
d->save_timeout_id)
2150 d->save_timeout_id = 0;
2153#ifdef HAVE_HTTP_SERVER
2154 if(
d->download_inflight)
2157 d->download_inflight =
NULL;
2161 if(
d->completion_popover)
2164 d->completion_popover =
NULL;
2166 if(
d->completion_model)
2169 d->completion_model =
NULL;
void dt_accels_disconnect_on_text_input(GtkWidget *widget)
Disconnect accels while a text or search entry has the focus, and reconnect them when it loses it....
int32_t dt_act_on_get_first_image()
GtkWidget * dt_gui_main_window(void)
struct dt_ui_t * dt_gui_get_ui(void)
static void error(char *msg)
void cleanup(dt_imageio_module_format_t *self)
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
gboolean dt_colorprofiles_srgb_to_display_strided(uint8_t *const pixels, const int width, const int height, const int rowstride, const int n_channels, const gboolean has_alpha)
Convert a strided, packed-RGB(A) 8-bit buffer (GdkPixbuf shape) from sRGB to the display profile,...
The colour-profile module's API: which profiles exist, and how to apply one.
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
const dt_colormatrix_t dt_aligned_pixel_t out
char * dt_image_build_text_path_from_path(const char *image_path)
void dt_image_full_path(const int32_t imgid, char *pathname, size_t pathname_len, gboolean *from_cache, const char *calling_func)
Get the full path of an image out of the database.
int32_t dt_control_get_mouse_over_id()
void dt_control_log(const char *msg,...)
struct dt_control_t * dt_control_get_global(void)
struct dt_gui_gtk_t * dt_gui_get_global(void)
gboolean dt_datetime_gdatetime_to_local(char *local, const size_t local_size, GDateTime *gdt, const gboolean msec, const gboolean tz)
GtkWidget * preview
what the selected row actually captures
GtkWidget * view
the tree view
const char * dt_loc_cachedir(void)
static guint dt_keys_mainpad_alternatives(const guint key_val)
Remap keypad keys to usual mainpad ones.
const dt_gtkentry_completion_spec * dt_gtkentry_get_default_path_compl_list()
G_BEGIN_DECLS struct completion_spec dt_gtkentry_completion_spec
void dt_image_cache_write_release(dt_image_t *img, dt_image_cache_write_mode_t mode)
dt_image_t * dt_image_cache_get(const int32_t imgid, char mode)
void dt_image_cache_read_release(const dt_image_t *img)
dt_job_t * dt_control_job_create(dt_job_execute_callback execute, const char *msg,...)
int dt_control_add_job(dt_control_t *control, dt_job_queue_t queue_id, _dt_job_t *job)
void * dt_control_job_get_params(const _dt_job_t *job)
void dt_control_job_set_state_callback(_dt_job_t *job, dt_job_state_change_callback cb)
void dt_control_job_set_params(_dt_job_t *job, void *params, dt_job_destroy_callback callback)
void dt_gui_textview_set_padding(GtkTextView *textview)
Apply the standard recessed-input text padding to a GtkTextView.
static const dt_iop_drawlayer_params_t * params
gboolean dt_lib_gui_get_expanded(dt_lib_module_t *module)
void dt_lib_presets_add(const char *name, const char *plugin_name, const int32_t version, const void *params, const int32_t params_size, gboolean readonly)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
static void dt_free_gpointer(gpointer ptr)
g_free() one pointer, with the signature GDestroyNotify wants.
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
#define DT_MODULE(MODVER)
Instantiate the version handshake every module must export. Use once, at file scope,...
fetch(component, metrics)
#define DT_PATH_MAX
Buffer size for a filesystem path anywhere in Ansel.
#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT(ctlsig, cb, user_data)
struct dt_control_signal_t * dt_control_signal_get_global(void)
@ DT_SIGNAL_DEVELOP_INITIALIZE
This signal is raised when darktable.develop is initialized.
@ DT_SIGNAL_DEVELOP_IMAGE_CHANGED
This signal is raised when image is changed in darkroom.
@ DT_SIGNAL_MOUSE_OVER_IMAGE_CHANGE
This signal is raised when mouse hovers over image thumbs both on lighttable and in the filmstrip....
#define DT_DEBUG_CONTROL_SIGNAL_CONNECT(ctlsig, signal, cb, user_data)
char * dt_variables_expand(dt_variables_params_t *params, gchar *source, gboolean iterate)
void dt_variables_params_destroy(dt_variables_params_t *params)
void dt_variables_params_init(dt_variables_params_t **params)
const float uint32_t state[4]
unsigned __int64 uint64_t
GtkTextMark * completion_mark
GtkWidget * completion_popover
GtkWidget * completion_tree
GtkListStore * completion_model
GtkTextView * preview_view
dt_variables_params_t * vars_params
static void _setup_completion(dt_lib_module_t *self, GtkWidget *textview)
static gboolean _textnotes_load_finish_idle(gpointer user_data)
int set_params(dt_lib_module_t *self, const void *params, int size)
static void _preview_map(GtkWidget *widget, dt_lib_module_t *self)
static gboolean _completion_apply_selected(dt_lib_module_t *self)
void * get_params(dt_lib_module_t *self, int *size)
static char * _text_sidecar_save_path(dt_lib_textnotes_t *d, const int32_t imgid)
static void _completion_fill(dt_lib_textnotes_t *d, const char *prefix)
static void _save_and_render(dt_lib_module_t *self)
static gboolean _edit_key_release(GtkWidget *widget, GdkEventKey *event, dt_lib_module_t *self)
static void _colorcorrect_pixbuf(GdkPixbuf *pixbuf)
static gboolean _completion_focus_out_idle(gpointer user_data)
void gui_cleanup(dt_lib_module_t *self)
static void _render_preview(dt_lib_textnotes_t *d, const char *text)
static void _image_changed_callback(gpointer instance, gpointer user_data)
static void _update_mtime_label(dt_lib_module_t *self)
static void _render_preview_from_edit(dt_lib_textnotes_t *d)
static void _clear_variables_cache(dt_lib_textnotes_t *d)
static void _edit_map(GtkWidget *widget, dt_lib_module_t *self)
static gboolean _set_image_paths(dt_lib_textnotes_t *d, const int32_t imgid)
static int32_t _textnotes_load_job_run(dt_job_t *job)
static gchar * _get_buffer_text(GtkTextBuffer *buffer)
static gboolean _textview_focus_out(GtkWidget *widget, GdkEventFocus *event, dt_lib_module_t *self)
static void _toggle_checklist_at_line(dt_lib_module_t *self, const int line_no)
static gchar * _expand_text_for_preview(dt_lib_textnotes_t *d, const char *source_text)
static void _textbuffer_changed(GtkTextBuffer *buffer, dt_lib_module_t *self)
static void _completion_row_activated(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, dt_lib_module_t *self)
static int _preview_text_window_width_px(dt_lib_textnotes_t *d)
static gboolean _completion_find_prefix(dt_lib_textnotes_t *d, GtkTextIter *cursor, GtkTextIter *start_iter, gchar **prefix_out)
void init_presets(dt_lib_module_t *self)
static void _completion_hide(dt_lib_textnotes_t *d)
static void _mouse_over_image_callback(gpointer instance, gpointer user_data)
static void _save_now(dt_lib_module_t *self)
uint32_t container(dt_lib_module_t *self)
static void _set_edit_text(dt_lib_textnotes_t *d, const char *text)
static void _completion_update(dt_lib_module_t *self)
static gchar * _get_edit_text(dt_lib_textnotes_t *d)
static void _ensure_has_txt_flag(const int32_t imgid)
static void _load_for_image(dt_lib_module_t *self, const int32_t imgid)
static void _textnotes_load_job_cleanup(void *data)
static void _clear_mtime_label(dt_lib_textnotes_t *d)
void gui_init(dt_lib_module_t *self)
static gboolean _save_timeout_cb(gpointer user_data)
static void _textnotes_load_job_state(dt_job_t *job, dt_job_state_t state)
const char ** views(dt_lib_module_t *self)
static void _update_for_current_image(dt_lib_module_t *self)
static gboolean _preview_button_press(GtkWidget *widget, GdkEventButton *event, dt_lib_module_t *self)
static gboolean _image_has_txt_flag(const int32_t imgid)
static void _open_uri(const char *uri)
static gboolean _refresh_preview_idle(gpointer user_data)
static gboolean _edit_key_press(GtkWidget *widget, GdkEventKey *event, dt_lib_module_t *self)
static void _toggle_mode(GtkToggleButton *button, dt_lib_module_t *self)
static gboolean _completion_match(const char *item, const char *prefix)
static void _preview_width_changed(GtkWidget *widget, GdkRectangle *allocation, gpointer user_data)
Re-render the preview when the panel-given width changes, so embedded images rescale to fit the avail...
static gboolean _edit_button_release(GtkWidget *widget, GdkEventButton *event, dt_lib_module_t *self)
static gboolean _initial_load_idle(gpointer user_data)
@ DT_UI_CONTAINER_PANEL_LEFT_CENTER