47 "red",
"yellow",
"green",
"blue",
"purple",
68 return _(
"unknown/invalid");
103 if(after & (1 <<
color))
105 if (!(before & (1 <<
color)))
108 else if (before & (1 <<
color))
121 for(GList *list = (GList *)data; list; list = g_list_next(list))
128 *imgs = g_list_prepend(*imgs, GINT_TO_POINTER(undocolorlabels->
imgid));
136 GList *l = (GList *)data;
171static int _colorlabels_execute(GList *imgs,
const int labels, GList **undo,
const gboolean undo_on,
int action)
176 for(
const GList *image = g_list_first(imgs); image; image = g_list_next((GList *)image))
178 const int32_t image_id = GPOINTER_TO_INT(image->data);
188 if(!(before & labels))
196 for(GList *image = g_list_first(imgs); image; image = g_list_next((GList *)image))
198 const int32_t image_id = GPOINTER_TO_INT(image->data);
211 after = before | labels;
214 after = (before & labels) ? before & (~labels) : before | labels;
227 undocolorlabels->
imgid = image_id;
228 undocolorlabels->
before = before;
229 undocolorlabels->
after = after;
230 *undo = g_list_append(*undo, undocolorlabels);
239 const int label = 1<<
color;
263 const int count = (int)g_list_length(list);
dt_collection_t * dt_collection_get_global(void)
void dt_collection_hint_message(const dt_collection_t *collection)
gboolean dt_colorlabel_repository_has(const int32_t imgid, const int color)
TRUE when colour color is set on imgid.
void dt_colorlabel_repository_remove_all(const int32_t imgid)
Clear every colour on imgid.
void dt_colorlabel_repository_remove(const int32_t imgid, const int color)
Clear colour color on imgid. Clearing one that is not set does nothing.
void dt_colorlabel_repository_set(const int32_t imgid, const int color)
Set colour color on imgid. Setting one that is already set does nothing.
int dt_colorlabel_repository_get(const int32_t imgid)
The colours set on imgid, as a bitmask: bit c is set when colour c is.
void dt_colorlabel_repository_cleanup(void)
Finalise whatever this repository still caches – today, nothing.
main.color_labels: which of the five colour labels are set on an image.
static void _pop_undo(gpointer user_data, dt_undo_type_t type, dt_undo_data_t data, dt_undo_action_t action, GList **imgs)
void dt_colorlabels_remove_label(const int32_t imgid, const int color)
void dt_colorlabels_remove_labels(const int32_t imgid)
static void _colorlabels_undo_data_free(gpointer data)
void dt_colorlabels_cleanup(void)
int dt_colorlabels_get_labels(const int32_t imgid)
int dt_colorlabels_check_label(const int32_t imgid, const int color)
static int _colorlabels_execute(GList *imgs, const int labels, GList **undo, const gboolean undo_on, int action)
static void _pop_undo_execute(const int32_t imgid, const int before, const int after)
void dt_colorlabels_set_label(const int32_t imgid, const int color)
void dt_colorlabels_toggle_label_on_list(GList *list, const int color, const gboolean undo_on)
const char * dt_colorlabels_to_string(int label)
char * dt_colorlabels_get_name(const int label)
const char * dt_colorlabels_name[]
void dt_colorlabels_set_labels(const int32_t imgid, const int colors)
const dt_collection_filter_flag_t colors[6]
void dt_image_cache_write_release(dt_image_t *img, dt_image_cache_write_mode_t mode)
dt_image_t * dt_image_cache_get(const int32_t imgid, char mode)
void dt_image_cache_read_release(const dt_image_t *img)
_lib_location_type_t type
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
void dt_undo_end_group(dt_undo_t *self)
void dt_undo_start_group(dt_undo_t *self, dt_undo_type_t type)
void dt_undo_record(dt_undo_t *self, gpointer user_data, dt_undo_type_t type, dt_undo_data_t data, void(*undo)(gpointer user_data, dt_undo_type_t type, dt_undo_data_t item, dt_undo_action_t action, GList **imgs), void(*free_data)(gpointer data))
dt_undo_t * dt_undo_get_global(void)