mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
sculpt: debug-dialog tweaks
Shorten the visible text. Make "wait" option depend on "wx" option. Indent checkboxes similar to the resource dialog. Issue #5012
This commit is contained in:
parent
5471ef7e1e
commit
ca85cb936b
@ -24,15 +24,12 @@ namespace Sculpt { struct Debug_dialog; }
|
|||||||
|
|
||||||
struct Sculpt::Debug_dialog : Noncopyable, Deprecated_dialog
|
struct Sculpt::Debug_dialog : Noncopyable, Deprecated_dialog
|
||||||
{
|
{
|
||||||
bool _monitor;
|
bool _monitor = false;
|
||||||
bool _wait;
|
bool _wait = false;
|
||||||
bool _wx;
|
bool _wx = false;
|
||||||
|
|
||||||
Hoverable_item _item { };
|
Hoverable_item _item { };
|
||||||
|
|
||||||
Debug_dialog(bool monitor, bool wait, bool wx)
|
|
||||||
: _monitor(monitor), _wait(wait), _wx(wx) { }
|
|
||||||
|
|
||||||
Hover_result hover(Xml_node hover) override
|
Hover_result hover(Xml_node hover) override
|
||||||
{
|
{
|
||||||
return Deprecated_dialog::any_hover_changed(
|
return Deprecated_dialog::any_hover_changed(
|
||||||
@ -46,63 +43,64 @@ struct Sculpt::Debug_dialog : Noncopyable, Deprecated_dialog
|
|||||||
if (!clicked.valid())
|
if (!clicked.valid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (clicked == "monitor")
|
if (clicked == "monitor") _monitor = !_monitor;
|
||||||
_monitor = component.monitor = !component.monitor;
|
if (clicked == "wx") _wx = !_wx;
|
||||||
else if (clicked == "wait") {
|
if (clicked == "wait") _wait = !_wait;
|
||||||
_wait = component.wait = !component.wait;
|
|
||||||
/* wait depends on wx */
|
/* "wx" depends on "monitor", "wait" depends on "wx" */
|
||||||
if (_wait)
|
_wx &= _monitor;
|
||||||
_wx = component.wx = true;
|
_wait &= _wx;
|
||||||
} else if (clicked == "wx") {
|
|
||||||
_wx = component.wx = !component.wx;
|
component.wx = _wx;
|
||||||
/* wait depends on wx */
|
component.monitor = _monitor;
|
||||||
if (!_wx)
|
component.wait = _wait;
|
||||||
_wait = component.wait = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _gen_menu_entry(Xml_generator &xml, Start_name const &name,
|
void _gen_checkbox(Xml_generator &xml, Start_name const &name,
|
||||||
Component::Info const &text, bool selected,
|
Component::Info const &text, bool selected) const
|
||||||
char const *style = "radio") const
|
|
||||||
{
|
{
|
||||||
gen_named_node(xml, "hbox", name, [&] () {
|
gen_named_node(xml, "hbox", name, [&] {
|
||||||
|
|
||||||
gen_named_node(xml, "float", "left", [&] () {
|
gen_named_node(xml, "float", "left", [&] {
|
||||||
xml.attribute("west", "yes");
|
xml.attribute("west", "yes");
|
||||||
|
|
||||||
xml.node("hbox", [&] () {
|
xml.node("hbox", [&] {
|
||||||
gen_named_node(xml, "button", "button", [&] () {
|
|
||||||
|
gen_named_node(xml, "button", "button", [&] {
|
||||||
|
|
||||||
if (selected)
|
if (selected)
|
||||||
xml.attribute("selected", "yes");
|
xml.attribute("selected", "yes");
|
||||||
|
|
||||||
xml.attribute("style", style);
|
xml.attribute("style", "checkbox");
|
||||||
_item.gen_hovered_attr(xml, name);
|
_item.gen_hovered_attr(xml, name);
|
||||||
xml.node("hbox", [&] () { });
|
xml.node("hbox", [&] { });
|
||||||
});
|
});
|
||||||
gen_named_node(xml, "label", "name", [&] () {
|
gen_named_node(xml, "label", "name", [&] {
|
||||||
xml.attribute("text", Path(" ", text)); });
|
xml.attribute("text", Path(" ", text)); });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gen_named_node(xml, "hbox", "right", [&] () { });
|
gen_named_node(xml, "hbox", "right", [&] { });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate(Xml_generator &xml) const override
|
void generate(Xml_generator &xml) const override
|
||||||
{
|
{
|
||||||
xml.node("vbox", [&] () {
|
xml.node("vbox", [&] {
|
||||||
_gen_menu_entry(xml, "monitor", "monitor this component", _monitor, "checkbox");
|
_gen_checkbox(xml, "monitor", "Debug", _monitor);
|
||||||
if (_monitor) {
|
|
||||||
_gen_menu_entry(xml, "wait", " wait for GDB", _wait, "checkbox");
|
if (_monitor)
|
||||||
_gen_menu_entry(xml, "wx", " map executable segments writeable", _wx, "checkbox");
|
_gen_checkbox(xml, "wx", "Allow code patching", _wx);
|
||||||
}
|
|
||||||
|
if (_wx)
|
||||||
|
_gen_checkbox(xml, "wait", "Wait for GDB", _wait);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() override
|
void reset() override
|
||||||
{
|
{
|
||||||
_item._hovered = Hoverable_item::Id();
|
_item._hovered = Hoverable_item::Id();
|
||||||
|
_monitor = _wait = _wx = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -107,25 +107,9 @@ void Popup_dialog::_gen_pkg_elements(Xml_generator &xml,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_debug.constructed()) {
|
|
||||||
gen_named_node(xml, "frame", "debug", [&] {
|
gen_named_node(xml, "frame", "debug", [&] {
|
||||||
xml.node("vbox", [&] () {
|
xml.node("vbox", [&] {
|
||||||
|
_debug.generate(xml); }); });
|
||||||
bool const selected = _route_selected("debug");
|
|
||||||
|
|
||||||
if (!selected)
|
|
||||||
_gen_route_entry(xml, "debug",
|
|
||||||
"Debug options ...", false, "enter");
|
|
||||||
|
|
||||||
if (selected) {
|
|
||||||
_gen_route_entry(xml, "back", "Debug options ...",
|
|
||||||
true, "back");
|
|
||||||
|
|
||||||
_debug->generate(xml);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Display "Add component" button once all routes are defined
|
* Display "Add component" button once all routes are defined
|
||||||
@ -457,7 +441,7 @@ void Popup_dialog::click(Action &action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (_state == ROUTE_SELECTED) {
|
else if (_state == ROUTE_SELECTED || _dialog_item.hovered("debug")) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keep the routing selection open when clicking on the "Add component"
|
* Keep the routing selection open when clicking on the "Add component"
|
||||||
@ -495,22 +479,6 @@ void Popup_dialog::click(Action &action)
|
|||||||
_resources->click(component); });
|
_resources->click(component); });
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (_debug_dialog_selected()) {
|
|
||||||
|
|
||||||
bool const clicked_on_different_route = clicked_route.valid()
|
|
||||||
&& (clicked_route != "");
|
|
||||||
if (clicked_on_different_route) {
|
|
||||||
|
|
||||||
/* close debug options dialog */
|
|
||||||
_selected_route.construct(clicked_route);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (_debug.constructed())
|
|
||||||
action.apply_to_construction([&] (Component &component) {
|
|
||||||
_debug->click(component); });
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
bool clicked_on_selected_route = false;
|
bool clicked_on_selected_route = false;
|
||||||
@ -561,4 +529,10 @@ void Popup_dialog::click(Action &action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_state == PKG_SHOWN || _state == ROUTE_SELECTED) {
|
||||||
|
if (_dialog_item.hovered("debug"))
|
||||||
|
action.apply_to_construction([&] (Component &component) {
|
||||||
|
_debug.click(component); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,10 +121,12 @@ struct Sculpt::Popup_dialog : Deprecated_dialog
|
|||||||
Activatable_item _action_item { };
|
Activatable_item _action_item { };
|
||||||
Activatable_item _install_item { };
|
Activatable_item _install_item { };
|
||||||
Hoverable_item _route_item { };
|
Hoverable_item _route_item { };
|
||||||
|
Hoverable_item _dialog_item { }; /* for detecting clicks into debug dialog */
|
||||||
Pd_route_dialog _pd_route { _runtime_config };
|
Pd_route_dialog _pd_route { _runtime_config };
|
||||||
|
|
||||||
Constructible<Resource_dialog> _resources { };
|
Constructible<Resource_dialog> _resources { };
|
||||||
Constructible<Debug_dialog> _debug { };
|
|
||||||
|
Debug_dialog _debug { };
|
||||||
|
|
||||||
enum State { TOP_LEVEL, DEPOT_REQUESTED, DEPOT_SHOWN, DEPOT_SELECTION,
|
enum State { TOP_LEVEL, DEPOT_REQUESTED, DEPOT_SHOWN, DEPOT_SELECTION,
|
||||||
INDEX_REQUESTED, INDEX_SHOWN,
|
INDEX_REQUESTED, INDEX_SHOWN,
|
||||||
@ -151,11 +153,6 @@ struct Sculpt::Popup_dialog : Deprecated_dialog
|
|||||||
return _route_selected("resources");
|
return _route_selected("resources");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _debug_dialog_selected() const
|
|
||||||
{
|
|
||||||
return _route_selected("debug");
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename FN>
|
template <typename FN>
|
||||||
void _apply_to_selected_route(Action &action, FN const &fn)
|
void _apply_to_selected_route(Action &action, FN const &fn)
|
||||||
{
|
{
|
||||||
@ -174,17 +171,19 @@ struct Sculpt::Popup_dialog : Deprecated_dialog
|
|||||||
_item .match(hover, "frame", "vbox", "hbox", "name"),
|
_item .match(hover, "frame", "vbox", "hbox", "name"),
|
||||||
_action_item .match(hover, "frame", "vbox", "button", "name"),
|
_action_item .match(hover, "frame", "vbox", "button", "name"),
|
||||||
_install_item.match(hover, "frame", "vbox", "float", "vbox", "float", "button", "name"),
|
_install_item.match(hover, "frame", "vbox", "float", "vbox", "float", "button", "name"),
|
||||||
_route_item .match(hover, "frame", "vbox", "frame", "vbox", "hbox", "name"));
|
_route_item .match(hover, "frame", "vbox", "frame", "vbox", "hbox", "name"),
|
||||||
|
_dialog_item .match(hover, "frame", "vbox", "frame", "name"));
|
||||||
|
|
||||||
_pd_route.hover(hover, "frame", "vbox", "frame", "vbox", "hbox", "name");
|
_pd_route.hover(hover, "frame", "vbox", "frame", "vbox", "hbox", "name");
|
||||||
|
|
||||||
if (_resources.constructed() &&
|
if (_resources.constructed())
|
||||||
hover_result == Deprecated_dialog::Hover_result::UNMODIFIED)
|
hover_result = Deprecated_dialog::any_hover_changed(
|
||||||
hover_result = _resources->match_sub_dialog(hover, "frame", "vbox", "frame", "vbox");
|
hover_result,
|
||||||
|
_resources->match_sub_dialog(hover, "frame", "vbox", "frame", "vbox"));
|
||||||
|
|
||||||
if (_debug.constructed() &&
|
hover_result = Deprecated_dialog::any_hover_changed(
|
||||||
hover_result == Deprecated_dialog::Hover_result::UNMODIFIED)
|
hover_result,
|
||||||
hover_result = _debug->match_sub_dialog(hover, "frame", "vbox", "frame", "vbox");
|
_debug.match_sub_dialog(hover, "frame", "vbox", "frame", "vbox"));
|
||||||
|
|
||||||
return hover_result;
|
return hover_result;
|
||||||
}
|
}
|
||||||
@ -365,6 +364,7 @@ struct Sculpt::Popup_dialog : Deprecated_dialog
|
|||||||
{
|
{
|
||||||
_item._hovered = Hoverable_item::Id();
|
_item._hovered = Hoverable_item::Id();
|
||||||
_route_item._hovered = Hoverable_item::Id();
|
_route_item._hovered = Hoverable_item::Id();
|
||||||
|
_dialog_item._hovered = Hoverable_item::Id();
|
||||||
_action_item.reset();
|
_action_item.reset();
|
||||||
_install_item.reset();
|
_install_item.reset();
|
||||||
_state = TOP_LEVEL;
|
_state = TOP_LEVEL;
|
||||||
@ -372,7 +372,7 @@ struct Sculpt::Popup_dialog : Deprecated_dialog
|
|||||||
_selected_route.destruct();
|
_selected_route.destruct();
|
||||||
_menu._level = 0;
|
_menu._level = 0;
|
||||||
_resources.destruct();
|
_resources.destruct();
|
||||||
_debug.destruct();
|
_debug.reset();
|
||||||
_pd_route.reset();
|
_pd_route.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,9 +427,7 @@ struct Sculpt::Popup_dialog : Deprecated_dialog
|
|||||||
construction.affinity_location,
|
construction.affinity_location,
|
||||||
construction.priority);
|
construction.priority);
|
||||||
|
|
||||||
_debug.construct(construction.monitor,
|
_debug.reset();
|
||||||
construction.wait,
|
|
||||||
construction.wx);
|
|
||||||
|
|
||||||
construction.try_apply_blueprint(blueprint);
|
construction.try_apply_blueprint(blueprint);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user