Skip to content

Commit

Permalink
Merge pull request #546 from o-sdn-o/vt-input-mode
Browse files Browse the repository at this point in the history
Fix text wrap switch
  • Loading branch information
o-sdn-o authored Jan 17, 2024
2 parents cb28535 + 6bb0f17 commit 7cf5e3e
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 19 deletions.
Binary file added .resources/images/vtm.ico
Binary file not shown.
1 change: 1 addition & 0 deletions .resources/images/vtm.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IDI_ICON_VTM ICON "vtm.ico"
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") # WIN32 and similar checks are soft
# /bigobj Our event model spawns a large number of objects. By default, an object file can hold up to 65,279 (almost 2^16) addressable sections. This limit applies no matter which target platform is specified. /bigobj increases that address capacity to 4,294,967,296 (2^32).
# /utf-8 All literals in our source code are in UTF-8 format.
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /bigobj /utf-8")
set (WIN32_RESOURCES ".resources/images/vtm.rc")
elseif (NOT CMAKE_SYSTEM_NAME MATCHES "Android")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
# Static linkage
#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -pthread -s")
endif ()

add_executable (vtm "src/vtm.cpp")
add_executable (vtm "src/vtm.cpp" ${WIN32_RESOURCES})
# add_executable (term "src/netxs/apps/term.cpp")
# add_executable (calc "src/netxs/apps/calc.cpp")

