Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
thumbtable.h File Reference

A widget to manage and display image thumbnails in Ansel's lighttable and filmstrip views. More...

#include "dtgtk/thumbnail.h"
#include "common/dtpthread.h"
#include "common/darktable.h"
#include "common/debug.h"
#include <gtk/gtk.h>
#include <gdk/gdk.h>
+ Include dependency graph for thumbtable.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_thumbtable_cache_t
 Cache entry for a single thumbnail. More...
 
struct  dt_thumbtable_t
 

Macros

#define dt_thumbtable_refresh_thumbnail(table, imgid, reinit)   DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_LIGHTTABLE, dt_thumbtable_refresh_thumbnail_real, (table), (imgid), (reinit))
 
#define dt_thumbtable_redraw(table)   DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_LIGHTTABLE, dt_thumbtable_redraw_real, (table))
 

Typedefs

typedef enum dt_thumbtable_mode_t dt_thumbtable_mode_t
 
typedef enum dt_thumbtable_zoom_t dt_thumbtable_zoom_t
 
typedef struct dt_thumbtable_cache_t dt_thumbtable_cache_t
 
typedef struct dt_thumbtable_t dt_thumbtable_t
 

Enumerations

enum  dt_thumbtable_mode_t {
  DT_THUMBTABLE_MODE_NONE ,
  DT_THUMBTABLE_MODE_FILEMANAGER ,
  DT_THUMBTABLE_MODE_FILMSTRIP
}
 Display modes for the thumbnail table. More...
 
enum  dt_thumbtable_zoom_t {
  DT_THUMBTABLE_ZOOM_FIT = 0 ,
  DT_THUMBTABLE_ZOOM_HALF = 1 ,
  DT_THUMBTABLE_ZOOM_FULL = 2 ,
  DT_THUMBTABLE_ZOOM_TWICE = 3
}
 Zoom levels for thumbnail display. More...
 

Functions

dt_thumbtable_tdt_thumbtable_new (dt_thumbtable_mode_t mode)
 Create a new thumbnail table widget.
 
void dt_thumbtable_cleanup (dt_thumbtable_t *table)
 
void dt_thumbtable_configure (dt_thumbtable_t *table)
 
void dt_thumbtable_update (dt_thumbtable_t *table)
 
void dt_thumbtable_set_parent (dt_thumbtable_t *table, dt_thumbtable_mode_t mode)
 
void dt_thumbtable_update_parent (dt_thumbtable_t *table)
 
void dt_thumbtable_event_dnd_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint target_type, guint time, gpointer user_data)
 Handle drag-and-drop data received.
 
void dt_thumbtable_set_overlays_mode (dt_thumbtable_t *table, dt_thumbnail_overlay_t over)
 Set the overlay display mode for thumbnails.
 
void dt_thumbtable_set_zoom (dt_thumbtable_t *table, dt_thumbtable_zoom_t level)
 
dt_thumbtable_zoom_t dt_thumbtable_get_zoom (dt_thumbtable_t *table)
 
void dt_thumbtable_offset_zoom (dt_thumbtable_t *table, const double delta_x, const double delta_y)
 
void dt_thumbtable_set_focus_regions (dt_thumbtable_t *table, gboolean enable)
 
gboolean dt_thumbtable_get_focus_regions (dt_thumbtable_t *table)
 
void dt_thumbtable_set_focus_peaking (dt_thumbtable_t *table, gboolean enable)
 
gboolean dt_thumbtable_get_focus_peaking (dt_thumbtable_t *table)
 
void dt_thumbtable_set_draw_group_borders (dt_thumbtable_t *table, gboolean enable)
 
gboolean dt_thumbtable_get_draw_group_borders (dt_thumbtable_t *table)
 
void dt_thumbtable_reset_collection (dt_thumbtable_t *table)
 
gboolean dt_thumbtable_key_released_grid (GtkWidget *self, GdkEventKey *event, gpointer user_data)
 
