From 3a7b05d60da84769d1216bbe92f2c5c1ae0fa9c6 Mon Sep 17 00:00:00 2001 From: sheaf Date: Sat, 19 Oct 2024 11:49:45 +0200 Subject: [PATCH] make stroke popover menu appear on right click --- assets/theme.css | 8 ++++---- src/app/MetaBrush/UI/Menu.hs | 2 +- src/app/MetaBrush/UI/StrokeTreeView.hs | 16 +++++++++++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/assets/theme.css b/assets/theme.css index e12754f..1be8db0 100644 --- a/assets/theme.css +++ b/assets/theme.css @@ -360,7 +360,7 @@ To specify it in CSS, set the box-shadow of the contents node." background-color: @bg; } -.metabrush .strokeMenu contents { +.metabrush .strokeMenu contents, .metabrush .strokeMenu arrow { border: unset; border-radius: 0px; margin: 0px; @@ -594,7 +594,7 @@ To specify it in CSS, set the box-shadow of the contents node." } /* Style when dragging layer item over the top part of an item */ -.metabrush .dragging-item .drag-top.layer-item { +.dragging-item .drag-top.layer-item { border-top: 2px solid @highlight; margin-top: -2px; box-shadow: @@ -602,7 +602,7 @@ To specify it in CSS, set the box-shadow of the contents node." } /* Style when dragging layer item over the bottom part of an item */ -.metabrush .dragging-item .drag-bot.layer-item { +.dragging-item .drag-bot.layer-item { border-bottom: 2px solid @highlight; margin-bottom: -2px; box-shadow: @@ -610,7 +610,7 @@ To specify it in CSS, set the box-shadow of the contents node." } /* Style when dragging brush over an item */ -.metabrush .dragging-brush .drag-top.layer-item, .dragging-brush .drag-bot.layer-item { +.dragging-brush .drag-top.layer-item, .dragging-brush .drag-bot.layer-item { border-top: 2px solid @brushStroke; border-bottom: 2px solid @brushStroke; border-left: 0px; diff --git a/src/app/MetaBrush/UI/Menu.hs b/src/app/MetaBrush/UI/Menu.hs index 2074b45..7a7812c 100644 --- a/src/app/MetaBrush/UI/Menu.hs +++ b/src/app/MetaBrush/UI/Menu.hs @@ -178,8 +178,8 @@ strokeMenuDescription lay = GroupLayer {} -> MenuItemDescription "Delete group" ( Nothing, DeleteLayer lay) Nothing , Section ( Just "New group" ) $ [ MenuItemDescription "...above" ( Nothing, NewGroup GroupAbove lay ) Nothing - , MenuItemDescription "...below" ( Nothing, NewGroup GroupBelow lay ) Nothing , MenuItemDescription "...containing" ( Nothing, NewGroup GroupContaining lay ) Nothing + , MenuItemDescription "...below" ( Nothing, NewGroup GroupBelow lay ) Nothing ] ] diff --git a/src/app/MetaBrush/UI/StrokeTreeView.hs b/src/app/MetaBrush/UI/StrokeTreeView.hs index 268b426..18123e9 100644 --- a/src/app/MetaBrush/UI/StrokeTreeView.hs +++ b/src/app/MetaBrush/UI/StrokeTreeView.hs @@ -459,10 +459,16 @@ newLayerView uiElts@( UIElements { window } ) vars = mdo ------------------ click <- GTK.gestureClickNew + GTK.gestureSingleSetButton click 0 -- listen to both left and right clicks - void $ GTK.onGestureClickPressed click $ \ clickNo x y -> do - case clickNo of - _ -> do + void $ GTK.onGestureClickPressed click $ \ _nbClicks x y -> do + button <- GTK.gestureSingleGetCurrentButton ?self + if -- | button <= 1 && nbClicks > 1 + -- -> do GTK.editableSetEditable label True + -- GTK.editableLabelStartEditing label + -- void $ GTK.widgetGrabFocus label + | button == 3 + -> do GTK.widgetUnparent layerPopover GTK.widgetSetParent layerPopover expander layer <- getLayerData listItem @@ -474,8 +480,8 @@ newLayerView uiElts@( UIElements { window } ) vars = mdo GDK.setRectangleY rect ( round y ) GTK.popoverSetPointingTo layerPopover ( Just rect ) GTK.popoverPopup layerPopover - - _ -> return () + | otherwise + -> return () ---------------------------- -- Visibility CheckButton --