Expand Down
2 changes: 1 addition & 1 deletion src/netxs/apps/desk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ namespace netxs::app::desk
auto highlight_color = skin::color(tone::highlight);
auto c8 = cell{}.bgc(0x00).fgc(highlight_color.bgc());
auto ver_label = ui::item::ctor(utf::concat(app::shared::version))
->active()
->active(cell{}.fgc(whitedk))
->shader(c8, e2::form::state::hover)
->limits({}, { -1, 1 })
->alignment({ snap::tail, snap::tail });
Expand Down
6 changes: 4 additions & 2 deletions src/netxs/apps/tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ namespace netxs::app::tile
auto [menu_block, cover, menu_data] = menu::mini(true, true, faux, 1,
menu::list
{
{ menu::item{ menu::item::type::Command, true, 0, std::vector<menu::item::look>{{ .label = "+", .notes = " New app " }}},
{ menu::item{ menu::item::type::Command, true, 0, std::vector<menu::item::look>{{ .label = "+", .notes = " Launch application instance. \n"
" The app to run can be set by RightClick on the taskbar. " }}},
[](auto& boss, auto& /*item*/)
{
boss.LISTEN(tier::release, hids::events::mouse::button::click::left, gear)
Expand Down Expand Up @@ -839,7 +840,8 @@ namespace netxs::app::tile
// gear.dismiss(true);
// };
//}},
{ menu::item{ menu::item::type::Command, true, 0, std::vector<menu::item::look>{{ .label = " + ", .notes = " Create and run a new app in active panes " }}},
{ menu::item{ menu::item::type::Command, true, 0, std::vector<menu::item::look>{{ .label = " + ", .notes = " Launch application instances in active empty slots. \n"
" The app to run can be set by RightClick on the taskbar. " }}},
[](auto& boss, auto& /*item*/)
{
boss.LISTEN(tier::release, hids::events::mouse::button::click::left, gear)
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/desktopio/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace netxs::app

namespace netxs::app::shared
{
static const auto version = "v0.9.54";
static const auto version = "v0.9.55";
static const auto repository = "https://github.com/directvt/vtm";
static const auto ipc_prefix = "vtm";
static const auto log_suffix = "_log";
Expand Down
27 changes: 25 additions & 2 deletions src/netxs/desktopio/canvas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,30 @@ namespace netxs
chan.b = chan.b > 0xFF - k ? 0xFF : chan.b + k;
}
}
// rgba: Shift color pair.
void xlight(si32 factor, rgba& second)
{
if (luma() > 140)
{
auto k = (byte)std::clamp(64 * factor, 0, 0xFF);
chan.r = chan.r < k ? 0x00 : chan.r - k;
chan.g = chan.g < k ? 0x00 : chan.g - k;
chan.b = chan.b < k ? 0x00 : chan.b - k;
second.chan.r = second.chan.r < k ? 0x00 : second.chan.r - k;
second.chan.g = second.chan.g < k ? 0x00 : second.chan.g - k;
second.chan.b = second.chan.b < k ? 0x00 : second.chan.b - k;
}
else
{
auto k = (byte)std::clamp(48 * factor, 0, 0xFF);
chan.r = chan.r > 0xFF - k ? 0xFF : chan.r + k;
chan.g = chan.g > 0xFF - k ? 0xFF : chan.g + k;
chan.b = chan.b > 0xFF - k ? 0xFF : chan.b + k;
second.chan.r = second.chan.r > 0xFF - k ? 0xFF : second.chan.r + k;
second.chan.g = second.chan.g > 0xFF - k ? 0xFF : second.chan.g + k;
second.chan.b = second.chan.b > 0xFF - k ? 0xFF : second.chan.b + k;
}
}
// rgba: Darken the color.
void shadow(byte k = 39)
{
Expand Down Expand Up @@ -1405,8 +1429,7 @@ namespace netxs
// cell: Delight both foreground and background.
void xlight(si32 factor = 1)
{
uv.fg.bright(factor);
uv.bg.xlight(factor);
uv.bg.xlight(factor, uv.fg);
}
// cell: Invert both foreground and background.
void invert()
Expand Down
28 changes: 17 additions & 11 deletions src/netxs/desktopio/terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6539,17 +6539,23 @@ namespace netxs::ui
});
}
// term: Proceed terminal input.
void ondata(view data, bufferbase* target_buffer = {})
template<bool Forced = faux>
void ondata(view data = {}, bufferbase* target_buffer = {})
{
update([&]
{
auto console_ptr = target_buffer ? target_buffer : this->target;
if (data.size())
{
if (io_log) log(prompt::cout, "\n\t", utf::change(ansi::hi(utf::debase(data)), "\n", ansi::pushsgr().nil().add("\n\t").popsgr()));
ansi::parse(data, target_buffer ? target_buffer : this->target);
ansi::parse(data, console_ptr);
return true;
}
else return faux;
else
{
console_ptr->parser::flush(); // Update line style, etc.
return Forced;
}
});
}
// term: Reset to defaults.
Expand Down Expand Up @@ -6616,7 +6622,7 @@ namespace netxs::ui
if (mtrack && selmod == mime::disabled)
{
follow[axis::Y] = true; // Reset viewport.
ondata(""); // Recalc trigger.
ondata<true>();
}
}
// term: Set selection form.
Expand All @@ -6628,7 +6634,7 @@ namespace netxs::ui
if (mtrack && selmod == mime::disabled)
{
follow[axis::Y] = true; // Reset viewport.
ondata(""); // Recalc trigger.
ondata<true>();
}
}
// term: Set the next selection mode.
Expand Down Expand Up @@ -6988,7 +6994,7 @@ namespace netxs::ui
{
follow[axis::Y] = true; // Reset viewport.
}
ondata(""); // Recalc trigger.
ondata<true>();
}
void set_align(si32 align)
{
Expand All @@ -7001,19 +7007,19 @@ namespace netxs::ui
target->style.jet((bias)align);
follow[axis::Y] = true; // Reset viewport.
}
ondata(""); // Recalc trigger.
ondata<true>();
}
void set_selmod(si32 mode)
{
selection_selmod(mode);
if (faux == target->selection_active()) follow[axis::Y] = true; // Reset viewport.
ondata(""); // Recalc trigger.
ondata<true>();
}
void set_selalt(bool boxed)
{
selection_selalt(boxed);
if (faux == target->selection_active()) follow[axis::Y] = true; // Reset viewport.
ondata(""); // Recalc trigger.
ondata<true>();
}
void set_log(bool state)
{
Expand Down Expand Up @@ -7044,7 +7050,7 @@ namespace netxs::ui
{
follow[axis::Y] = true; // Reset viewport.
}
ondata(""); // Recalc trigger.
ondata<true>();
}
void data_in(view data)
{
Expand Down Expand Up @@ -7847,7 +7853,7 @@ namespace netxs::ui
splash.fill(canvas, cell::shaders::onlyid(parent_id));
}
}
else splash.wipe(cell{}.link(parent_id).bgc(blacklt).bga(0x40));
else splash.wipe(cell{}.link(parent_id).fgc(blacklt).bgc(blacklt).alpha(0x40));
}
}
// dtvt: Render next frame.
Expand Down
6 changes: 5 additions & 1 deletion src/vtm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,11 @@ namespace netxs::app::vtm
{
//canvas[p].fuse(grade[k], obj_id, p - offset);
//canvas[p].fuse(grade[k], obj_id);
canvas[p].link(obj_id).bgc().mix_one(grade[k & 0xFF].bgc());
auto g = grade[k & 0xFF].bgc();
auto& c = canvas[p];
c.link(obj_id);
c.bgc().mix_one(g);
c.fgc().mix_one(g);
};
window.coor = dot_00;
netxs::online(window, origin, center, pset);
Expand Down

0 comments on commit 7cf5e3e

Please sign in to comment.