gboolean dt_thumbtable_key_pressed_grid (GtkWidget *self, GdkEventKey *event, gpointer user_data)
 
void dt_thumbtable_refresh_thumbnail_real (dt_thumbtable_t *table, int32_t imgid, gboolean reinit)
 
void dt_thumbtable_select_all (dt_thumbtable_t *table)
 Select all images in the current grid.
 
void dt_thumbtable_select_range (dt_thumbtable_t *table, const int rowid)
 Select a range of images in the collection.
 
void dt_thumbtable_invert_selection (dt_thumbtable_t *table)
 Invert the current selection.
 
void dt_thumbtable_dispatch_over (dt_thumbtable_t *table, GdkEventType type, int32_t imgid)
 Update the mouse-over image ID with conflict resolution.
 
int dt_thumbtable_scroll_to_imgid (dt_thumbtable_t *table, int32_t imgid)
 Scroll the view to show a specific image.
 
int dt_thumbtable_scroll_to_active_rowid (dt_thumbtable_t *table)
 Scroll to show the active row.
 
int dt_thumbtable_scroll_to_selection (dt_thumbtable_t *table)
 Scroll to show selected content.
 
void dt_thumbtable_set_active_rowid (dt_thumbtable_t *table)
 Update internal active row tracking.
 
static void dt_thumbtable_redraw_real (dt_thumbtable_t *table)
 
static void dt_thumbtable_show (dt_thumbtable_t *table)
 Show the thumbnail table widget.
 
static void dt_thumbtable_hide (dt_thumbtable_t *table)
 Hide the thumbnail table widget.
 

Detailed Description

A widget to manage and display image thumbnails in Ansel's lighttable and filmstrip views.

This implements an efficient thumbnail grid/table with support for:

  • Dynamic loading/unloading of thumbnails based on visibility
  • Drag and drop for reordering and file import
  • Keyboard navigation
  • Multiple selection modes
  • Group management
  • Custom overlays and zooming

Macro Definition Documentation

◆ dt_thumbtable_redraw

#define dt_thumbtable_redraw (   table)    DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_LIGHTTABLE, dt_thumbtable_redraw_real, (table))

◆ dt_thumbtable_refresh_thumbnail

#define dt_thumbtable_refresh_thumbnail (   table,
  imgid,
  reinit 
)    DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_LIGHTTABLE, dt_thumbtable_refresh_thumbnail_real, (table), (imgid), (reinit))

Typedef Documentation

◆ dt_thumbtable_cache_t

◆ dt_thumbtable_mode_t

◆ dt_thumbtable_t

◆ dt_thumbtable_zoom_t

Enumeration Type Documentation

◆ dt_thumbtable_mode_t

Display modes for the thumbnail table.

Enumerator
DT_THUMBTABLE_MODE_NONE 

Invalid/uninitialized mode

DT_THUMBTABLE_MODE_FILEMANAGER 

Grid layout for lighttable view

DT_THUMBTABLE_MODE_FILMSTRIP 

Horizontal strip layout

◆ dt_thumbtable_zoom_t

Zoom levels for thumbnail display.

Enumerator
DT_THUMBTABLE_ZOOM_FIT 

Fit thumbnails to available space

DT_THUMBTABLE_ZOOM_HALF 

Display at 50% size

DT_THUMBTABLE_ZOOM_FULL 

Display at 100% size

DT_THUMBTABLE_ZOOM_TWICE 

Display at 200% size

Function Documentation

◆ dt_thumbtable_cleanup()

◆ dt_thumbtable_configure()

◆ dt_thumbtable_dispatch_over()

void dt_thumbtable_dispatch_over ( dt_thumbtable_t table,
GdkEventType  type,
int32_t  imgid 
)

Update the mouse-over image ID with conflict resolution.

Parameters
tableThe thumbnail table
typeThe event type triggering the update
imgidImage ID the mouse is over

Updates which image is considered "under the mouse", resolving conflicts between mouse and keyboard events.

