Commit df6916b6 authored by Jabier Arraiza's avatar Jabier Arraiza

Add panned to XMLDialog and ArrtDialog

parent 99648a41
...@@ -317,28 +317,17 @@ ...@@ -317,28 +317,17 @@
color: @theme_fg_color; color: @theme_fg_color;
} }
#XMLDialogAndAttribuesDialog,
#SelectorsAndStyleDialog{
min-height:200px;
min-width:250px;
}
#XMLAndAttributesDialog button,
#SelectorsAndStyleDialog button{ #SelectorsAndStyleDialog button{
padding:4px; padding:4px;
min-height:16px; min-height:16px;
margin:2px; margin:2px;
padding:2px;
} }
#XMLAndAttributesDialog .directiontoggler image,
#XMLAndAttributesDialog .stylesheettoggler image, .inkswitch image{
#SelectorsAndStyleDialog .directiontoggler image,
#SelectorsAndStyleDialog .stylesheettoggler image {
color: transparent; color: transparent;
} }
.inkswitch {
#XMLAndAttributesDialog .directiontoggler,
#XMLAndAttributesDialog .stylesheettoggler,
#SelectorsAndStyleDialog .directiontoggler,
#SelectorsAndStyleDialog .stylesheettoggler {
margin:2px; margin:2px;
} }
...@@ -350,18 +339,6 @@ ...@@ -350,18 +339,6 @@
padding-top: 0; padding-top: 0;
padding-bottom: 0; padding-bottom: 0;
} }
#XMLFlow GtkFlowBoxChild,
#XMLFlow flowboxchild{
border-right-width:1px;
border-top-width:1px;
border-bottom-width:1px;
margin-top:-1px;
border-style:solid;
border-color:@borders;
padding:7px;
}
SPRuler { SPRuler {
background-color: @theme_bg_color; background-color: @theme_bg_color;
color: @theme_fg_color; color: @theme_fg_color;
......
...@@ -354,7 +354,7 @@ void SelectorsDialog::_showWidgets() ...@@ -354,7 +354,7 @@ void SelectorsDialog::_showWidgets()
{ {
// Pack widgets // Pack widgets
Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool dir = prefs->getBool("/dialogs/selectors/updown", true); bool dir = prefs->getBool("/dialogs/selectors/vertical", true);
_paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL); _paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL);
_selectors_box.set_orientation(Gtk::ORIENTATION_VERTICAL); _selectors_box.set_orientation(Gtk::ORIENTATION_VERTICAL);
_selectors_box.set_name("SelectorsDialog"); _selectors_box.set_name("SelectorsDialog");
...@@ -362,34 +362,52 @@ void SelectorsDialog::_showWidgets() ...@@ -362,34 +362,52 @@ void SelectorsDialog::_showWidgets()
_scrolled_window_selectors.add(_treeView); _scrolled_window_selectors.add(_treeView);
_scrolled_window_selectors.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _scrolled_window_selectors.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
Gtk::Label *dirtogglerlabel = Gtk::manage(new Gtk::Label(_("Paned vertical"))); Gtk::Label *dirtogglerlabel = Gtk::manage(new Gtk::Label(_("Paned vertical")));
_direction.property_active() = dir;
_direction.property_active().signal_changed().connect(sigc::mem_fun(*this, &SelectorsDialog::_toggleDirection)); _direction.property_active().signal_changed().connect(sigc::mem_fun(*this, &SelectorsDialog::_toggleDirection));
_direction.get_style_context()->add_class("directiontoggler"); _direction.get_style_context()->add_class("inkswitch");
_styleButton(_create, "list-add", "Add a new CSS Selector"); _styleButton(_create, "list-add", "Add a new CSS Selector");
_create.signal_clicked().connect(sigc::mem_fun(*this, &SelectorsDialog::_addSelector)); _create.signal_clicked().connect(sigc::mem_fun(*this, &SelectorsDialog::_addSelector));
_styleButton(_del, "list-remove", "Remove a CSS Selector"); _styleButton(_del, "list-remove", "Remove a CSS Selector");
_button_box.pack_start(_create, Gtk::PACK_SHRINK); _button_box.pack_start(_create, Gtk::PACK_SHRINK);
_button_box.pack_start(_del, Gtk::PACK_SHRINK); _button_box.pack_start(_del, Gtk::PACK_SHRINK);
_button_box.pack_start(_direction, Gtk::PACK_SHRINK); _button_box.pack_start(_direction, false, false, 0);
_button_box.pack_start(*dirtogglerlabel, Gtk::PACK_SHRINK); _button_box.pack_start(*dirtogglerlabel, false, false, 0);
_selectors_box.pack_end(_button_box, Gtk::PACK_SHRINK); _selectors_box.pack_end(_button_box, false, false, 0);
_del.signal_clicked().connect(sigc::mem_fun(*this, &SelectorsDialog::_delSelector)); _del.signal_clicked().connect(sigc::mem_fun(*this, &SelectorsDialog::_delSelector));
_del.hide(); _del.hide();
_style_dialog = new StyleDialog; _style_dialog = new StyleDialog;
_selectors_box.set_name("StyleDialog"); _selectors_box.set_name("StyleDialog");
_paned.pack1(*_style_dialog, Gtk::SHRINK); _paned.pack1(*_style_dialog, Gtk::SHRINK);
_paned.pack2(_selectors_box, true, true); _paned.pack2(_selectors_box, true, true);
_paned.set_position(-1);
_getContents()->pack_start(_paned, Gtk::PACK_EXPAND_WIDGET); _getContents()->pack_start(_paned, Gtk::PACK_EXPAND_WIDGET);
show_all();
int widthpos = _paned.property_max_position() - _paned.property_min_position();
int panedpos = prefs->getInt("/dialogs/selectors/panedpos", 130);
_paned.set_position(panedpos);
_paned.property_wide_handle() = true;
_paned.signal_button_release_event().connect(sigc::mem_fun(*this, &SelectorsDialog::_resized), false);
set_size_request(320, 260);
set_name("SelectorsAndStyleDialog"); set_name("SelectorsAndStyleDialog");
} }
bool SelectorsDialog::_resized(GdkEventButton *event)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setInt("/dialogs/selectors/pannedpos", _paned.get_position());
return false;
}
void SelectorsDialog::_toggleDirection() void SelectorsDialog::_toggleDirection()
{ {
Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool dir = !prefs->getBool("/dialogs/selectors/updown", true); bool dir = !prefs->getBool("/dialogs/selectors/vertical", true);
prefs->setBool("/dialogs/selectors/updown", dir); prefs->setBool("/dialogs/selectors/vertical", dir);
_paned.set_position(-1);
_paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL); _paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL);
int widthpos = _paned.property_max_position() - _paned.property_min_position();
_paned.set_position(widthpos/2);
} }
/** /**
......
...@@ -146,6 +146,7 @@ class SelectorsDialog : public Widget::Panel { ...@@ -146,6 +146,7 @@ class SelectorsDialog : public Widget::Panel {
void _removeClass(SPObject *obj, const Glib::ustring &className, bool all = false); void _removeClass(SPObject *obj, const Glib::ustring &className, bool all = false);
void _toggleDirection(); void _toggleDirection();
void _showWidgets(); void _showWidgets();
bool _resized(GdkEventButton *event);
void _selectObjects(int, int); void _selectObjects(int, int);
// Variables // Variables
......
...@@ -211,7 +211,7 @@ StyleDialog::StyleDialog() ...@@ -211,7 +211,7 @@ StyleDialog::StyleDialog()
_mainBox.set_orientation(Gtk::ORIENTATION_VERTICAL); _mainBox.set_orientation(Gtk::ORIENTATION_VERTICAL);
_getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET);
_all_css->get_style_context()->add_class("stylesheettoggler"); _all_css->get_style_context()->add_class("inkswitch");
// Document & Desktop // Document & Desktop
_desktop_changed_connection = _desktop_changed_connection =
_desktopTracker.connectDesktopChanged(sigc::mem_fun(*this, &StyleDialog::_handleDesktopChanged)); _desktopTracker.connectDesktopChanged(sigc::mem_fun(*this, &StyleDialog::_handleDesktopChanged));
......
...@@ -74,19 +74,16 @@ XmlTree::XmlTree() : ...@@ -74,19 +74,16 @@ XmlTree::XmlTree() :
return; return;
} }
Gtk::Box *contents = _getContents(); Gtk::Box *contents = _getContents();
contents->set_name("XMLAndAttributesDialog");
contents->set_spacing(0);
contents->set_size_request(320, 260);
status.set_halign(Gtk::ALIGN_START); status.set_halign(Gtk::ALIGN_START);
status.set_valign(Gtk::ALIGN_CENTER); status.set_valign(Gtk::ALIGN_CENTER);
status.set_size_request(1, -1); status.set_size_request(1, -1);
status.set_markup(""); status.set_markup("");
status.set_line_wrap(true); status.set_line_wrap(true);
status_box.pack_start( status, TRUE, TRUE, 0); status_box.pack_start( status, TRUE, TRUE, 0);
status_box.pack_start(_direction, Gtk::PACK_SHRINK);
contents->pack_start(_paned, true, true, 0); 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<Inkscape::MessageStack>(); _message_stack = std::make_shared<Inkscape::MessageStack>();
_message_context = std::unique_ptr<Inkscape::MessageContext>(new Inkscape::MessageContext(_message_stack)); _message_context = std::unique_ptr<Inkscape::MessageContext>(new Inkscape::MessageContext(_message_stack));
_message_changed_connection = _message_stack->connectChanged( _message_changed_connection = _message_stack->connectChanged(
...@@ -174,25 +171,29 @@ XmlTree::XmlTree() : ...@@ -174,25 +171,29 @@ XmlTree::XmlTree() :
node_box.pack_end(status_box, false, false, 2); node_box.pack_end(status_box, false, false, 2);
Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool attrtoggler = prefs->getBool("/dialogs/xml/attrtoggler", true); bool attrtoggler = prefs->getBool("/dialogs/xml/attrtoggler", true);
bool dir = prefs->getBool("/dialogs/xml/vertical", true);
attributes = new AttrDialog; attributes = new AttrDialog;
_paned.set_orientation(attrtoggler ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL); _paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL);
_paned.pack1(node_box, Gtk::SHRINK); _paned.pack1(node_box, Gtk::SHRINK);
/* attributes */ /* attributes */
Gtk::Box *actionsbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); Gtk::Box *actionsbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
actionsbox->set_valign(Gtk::ALIGN_START);
Gtk::Label *attrtogglerlabel = Gtk::manage(new Gtk::Label(_("Show attributes"))); Gtk::Label *attrtogglerlabel = Gtk::manage(new Gtk::Label(_("Show attributes")));
attrtogglerlabel->set_margin_right(5);
_attrswitch.property_active() = attrtoggler; _attrswitch.property_active() = attrtoggler;
_attrswitch.get_style_context()->add_class("inkswitch");
_attrswitch.property_active().signal_changed().connect(sigc::mem_fun(*this, &XmlTree::_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"))); _dirtogglerlabel = Gtk::manage(new Gtk::Label(_("Paned vertical")));
_direction.property_active() = dir;
_direction.property_active().signal_changed().connect(sigc::mem_fun(*this, &XmlTree::_toggleDirection)); _direction.property_active().signal_changed().connect(sigc::mem_fun(*this, &XmlTree::_toggleDirection));
_direction.get_style_context()->add_class("directiontoggler"); _direction.get_style_context()->add_class("inkswitch");
actionsbox->pack_start(_attrswitch, Gtk::PACK_SHRINK); actionsbox->pack_start(_attrswitch, Gtk::PACK_SHRINK);
actionsbox->pack_start(*attrtogglerlabel, Gtk::PACK_SHRINK); actionsbox->pack_start(*attrtogglerlabel, Gtk::PACK_SHRINK);
actionsbox->pack_start(_direction, Gtk::PACK_SHRINK); actionsbox->pack_start(_direction, Gtk::PACK_SHRINK);
actionsbox->pack_start(*_dirtogglerlabel, Gtk::PACK_SHRINK); actionsbox->pack_start(*_dirtogglerlabel, Gtk::PACK_SHRINK);
_paned.pack2(*attributes, true, true); _paned.pack2(*attributes, true, true);
contents->pack_start(*actionsbox, true, true, 0); contents->pack_start(*actionsbox, false, false, 0);
/* Signal handlers */ /* Signal handlers */
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(tree)); 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); g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (on_tree_select_row), this);
...@@ -209,14 +210,21 @@ XmlTree::XmlTree() : ...@@ -209,14 +210,21 @@ XmlTree::XmlTree() :
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &XmlTree::set_tree_desktop) ); desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &XmlTree::set_tree_desktop) );
deskTrack.connect(GTK_WIDGET(gobj())); deskTrack.connect(GTK_WIDGET(gobj()));
int widthpos = _paned.property_max_position() - _paned.property_min_position();
/* initial show/hide */ int panedpos = prefs->getInt("/dialogs/xml/panedpos", 130);
_paned.set_position(panedpos);
_paned.signal_button_release_event().connect(sigc::mem_fun(*this, &XmlTree::_resized), false); /* initial show/hide */
set_name("XMLAndAttributesDialog");
set_spacing(0);
set_size_request(320, 260);
show_all(); show_all();
if (attrtoggler) { _paned.property_wide_handle() = true;
if (!attrtoggler) {
attributes->hide(); attributes->hide();
_dirtogglerlabel->hide(); _dirtogglerlabel->hide();
_direction.hide(); _direction.hide();
_paned.set_position(9999999); _paned.set_position(widthpos);
} }
tree_reset_context(); tree_reset_context();
...@@ -225,13 +233,21 @@ XmlTree::XmlTree() : ...@@ -225,13 +233,21 @@ XmlTree::XmlTree() :
} }
bool XmlTree::_resized(GdkEventButton *event)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setInt("/dialogs/xml/panedpos", _paned.get_position());
return false;
}
void XmlTree::_toggleDirection() void XmlTree::_toggleDirection()
{ {
Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool dir = !prefs->getBool("/dialogs/xml/updown", true); bool dir = !prefs->getBool("/dialogs/xml/vertical", true);
prefs->setBool("/dialogs/xml/updown", dir); prefs->setBool("/dialogs/xml/vertical", dir);
_paned.set_position(-1);
_paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL); _paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL);
int widthpos = _paned.property_max_position() - _paned.property_min_position();
_paned.set_position(widthpos/2);
} }
void XmlTree::_attrtoggler() void XmlTree::_attrtoggler()
...@@ -239,16 +255,18 @@ void XmlTree::_attrtoggler() ...@@ -239,16 +255,18 @@ void XmlTree::_attrtoggler()
Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool attrtoggler = !prefs->getBool("/dialogs/xml/attrtoggler", true); bool attrtoggler = !prefs->getBool("/dialogs/xml/attrtoggler", true);
prefs->setBool("/dialogs/xml/attrtoggler", attrtoggler); prefs->setBool("/dialogs/xml/attrtoggler", attrtoggler);
if (prefs->getBool("/dialogs/xml/attrtoggler", true)) { if (attrtoggler) {
_attrbox->hide(); attributes->show();
_dirtogglerlabel->hide();
_direction.hide();
_paned.set_position(9999999);
} else {
_attrbox->show();
_dirtogglerlabel->show(); _dirtogglerlabel->show();
_direction.show(); _direction.show();
_paned.set_position(-1); int widthpos = _paned.property_max_position() - _paned.property_min_position();
_paned.set_position(widthpos/2);
} else {
attributes->hide();
_dirtogglerlabel->hide();
_direction.hide();
int widthpos = _paned.property_max_position() - _paned.property_min_position();
_paned.set_position(widthpos);
} }
} }
......
...@@ -167,6 +167,7 @@ private: ...@@ -167,6 +167,7 @@ private:
void present() override; void present() override;
void _attrtoggler(); void _attrtoggler();
void _toggleDirection(); void _toggleDirection();
bool _resized(GdkEventButton *event);
bool in_dt_coordsys(SPObject const &item); bool in_dt_coordsys(SPObject const &item);
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment