summaryrefslogtreecommitdiff
path: root/src/CheckerboardLayout.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-09-23 09:36:45 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-09-23 09:36:45 +0200
commit566dc060676b41e1e58a446b7dcc4159e242fee6 (patch)
tree6eaeba1cf78d3f03b8a1d5bfa998eb104ca47425 /src/CheckerboardLayout.vala
parent4ea2cc3bd4a7d9b1c54a9d33e6a1cf82e7c8c21d (diff)
Imported Upstream version 0.20.0upstream/0.20.0
Diffstat (limited to 'src/CheckerboardLayout.vala')
-rw-r--r--src/CheckerboardLayout.vala40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/CheckerboardLayout.vala b/src/CheckerboardLayout.vala
index 398152e..6d0ce61 100644
--- a/src/CheckerboardLayout.vala
+++ b/src/CheckerboardLayout.vala
@@ -126,6 +126,7 @@ public abstract class CheckerboardItem : ThumbnailView {
private bool comment_visible = true;
private CheckerboardItemText? subtitle = null;
private bool subtitle_visible = false;
+ private bool is_cursor = false;
private Gdk.Pixbuf pixbuf = null;
private Gdk.Pixbuf display_pixbuf = null;
private Gdk.Pixbuf brightened = null;
@@ -275,6 +276,14 @@ public abstract class CheckerboardItem : ThumbnailView {
recalc_size("set_subtitle_visible");
notify_view_altered();
}
+
+ public void set_is_cursor(bool is_cursor) {
+ this.is_cursor = is_cursor;
+ }
+
+ public bool get_is_cusor() {
+ return is_cursor;
+ }
protected override void notify_membership_changed(DataCollection? collection) {
bool title_visible = (bool) get_collection_property(PROP_SHOW_TITLES, true);
@@ -549,6 +558,16 @@ public abstract class CheckerboardItem : ThumbnailView {
ctx.restore();
}
+ // draw a border for the cursor with the selection width and normal border color
+ if (is_cursor) {
+ ctx.save();
+ ctx.set_source_rgba(border_color.red, border_color.green, border_color.blue,
+ border_color.alpha);
+ paint_border(ctx, pixbuf_dim, pixbuf_origin,
+ get_selection_border_width(int.max(pixbuf_dim.width, pixbuf_dim.height)));
+ ctx.restore();
+ }
+
// draw selection border
if (is_selected()) {
// border thickness depends on the size of the thumbnail
@@ -795,6 +814,7 @@ public class CheckerboardLayout : Gtk.DrawingArea {
private bool flow_scheduled = false;
private bool exposure_dirty = true;
private CheckerboardItem? anchor = null;
+ private CheckerboardItem? cursor = null;
private bool in_center_on_anchor = false;
private bool size_allocate_due_to_reflow = false;
private bool is_in_view = false;
@@ -964,6 +984,26 @@ public class CheckerboardLayout : Gtk.DrawingArea {
in_center_on_anchor = false;
}
+
+ public void set_cursor(CheckerboardItem item) {
+ Gee.HashSet<DataView> collection = new Gee.HashSet<DataView>();
+ if (cursor != null) {
+ cursor.set_is_cursor(false);
+ // Bug #732334, the cursor DataView might have disappeared when user drags a full screen Photo to another event
+ if (view.contains(cursor)) {
+ collection.add(cursor);
+ }
+ }
+ item.set_is_cursor(true);
+ cursor = item;
+ collection.add(item);
+ on_items_state_changed(collection);
+ }
+
+ public CheckerboardItem get_cursor() {
+ return cursor;
+ }
+
private void on_contents_altered(Gee.Iterable<DataObject>? added,
Gee.Iterable<DataObject>? removed) {