76 return _(
"Duplicates");
81 static const char *
v[] = {
"darkroom", NULL};
99 const int32_t imgid = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget),
"imgid"));
102 dt_metadata_set(imgid,
"Xmp.darktable.version_name", gtk_entry_get_text(GTK_ENTRY(widget)),
FALSE);
111 const int32_t imgid = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),
"imgid"));
116 for(GList *l =
d->thumbs; l; l = g_list_next(l))
119 if(thumb->
info.
id == imgid)
121 GList *
l2 = g_list_next(l);
137 g_list_prepend(NULL, GINT_TO_POINTER(imgid)));
142 if(event->button == 1 && event->type == GDK_BUTTON_PRESS)
148 const int32_t imgid = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget),
"imgid"));
149 if(imgid <= 0)
return FALSE;
155 if(
d->preview_cached_imgid != imgid)
180 if(event->type == GDK_LEAVE_NOTIFY && event->crossing.detail == GDK_NOTIFY_INFERIOR)
return FALSE;
196 if(
IS_NULL_PTR(
d) ||
d->imgid <= 0 ||
d->preview_cached_imgid !=
d->imgid)
return;
199 float image_box[4] = { 0.0f };
201 if(image_box[2] <= 0.0f || image_box[3] <= 0.0f)
return;
223 gtk_container_remove(GTK_CONTAINER(parent), thumb->
w_main);
261 for(GList *l = versions; l; l = g_list_next(l))
265 const int32_t imgid =
v->imgid;
275 gtk_widget_queue_draw(thumb->
widget);
279 g_object_set_data(G_OBJECT(thumb->
widget),
"imgid", GINT_TO_POINTER(imgid));
280 g_signal_connect(G_OBJECT(thumb->
widget),
"button-press-event",
282 g_signal_connect(G_OBJECT(thumb->
widget),
"button-release-event",
286 gtk_widget_add_events(thumb->
widget, GDK_LEAVE_NOTIFY_MASK);
287 g_signal_connect(G_OBJECT(thumb->
widget),
"leave-notify-event",
292 const gchar *path =
v->version_name;
293 g_snprintf(chl,
sizeof(chl),
"%d",
v->version);
297 if(path) gtk_entry_set_text(GTK_ENTRY(tb), path);
298 gtk_entry_set_width_chars(GTK_ENTRY(tb), 0);
299 gtk_widget_set_hexpand(tb,
TRUE);
300 g_object_set_data (G_OBJECT(tb),
"imgid", GINT_TO_POINTER(imgid));
301 gtk_widget_add_events(tb, GDK_FOCUS_CHANGE_MASK);
304 gtk_widget_set_hexpand(lb,
TRUE);
307 g_object_set_data(G_OBJECT(bt),
"imgid", GINT_TO_POINTER(imgid));
310 gtk_grid_attach(GTK_GRID(hb), thumb->
widget, 0, 0, 1, 2);
311 gtk_grid_attach(GTK_GRID(hb), bt, 2, 0, 1, 1);
312 gtk_grid_attach(GTK_GRID(hb), lb, 1, 0, 1, 1);
313 gtk_grid_attach(GTK_GRID(hb), tb, 1, 1, 2, 1);
316 gtk_widget_show(thumb->
widget);
320 gtk_box_pack_start(GTK_BOX(
d->duplicate_box), hb,
FALSE,
FALSE, 0);
321 d->thumbs = g_list_append(
d->thumbs, thumb);
326 gtk_widget_show(
d->duplicate_box);
331 gtk_widget_set_sensitive(bt,
FALSE);
332 gtk_widget_set_visible(bt,
FALSE);
348 gtk_widget_queue_draw (
d->duplicate_box);
357 self->
data = (
void *)
d;
370 gtk_box_pack_start(GTK_BOX(self->
widget),
375 gtk_widget_show_all(self->
widget);
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....
Handle default and user-set shortcuts (accelerators)
void dt_collection_update_query(const dt_collection_t *collection, dt_collection_change_t query_change, dt_collection_properties_t changed_property, GList *list)
dt_collection_t * dt_collection_get_global(void)
dt_collection_properties_t
@ DT_COLLECTION_PROP_UNDEF
@ DT_COLLECTION_CHANGE_RELOAD
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
void dt_gui_container_destroy_children(GtkContainer *container)
void dt_control_queue_redraw_center()
Request a redraw of the centre view.
void dt_control_change_cursor_by_name_and_flush(const char *curs_str)
Apply a named cursor immediatelly and flush display updates for immediate feedback.
void dt_control_commit_cursor()
void dt_control_save_xmp(const int32_t imgid)
void dt_control_delete_image(int32_t imgid)
struct dt_develop_t * dt_dev_get_global(void)
void dt_dev_snapshot_draw(dt_dev_snapshot_t *snap, cairo_t *cri, struct dt_develop_t *dev, int32_t width, int32_t height, double clip_x, double clip_y, double clip_w, double clip_h)
void dt_dev_snapshot_clear(dt_dev_snapshot_t *snap)
gboolean dt_dev_snapshot_capture(dt_dev_snapshot_t *snap, dt_develop_t *dev, int32_t imgid, GList *history_override, GList *iop_order_override, int32_t history_end_override)
void dt_dev_get_image_box_in_widget(const dt_develop_t *dev, const int32_t width, const int32_t height, float *box)
Get the displayed image rectangle in darkroom widget coordinates.
static void _lib_duplicate_preview_updated_callback(gpointer instance, dt_lib_module_t *self)
static void _lib_duplicate_collection_changed(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 _lib_duplicate_thumb_revert_callback(GtkWidget *widget, GdkEvent *event, dt_lib_module_t *self)
static void _lib_duplicate_init_callback(gpointer instance, dt_lib_module_t *self)
void gui_cleanup(dt_lib_module_t *self)
static void _lib_duplicate_delete(GtkButton *button, dt_lib_module_t *self)
static void _thumb_remove(gpointer user_data)
uint32_t container(dt_lib_module_t *self)
void view_leave(struct dt_lib_module_t *self, struct dt_view_t *old_view, struct dt_view_t *new_view)
void gui_init(dt_lib_module_t *self)
const char ** views(dt_lib_module_t *self)
static gboolean _lib_duplicate_thumb_press_callback(GtkWidget *widget, GdkEventButton *event, dt_lib_module_t *self)
void gui_post_expose(dt_lib_module_t *self, cairo_t *cri, int32_t width, int32_t height, int32_t pointerx, int32_t pointery)
static gboolean _lib_duplicate_caption_out_callback(GtkWidget *widget, GdkEvent *event, dt_lib_module_t *self)
GList * dt_image_repository_get_versions(const int32_t film_id, const char *filename, const int name_keyid)
Every version of the file (film_id, filename), in version order, each with the name stored under meta...
void dt_image_version_free(gpointer data)
Release one dt_image_version_t. Use with g_list_free_full().
Reading and writing one dt_image_t to and from the library database. The SQL half of what used to be ...
#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.
#define DT_MODULE(MODVER)
Instantiate the version handshake every module must export. Use once, at file scope,...
void dt_control_signal_unblock_by_func(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data)
void dt_control_signal_block_by_func(const struct dt_control_signal_t *ctlsig, GCallback cb, gpointer user_data)
#define DT_DEBUG_CONTROL_SIGNAL_DISCONNECT(ctlsig, cb, user_data)
#define DT_DEBUG_CONTROL_SIGNAL_RAISE(ctlsig, signal,...)
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_VIEWMANAGER_THUMBTABLE_ACTIVATE
@ DT_SIGNAL_DEVELOP_IMAGE_CHANGED
This signal is raised when image is changed in darkroom.
@ DT_SIGNAL_DEVELOP_PREVIEW_PIPE_FINISHED
This signal is raised when develop preview pipe process is finished no param, no returned value.
@ DT_SIGNAL_COLLECTION_CHANGED
This signal is raised when collection changed. To avoid leaking the list, dt_collection_t is connecte...
#define DT_DEBUG_CONTROL_SIGNAL_CONNECT(ctlsig, signal, cb, user_data)
char filename[DT_MAX_FILENAME_LEN]
One version of a file: which duplicate it is, its id, and the name the user gave it.
int32_t preview_cached_imgid
dt_dev_snapshot_t preview
GtkWidget * duplicate_box
gboolean disable_mouseover
dt_thumbnail_t * dt_thumbnail_new(int rowid, dt_thumbnail_overlay_t over, dt_thumbtable_t *table, dt_image_t *info)
void dt_thumbnail_set_mouseover(dt_thumbnail_t *thumb, gboolean over)
int dt_thumbnail_destroy(dt_thumbnail_t *thumb)
void dt_thumbnail_update_selection(dt_thumbnail_t *thumb, gboolean selected)
void dt_thumbnail_resize(dt_thumbnail_t *thumb, int width, int height)
@ DT_THUMBNAIL_OVERLAYS_NONE
@ DT_UI_CONTAINER_PANEL_LEFT_CENTER