@@ -223,11 +223,13 @@ public class Akira.Layouts.Partials.Artboard : Gtk.ListBoxRow {
223223
224224 handle. enter_notify_event. connect (event = > {
225225 get_style_context (). add_class (" hover" );
226+ window. event_bus. hover_over_layer (model);
226227 return false ;
227228 });
228229
229230 handle. leave_notify_event. connect (event = > {
230231 get_style_context (). remove_class (" hover" );
232+ window. event_bus. hover_over_layer (null );
231233 return false ;
232234 });
233235
@@ -237,6 +239,20 @@ public class Akira.Layouts.Partials.Artboard : Gtk.ListBoxRow {
237239 var item_model = item as Akira . Lib . Models . CanvasItem ;
238240 return new Akira .Layouts .Partials .Layer (window, item_model, container);
239241 });
242+
243+ lock_actions ();
244+ hide_actions ();
245+
246+ window. event_bus. hover_over_item. connect (on_hover_over_item);
247+ }
248+
249+ private void on_hover_over_item (Lib .Models .CanvasItem ? item ) {
250+ if (item == model) {
251+ get_style_context (). add_class (" hovered" );
252+ return ;
253+ }
254+
255+ get_style_context (). remove_class (" hovered" );
240256 }
241257
242258 private void build_drag_and_drop () {
@@ -461,4 +477,71 @@ public class Akira.Layouts.Partials.Artboard : Gtk.ListBoxRow {
461477 window. event_bus. disconnect_typing_accel ();
462478 return false ;
463479 }
480+
481+ private void lock_actions () {
482+ button_locked. bind_property (" active" , model, " locked" ,
483+ BindingFlags . BIDIRECTIONAL | BindingFlags . SYNC_CREATE );
484+
485+ button_locked. toggled. connect (() = > {
486+ var active = button_locked. get_active ();
487+ button_locked. tooltip_text = active ? _(" Unlock Layer" ) : _(" Lock Layer" );
488+
489+ if (active) {
490+ button_locked. get_style_context (). add_class (" show" );
491+ } else {
492+ button_locked. get_style_context (). remove_class (" show" );
493+ }
494+
495+ icon_unlocked. visible = active;
496+ icon_unlocked. no_show_all = ! active;
497+
498+ icon_locked. visible = ! active;
499+ icon_locked. no_show_all = active;
500+
501+ if (active) {
502+ window. event_bus. item_locked (model);
503+ (parent as Gtk . ListBox ). unselect_row (this );
504+ }
505+
506+ window. event_bus. set_focus_on_canvas ();
507+ window. event_bus. file_edited ();
508+ });
509+ }
510+
511+ private void hide_actions () {
512+ button_hidden. bind_property (" active" , model, " visibility" ,
513+ BindingFlags . BIDIRECTIONAL | BindingFlags . SYNC_CREATE ,
514+ (binding, srcval, ref targetval) = > {
515+ Goo . CanvasItemVisibility status = (bool ) srcval. get_boolean ()
516+ ? Goo . CanvasItemVisibility . INVISIBLE
517+ : Goo . CanvasItemVisibility . VISIBLE ;
518+ targetval. set_enum (status);
519+ return true ;
520+ },
521+ (binding, srcval, ref targetval) = > {
522+ var status = ((Goo . CanvasItemVisibility ) srcval. get_enum ()) == Goo . CanvasItemVisibility . INVISIBLE ;
523+ targetval. set_boolean (status);
524+ return true ;
525+ });
526+
527+ button_hidden. toggled. connect (() = > {
528+ var active = button_hidden. get_active ();
529+ button_hidden. tooltip_text = active ? _(" Show Layer" ) : _(" Hide Layer" );
530+
531+ if (active) {
532+ button_hidden. get_style_context (). add_class (" show" );
533+ } else {
534+ button_hidden. get_style_context (). remove_class (" show" );
535+ }
536+
537+ icon_visible. visible = active;
538+ icon_visible. no_show_all = ! active;
539+
540+ icon_hidden. visible = ! active;
541+ icon_hidden. no_show_all = active;
542+
543+ window. event_bus. set_focus_on_canvas ();
544+ window. event_bus. file_edited ();
545+ });
546+ }
464547}
0 commit comments