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

main.selected_images, and the memory.selected_backup it is pushed onto. More...

#include <glib.h>
#include <stdint.h>
+ Include dependency graph for selection_repository.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

G_BEGIN_DECLS void dt_selection_repository_select (const int32_t imgid)
 Add imgid to the selection. Selecting an already-selected image does nothing.
 
void dt_selection_repository_deselect (const int32_t imgid)
 Remove imgid from the selection.
 
void dt_selection_repository_select_list (const char *ids)
 Add every id in ids to the selection.
 
void dt_selection_repository_deselect_list (const char *ids)
 Remove every id in ids from the selection.
 
void dt_selection_repository_clear (void)
 Empty the selection.
 
GListdt_selection_repository_get_all (void)
 Every selected image id, GINT_TO_POINTER, ASCENDING. Free with g_list_free().
 
void dt_selection_repository_drop_uncollected (void)
 Drop selected images that are no longer in the current collection.
 
void dt_selection_repository_push (void)
 Copy the selection into memory.selected_backup, replacing what was there.
 
void dt_selection_repository_pop (void)
 Copy memory.selected_backup back over the selection.
 
int32_t dt_selection_repository_get_lowest_id (void)
 The lowest selected image id, or UNKNOWN_IMAGE when nothing is selected.
 
void dt_selection_repository_cleanup (void)
 Finalise whatever this repository still caches – today, nothing. See dt_colorlabel_repository_cleanup() for why the hook stays.
 

Detailed Description

main.selected_images, and the memory.selected_backup it is pushed onto.

The selection is in the database rather than in memory because the collection query joins against it. common/selection.c keeps the in-memory mirror, the signals and the range/toggle semantics; the two tables live here.

Definition in file selection_repository.h.

Function Documentation

◆ dt_selection_repository_cleanup()

void dt_selection_repository_cleanup ( void  )

Finalise whatever this repository still caches – today, nothing. See dt_colorlabel_repository_cleanup() for why the hook stays.

Definition at line 146 of file selection_repository.c.

Referenced by dt_selection_free(), and testdb_teardown().

◆ dt_selection_repository_clear()

void dt_selection_repository_clear ( void  )

◆ dt_selection_repository_deselect()

void dt_selection_repository_deselect ( const int32_t  imgid)

Remove imgid from the selection.

Definition at line 42 of file selection_repository.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, dt_free, and L.

Referenced by _selection_deselect(), and test_selection_lowest_id().

◆ dt_selection_repository_deselect_list()

void dt_selection_repository_deselect_list ( const char *  ids)

Remove every id in ids from the selection.

Parameters
idsa comma-separated list of bare ids, "1,2,3". Note this is NOT the same spelling as dt_selection_repository_select_list() takes – one lands in a VALUES clause, the other in an IN (...). That asymmetry is inherited; both callers are in common/selection.c, a dozen lines apart.

Definition at line 60 of file selection_repository.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, dt_free, IS_NULL_PTR, and L.

Referenced by dt_selection_deselect_list().

◆ dt_selection_repository_drop_uncollected()

void dt_selection_repository_drop_uncollected ( void  )

Drop selected images that are no longer in the current collection.

Definition at line 100 of file selection_repository.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, and L.

Referenced by _clean_missing_ids().

◆ dt_selection_repository_get_all()

GList * dt_selection_repository_get_all ( void  )

Every selected image id, GINT_TO_POINTER, ASCENDING. Free with g_list_free().

The query orders DESC and the list is built by prepending, which flips it – that is the order the selection's in-memory mirror is kept in and what every caller expects.

Definition at line 75 of file selection_repository.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, IS_NULL_PTR, and L.

Referenced by _selection_database_to_glist(), and test_selection_lowest_id().

◆ dt_selection_repository_get_lowest_id()

int32_t dt_selection_repository_get_lowest_id ( void  )

The lowest selected image id, or UNKNOWN_IMAGE when nothing is selected.

The caller this replaced took the first row of an unordered SELECT imgid FROM main.selected_images. That is not arbitrary: imgid is that table's INTEGER PRIMARY KEY, so a full scan yields ascending ids and the first row is always the lowest. Same query, and the name now says which image you get.

Definition at line 132 of file selection_repository.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, IS_NULL_PTR, L, and UNKNOWN_IMAGE.

Referenced by _jump_to(), and test_selection_lowest_id().

◆ dt_selection_repository_pop()

void dt_selection_repository_pop ( void  )

Copy memory.selected_backup back over the selection.

Definition at line 121 of file selection_repository.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, and L.

Referenced by dt_selection_pop().

◆ dt_selection_repository_push()

void dt_selection_repository_push ( void  )

Copy the selection into memory.selected_backup, replacing what was there.

Definition at line 110 of file selection_repository.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, and L.

Referenced by dt_selection_push().

◆ dt_selection_repository_select()

G_BEGIN_DECLS void dt_selection_repository_select ( const int32_t  imgid)

Add imgid to the selection. Selecting an already-selected image does nothing.

Definition at line 33 of file selection_repository.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, dt_free, and L.

Referenced by _selection_select(), test_metadata_foreach_selected(), and test_selection_lowest_id().

◆ dt_selection_repository_select_list()

void dt_selection_repository_select_list ( const char *  ids)

Add every id in ids to the selection.

Parameters
idsa comma-separated list of parenthesised single-column tuples, "(1),(2),(3)" – the VALUES clause of the insert. Built by the caller because it is the caller that knows how to walk its own list.

Definition at line 51 of file selection_repository.c.

References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_EXEC, dt_free, IS_NULL_PTR, and L.

Referenced by dt_selection_select_list().