sculpt_manager: remove double name attributes

The 'name' attribute was generated by both the call of 'gen_named_node'
and 'Hoverable_item::gen_button_attr'. Use only the former.
This commit is contained in:
Norman Feske 2019-04-18 12:12:52 +02:00 committed by Christian Helmuth
parent 05fa063068
commit 3f8dfa346c
2 changed files with 12 additions and 5 deletions

View File

@ -44,14 +44,21 @@ struct Sculpt::Hoverable_item
*/
bool hovered(Id const &id) const { return id == _hovered; }
/**
* Generate hovered attribute depending on the item state
*/
void gen_hovered_attr(Xml_generator &xml, Id const &id) const
{
if (hovered(id)) xml.attribute("hovered", "yes");
}
/**
* Generate button attributes depending on the item state
*/
void gen_button_attr(Xml_generator &xml, Id const &id) const
{
xml.attribute("name", id);
if (hovered(id)) xml.attribute("hovered", "yes");
gen_hovered_attr(xml, id);
}
};

View File

@ -270,7 +270,7 @@ struct Sculpt::Popup_dialog
gen_named_node(xml, "button", "back", [&] () {
xml.attribute("selected", "yes");
xml.attribute("style", "back");
_item.gen_button_attr(xml, name);
_item.gen_hovered_attr(xml, name);
xml.node("hbox", [&] () { });
});
gen_named_node(xml, "label", "label", [&] () {
@ -299,7 +299,7 @@ struct Sculpt::Popup_dialog
xml.attribute("selected", "yes");
xml.attribute("style", style);
_item.gen_button_attr(xml, name);
_item.gen_hovered_attr(xml, name);
xml.node("hbox", [&] () { });
});
gen_named_node(xml, "label", "name", [&] () {
@ -328,7 +328,7 @@ struct Sculpt::Popup_dialog
xml.attribute("selected", "yes");
xml.attribute("style", style);
_route_item.gen_button_attr(xml, name);
_route_item.gen_hovered_attr(xml, name);
xml.node("hbox", [&] () { });
});
gen_named_node(xml, "label", "name", [&] () {