Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
selection.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2011 Henrik Andersson.
4 Copyright (C) 2012 Richard Wonka.
5 Copyright (C) 2013 Jérémy Rosen.
6 Copyright (C) 2013-2014, 2016 Tobias Ellinghaus.
7 Copyright (C) 2016 Roman Lebedev.
8 Copyright (C) 2018 Rick Yorgason.
9 Copyright (C) 2020-2021 Aldric Renaudin.
10 Copyright (C) 2020-2021 Pascal Obry.
11 Copyright (C) 2022 Martin Bařinka.
12 Copyright (C) 2022 Philippe Weyland.
13 Copyright (C) 2023, 2025 Aurélien PIERRE.
14
15 darktable is free software: you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 darktable is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with darktable. If not, see <http://www.gnu.org/licenses/>.
27*/
28
29#ifndef DT_COMMON_SELECTION_H
30#define DT_COMMON_SELECTION_H
31
32#include <glib.h>
33#include <inttypes.h>
34
35#include "common/debug.h"
36
72struct dt_selection_t;
73
75void dt_selection_free(struct dt_selection_t *selection);
76
77// Interim accessor (Strategy B, doc/globals-migration.md): implemented by the module itself; long-term the handle should be carried on the job/view context (Strategy C).
78// NULL in a GUI-less process (ansel-cli): the selection is lighttable state, created by
79// dt_gui_gtk_init() through dt_selection_init_global(). Every public function here accepts a
80// NULL selection and degrades to a no-op / neutral result, so shared code paths need no guard.
86
88int32_t dt_selection_get_first_id(struct dt_selection_t *selection);
90void dt_selection_clear(struct dt_selection_t *selection);
92void dt_selection_select(struct dt_selection_t *selection, int32_t imgid);
94void dt_selection_deselect(struct dt_selection_t *selection, int32_t imgid);
96void dt_selection_select_single(struct dt_selection_t *selection, int32_t imgid);
98void dt_selection_toggle(struct dt_selection_t *selection, int32_t imgid);
100void dt_selection_select_list(struct dt_selection_t *selection, const GList *list);
102void dt_selection_deselect_list(struct dt_selection_t *selection, const GList *list);
104GList *dt_selection_get_list(struct dt_selection_t *selection);
105
107void dt_selection_push(struct dt_selection_t *selection);
109void dt_selection_pop(struct dt_selection_t *selection);
110
112int dt_selection_get_length(struct dt_selection_t *selection);
113
115gchar *dt_selection_ids_to_string(struct dt_selection_t *selection);
116
118gboolean dt_selection_is_id_selected(struct dt_selection_t *selection, int32_t imgid);
119
122
123#define dt_selection_reload_from_database(selection) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_SQL, dt_selection_reload_from_database_real, (selection))
124
125#endif // DT_COMMON_SELECTION_H
126
127// clang-format off
128// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
129// vim: shiftwidth=2 expandtab tabstop=2 cindent
130// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
131// clang-format on
Call tracing for functions you do not want to edit every caller of.
struct dt_selection_t * dt_selection_new()
Definition selection.c:246
int32_t dt_selection_get_first_id(struct dt_selection_t *selection)
Definition selection.c:103
void dt_selection_select_single(struct dt_selection_t *selection, int32_t imgid)
Definition selection.c:297
void dt_selection_cleanup_global(void)
Definition selection.c:90
void dt_selection_pop(struct dt_selection_t *selection)
Definition selection.c:230
struct dt_selection_t * dt_selection_get_global(void)
Definition selection.c:80
void dt_selection_clear(struct dt_selection_t *selection)
Definition selection.c:271
gchar * dt_selection_ids_to_string(struct dt_selection_t *selection)
Definition selection.c:377
int dt_selection_get_length(struct dt_selection_t *selection)
Definition selection.c:193
void dt_selection_init_global(void)
Definition selection.c:85
void dt_selection_select(struct dt_selection_t *selection, int32_t imgid)
Definition selection.c:279
void dt_selection_select_list(struct dt_selection_t *selection, const GList *list)
Definition selection.c:330
GList * dt_selection_get_list(struct dt_selection_t *selection)
Definition selection.c:185
void dt_selection_free(struct dt_selection_t *selection)
Definition selection.c:260
gboolean dt_selection_is_id_selected(struct dt_selection_t *selection, int32_t imgid)
Definition selection.c:404
void dt_selection_toggle(struct dt_selection_t *selection, int32_t imgid)
Definition selection.c:305
void dt_selection_reload_from_database_real(struct dt_selection_t *selection)
Definition selection.c:142
void dt_selection_deselect(struct dt_selection_t *selection, int32_t imgid)
Definition selection.c:288
void dt_selection_deselect_list(struct dt_selection_t *selection, const GList *list)
Definition selection.c:354
void dt_selection_push(struct dt_selection_t *selection)
Definition selection.c:214