diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 7b0bf5999c260098083ddac29c84ff5827bdcfa3..6a5cba2beffb23cda0fc7d12e94f7935b5e7d1f7 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -820,7 +820,10 @@ ObjectsPanel::ObjectsPanel() os << CLAMP(value, 0.0, 1.0); auto css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "opacity", os.str().c_str()); - current_item->changeCSS(css, "style"); + + // Apply the style change through the StyleSubject. + // This ensures the "last style used" system is notified + _subject.setCSS(css); sp_repr_css_attr_unref(css); DocumentUndo::maybeDone(current_item->document, ":opacity", _("Change opacity"), INKSCAPE_ICON("dialog-object-properties")); } @@ -1036,7 +1039,12 @@ void ObjectsPanel::desktopReplaced() { layer_changed.disconnect(); - if (auto desktop = getDesktop()) { + auto desktop = getDesktop(); + + // Update the _subject with the new desktop + _subject.setDesktop(desktop); + + if (desktop) { layer_changed = desktop->layerManager().connectCurrentLayerChanged(sigc::mem_fun(*this, &ObjectsPanel::layerChanged)); } } diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h index dc5646de5fa898ae5e1512075dd521363d1a10ef..06690a506f1530a9f108ec13f9b583a9ed640ccb 100644 --- a/src/ui/dialog/objects.h +++ b/src/ui/dialog/objects.h @@ -26,6 +26,7 @@ #include "ui/widget/color-notebook.h" #include "ui/widget/popover-bin.h" #include "ui/widget/preferences-widget.h" +#include "ui/widget/style-subject.h" namespace Glib { class ValueBase; @@ -152,6 +153,9 @@ private: Gtk::TreeRow _clicked_item_row; UI::Widget::PopoverBin _popoverbin; + // Manage selection and apply style changes + UI::Widget::StyleSubject::Selection _subject; + void _activateAction(const std::string& layerAction, const std::string& selectionAction); bool blendModePopup(int x, int y, Gtk::TreeModel::Row row);