diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-06-10 22:28:01 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-06-10 22:28:01 +0000 |
| commit | 99648a411e5b9c022b85d20540fd2c98bf712cca (patch) | |
| tree | 2204ce1129403973295e7850b23de331623633d4 /src | |
| parent | Fix typos by PeterK. (diff) | |
| download | inkscape-99648a411e5b9c022b85d20540fd2c98bf712cca.tar.gz inkscape-99648a411e5b9c022b85d20540fd2c98bf712cca.zip | |
Move XMLDialog and Attributes Dialog to Gtk::Paned
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/attrdialog.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/selectorsdialog.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/xml-tree.cpp | 67 | ||||
| -rw-r--r-- | src/ui/dialog/xml-tree.h | 18 |
4 files changed, 69 insertions, 22 deletions
diff --git a/src/ui/dialog/attrdialog.cpp b/src/ui/dialog/attrdialog.cpp index 0403f9b7c..3db739059 100644 --- a/src/ui/dialog/attrdialog.cpp +++ b/src/ui/dialog/attrdialog.cpp @@ -137,6 +137,8 @@ AttrDialog::AttrDialog() setDesktop(getDesktop()); } + + /** * @brief AttrDialog::~AttrDialog * Class destructor diff --git a/src/ui/dialog/selectorsdialog.cpp b/src/ui/dialog/selectorsdialog.cpp index fbbff3231..0d46886b6 100644 --- a/src/ui/dialog/selectorsdialog.cpp +++ b/src/ui/dialog/selectorsdialog.cpp @@ -361,7 +361,7 @@ void SelectorsDialog::_showWidgets() _selectors_box.pack_start(_scrolled_window_selectors, Gtk::PACK_EXPAND_WIDGET); _scrolled_window_selectors.add(_treeView); _scrolled_window_selectors.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - Gtk::Label *dirogglerlabel = Gtk::manage(new Gtk::Label(_("Paned vertical"))); + Gtk::Label *dirtogglerlabel = Gtk::manage(new Gtk::Label(_("Paned vertical"))); _direction.property_active().signal_changed().connect(sigc::mem_fun(*this, &SelectorsDialog::_toggleDirection)); _direction.get_style_context()->add_class("directiontoggler"); _styleButton(_create, "list-add", "Add a new CSS Selector"); @@ -370,7 +370,7 @@ void SelectorsDialog::_showWidgets() _button_box.pack_start(_create, Gtk::PACK_SHRINK); _button_box.pack_start(_del, Gtk::PACK_SHRINK); _button_box.pack_start(_direction, Gtk::PACK_SHRINK); - _button_box.pack_start(*dirogglerlabel, Gtk::PACK_SHRINK); + _button_box.pack_start(*dirtogglerlabel, Gtk::PACK_SHRINK); _selectors_box.pack_end(_button_box, Gtk::PACK_SHRINK); _del.signal_clicked().connect(sigc::mem_fun(*this, &SelectorsDialog::_delSelector)); _del.hide(); diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index a4cc34335..bf3f237be 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -73,8 +73,8 @@ XmlTree::XmlTree() : if (!desktop) { return; } - flowbox_content = Gtk::manage(new Inkscape::UI::Widget::InkFlowBox("XMLFlow")); Gtk::Box *contents = _getContents(); + contents->set_name("XMLAndAttributesDialog"); contents->set_spacing(0); contents->set_size_request(320, 260); @@ -84,16 +84,15 @@ XmlTree::XmlTree() : status.set_markup(""); status.set_line_wrap(true); status_box.pack_start( status, TRUE, TRUE, 0); - - contents->pack_start(*flowbox_content, true, true, 0); - + status_box.pack_start(_direction, Gtk::PACK_SHRINK); + contents->pack_start(_paned, true, true, 0); + _message_stack = std::make_shared<Inkscape::MessageStack>(); _message_context = std::unique_ptr<Inkscape::MessageContext>(new Inkscape::MessageContext(_message_stack)); _message_changed_connection = _message_stack->connectChanged( sigc::bind(sigc::ptr_fun(_set_status_message), GTK_WIDGET(status.gobj()))); /* tree view */ - flowbox_content->insert(&node_box, _("_Nodes"), FLOWBOX_PAGE_NODES, true, -1); tree = SP_XMLVIEW_TREE(sp_xmlview_tree_new(nullptr, nullptr, nullptr)); gtk_widget_set_tooltip_text( GTK_WIDGET(tree), _("Drag to reorder nodes") ); @@ -173,12 +172,27 @@ XmlTree::XmlTree() : node_box.pack_start(*tree_scroller); node_box.pack_end(status_box, false, false, 2); - - /* attributes */ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool attrtoggler = prefs->getBool("/dialogs/xml/attrtoggler", true); attributes = new AttrDialog; - attr_box.pack_start(*attributes); - flowbox_content->insert(&attr_box, _("_Attributes"), FLOWBOX_PAGE_ATTRS, false, 200); - + _paned.set_orientation(attrtoggler ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL); + _paned.pack1(node_box, Gtk::SHRINK); + /* attributes */ + Gtk::Box *actionsbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); + Gtk::Label *attrtogglerlabel = Gtk::manage(new Gtk::Label(_("Show attributes"))); + _attrswitch.property_active() = attrtoggler; + _attrswitch.property_active().signal_changed().connect(sigc::mem_fun(*this, &XmlTree::_attrtoggler)); + _attrswitch.get_style_context()->add_class("directiontoggler"); + _dirtogglerlabel = Gtk::manage(new Gtk::Label(_("Paned vertical"))); + _direction.property_active().signal_changed().connect(sigc::mem_fun(*this, &XmlTree::_toggleDirection)); + _direction.get_style_context()->add_class("directiontoggler"); + actionsbox->pack_start(_attrswitch, Gtk::PACK_SHRINK); + actionsbox->pack_start(*attrtogglerlabel, Gtk::PACK_SHRINK); + actionsbox->pack_start(_direction, Gtk::PACK_SHRINK); + actionsbox->pack_start(*_dirtogglerlabel, Gtk::PACK_SHRINK); + + _paned.pack2(*attributes, true, true); + contents->pack_start(*actionsbox, true, true, 0); /* Signal handlers */ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(tree)); g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (on_tree_select_row), this); @@ -198,6 +212,12 @@ XmlTree::XmlTree() : /* initial show/hide */ show_all(); + if (attrtoggler) { + attributes->hide(); + _dirtogglerlabel->hide(); + _direction.hide(); + _paned.set_position(9999999); + } tree_reset_context(); g_assert(desktop != nullptr); @@ -205,6 +225,33 @@ XmlTree::XmlTree() : } +void XmlTree::_toggleDirection() +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool dir = !prefs->getBool("/dialogs/xml/updown", true); + prefs->setBool("/dialogs/xml/updown", dir); + _paned.set_position(-1); + _paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL); +} + +void XmlTree::_attrtoggler() +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool attrtoggler = !prefs->getBool("/dialogs/xml/attrtoggler", true); + prefs->setBool("/dialogs/xml/attrtoggler", attrtoggler); + if (prefs->getBool("/dialogs/xml/attrtoggler", true)) { + _attrbox->hide(); + _dirtogglerlabel->hide(); + _direction.hide(); + _paned.set_position(9999999); + } else { + _attrbox->show(); + _dirtogglerlabel->show(); + _direction.show(); + _paned.set_position(-1); + } +} + void XmlTree::present() { set_tree_select(get_dt_select()); diff --git a/src/ui/dialog/xml-tree.h b/src/ui/dialog/xml-tree.h index bd602366e..2750c7d15 100644 --- a/src/ui/dialog/xml-tree.h +++ b/src/ui/dialog/xml-tree.h @@ -15,13 +15,13 @@ #include <memory> -#include "ui/widget/ink-flow-box.h" #include "ui/widget/panel.h" #include <gtkmm/button.h> #include <gtkmm/entry.h> #include <gtkmm/paned.h> #include <gtkmm/scrolledwindow.h> #include <gtkmm/separatortoolitem.h> +#include <gtkmm/switch.h> #include <gtkmm/textview.h> #include <gtkmm/toolbar.h> @@ -165,7 +165,8 @@ private: void cmd_unindent_node(); void present() override; - + void _attrtoggler(); + void _toggleDirection(); bool in_dt_coordsys(SPObject const &item); /** @@ -178,13 +179,6 @@ private: */ gint blocked; - /* Each of the notebook page type (by number) */ - UI::Widget::InkFlowBox *flowbox_content; - enum { - FLOWBOX_PAGE_NODES, - FLOWBOX_PAGE_ATTRS, - }; - /** * Status bar */ @@ -212,14 +206,18 @@ private: SPXMLViewTree *tree; //SPXMLViewAttrList *attributes; AttrDialog *attributes; + Gtk::Box *_attrbox; /* XML Node Creation pop-up window */ Gtk::Entry *name_entry; Gtk::Button *create_button; + Gtk::Paned _paned; Gtk::VBox node_box; - Gtk::VBox attr_box; Gtk::HBox status_box; + Gtk::Switch _attrswitch; + Gtk::Switch _direction; + Gtk::Label *_dirtogglerlabel; Gtk::Label status; Gtk::Toolbar tree_toolbar; Gtk::ToolButton xml_element_new_button; |
