diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-07-20 22:51:39 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-07-20 22:52:53 +0000 |
| commit | a6e593e63a4c7de57f9792adb2e2d5295080e7fe (patch) | |
| tree | a188e8d83227c05096846a3e5c871214d34db12a | |
| parent | Preferences: save shortcut file location relative to INKSCAPE_DATADIR (diff) | |
| download | inkscape-a6e593e63a4c7de57f9792adb2e2d5295080e7fe.tar.gz inkscape-a6e593e63a4c7de57f9792adb2e2d5295080e7fe.zip | |
Fix icon positions in context menus of Layers and Objects dialogs
Fixes https://gitlab.com/inkscape/inbox/issues/462
| -rw-r--r-- | src/ui/dialog/layers.cpp | 7 | ||||
| -rw-r--r-- | src/ui/dialog/objects.cpp | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 1e2a6ea35..18020e87b 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -36,6 +36,7 @@ #include "svg/css-ostringstream.h" +#include "ui/contextmenu.h" #include "ui/icon-loader.h" #include "ui/icon-names.h" #include "ui/tools/tool-base.h" @@ -146,6 +147,7 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code auto box = Gtk::manage(new Gtk::Box()); Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem()); + item->set_name("ImageMenuItem"); // custom name to identify our "ImageMenuItems" if (iconWidget) { box->pack_start(*iconWidget, false, true, 0); @@ -913,8 +915,11 @@ LayersPanel::LayersPanel() : _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DUPLICATE, nullptr, "Duplicate", (int)BUTTON_DUPLICATE ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DELETE, nullptr, "Delete", (int)BUTTON_DELETE ) ); - + _popupMenu.show_all_children(); + + // Install CSS to shift icons into the space reserved for toggles (i.e. check and radio items). + _popupMenu.signal_map().connect(sigc::mem_fun(static_cast<ContextMenu*>(&_popupMenu), &ContextMenu::ShiftIcons)); } // ------------------------------------------------------- diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 606539797..3fb575daa 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -43,6 +43,7 @@ #include "object/sp-shape.h" #include "style.h" +#include "ui/contextmenu.h" #include "ui/dialog-events.h" #include "ui/icon-names.h" #include "ui/selected-color.h" @@ -276,6 +277,7 @@ Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int cod auto box = Gtk::manage(new Gtk::Box()); Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem()); + item->set_name("ImageMenuItem"); // custom name to identify our "ImageMenuItems" if (iconWidget) { box->pack_start(*iconWidget, false, true, 0); @@ -1905,7 +1907,7 @@ ObjectsPanel::ObjectsPanel() : _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_SET_CLIPPATH, nullptr, _("Set Clip"), (int)BUTTON_SETCLIP ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_CREATE_CLIP_GROUP, nullptr, _("Create Clip Group"), (int)BUTTON_CLIPGROUP ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_CREATE_CLIP_GROUP, nullptr, _("Create Clip Group"), (int)BUTTON_CLIPGROUP ) ); //will never be implemented //_watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_OBJECT_SET_INVERSE_CLIPPATH, 0, "Set Inverse Clip", (int)BUTTON_SETINVCLIP ) ); @@ -1918,7 +1920,11 @@ ObjectsPanel::ObjectsPanel() : _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_EDIT_DUPLICATE, nullptr, _("Duplicate"), (int)BUTTON_DUPLICATE ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_EDIT_DELETE, nullptr, _("Delete"), (int)BUTTON_DELETE ) ); + _popupMenu.show_all_children(); + + // Install CSS to shift icons into the space reserved for toggles (i.e. check and radio items). + _popupMenu.signal_map().connect(sigc::mem_fun(static_cast<ContextMenu*>(&_popupMenu), &ContextMenu::ShiftIcons)); } // ------------------------------------------------------- |
