From cd7f6ac974dde831c8963d1c2afdb6f06cee5448 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sat, 7 Sep 2019 23:46:00 +0200 Subject: Add scrolled window to XMLDialog and CSS dialog to avoid auto growing when add new content --- src/ui/dialog/selectorsdialog.cpp | 12 ++++++++++-- src/ui/dialog/xml-tree.cpp | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/selectorsdialog.cpp b/src/ui/dialog/selectorsdialog.cpp index a4b6c2c8b..c5e0e9f0b 100644 --- a/src/ui/dialog/selectorsdialog.cpp +++ b/src/ui/dialog/selectorsdialog.cpp @@ -374,8 +374,16 @@ void SelectorsDialog::_showWidgets() _paned.pack1(*_style_dialog, Gtk::SHRINK); _paned.pack2(_selectors_box, true, true); _paned.set_wide_handle(true); - _getContents()->pack_start(_paned, Gtk::PACK_EXPAND_WIDGET); - _getContents()->pack_start(_button_box, false, false, 0); + Gtk::Box *contents = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); + contents->pack_start(_paned, Gtk::PACK_EXPAND_WIDGET); + contents->pack_start(_button_box, false, false, 0); + contents->set_valign(Gtk::ALIGN_FILL); + contents->child_property_fill(_paned); + Gtk::ScrolledWindow *dialog_scroller = new Gtk::ScrolledWindow(); + dialog_scroller->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); + dialog_scroller->set_shadow_type(Gtk::SHADOW_IN); + dialog_scroller->add(*Gtk::manage(contents)); + _getContents()->pack_start(*dialog_scroller, Gtk::PACK_EXPAND_WIDGET); show_all(); int widthpos = _paned.property_max_position() - _paned.property_min_position(); int panedpos = prefs->getInt("/dialogs/selectors/panedpos", widthpos / 2); diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index c91bcd2ab..f3259eb15 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -74,7 +74,9 @@ XmlTree::XmlTree() if (!desktop) { return; } - Gtk::Box *contents = _getContents(); + + Gtk::Box *root = _getContents(); + Gtk::Box *contents = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); status.set_halign(Gtk::ALIGN_START); status.set_valign(Gtk::ALIGN_CENTER); status.set_size_request(1, -1); @@ -85,6 +87,7 @@ XmlTree::XmlTree() contents->pack_start(_paned, true, true, 0); contents->set_valign(Gtk::ALIGN_FILL); contents->child_property_fill(_paned); + _paned.set_vexpand(true); _message_stack = std::make_shared(); _message_context = std::unique_ptr(new Inkscape::MessageContext(_message_stack)); @@ -234,7 +237,11 @@ XmlTree::XmlTree() _paned.property_position() = panedpos; _updating = false; tree_reset_context(); - + Gtk::ScrolledWindow *dialog_scroller = new Gtk::ScrolledWindow(); + dialog_scroller->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); + dialog_scroller->set_shadow_type(Gtk::SHADOW_IN); + dialog_scroller->add(*Gtk::manage(contents)); + root->pack_start(*dialog_scroller, true, true, 0); g_assert(desktop != nullptr); set_tree_desktop(desktop); -- cgit v1.2.3