Skip to content

Commit

Permalink
Term: Support custom palette (OSC 4/104, OSC P/R)
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o authored Dec 7, 2021
2 parents 4acf681 + 8320e97 commit 0edbf51
Show file tree
Hide file tree
Showing 15 changed files with 589 additions and 298 deletions.
2 changes: 0 additions & 2 deletions src/netxs/abstract/ring.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include "../math/intmath.hpp"

#include <cassert>

namespace netxs::generics
{
template<class vect, bool USE_UNDOCK = faux>
Expand Down
56 changes: 28 additions & 28 deletions src/netxs/apps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ namespace netxs::app::shared
X(Shop , "Shop" , ("Desktopio App Store") , "" ) \
X(Logs , "Logs" , ("Logs \nDebug output console") , "" ) \
X(View , "View" , (ansi::jet(bias::center).add("View \n Region 1")) , "" ) \
X(Tile , "Tile" , ("Tiling Window Manager") , "VTM_PROFILE_1=\"Tile\", \"Tiling Window Manager\", h()" ) \
X(RefreshRate , "Settings" , ("Settings: Frame Rate Limit") , "" ) \
X(PowerShell , "pwsh PowerShell" , ("Term \nPowerShell") , "" ) \
X(CommandPrompt, "cmd Command Prompt" , ("Term \nCommand Prompt") , "" ) \
X(Tile , "Tile" , ("Tiling Window Manager") , "VTM_PROFILE_1=\"Tile\", \"Tiling Window Manager\", h(a(\"Term\" ,\"\" ,\"\"), a(\"Term\" ,\"\" ,\"\"))" ) \
X(Settings , "Settings" , ("Settings: Frame Rate Limit") , "" ) \
X(PowerShell , "PowerShell" , ("Term \nPowerShell") , "" ) \
X(CommandPrompt, "Command Prompt" , ("Term \nCommand Prompt") , "" ) \
X(Bash , "Bash/Zsh/CMD" , ("Term \nBash/Zsh/CMD") , "" ) \
X(Far , "Far Manager" , ("Term \nFar Manager") , "" ) \
X(VTM , "vtm (recursively)" , ("Term \nvtm (recursively)") , "" ) \
X(MC , "mc Midnight Commander", ("Term \nMidnight Commander") , "" ) \
X(Truecolor , "RGB Truecolor image" , (ansi::jet(bias::right).add("True color ANSI/ASCII image test")), "" ) \
X(Truecolor , "Truecolor image" , (ansi::jet(bias::right).add("True color ANSI/ASCII image test")), "" ) \
X(Strobe , "Strobe" , (ansi::jet(bias::center).add("Strobe")) , "" ) \
X(Test , "Test Window" , (ansi::jet(bias::center).add("Test Page")) , "" ) \
X(Empty , "Empty Window" , (ansi::mgl(1).mgr(1).add("Empty Instance \nid: ")) , "" )
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace netxs::app::shared
boss.reflow();
gear.dismiss();
};
boss.base::broadcast->SUBMIT(tier::release, e2::form::prop::menusize, size)
boss.SUBMIT(tier::anycast, e2::form::prop::menusize, size)
{
auto& limit = boss.plugins<pro::limit>();
auto limits = limit.get();
Expand Down Expand Up @@ -265,7 +265,7 @@ namespace netxs::app::shared
};
return window;
};
auto build_RefreshRate = [](view v)
auto build_Settings = [](view v)
{
auto window = ui::cake::ctor();
window->plugin<pro::focus>()
Expand Down Expand Up @@ -495,7 +495,7 @@ namespace netxs::app::shared
(*c)--;
log("main: vtm recursive conn destoyed");
};
boss.base::broadcast->SUBMIT_T(tier::release, e2::form::upon::started, boss.bell::tracker, root)
boss.SUBMIT(tier::anycast, e2::form::upon::started, root)
{
boss.start();
};
Expand Down Expand Up @@ -530,10 +530,10 @@ namespace netxs::app::shared
->colors(whitelt, blackdk)
->invoke([&](auto& boss)
{
boss.base::broadcast->SUBMIT_T(tier::release, e2::form::upon::started, boss.bell::tracker, root)
{
boss.start();
};
boss.SUBMIT(tier::anycast, e2::form::upon::started, root)
{
boss.start();
};
});
layers->attach(app::shared::scroll_bars_term(scroll));
return window;
Expand Down Expand Up @@ -571,7 +571,7 @@ namespace netxs::app::shared
inst->colors(whitelt, blackdk)
->invoke([&](auto& boss)
{
boss.base::broadcast->SUBMIT_T(tier::release, e2::form::upon::started, boss.bell::tracker, root)
boss.SUBMIT(tier::anycast, e2::form::upon::started, root)
{
boss.start();
};
Expand All @@ -595,7 +595,7 @@ namespace netxs::app::shared
{
boss.SUBMIT(tier::release, hids::events::mouse::button::click::left, gear)
{
boss.base::broadcast->SIGNAL(tier::preview, app::term::events::cmd, ui::term::commands::ui::clear);
boss.SIGNAL(tier::anycast, app::term::events::cmd, ui::term::commands::ui::clear);
gear.dismiss(true);
};
}},
Expand All @@ -604,7 +604,7 @@ namespace netxs::app::shared
{
boss.SUBMIT(tier::release, hids::events::mouse::button::click::left, gear)
{
boss.base::broadcast->SIGNAL(tier::preview, app::term::events::cmd, ui::term::commands::ui::reset);
boss.SIGNAL(tier::anycast, app::term::events::cmd, ui::term::commands::ui::reset);
gear.dismiss(true);
};
}},
Expand All @@ -618,10 +618,10 @@ namespace netxs::app::shared
->colors(whitelt, 0xFF562401)
->invoke([&](auto& boss)
{
boss.base::broadcast->SUBMIT_T(tier::release, e2::form::upon::started, boss.bell::tracker, root)
{
boss.start();
};
boss.SUBMIT(tier::anycast, e2::form::upon::started, root)
{
boss.start();
};
});

