53#include <gdk/gdkkeysyms.h>
117 d->buf[
k].cache =
d->buf[
k+1].cache;
118 d->buf[
k].imgid =
d->buf[
k+1].imgid;
119 d->buf[
k].rank =
d->buf[
k+1].rank;
120 d->buf[
k].invalidated =
d->buf[
k+1].invalidated;
134 d->buf[
k].cache =
d->buf[
k-1].cache;
135 d->buf[
k].imgid =
d->buf[
k-1].imgid;
136 d->buf[
k].rank =
d->buf[
k-1].rank;
137 d->buf[
k].invalidated =
d->buf[
k-1].invalidated;
142 d->buf[
S_LEFT].cache = tmp_cache;
147 d->delay = CLAMP(
d->delay +
value, 1, 60);
157 const GList *link = g_list_nth(
d->playlist, rank);
168 if(buffer->
rank < 0 || buffer->
rank >=
d->col_count)
185 buffer->
imgid = imgid;
199 if(!
d->auto_advance)
return FALSE;
205 const gboolean can_advance =
d->buf[
S_RIGHT].rank >= 0 &&
d->buf[
S_RIGHT].rank <
d->col_count
207 const gboolean at_end =
d->buf[
S_CURRENT].rank >=
d->col_count - 1;
210 if(can_advance || at_end)
275 dt_control_log(_(
"end of images. press any key to return to lighttable mode"));
284 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
285 d->auto_advance_timeout = g_timeout_add_seconds(
d->delay,
auto_advance,
d);
293 return _(
"slideshow");
333 g_list_free(
d->incoming_selection);
349 d->mouse_timeout = 0;
350 d->auto_advance_timeout = 0;
366 GdkDisplay *display = gtk_widget_get_display(
window);
367 GdkMonitor *
mon = gdk_display_get_monitor_at_window(display, gtk_widget_get_window(
window));
368 gdk_monitor_get_geometry(
mon, &
rect);
373 d->height =
rect.height;
376 g_list_free(
d->playlist);
378 if(
d->incoming_selection)
383 d->incoming_selection = NULL;
394 d->buf[
k].invalidated =
TRUE;
400 d->buf[
S_CURRENT].imgid = GPOINTER_TO_INT(
d->playlist->data);
402 else if(
d->col_count > 0)
430 if(
d->mouse_timeout > 0) g_source_remove(
d->mouse_timeout);
431 d->mouse_timeout = 0;
432 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
433 d->auto_advance_timeout = 0;
442 g_list_free(
d->incoming_selection);
443 d->incoming_selection = NULL;
444 g_list_free(
d->playlist);
451 d->buf[
k].invalidated =
TRUE;
472 const int surface_width = cairo_image_surface_get_width(surface);
473 const int surface_height = cairo_image_surface_get_height(surface);
474 double sx = 1.0, sy = 1.0;
475 cairo_surface_get_device_scale(surface, &sx, &sy);
476 const double logical_width = surface_width / sx;
477 const double logical_height = surface_height / sy;
479 const float tr_width = (
width < logical_width) ? 0.f : (
width - logical_width) * .5f;
480 const float tr_height = (
height < logical_height) ? 0.f : (
height - logical_height) * .5f;
483 cairo_translate(cr, tr_width, tr_height);
484 cairo_set_source_surface(cr, surface, 0, 0);
486 cairo_rectangle(cr, 0, 0, logical_width, logical_height);
501 switch(event->keyval)
519 GdkModifierType mods, gpointer user_data)
525 d->auto_advance =
TRUE;
526 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
527 d->auto_advance_timeout = g_timeout_add_seconds(
d->delay,
auto_advance,
d);
533 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
534 d->auto_advance_timeout = 0;
545 GdkModifierType mods, gpointer user_data)
550 dt_control_log(ngettext(
"slideshow delay set to %d second",
"slideshow delay set to %d seconds",
d->delay),
560 GdkModifierType mods, gpointer user_data)
565 dt_control_log(ngettext(
"slideshow delay set to %d second",
"slideshow delay set to %d seconds",
d->delay),
575 GdkModifierType mods, gpointer user_data)
581 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
582 d->auto_advance_timeout = 0;
592 GdkModifierType mods, gpointer user_data)
598 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
599 d->auto_advance_timeout = 0;
608 d->mouse_timeout = 0;
618 if(
d->mouse_timeout > 0) g_source_remove(
d->mouse_timeout);
620 d->mouse_timeout = g_timeout_add_seconds(1,
_hide_mouse, self);
647 N_(
"Start and stop"), GDK_KEY_space, 0,
648 _(
"Toggles slideshow auto-advance"));
650 N_(
"Slow down"), GDK_KEY_Up, 0,
651 _(
"Increases the slideshow delay"));
653 N_(
"Slow down"), GDK_KEY_KP_Add, 0,
654 _(
"Increases the slideshow delay"));
656 N_(
"Slow down"), GDK_KEY_plus, 0,
657 _(
"Increases the slideshow delay"));
659 N_(
"Speed up"), GDK_KEY_Down, 0,
660 _(
"Decreases the slideshow delay"));
662 N_(
"Speed up"), GDK_KEY_KP_Subtract, 0,
663 _(
"Decreases the slideshow delay"));
665 N_(
"Speed up"), GDK_KEY_minus, 0,
666 _(
"Decreases the slideshow delay"));
668 N_(
"Step back"), GDK_KEY_Left, 0,
669 _(
"Displays the previous image"));
671 N_(
"Step forward"), GDK_KEY_Right, 0,
672 _(
"Displays the next image"));
void dt_accels_connect_accels(dt_accels_t *accels)
Actually enable accelerators after having loaded user config.
void dt_accels_connect_active_group(dt_accels_t *accels, const gchar *group)
Connect the contextual active accels group to the window. Views can declare their own set of contextu...
void dt_accels_disconnect_active_group(dt_accels_t *accels)
Disconnect the contextual active accels group from the window.
GtkWidget * dt_gui_main_window(void)
struct dt_accels_t * dt_gui_get_accels(void)
struct dt_ui_t * dt_gui_get_ui(void)
GtkWidget * dt_gui_center_widget(void)
void dt_gui_refocus_center()
#define dt_accels_new_slideshow_action(a, b, w, c, d, e, f, g)
dt_collection_t * dt_collection_get_global(void)
uint32_t dt_collection_get_count(const dt_collection_t *collection)
int32_t dt_collection_query_get_nth(const int nth)
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
void dt_conf_set_int(const char *name, int val)
int dt_conf_get_int(const char *name)
Integer for name, clamped to the bounds declared in the XML.
void dt_ctl_switch_mode_to(const char *mode)
void dt_control_draw_busy_msg(cairo_t *cr, int width, int height)
void dt_control_log(const char *msg,...)
void dt_control_queue_redraw_center()
Request a redraw of the centre view.
void dt_control_queue_redraw()
Request a redraw of the whole workspace.
#define dt_control_change_cursor(cursor)
void dt_ui_panel_show(dt_ui_t *ui, const dt_ui_panel_t p, gboolean show, gboolean write)
shows/hide a panel
GtkWidget * view
the tree view
static int dt_pthread_mutex_unlock(dt_pthread_mutex_t *mutex) RELEASE(mutex) NO_THREAD_SAFETY_ANALYSIS
static int dt_pthread_mutex_init(dt_pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr)
Initialise a mutex. With mutexattr NULL – which is how 54 of the 56 call sites in this tree spell it ...
static int dt_pthread_mutex_destroy(dt_pthread_mutex_t *mutex)
static int dt_pthread_mutex_lock(dt_pthread_mutex_t *mutex) ACQUIRE(mutex) NO_THREAD_SAFETY_ANALYSIS
_lib_location_type_t type
float *const restrict const size_t k
#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,...
struct dt_selection_t * dt_selection_get_global(void)
GList * dt_selection_get_list(struct dt_selection_t *selection)
void dt_selection_select_list(struct dt_selection_t *selection, const GList *const l)
void dt_selection_clear(dt_selection_t *selection)
static const dt_aligned_pixel_simd_t value
void init(dt_view_t *self)
static gboolean _slideshow_start_stop_accel(GtkAccelGroup *accel_group, GObject *accelerable, guint keyval, GdkModifierType mods, gpointer user_data)
Toggle slideshow auto-advance using the same stepping code path as manual navigation,...
static gboolean _slideshow_slow_down_accel(GtkAccelGroup *accel_group, GObject *accelerable, guint keyval, GdkModifierType mods, gpointer user_data)
Increase the slideshow delay and store it immediately so repeated keyboard adjustments persist across...
static gboolean _slideshow_step_forward_accel(GtkAccelGroup *accel_group, GObject *accelerable, guint keyval, GdkModifierType mods, gpointer user_data)
Advance the slideshow while keeping auto-advance and global actions synced with the image currently d...
void leave(dt_view_t *self)
static int32_t _slideshow_get_imgid_from_rank(const dt_slideshow_t *d, const int32_t rank)
int button_pressed(dt_view_t *self, double x, double y, double pressure, int which, int type, uint32_t state)
static void shift_right(dt_slideshow_t *d)
void cleanup(dt_view_t *self)
static gboolean _slideshow_step_back_accel(GtkAccelGroup *accel_group, GObject *accelerable, guint keyval, GdkModifierType mods, gpointer user_data)
Step back in slideshow mode and keep the fullscreen image as the sole active image when the selection...
static gboolean auto_advance(gpointer user_data)
void expose(dt_view_t *self, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery)
int key_pressed(dt_view_t *self, GdkEventKey *event)
static gboolean _hide_mouse(gpointer user_data)
void mouse_moved(dt_view_t *self, double x, double y, double pressure, int which)
int button_released(dt_view_t *self, double x, double y, int which, uint32_t state)
struct _slideshow_buf_t dt_slideshow_buf_t
static void _refresh_display(dt_slideshow_t *d)
void enter(dt_view_t *self)
static void _set_delay(dt_slideshow_t *d, int value)
static void _step_state(dt_slideshow_t *d, dt_slideshow_event_t event)
void gui_init(dt_view_t *self)
static gboolean _slideshow_speed_up_accel(GtkAccelGroup *accel_group, GObject *accelerable, guint keyval, GdkModifierType mods, gpointer user_data)
Decrease the slideshow delay and store it immediately so the current playback cadence matches the per...
static dt_view_surface_value_t _slideshow_request_slot(dt_slideshow_t *d, const dt_slideshow_slot_t slot)
int try_enter(dt_view_t *self)
static void shift_left(dt_slideshow_t *d)
const float uint32_t state[4]
static const char *const mon[12]
struct dt_slideshow_cache_t * cache
dt_view_image_surface_fetcher_t fetcher
cairo_surface_t * surface
dt_slideshow_buf_t buf[S_SLOT_LAST]
GList * incoming_selection
guint auto_advance_timeout
dt_slideshow_cache_t cache[S_SLOT_LAST]
Track one asynchronous Cairo surface fetch request for a GUI widget.
A widget to manage and display image thumbnails in Ansel's lighttable and filmstrip views.
void dt_view_image_surface_fetcher_invalidate(dt_view_image_surface_fetcher_t *fetcher, cairo_surface_t **target)
void dt_view_image_surface_fetcher_cleanup(dt_view_image_surface_fetcher_t *fetcher)
void dt_view_image_surface_fetcher_init(dt_view_image_surface_fetcher_t *fetcher)
dt_view_surface_value_t dt_view_image_get_surface_async(dt_view_image_surface_fetcher_t *fetcher, int32_t imgid, int width, int height, cairo_surface_t **target, GtkWidget *widget, int zoom)
void dt_view_active_images_add(int32_t imgid, gboolean raise)
void dt_view_active_images_reset(gboolean raise)
GList * dt_view_active_images_get_all()
void dt_view_active_images_set(GList *images, gboolean raise)