Commit c3bcdae2 authored by Jabier Arraiza's avatar Jabier Arraiza

trying to improbe @doctormo feedback

parent 5dfb06e1
Pipeline #65609055 canceled with stages
in 9 minutes and 14 seconds
......@@ -323,12 +323,24 @@
margin:2px;
padding:2px;
}
.inksmall{
font-size:11;
}
.inkswitch slider{
min-width:18px;
min-height:18px;
}
.inkswitch image{
color: transparent;
}
.inkswitch {
margin:2px;
padding:0;
font-size:8px;
}
#XMLAndAttributesDialog .toggle,
......
......@@ -225,6 +225,10 @@ void SelectorsDialog::fixCSSSelectors(Glib::ustring &selector)
}
if (i != std::string::npos) {
toparse.erase(0, i);
} else {
toparse = tag;
selectorpart = selectorpart == Glib::ustring("") ? toparse : selectorpart + " " + toparse;
continue;
}
}
auto i = toparse.find("#");
......@@ -362,6 +366,7 @@ void SelectorsDialog::_showWidgets()
_scrolled_window_selectors.add(_treeView);
_scrolled_window_selectors.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
Gtk::Label *dirtogglerlabel = Gtk::manage(new Gtk::Label(_("Paned vertical")));
dirtogglerlabel->get_style_context()->add_class("inksmall");
_direction.property_active() = dir;
_direction.property_active().signal_changed().connect(sigc::mem_fun(*this, &SelectorsDialog::_toggleDirection));
_direction.get_style_context()->add_class("inkswitch");
......@@ -381,7 +386,7 @@ void SelectorsDialog::_showWidgets()
_paned.pack2(_selectors_box, true, true);
_getContents()->pack_start(_paned, Gtk::PACK_EXPAND_WIDGET);
show_all();
int widthpos = _paned.property_max_position() - _paned.property_min_position();
int widthpos = _paned.property_max_position();
int panedpos = prefs->getInt("/dialogs/selectors/panedpos", 130);
_paned.set_position(panedpos);
......@@ -405,7 +410,8 @@ void SelectorsDialog::_toggleDirection()
bool dir = !prefs->getBool("/dialogs/selectors/vertical", true);
prefs->setBool("/dialogs/selectors/vertical", dir);
_paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL);
int widthpos = _paned.property_max_position() - _paned.property_min_position();
int widthpos = _paned.property_max_position();
prefs->setInt("/dialogs/xml/panedpos", widthpos / 2);
_paned.set_position(widthpos / 2);
}
......@@ -1341,8 +1347,16 @@ void SelectorsDialog::_selectRow()
if (!row->parent() && row->children().size() < 2) {
_del.show();
}
if (!row->parent() && row->children().size() > 1) {
_style_dialog->setCurrentSelector(row[_mColumns._colSelector]);
} else {
_style_dialog->setCurrentSelector("");
}
} else if (selectedrows.size() == 0) {
_style_dialog->setCurrentSelector("");
_del.show();
} else {
_style_dialog->setCurrentSelector("");
}
if (_updating || !getDesktop()) return; // Avoid updating if we have set row via dialog.
if (SP_ACTIVE_DESKTOP != getDesktop()) {
......
......@@ -199,19 +199,20 @@ StyleDialog::StyleDialog()
_scrolledWindow.add(_styleBox);
Gtk::Box *alltoggler = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
Gtk::Label *infotoggler = Gtk::manage(new Gtk::Label(_("Edit Full Stylesheet")));
infotoggler->get_style_context()->add_class("inksmall");
_all_css = Gtk::manage(new Gtk::Switch());
_scroolpos = 0;
vadj = _scrolledWindow.get_vadjustment();
vadj->signal_changed().connect(sigc::mem_fun(*this, &StyleDialog::_vscrool));
_all_css->property_active().signal_changed().connect(sigc::mem_fun(*this, &StyleDialog::_reload));
alltoggler->pack_start(*_all_css, false, false, 0);
alltoggler->pack_start(*infotoggler, false, false, 0);
_all_css->set_active(false);
_mainBox.pack_start(*alltoggler, false, false, 0);
//_all_css->property_active().signal_changed().connect(sigc::mem_fun(*this, &StyleDialog::_reload));
//alltoggler->pack_start(*_all_css, false, false, 0);
//alltoggler->pack_start(*infotoggler, false, false, 0);
//_all_css->set_active(false);
//_mainBox.pack_start(*alltoggler, false, false, 0);
_mainBox.set_orientation(Gtk::ORIENTATION_VERTICAL);
_getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET);
_all_css->get_style_context()->add_class("inkswitch");
//_all_css->get_style_context()->add_class("inkswitch");
// Document & Desktop
_desktop_changed_connection =
_desktopTracker.connectDesktopChanged(sigc::mem_fun(*this, &StyleDialog::_handleDesktopChanged));
......@@ -333,6 +334,10 @@ Glib::RefPtr<Gtk::TreeModel> StyleDialog::_selectTree(Glib::ustring selector)
return model;
}
void StyleDialog::setCurrentSelector(Glib::ustring current_selector){
_current_selector = current_selector;
_readStyleElement();
}
/**
* Fill the Gtk::TreeStore from the svg:style element.
*/
......@@ -503,7 +508,7 @@ void StyleDialog::_readStyleElement()
}
// Get list of objects selector matches
std::vector<SPObject *> objVec = _getObjVec(selector);
if (!_all_css->get_active()) {
if (!_all_css->get_active() && _current_selector == "") {
bool stop = true;
for (auto objel : objVec) {
if (objel->getId() == obj->getId()) {
......@@ -516,6 +521,9 @@ void StyleDialog::_readStyleElement()
continue;
}
}
if (!_current_selector.empty() && _current_selector != selector) {
continue;
}
Glib::ustring properties;
// Check to make sure we do have a value to match selector.
if ((i + 1) < tokens.size()) {
......@@ -598,7 +606,7 @@ void StyleDialog::_readStyleElement()
css_selector_event_add->signal_button_release_event().connect(
sigc::bind<Glib::RefPtr<Gtk::TreeStore>, Gtk::TreeView *, Glib::ustring, gint>(
sigc::mem_fun(*this, &StyleDialog::_addRow), store, css_tree, selector, selectorpos));
if (!_all_css->get_active()) {
if (!_all_css->get_active() || _current_selector != "") {
for (auto iter : obj->style->properties()) {
if (iter->style_src != SP_STYLE_SRC_UNSET) {
if (attr_prop_styleshet.count(iter->name)) {
......
......@@ -66,6 +66,7 @@ class StyleDialog : public Widget::Panel {
StyleDialog operator=(StyleDialog const &d) = delete;
static StyleDialog &getInstance() { return *new StyleDialog(); }
void setCurrentSelector(Glib::ustring current_selector);
private:
// Monitor <style> element for changes.
......@@ -137,6 +138,7 @@ class StyleDialog : public Widget::Panel {
void _reload();
void _vscrool();
double _scroolpos;
Glib::ustring _current_selector;
// Update watchers
void _addWatcherRecursive(Inkscape::XML::Node *node);
......
......@@ -183,10 +183,12 @@ XmlTree::XmlTree() :
_attrswitch.property_active() = attrtoggler;
_attrswitch.get_style_context()->add_class("inkswitch");
_attrswitch.property_active().signal_changed().connect(sigc::mem_fun(*this, &XmlTree::_attrtoggler));
attrtogglerlabel->get_style_context()->add_class("inksmall");
_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.get_style_context()->add_class("inkswitch");
_dirtogglerlabel->get_style_context()->add_class("inksmall");
actionsbox->pack_start(_attrswitch, Gtk::PACK_SHRINK);
actionsbox->pack_start(*attrtogglerlabel, Gtk::PACK_SHRINK);
actionsbox->pack_start(_direction, Gtk::PACK_SHRINK);
......@@ -210,7 +212,7 @@ XmlTree::XmlTree() :
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &XmlTree::set_tree_desktop) );
deskTrack.connect(GTK_WIDGET(gobj()));
int widthpos = _paned.property_max_position() - _paned.property_min_position();
int widthpos = _paned.property_max_position();
int panedpos = prefs->getInt("/dialogs/xml/panedpos", 130);
_paned.set_position(panedpos);
......@@ -238,7 +240,7 @@ bool XmlTree::_resized(GdkEventButton *event)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setInt("/dialogs/xml/panedpos", _paned.get_position());
return false;
return true;
}
void XmlTree::_toggleDirection()
......@@ -247,7 +249,8 @@ void XmlTree::_toggleDirection()
bool dir = !prefs->getBool("/dialogs/xml/vertical", true);
prefs->setBool("/dialogs/xml/vertical", dir);
_paned.set_orientation(dir ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL);
int widthpos = _paned.property_max_position() - _paned.property_min_position();
int widthpos = _paned.property_max_position();
prefs->setInt("/dialogs/xml/panedpos", widthpos / 2);
_paned.set_position(widthpos / 2);
}
......@@ -260,13 +263,14 @@ void XmlTree::_attrtoggler()
attributes->show();
_dirtogglerlabel->show();
_direction.show();
int widthpos = _paned.property_max_position() - _paned.property_min_position();
int widthpos = _paned.property_max_position();
prefs->setInt("/dialogs/xml/panedpos", widthpos / 2);
_paned.set_position(widthpos / 2);
} else {
attributes->hide();
_dirtogglerlabel->hide();
_direction.hide();
int widthpos = _paned.property_max_position() - _paned.property_min_position();
int widthpos = _paned.property_max_position();
_paned.set_position(widthpos);
}
}
......
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