51#include <gdk/gdkkeysyms.h>
115 d->buf[
k].cache =
d->buf[
k+1].cache;
116 d->buf[
k].imgid =
d->buf[
k+1].imgid;
117 d->buf[
k].rank =
d->buf[
k+1].rank;
118 d->buf[
k].invalidated =
d->buf[
k+1].invalidated;
132 d->buf[
k].cache =
d->buf[
k-1].cache;
133 d->buf[
k].imgid =
d->buf[
k-1].imgid;
134 d->buf[
k].rank =
d->buf[
k-1].rank;
135 d->buf[
k].invalidated =
d->buf[
k-1].invalidated;
140 d->buf[
S_LEFT].cache = tmp_cache;
145 d->delay = CLAMP(
d->delay +
value, 1, 60);
155 const GList *link = g_list_nth(
d->playlist, rank);
167 if(sqlite3_step(stmt) == SQLITE_ROW)
id = sqlite3_column_int(stmt, 0);
168 sqlite3_finalize(stmt);
175 if(buffer->
rank < 0 || buffer->
rank >=
d->col_count)
192 buffer->
imgid = imgid;
206 if(!
d->auto_advance)
return FALSE;
212 const gboolean can_advance =
d->buf[
S_RIGHT].rank >= 0 &&
d->buf[
S_RIGHT].rank <
d->col_count
214 const gboolean at_end =
d->buf[
S_CURRENT].rank >=
d->col_count - 1;
217 if(can_advance || at_end)
282 dt_control_log(_(
"end of images. press any key to return to lighttable mode"));
291 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
292 d->auto_advance_timeout = g_timeout_add_seconds(
d->delay,
auto_advance,
d);
300 return _(
"slideshow");
340 g_list_free(
d->incoming_selection);
356 d->mouse_timeout = 0;
357 d->auto_advance_timeout = 0;
373 GdkDisplay *display = gtk_widget_get_display(window);
374 GdkMonitor *
mon = gdk_display_get_monitor_at_window(display, gtk_widget_get_window(window));
375 gdk_monitor_get_geometry(
mon, &
rect);
380 d->height =
rect.height;
383 g_list_free(
d->playlist);
385 if(
d->incoming_selection)
390 d->incoming_selection = NULL;
401 d->buf[
k].invalidated =
TRUE;
407 d->buf[
S_CURRENT].imgid = GPOINTER_TO_INT(
d->playlist->data);
409 else if(
d->col_count > 0)
437 if(
d->mouse_timeout > 0) g_source_remove(
d->mouse_timeout);
438 d->mouse_timeout = 0;
439 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
440 d->auto_advance_timeout = 0;
449 g_list_free(
d->incoming_selection);
450 d->incoming_selection = NULL;
451 g_list_free(
d->playlist);
458 d->buf[
k].invalidated =
TRUE;
479 const int surface_width = cairo_image_surface_get_width(surface);
480 const int surface_height = cairo_image_surface_get_height(surface);
481 double sx = 1.0, sy = 1.0;
482 cairo_surface_get_device_scale(surface, &sx, &sy);
483 const double logical_width = surface_width / sx;
484 const double logical_height = surface_height / sy;
486 const float tr_width = (
width < logical_width) ? 0.f : (
width - logical_width) * .5f;
487 const float tr_height = (
height < logical_height) ? 0.f : (
height - logical_height) * .5f;
490 cairo_translate(cr, tr_width, tr_height);
491 cairo_set_source_surface(cr, surface, 0, 0);
493 cairo_rectangle(cr, 0, 0, logical_width, logical_height);
508 switch(event->keyval)
526 GdkModifierType mods, gpointer user_data)
532 d->auto_advance =
TRUE;
533 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
534 d->auto_advance_timeout = g_timeout_add_seconds(
d->delay,
auto_advance,
d);
540 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
541 d->auto_advance_timeout = 0;
552 GdkModifierType mods, gpointer user_data)
557 dt_control_log(ngettext(
"slideshow delay set to %d second",
"slideshow delay set to %d seconds",
d->delay),
567 GdkModifierType mods, gpointer user_data)
572 dt_control_log(ngettext(
"slideshow delay set to %d second",
"slideshow delay set to %d seconds",
d->delay),
582 GdkModifierType mods, gpointer user_data)
588 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
589 d->auto_advance_timeout = 0;
599 GdkModifierType mods, gpointer user_data)
605 if(
d->auto_advance_timeout > 0) g_source_remove(
d->auto_advance_timeout);
606 d->auto_advance_timeout = 0;
615 d->mouse_timeout = 0;
625 if(
d->mouse_timeout > 0) g_source_remove(
d->mouse_timeout);
627 d->mouse_timeout = g_timeout_add_seconds(1,
_hide_mouse, self);
654 N_(
"Start and stop"), GDK_KEY_space, 0,
655 _(
"Toggles slideshow auto-advance"));
657 N_(
"Slow down"), GDK_KEY_Up, 0,
658 _(
"Increases the slideshow delay"));
660 N_(
"Slow down"), GDK_KEY_KP_Add, 0,
661 _(
"Increases the slideshow delay"));
663 N_(
"Slow down"), GDK_KEY_plus, 0,
664 _(
"Increases the slideshow delay"));
666 N_(
"Speed up"), GDK_KEY_Down, 0,
667 _(
"Decreases the slideshow delay"));
669 N_(
"Speed up"), GDK_KEY_KP_Subtract, 0,
670 _(
"Decreases the slideshow delay"));
672 N_(
"Speed up"), GDK_KEY_minus, 0,
673 _(
"Decreases the slideshow delay"));
675 N_(
"Step back"), GDK_KEY_Left, 0,
676 _(
"Displays the previous image"));
678 N_(
"Step forward"), GDK_KEY_Right, 0,
679 _(
"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.
const gchar * dt_collection_get_query(const dt_collection_t *collection)
uint32_t dt_collection_get_count(const dt_collection_t *collection)
void dt_conf_set_int(const char *name, int val)
int dt_conf_get_int(const char *name)
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 redraw of center window. This redraws the center view within a gdk critical section to preven...
void dt_control_queue_redraw()
request redraw of the workspace. This redraws the whole workspace within a gdk critical section to pr...
#define dt_control_change_cursor(cursor)
#define DT_MODULE(MODVER)
static const dt_aligned_pixel_simd_t value
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
sqlite3 * dt_database_get(const dt_database_t *db)
#define DT_DEBUG_SQLITE3_PREPARE_V2(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_BIND_INT(a, b, c)
void dt_ui_panel_show(dt_ui_t *ui, const dt_ui_panel_t p, gboolean show, gboolean write)
shows/hide a panel
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)
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
void dt_gui_refocus_center()
GtkWidget * dt_ui_center(dt_ui_t *ui)
get the center drawable widget
#define dt_accels_new_slideshow_action(a, b, c, d, e, f, g)
GtkWidget * dt_ui_main_window(dt_ui_t *ui)
get the main window widget
float *const restrict const size_t k
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)
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)
uint32_t view(const dt_view_t *self)
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)
struct _GtkWidget GtkWidget
const float uint32_t state[4]
static const char *const mon[12]
struct dt_slideshow_cache_t * cache
struct dt_gui_gtk_t * gui
struct dt_collection_t * collection
struct dt_selection_t * selection
const struct dt_database_t * db
cairo_filter_t filter_image
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)