References _find_rowid_from_imgid(), dt_control_set_keyboard_over_id(), dt_control_set_mouse_over_id(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_thumbtable_get_scroll_position(), dt_thumbtable_scroll_to_position(), dt_thumbtable_t::grid, dt_thumbtable_t::lock, next_over_time, dt_thumbtable_t::rowid, dt_thumbtable_t::scroll_window, and type.

Referenced by _event_main_enter(), _event_main_leave(), _event_main_motion(), _event_main_press(), and _move_in_grid().

◆ dt_thumbtable_event_dnd_received()

void dt_thumbtable_event_dnd_received ( GtkWidget *  widget,
GdkDragContext *  context,
gint  x,
gint  y,
GtkSelectionData *  selection_data,
guint  target_type,
guint  time,
gpointer  user_data 
)

Handle drag-and-drop data received.

Parameters
widgetThe widget receiving the drop
contextThe drag context
xDrop x coordinate
yDrop y coordinate
selection_dataThe dropped data
target_typeTarget type ID
timeTimestamp
user_dataUser data (thumbtable instance)

Handles drops of files/URIs onto the thumbtable. Files are imported into the current film roll.

References _thumbtable_dnd_import(), DND_TARGET_URI, and FALSE.

Referenced by dt_thumbtable_new().

◆ dt_thumbtable_get_draw_group_borders()

gboolean dt_thumbtable_get_draw_group_borders ( dt_thumbtable_t table)

◆ dt_thumbtable_get_focus_peaking()

gboolean dt_thumbtable_get_focus_peaking ( dt_thumbtable_t table)

◆ dt_thumbtable_get_focus_regions()

gboolean dt_thumbtable_get_focus_regions ( dt_thumbtable_t table)

◆ dt_thumbtable_get_zoom()

dt_thumbtable_zoom_t dt_thumbtable_get_zoom ( dt_thumbtable_t table)

References dt_thumbtable_t::zoom.

Referenced by _zoom_checked().

◆ dt_thumbtable_hide()

static void dt_thumbtable_hide ( dt_thumbtable_t table)
inlinestatic

Hide the thumbnail table widget.

Parameters
tableThe thumbnail table

References dt_thumbtable_t::grid, dt_thumbtable_t::parent_overlay, and dt_thumbtable_t::scroll_window.

Referenced by leave().

◆ dt_thumbtable_invert_selection()

void dt_thumbtable_invert_selection ( dt_thumbtable_t table)

Invert the current selection.

Parameters
tableThe thumbnail table

Inverts the selection state of all images in the current collection.

References dt_thumbtable_t::collection_count, dt_thumbtable_t::collection_inited, darktable, dt_selection_deselect_list(), dt_selection_get_list(), dt_thumbtable_select_all(), and darktable_t::selection.

Referenced by invert_selection_callback().

◆ dt_thumbtable_key_pressed_grid()

◆ dt_thumbtable_key_released_grid()

gboolean dt_thumbtable_key_released_grid ( GtkWidget *  self,
GdkEventKey *  event,
gpointer  user_data 
)

◆ dt_thumbtable_new()

dt_thumbtable_t * dt_thumbtable_new ( dt_thumbtable_mode_t  mode)

Create a new thumbnail table widget.

Parameters
modeThe display mode (filemanager or filmstrip)
Returns
New thumbtable instance or NULL on error

Creates and initializes a new thumbnail table widget with drag-and-drop support, keyboard navigation, and configurable overlays. The widget automatically handles thumbnail loading/unloading as the view scrolls.

References _draw_callback(), _dt_collection_changed_callback(), _dt_image_info_changed_callback(), _dt_profile_change_callback(), _dt_selection_changed_callback(), _event_dnd_begin(), _event_dnd_end(), _event_dnd_get(), _event_main_leave(), _mouse_over_image_callback(), _thumbs_update_overlays_mode(), dt_gui_gtk_t::accels, dt_thumbtable_t::alternate_mode, dt_thumbtable_t::collapse_groups, dt_thumbtable_t::collection_count, dt_thumbtable_t::collection_hash, dt_thumbtable_t::collection_inited, dt_thumbtable_t::configured, darktable, dt_thumbtable_t::draw_group_borders, dt_accels_build_path(), dt_accels_new_virtual_shortcut(), dt_conf_get_bool(), DT_DEBUG_CONTROL_SIGNAL_CONNECT, dt_get_help_url(), dt_gui_add_class(), dt_gui_add_help_link(), dt_pthread_mutex_init(), DT_SIGNAL_COLLECTION_CHANGED, DT_SIGNAL_CONTROL_PROFILE_USER_CHANGED, DT_SIGNAL_IMAGE_INFO_CHANGED, DT_SIGNAL_MOUSE_OVER_IMAGE_CHANGE, DT_SIGNAL_SELECTION_CHANGED, dt_thumbtable_event_dnd_received(), dt_thumbtable_key_pressed_grid(), dt_thumbtable_key_released_grid(), dt_thumbtable_set_parent(), dummy, FALSE, dt_thumbtable_t::grid, dt_thumbtable_t::grid_cols, darktable_t::gui, dt_thumbtable_t::h_scrollbar, dt_accels_t::lighttable_accels, dt_thumbtable_t::list, dt_thumbtable_t::lock, dt_thumbtable_t::lut, dt_thumbtable_t::max_row_id, dt_thumbtable_t::min_row_id, n_targets_all, dt_thumbtable_t::reset_collection, dt_thumbtable_t::rowid, dt_thumbtable_t::scroll_window, darktable_t::signals, target_list_all, dt_thumbtable_t::thumb_nb, dt_thumbtable_t::thumbs_inited, TRUE, dt_thumbtable_t::v_scrollbar, dt_thumbtable_t::x_position, and dt_thumbtable_t::y_position.

Referenced by _ui_init_panel_bottom(), and dt_ui_init_main_table().

◆ dt_thumbtable_offset_zoom()

◆ dt_thumbtable_redraw_real()

static void dt_thumbtable_redraw_real ( dt_thumbtable_t table)
inlinestatic

Gtk quick wrappers/helpers

References dt_thumbtable_t::grid.

◆ dt_thumbtable_refresh_thumbnail_real()

void dt_thumbtable_refresh_thumbnail_real ( dt_thumbtable_t table,
int32_t  imgid,
gboolean  reinit 
)

◆ dt_thumbtable_reset_collection()

void dt_thumbtable_reset_collection ( dt_thumbtable_t table)

References dt_thumbtable_t::reset_collection, and TRUE.

Referenced by _culling_mode().

◆ dt_thumbtable_scroll_to_active_rowid()

int dt_thumbtable_scroll_to_active_rowid ( dt_thumbtable_t table)

Scroll to show the active row.

Parameters
tableThe thumbnail table
Returns
1 if successful, 0 if no active row

References dt_thumbtable_scroll_to_rowid(), dt_thumbtable_scroll_to_selection(), dt_thumbtable_t::rowid, and UNKNOWN_IMAGE.

Referenced by _set_columns(), and configure().

◆ dt_thumbtable_scroll_to_imgid()

int dt_thumbtable_scroll_to_imgid ( dt_thumbtable_t table,
int32_t  imgid 
)

Scroll the view to show a specific image.

Parameters
tableThe thumbnail table
imgidThe image ID to scroll to
Returns
1 if successful, 0 if image not found

References _find_rowid_from_imgid(), dt_thumbtable_t::collection_inited, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_thumbtable_scroll_to_rowid(), dt_thumbtable_t::lock, dt_thumbtable_t::rowid, and UNKNOWN_IMAGE.

Referenced by _move_in_grid(), and dt_thumbtable_scroll_to_selection().

◆ dt_thumbtable_scroll_to_selection()

int dt_thumbtable_scroll_to_selection ( dt_thumbtable_t table)

Scroll to show selected content.

Parameters
tableThe thumbnail table
Returns
1 if successful, 0 if nothing to scroll to

Scrolls to the first-selected image. If none selected, tries keyboard "over", then mouse "over", then last active image, in this order.

References darktable, dt_control_get_keyboard_over_id(), dt_control_get_mouse_over_id(), dt_selection_get_first_id(), dt_thumbtable_scroll_to_imgid(), and darktable_t::selection.

Referenced by _grab_focus(), dt_thumbtable_scroll_to_active_rowid(), and scroll_to_selection_callback().

◆ dt_thumbtable_select_all()

void dt_thumbtable_select_all ( dt_thumbtable_t table)

◆ dt_thumbtable_select_range()

void dt_thumbtable_select_range ( dt_thumbtable_t table,
const int  rowid 
)

Select a range of images in the collection.

Parameters
tableThe thumbnail table
rowidTarget row index to extend selection to

Selects all images between the closest current selection bound and the specified rowid. Used for shift-click selection behavior.

References _find_rowid_from_imgid(), dt_thumbtable_t::collapse_groups, dt_thumbtable_t::collection_count, dt_thumbtable_t::collection_inited, darktable, dt_control_log(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_selection_get_list(), dt_selection_select_list(), dt_thumbtable_cache_t::imgid, dt_thumbtable_t::lock, dt_thumbtable_t::lut, and darktable_t::selection.

Referenced by _event_main_release(), and dt_thumbtable_key_pressed_grid().

◆ dt_thumbtable_set_active_rowid()

void dt_thumbtable_set_active_rowid ( dt_thumbtable_t table)

Update internal active row tracking.

Parameters
tableThe thumbnail table

Updates the internal first visible thumbnail index based on current scroll position.

References _position_to_rowid(), dt_thumbtable_get_scroll_position(), and dt_thumbtable_t::rowid.

Referenced by _dt_collection_changed_callback(), _set_columns(), configure(), and dt_thumbtable_set_zoom().

◆ dt_thumbtable_set_draw_group_borders()

void dt_thumbtable_set_draw_group_borders ( dt_thumbtable_t table,
gboolean  enable 
)

◆ dt_thumbtable_set_focus_peaking()

void dt_thumbtable_set_focus_peaking ( dt_thumbtable_t table,
gboolean  enable 
)

◆ dt_thumbtable_set_focus_regions()

void dt_thumbtable_set_focus_regions ( dt_thumbtable_t table,
gboolean  enable 
)

◆ dt_thumbtable_set_overlays_mode()

void dt_thumbtable_set_overlays_mode ( dt_thumbtable_t table,
dt_thumbnail_overlay_t  over 
)

Set the overlay display mode for thumbnails.

Parameters
tableThe thumbnail table
overNew overlay mode to use

Changes how overlays (text, icons etc) are displayed on thumbnails. Updates all visible thumbnails immediately.

References _resize_thumbnails(), _thumbs_get_overlays_class(), dt_conf_set_int(), dt_gui_add_class(), dt_gui_remove_class(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_thumbtable_t::grid, dt_thumbtable_t::lock, dt_thumbtable_t::overlays, sanitize_overlays(), and dt_thumbtable_t::thumbs_inited.

Referenced by _thumbs_update_overlays_mode(), always_hide_overlays_callback(), always_show_overlays_callback(), and hover_overlays_callback().

◆ dt_thumbtable_set_parent()

◆ dt_thumbtable_set_zoom()

◆ dt_thumbtable_show()

static void dt_thumbtable_show ( dt_thumbtable_t table)
inlinestatic

Show the thumbnail table widget.

Parameters
tableThe thumbnail table

Makes the widget visible and forces an update of the display.

References dt_thumbtable_redraw, dt_thumbtable_t::grid, dt_thumbtable_t::parent_overlay, and dt_thumbtable_t::scroll_window.

Referenced by enter().

◆ dt_thumbtable_update()

◆ dt_thumbtable_update_parent()

void dt_thumbtable_update_parent ( dt_thumbtable_t table)

References _grab_focus().

Referenced by enter().