Skip to content

Commit

Permalink
Merge pull request #665 from o-sdn-o/gui-bridge
Browse files Browse the repository at this point in the history
Refactoring: Drop RISEUP(...) macro
  • Loading branch information
o-sdn-o authored Oct 24, 2024
2 parents 55d30a6 + e285ed3 commit cf831c6
Show file tree
Hide file tree
Showing 16 changed files with 196 additions and 198 deletions.
32 changes: 16 additions & 16 deletions src/netxs/apps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace netxs::app::shared
boss.LISTEN(tier::release, e2::form::upon::vtree::attached, parent)
{
auto title = ansi::add("Empty Instance \nid: ", parent->id);
boss.RISEUP(tier::preview, e2::form::prop::ui::header, title);
boss.base::template riseup<tier::preview>(e2::form::prop::ui::header, title);
};
});
auto object = window->attach(ui::mock::ctor())
Expand Down Expand Up @@ -285,7 +285,7 @@ namespace netxs::app::shared
//boss.LISTEN(tier::release, hids::events::mouse::button::dblclick::left, gear)
//{
// auto outer = e2::config::plugins::sizer::outer.param();
// boss.RISEUP(tier::request, e2::config::plugins::sizer::outer, outer);
// boss.base::template riseup<tier::request>(e2::config::plugins::sizer::outer, outer);
// auto actual_rect = rect{ dot_00, boss.base::size() } + outer;
// if (actual_rect.hittest(gear.coord))
// {
Expand Down Expand Up @@ -320,14 +320,14 @@ namespace netxs::app::shared
if (cmd.starts_with("@"))
{
static auto title_map = std::unordered_map<text, si32>{};
boss.RISEUP(tier::request, e2::form::prop::ui::header, title, ());
auto title = boss.base::template riseup<tier::request>(e2::form::prop::ui::header);
title += std::to_string(++title_map[title]);
boss.RISEUP(tier::preview, e2::form::prop::ui::header, title);
boss.base::template riseup<tier::preview>(e2::form::prop::ui::header, title);
}
boss.RISEUP(tier::release, e2::config::plugins::sizer::outer, outer, (dent{ 2, 2, 1, 1 }));
boss.RISEUP(tier::release, e2::config::plugins::sizer::inner, inner, (dent{ -4,-4,-2,-2 }));
boss.RISEUP(tier::release, e2::config::plugins::align, faux);
boss.RISEUP(tier::preview, e2::form::prop::zorder, zpos::backmost);
boss.base::template riseup<tier::release>(e2::config::plugins::sizer::outer, dent{ 2, 2, 1, 1 });
boss.base::template riseup<tier::release>(e2::config::plugins::sizer::inner, dent{ -4,-4,-2,-2 });
boss.base::template riseup<tier::release>(e2::config::plugins::align, faux);
boss.base::template riseup<tier::preview>(e2::form::prop::zorder, zpos::backmost);
parent.LISTEN(tier::release, hids::events::mouse::button::click::right, gear)
{
auto area = boss.base::area() + dent{ 2, 2, 1, 1 };
Expand Down Expand Up @@ -369,7 +369,7 @@ namespace netxs::app::shared
};
boss.LISTEN(tier::preview, e2::config::plugins::sizer::alive, state)
{
boss.RISEUP(tier::release, e2::config::plugins::sizer::alive, state);
boss.base::template riseup<tier::release>(e2::config::plugins::sizer::alive, state);
};
boss.LISTEN(tier::anycast, e2::form::proceed::quit::any, fast)
{
Expand Down Expand Up @@ -425,7 +425,7 @@ namespace netxs::app::shared
auto& term_inst = *inst;
boss.LISTEN(tier::preview, e2::config::plugins::sizer::alive, state)
{
boss.RISEUP(tier::release, e2::config::plugins::sizer::alive, state);
boss.base::template riseup<tier::release>(e2::config::plugins::sizer::alive, state);
};
boss.LISTEN(tier::anycast, e2::form::proceed::quit::any, fast)
{
Expand Down Expand Up @@ -470,7 +470,7 @@ namespace netxs::app::shared
if (order) pro::focus::pass(t, d);
else pro::focus::pass(d, t);
boss.roll();
boss.back()->RISEUP(tier::preview, e2::form::prop::ui::footer, footer, ());
boss.back()->base::template riseup<tier::preview>(e2::form::prop::ui::footer);
boss.back()->reflow();
boss.back()->deface();
order = !order;
Expand All @@ -482,7 +482,7 @@ namespace netxs::app::shared
if (--count == 0)
if (auto parent = boss.parent())
{
parent->RISEUP(tier::release, e2::form::proceed::quit::one, fast);
parent->base::template riseup<tier::release>(e2::form::proceed::quit::one, fast);
}
};
});
Expand Down Expand Up @@ -522,15 +522,15 @@ namespace netxs::app::shared
{
boss.LISTEN(tier::anycast, e2::form::proceed::quit::any, fast)
{
boss.RISEUP(tier::release, e2::form::proceed::quit::one, fast);
boss.base::template riseup<tier::release>(e2::form::proceed::quit::one, fast);
};
boss.LISTEN(tier::anycast, e2::form::upon::started, window_ptr2)
{
boss.RISEUP(tier::request, e2::form::prop::window::instance, window_ptr, ());
auto window_ptr = boss.base::template riseup<tier::request>(e2::form::prop::window::instance);
//todo too hacky
if (auto form_ptr = std::dynamic_pointer_cast<ui::cake>(window_ptr))
{
form_ptr->plugins<pro::title>().live = faux;
form_ptr->template plugins<pro::title>().live = faux;
}
};
});
Expand All @@ -549,7 +549,7 @@ namespace netxs::app::shared
boss.LISTEN(tier::release, hids::events::mouse::button::click::left, gear)
{
auto backup = boss.This();
boss.RISEUP(tier::release, e2::form::proceed::quit::one, true);
boss.base::template riseup<tier::release>(e2::form::proceed::quit::one, true);
gear.dismiss(true);
};
}},
Expand Down
4 changes: 2 additions & 2 deletions src/netxs/apps/calc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,13 @@ namespace netxs::app::calc
//boss.keybd.accept(true);
boss.LISTEN(tier::anycast, e2::form::proceed::quit::any, fast)
{
boss.RISEUP(tier::release, e2::form::proceed::quit::one, fast);
boss.base::template riseup<tier::release>(e2::form::proceed::quit::one, fast);
};
boss.LISTEN(tier::release, e2::form::upon::vtree::attached, parent)
{
static auto i = 0; i++;
auto title = ansi::jet(bias::right).add("Spreadsheet\n ~/Untitled ", i, ".ods");
boss.RISEUP(tier::preview, e2::form::prop::ui::header, title);
boss.base::template riseup<tier::preview>(e2::form::prop::ui::header, title);
};
});
auto object = window->attach(ui::fork::ctor(axis::Y))
Expand Down
36 changes: 18 additions & 18 deletions src/netxs/apps/desk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace netxs::app::desk
auto data_src_shadow = ptr::shadow(data_src);
auto check_id = [](auto& boss, auto gear_id)
{
boss.RISEUP(tier::request, events::ui::id, owner_id, ());
auto owner_id = boss.base::template riseup<tier::request>(events::ui::id);
auto disabled = gear_id && gear_id != owner_id;
boss.SIGNAL(tier::release, e2::form::state::disabled, disabled);
auto& notes = boss.template plugins<pro::notes>();
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace netxs::app::desk
auto& window = *data_src;
if (gear.meta(hids::anyAlt)) // Pull window.
{
window.RISEUP(tier::preview, e2::form::layout::expose, area, ());
window.base::template riseup<tier::preview>(e2::form::layout::expose);
gear.owner.SIGNAL(tier::request, e2::form::prop::viewport, viewport, ());
window.SIGNAL(tier::preview, e2::form::layout::appear, viewport.center()); // Pull window.
if (window.hidden) // Restore if minimized.
Expand Down Expand Up @@ -154,7 +154,7 @@ namespace netxs::app::desk
}
else // Expose and set group focus.
{
window.RISEUP(tier::preview, e2::form::layout::expose, area, ());
window.base::template riseup<tier::preview>(e2::form::layout::expose);
if (window.hidden) // Restore if minimized.
{
window.SIGNAL(tier::release, e2::form::size::minimize, gear);
Expand All @@ -169,7 +169,7 @@ namespace netxs::app::desk
}
else // Set unique focus.
{
window.RISEUP(tier::preview, e2::form::layout::expose, area, ());
window.base::template riseup<tier::preview>(e2::form::layout::expose);
if (window.hidden) // Restore if minimized.
{
window.SIGNAL(tier::release, e2::form::size::minimize, gear);
Expand Down Expand Up @@ -210,7 +210,7 @@ namespace netxs::app::desk
item_area->LISTEN(tier::release, e2::form::state::mouse, hover, -)
{
if (disabled) return;
//boss.RISEUP(tier::request, events::ui::toggle, unfolded, ());
//auto unfolded = boss.base::template riseup<tier::request>(events::ui::toggle);
//auto hidden = !unfolded || !hover;
//auto folded = item_area_inst.base::size().x <= boss.base::size().x * 2;
//auto hidden = folded || !hover;
Expand Down Expand Up @@ -261,19 +261,19 @@ namespace netxs::app::desk
{
boss.LISTEN(tier::release, e2::form::upon::vtree::attached, parent)
{
boss.RISEUP(tier::request, e2::data::changed, current_default, ());
auto current_default = boss.base::template riseup<tier::request>(e2::data::changed);
boss.SIGNAL(tier::anycast, events::ui::selected, current_default);
//todo combine anycasts (update on user disconnect)
boss.RISEUP(tier::request, events::ui::toggle, state, ());
boss.SIGNAL(tier::anycast, events::ui::recalc, state);
auto state = boss.base::template riseup<tier::request>(events::ui::toggle);
boss.base::template riseup<tier::anycast>(events::ui::recalc, state);
};
});

auto def_note = text{" Application: \n"
" LeftClick to start the application instance \n"
" RightClick to set it as default \n"
" LeftDrag to move desktop viewport "};
data_src->RISEUP(tier::request, desk::events::menu, conf_list_ptr, ());
auto conf_list_ptr = data_src->base::template riseup<tier::request>(desk::events::menu);
if (!conf_list_ptr || !apps_map_ptr) return apps;
auto& conf_list = *conf_list_ptr;
auto& apps_map = *apps_map_ptr;
Expand Down Expand Up @@ -338,7 +338,7 @@ namespace netxs::app::desk
gear.slot.coor = viewport.coor + offset + viewport.size * 1 / 32 + dot_11;
gear.slot.size = viewport.size * 3 / 4;
gear.slot_forced = faux;
boss.RISEUP(tier::request, e2::form::proceed::createby, gear);
boss.base::template riseup<tier::request>(e2::form::proceed::createby, gear);
gear.dismiss(true);
};
});
Expand Down Expand Up @@ -369,7 +369,7 @@ namespace netxs::app::desk
{
if (!state)
{
boss.RISEUP(tier::preview, e2::form::upon::scroll::to_top::v, info, ());
boss.base::template riseup<tier::preview>(e2::form::upon::scroll::to_top::v);
}
};
});
Expand Down Expand Up @@ -447,7 +447,7 @@ namespace netxs::app::desk
boss.LISTEN(tier::release, hids::events::mouse::button::click::left, gear, -, (infospec))
{
infospec.gearid = gear.id;
gear.owner.RISEUP(tier::request, desk::events::exec, infospec);
gear.owner.base::template riseup<tier::request>(desk::events::exec, infospec);
gear.dismiss(true);
};
});
Expand Down Expand Up @@ -610,7 +610,7 @@ namespace netxs::app::desk
{
usrcfg.win = {};
usrcfg.hid = gear.id;
boss.RISEUP(tier::release, scripting::events::invoke, usrcfg);
boss.base::template riseup<tier::release>(scripting::events::invoke, usrcfg);
oneshot->reset();
};
};
Expand Down Expand Up @@ -641,7 +641,7 @@ namespace netxs::app::desk
};
boss.LISTEN(tier::release, hids::events::mouse::button::click::any, gear)
{
boss.RISEUP(tier::preview, events::ui::toggle, !active);
boss.base::template riseup<tier::preview>(events::ui::toggle, !active);
};
boss.LISTEN(tier::release, e2::form::state::mouse, state)
{
Expand All @@ -654,7 +654,7 @@ namespace netxs::app::desk
// Only when mouse leaving.
auto toggle = [&](auto state)
{
boss.RISEUP(tier::preview, events::ui::toggle, state);
boss.base::template riseup<tier::preview>(events::ui::toggle, state);
return faux; // One shot call.
};
timer.actify(faux, skin::globals().menu_timeout, toggle);
Expand Down Expand Up @@ -720,7 +720,7 @@ namespace netxs::app::desk
{
boss.LISTEN(tier::anycast, e2::form::upon::started, parent_ptr)
{
boss.RISEUP(tier::request, e2::config::creator, world_ptr, ());
auto world_ptr = boss.base::template riseup<tier::request>(e2::config::creator);
if (world_ptr)
{
auto apps = boss.attach_element(desk::events::apps, world_ptr, apps_template);
Expand Down Expand Up @@ -749,7 +749,7 @@ namespace netxs::app::desk
boss.base::hidden = userlist_hidden;
boss.LISTEN(tier::anycast, e2::form::upon::started, parent_ptr, -, (branch_template))
{
boss.RISEUP(tier::request, e2::config::creator, world_ptr, ());
auto world_ptr = boss.base::template riseup<tier::request>(e2::config::creator);
if (world_ptr)
{
auto users = boss.attach_element(desk::events::usrs, world_ptr, branch_template);
Expand Down Expand Up @@ -782,7 +782,7 @@ namespace netxs::app::desk
{
if (state)
{
boss.RISEUP(tier::preview, events::ui::toggle, state);
boss.base::template riseup<tier::preview>(events::ui::toggle, state);
}
};
});
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/apps/shop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ namespace netxs::app::shop
//boss.keybd.accept(true);
boss.LISTEN(tier::anycast, e2::form::proceed::quit::any, fast)
{
boss.RISEUP(tier::release, e2::form::proceed::quit::one, fast);
boss.base::template riseup<tier::release>(e2::form::proceed::quit::one, fast);
};
});
auto object = window->attach(ui::fork::ctor(axis::Y))
Expand Down
10 changes: 5 additions & 5 deletions src/netxs/apps/term.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ namespace netxs::app::terminal
{
_submit<true>(boss, item, [](auto& boss, auto& /*item*/, auto& gear)
{
boss.RISEUP(tier::preview, e2::form::size::enlarge::fullscreen, gear);
boss.base::template riseup<tier::preview>(e2::form::size::enlarge::fullscreen, gear);
});
}
static void TerminalRestart(ui::item& boss, menu::item& item)
Expand Down Expand Up @@ -876,13 +876,13 @@ namespace netxs::app::terminal
// 0 -- maximize (toggle)
if (new_size == dot_00) // Toggle fullscreen terminal (only if it is focused by someone).
{
boss.RISEUP(tier::request, e2::form::state::keybd::enlist, gates, ());
auto gates = boss.base::template riseup<tier::request>(e2::form::state::keybd::enlist);
if (gates.size())
if (auto gate_ptr = boss.bell::getref(gates.back()))
{
gate_ptr->SIGNAL(tier::release, e2::form::proceed::onbehalf, [&](auto& gear)
{
boss.RISEUP(tier::preview, e2::form::size::enlarge::fullscreen, gear);
boss.base::template riseup<tier::preview>(e2::form::size::enlarge::fullscreen, gear);
});
}
}
Expand All @@ -894,7 +894,7 @@ namespace netxs::app::terminal
boss.base::locked = faux; // Unlock resizing.
boss.base::resize(new_size);
boss.base::locked = true; // Lock resizing until reflow is complete.
boss.RISEUP(tier::preview, e2::form::layout::swarp, warp);
boss.base::template riseup<tier::preview>(e2::form::layout::swarp, warp);
}
};
boss.LISTEN(tier::release, e2::area, new_area)
Expand Down Expand Up @@ -1006,7 +1006,7 @@ namespace netxs::app::terminal
{
if (std::exchange(state, *visible || winsz->y != 1) != state)
{
boss.RISEUP(tier::preview, e2::form::prop::ui::cache, state);
boss.base::riseup<tier::preview>(e2::form::prop::ui::cache, state);
}
});
boss.LISTEN(tier::release, e2::form::state::visible, menu_visible, -, (visible, check_state))
Expand Down
Loading

0 comments on commit cf831c6

Please sign in to comment.