Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ changes (where available).
configuration-directory and custom shortcut-name, useful for
multiple parallel darktable installations.

- Added a control in the bottom panel of the lighttable to reset
the star rating of images.

## Bug Fixes

- Clarified multi-image rating toasts for un-reject and for mixed
Expand Down
27 changes: 19 additions & 8 deletions src/libs/tools/ratings.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static gboolean _lib_ratings_draw_callback(GtkWidget *widget, cairo_t *crf, dt_l
gtk_widget_get_allocation(widget, &allocation);

const float star_size = allocation.height;
const float star_spacing = (allocation.width - 5.0 * star_size) / 4.0;
const float star_spacing = (allocation.width - 6.0 * star_size) / 5.0;

cairo_surface_t *cst
= dt_cairo_image_surface_create(CAIRO_FORMAT_ARGB32, allocation.width, allocation.height);
Expand All @@ -151,6 +151,20 @@ static gboolean _lib_ratings_draw_callback(GtkWidget *widget, cairo_t *crf, dt_l
int x = 0;
cairo_set_line_width(cr, DT_PIXEL_APPLY_DPI(1));
gdk_cairo_set_source_rgba(cr, &fg_color);

// draw unrated star
cairo_set_source_rgba(cr, fg_color.red, fg_color.green, fg_color.blue, fg_color.alpha * 0.3);
dt_draw_star(cr, star_size / 2.0 + x, star_size / 2.0, star_size / 2.0, star_size / (2.0 * 2.5));
cairo_stroke(cr);
gdk_cairo_set_source_rgba(cr, &fg_color);
cairo_set_line_width(cr, 1.6 * cairo_get_line_width(cr));
cairo_move_to(cr, x + star_size * .1, star_size / 2.0);
cairo_line_to(cr, x + star_size * .9, star_size / 2.0);
cairo_stroke(cr);
cairo_set_line_width(cr, cairo_get_line_width(cr) / 1.6);
x += star_size + star_spacing;

//now the regular stars
d->current = 0;
for(int k = 0; k < 5; k++)
{
Expand Down Expand Up @@ -194,14 +208,11 @@ static void _lib_ratings_button_press_callback(GtkGestureSingle *gesture, int n_
dt_lib_module_t *self)
{
dt_lib_ratings_t *d = self->data;
if(d->current > 0)
{
GList *imgs = dt_act_on_get_images(FALSE, TRUE, FALSE);
dt_ratings_apply_on_list(imgs, d->current, TRUE);
dt_collection_update_query(darktable.collection, DT_COLLECTION_CHANGE_RELOAD, DT_COLLECTION_PROP_RATING_RANGE, imgs);
GList *imgs = dt_act_on_get_images(FALSE, TRUE, FALSE);
dt_ratings_apply_on_list(imgs, d->current, TRUE);
dt_collection_update_query(darktable.collection, DT_COLLECTION_CHANGE_RELOAD, DT_COLLECTION_PROP_RATING_RANGE, imgs);

dt_control_queue_redraw_center();
}
dt_control_queue_redraw_center();
}

static void _lib_ratings_button_release_callback(GtkGestureSingle *gesture, int n_press,
Expand Down
Loading