summaryrefslogtreecommitdiff
path: root/src/CheckerboardLayout.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-06-25 21:12:13 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-06-25 21:12:13 +0200
commit059a62ee3c820a42fbce980c3256049adecc9100 (patch)
treee51eab94fd7d65459640ca227fb2257bb41d2acb /src/CheckerboardLayout.vala
parent55778740c211992cc86ea87588ab62c6750f36d1 (diff)
parente8f4d7a9cdd37c5a9fb3b6991a4e9173829808da (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/CheckerboardLayout.vala')
-rw-r--r--src/CheckerboardLayout.vala24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/CheckerboardLayout.vala b/src/CheckerboardLayout.vala
index d508617..0c52748 100644
--- a/src/CheckerboardLayout.vala
+++ b/src/CheckerboardLayout.vala
@@ -184,6 +184,11 @@ public abstract class CheckerboardItem : ThumbnailView {
notify_view_altered();
}
}
+
+ public void translate_coordinates(ref int x, ref int y) {
+ x -= allocation.x + FRAME_WIDTH;
+ y -= allocation.y + FRAME_WIDTH;
+ }
public void clear_title() {
if (title == null)
@@ -589,10 +594,13 @@ public abstract class CheckerboardItem : ThumbnailView {
public void paint(Cairo.Context ctx, Gdk.RGBA bg_color, Gdk.RGBA selected_color,
Gdk.RGBA text_color, Gdk.RGBA? border_color) {
+ ctx.save();
+ ctx.translate(allocation.x + FRAME_WIDTH,
+ allocation.y + FRAME_WIDTH);
// calc the top-left point of the pixbuf
Gdk.Point pixbuf_origin = Gdk.Point();
- pixbuf_origin.x = allocation.x + FRAME_WIDTH + BORDER_WIDTH;
- pixbuf_origin.y = allocation.y + FRAME_WIDTH + BORDER_WIDTH;
+ pixbuf_origin.x = BORDER_WIDTH;
+ pixbuf_origin.y = BORDER_WIDTH;
ctx.set_line_width(FRAME_WIDTH);
ctx.set_source_rgba(selected_color.red, selected_color.green, selected_color.blue,
@@ -646,11 +654,11 @@ public abstract class CheckerboardItem : ThumbnailView {
ctx.set_source_rgba(text_color.red, text_color.green, text_color.blue, text_color.alpha);
// title and subtitles are LABEL_PADDING below bottom of pixbuf
- int text_y = allocation.y + FRAME_WIDTH + pixbuf_dim.height + FRAME_WIDTH + LABEL_PADDING;
+ int text_y = pixbuf_dim.height + FRAME_WIDTH + LABEL_PADDING;
if (title != null && title_visible) {
// get the layout sized so its with is no more than the pixbuf's
// resize the text width to be no more than the pixbuf's
- title.allocation.x = allocation.x + FRAME_WIDTH;
+ title.allocation.x = 0;
title.allocation.y = text_y;
title.allocation.width = pixbuf_dim.width;
title.allocation.height = title.get_height();
@@ -662,7 +670,7 @@ public abstract class CheckerboardItem : ThumbnailView {
}
if (comment != null && comment_visible) {
- comment.allocation.x = allocation.x + FRAME_WIDTH;
+ comment.allocation.x = 0;
comment.allocation.y = text_y;
comment.allocation.width = pixbuf_dim.width;
comment.allocation.height = comment.get_height();
@@ -674,7 +682,7 @@ public abstract class CheckerboardItem : ThumbnailView {
}
if (subtitle != null && subtitle_visible) {
- subtitle.allocation.x = allocation.x + FRAME_WIDTH;
+ subtitle.allocation.x = 0;
subtitle.allocation.y = text_y;
subtitle.allocation.width = pixbuf_dim.width;
subtitle.allocation.height = subtitle.get_height();
@@ -728,6 +736,7 @@ public abstract class CheckerboardItem : ThumbnailView {
ctx.rectangle(x, y, trinket.get_width(), trinket.get_height());
ctx.fill();
}
+ ctx.restore();
}
protected void set_horizontal_trinket_offset(int horizontal_trinket_offset) {
@@ -1267,6 +1276,9 @@ public class CheckerboardLayout : Gtk.DrawingArea {
Pango.Layout? layout = item.get_tag_list_layout();
if (layout == null)
return -1;
+
+ item.translate_coordinates(ref x, ref y);
+
Gdk.Rectangle rect = item.get_subtitle_allocation();
int index, trailing;
int px = (x - rect.x) * Pango.SCALE;