auto scroll_bars = layers->attach(ui::fork::ctor());
Expand All @@ -645,7 +645,7 @@ namespace netxs::app::shared
{
boss.SUBMIT(tier::release, hids::events::mouse::button::click::left, gear)
{
boss.base::broadcast->SIGNAL(tier::preview, app::term::events::cmd, ui::term::commands::ui::clear);
boss.SIGNAL(tier::anycast, app::term::events::cmd, ui::term::commands::ui::clear);
gear.dismiss(true);
};
}},
Expand All @@ -654,7 +654,7 @@ namespace netxs::app::shared
{
boss.SUBMIT(tier::release, hids::events::mouse::button::click::left, gear)
{
boss.base::broadcast->SIGNAL(tier::preview, app::term::events::cmd, ui::term::commands::ui::reset);
boss.SIGNAL(tier::anycast, app::term::events::cmd, ui::term::commands::ui::reset);
gear.dismiss(true);
};
}},
Expand All @@ -677,7 +677,7 @@ namespace netxs::app::shared
inst->colors(whitelt, blackdk)
->invoke([&](auto& boss)
{
boss.base::broadcast->SUBMIT_T(tier::release, e2::form::upon::started, boss.bell::tracker, root)
boss.SUBMIT(tier::anycast, e2::form::upon::started, root)
{
boss.start();
};
Expand All @@ -690,7 +690,7 @@ namespace netxs::app::shared
};

app::shared::initialize builder_Strobe { "Strobe" , build_Strobe };
app::shared::initialize builder_RefreshRate { "RefreshRate" , build_RefreshRate };
app::shared::initialize builder_Settings { "Settings" , build_Settings };
app::shared::initialize builder_Empty { "Empty" , build_Empty };
app::shared::initialize builder_View { "View" , build_View };
app::shared::initialize builder_Truecolor { "Truecolor" , build_Truecolor };
Expand All @@ -711,9 +711,9 @@ namespace netxs::app::shared
#ifdef DEMO
auto shell = os::get_shell();
#ifdef PROD
app::shared::objs_config[objs_lookup["Tile"]].data = "VTM_PROFILE_1=\"Tile\", \"Tiling Window Manager\", h(v(\"" + shell + " -c 'LC_ALL=en_US.UTF-8 mc -c -x -d; cat'\", h(\"" + shell + " -c 'ls /bin | nl | ccze -A; " + shell + "'\", a(\"RefreshRate\",\"\",\"\"))), a(\"Calc\",\"\",\"\"))";
app::shared::objs_config[objs_lookup["Tile"]].data = "VTM_PROFILE_1=\"Tile\", \"Tiling Window Manager\", h(v(\"" + shell + " -c 'LC_ALL=en_US.UTF-8 mc -c -x -d; cat'\", h(\"" + shell + " -c 'ls /bin | nl | ccze -A; " + shell + "'\", a(\"Settings\",\"\",\"\"))), a(\"Calc\",\"\",\"\"))";
#else
app::shared::objs_config[objs_lookup["Tile"]].data = "VTM_PROFILE_1=\"Tile\", \"Tiling Window Manager\", h1:1(v1:1(\"" + shell + " -c 'LC_ALL=en_US.UTF-8 mc -c -x -d; cat'\", h1:1(\"" + shell + " -c 'ls /bin | nl | ccze -A; " + shell + "'\", a(\"RefreshRate\",\"\",\"\"))), a(\"Calc\",\"\",\"\"))";
app::shared::objs_config[objs_lookup["Tile"]].data = "VTM_PROFILE_1=\"Tile\", \"Tiling Window Manager\", h1:1(v1:1(\"" + shell + " -c 'LC_ALL=en_US.UTF-8 mc -c -x -d; cat'\", h1:1(\"" + shell + " -c 'ls /bin | nl | ccze -A; " + shell + "'\", a(\"Settings\",\"\",\"\"))), a(\"Calc\",\"\",\"\"))";
#endif

for (auto& [menu_item_id, app_data] : app::shared::objs_config)
Expand All @@ -726,13 +726,13 @@ namespace netxs::app::shared
menu_list[objs_lookup["Tile"]];
menu_list[objs_lookup["Logs"]];
menu_list[objs_lookup["View"]];
menu_list[objs_lookup["RefreshRate"]];
menu_list[objs_lookup["Settings"]];
#else
menu_list[objs_lookup["Term"]];
menu_list[objs_lookup["Tile"]];
menu_list[objs_lookup["Logs"]];
menu_list[objs_lookup["View"]];
menu_list[objs_lookup["RefreshRate"]];
menu_list[objs_lookup["Settings"]];
#endif

// Add custom commands to the menu.
Expand Down Expand Up @@ -786,7 +786,7 @@ namespace netxs::app::shared
sub_pos = twod{-120, 60};
creator(objs_lookup["Truecolor" ], { twod{ 20, 15 } + sub_pos, { 70, 30 } });
creator(objs_lookup["Logs" ], { twod{ 52, 33 } + sub_pos, { 45, 12 } });
creator(objs_lookup["RefreshRate"], { twod{ 60, 41 } + sub_pos, { 35, 10 } });
creator(objs_lookup["Settings" ], { twod{ 60, 41 } + sub_pos, { 35, 10 } });
#endif
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/netxs/apps/desk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ namespace netxs::app::desk
auto taskbar_viewport = window->attach(ui::fork::ctor(axis::X))
->invoke([](auto& boss)
{
boss.broadcast->SUBMIT(tier::request, e2::form::prop::viewport, viewport)
boss.SUBMIT(tier::anycast, e2::form::prop::viewport, viewport)
{
viewport = boss.base::area();
};
Expand Down Expand Up @@ -394,7 +394,7 @@ namespace netxs::app::desk
else timer.actify(faux, MENU_TIMEOUT, apply);
}
};
boss.broadcast->SUBMIT_T_BYVAL(tier::request, e2::form::prop::viewport, boss.tracker, viewport)
boss.SUBMIT_BYVAL(tier::anycast, e2::form::prop::viewport, viewport)
{
auto& [uibar_full_size, uibar_min_size] = *size_config;
viewport.coor.x += uibar_min_size;
Expand Down
37 changes: 18 additions & 19 deletions src/netxs/apps/logs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ namespace netxs::events::userland
{
EVENTPACK( logs, netxs::events::userland::root::custom )
{
GROUP_XS( ui, input::hids ),
GROUP_XS( codepoints, iota ),

SUBSET_XS( ui )
SUBSET_XS( codepoints )
{
EVENT_XS( create , input::hids ),
GROUP_XS( split , input::hids ),

SUBSET_XS( split )
{
EVENT_XS( hz, input::hids ),
};
EVENT_XS( release, iota ),
EVENT_XS( preview, iota ),
EVENT_XS( request, iota ),
};
};
};
Expand Down Expand Up @@ -73,7 +69,7 @@ namespace netxs::app::logs
auto msg = ansi::bgc(s ? greendk : yellowdk).fgc(whitelt)
.add(" show codepoints: ", s ? "on":"off", "\n").nil();
SIGNAL(tier::general, e2::debug::logs, msg);
SIGNAL(tier::release, e2::command::custom, s ? 1 : 2);
SIGNAL(tier::release, events::codepoints::release, s ? 1 : 2);
}
void worker()
{
Expand Down Expand Up @@ -188,7 +184,7 @@ namespace netxs::app::logs
clear();
gear.dismiss();
};
broadcast->SUBMIT(tier::request, e2::command::custom, status)
SUBMIT(tier::anycast, events::codepoints::request, status)
{
switch (status)
{
Expand All @@ -199,7 +195,7 @@ namespace netxs::app::logs
break;
}
};
broadcast->SUBMIT(tier::preview, e2::command::custom, cmd_id)
SUBMIT(tier::anycast, events::codepoints::preview, cmd_id)
{
switch (cmd_id)
{
Expand All @@ -216,7 +212,10 @@ namespace netxs::app::logs
break;
}
};
broadcast->SIGNAL(tier::release, e2::command::custom, worker->show_codepoints ? 1 : 2);
SUBMIT(tier::anycast, e2::form::upon::started, root)
{
this->SIGNAL(tier::anycast, events::codepoints::release, worker->show_codepoints ? 1 : 2);
};
SUBMIT(tier::preview, e2::size::set, newsize)
{
caret.coor(flow::cp());
Expand All @@ -226,9 +225,9 @@ namespace netxs::app::logs
topic += utf8;
update();
};
worker->SUBMIT_T(tier::release, e2::command::custom, token, status)
worker->SUBMIT_T(tier::release, events::codepoints::release, token, status)
{
broadcast->SIGNAL(tier::release, e2::command::custom, status);
this->SIGNAL(tier::anycast, events::codepoints::release, status);
};
worker->SUBMIT_T(tier::release, e2::debug::parsed, token, parsed_page)
{
Expand Down Expand Up @@ -263,11 +262,11 @@ namespace netxs::app::logs
boss.SUBMIT(tier::release, hids::events::mouse::button::click::left, gear)
{
iota status = 1;
boss.base::broadcast->SIGNAL(tier::request, e2::command::custom, status);
boss.base::broadcast->SIGNAL(tier::preview, e2::command::custom, status == 2 ? 1/*show*/ : 2/*hide*/);
boss.SIGNAL(tier::anycast, app::logs::events::codepoints::request, status);
boss.SIGNAL(tier::anycast, app::logs::events::codepoints::preview, status == 2 ? 1/*show*/ : 2/*hide*/);
gear.dismiss(true);
};
boss.base::broadcast->SUBMIT(tier::release, e2::command::custom, status)
boss.SUBMIT(tier::anycast, app::logs::events::codepoints::release, status)
{
//todo unify, get boss base colors, don't use x3
boss.color(status == 1 ? 0xFF00ff00 : x3.fgc(), x3.bgc());
Expand All @@ -278,7 +277,7 @@ namespace netxs::app::logs
{
boss.SUBMIT(tier::release, hids::events::mouse::button::click::left, gear)
{
boss.base::broadcast->SIGNAL(tier::preview, e2::command::custom, 0);
boss.SIGNAL(tier::anycast, app::logs::events::codepoints::preview, 0);
gear.dismiss(true);
};
}},
Expand Down
Loading

0 comments on commit 0edbf51

Please sign in to comment.