Skip to content

Commit

Permalink
Merge pull request #505 from o-sdn-o/vt-input-mode
Browse files Browse the repository at this point in the history
Add print screen copy format option
  • Loading branch information
o-sdn-o authored Dec 20, 2023
2 parents 8ecc77e + b09e9c8 commit 2a8e2c9
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions doc/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ Note: Hardcoded settings are built from the [/src/vtm.xml](../src/vtm.xml) sourc
<timeout=3s /> <!-- Preview hiding timeout. Set it to zero to disable hiding. -->
<shadow=7 /> <!-- Preview shadow strength (0-10). -->
</preview>
<format=html /> <!-- none | text | ansi | rich | html | protected -->
</clipboard>
<viewport coor=0,0 />
<mouse dblclick=500ms />
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/apps/term.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ namespace netxs::app::term
}
static void TerminalSelectionMode(ui::item& boss, menu::item& item)
{
item.reindex([](auto& utf8){ return netxs::get_or(xml::options::selmod, utf8, mime::disabled); });
item.reindex([](auto& utf8){ return netxs::get_or(xml::options::format, utf8, mime::disabled); });
_submit(boss, item, [](auto& boss, auto& item, auto& gear)
{
boss.SIGNAL(tier::anycast, preview::selection::mode, item.views[item.taken].value);
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.36";
static const auto version = "v0.9.37";
static const auto ipc_prefix = "vtm";
static const auto log_suffix = "_log";
static const auto usr_config = "~/.config/vtm/settings.xml"s;
Expand Down
7 changes: 6 additions & 1 deletion src/netxs/desktopio/console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ namespace netxs::ui
bool show_regions; // conf: Highlight region ownership.
bool simple; // conf: .
svga vtmode; // conf: .
si32 clip_prtscrn_mime; // conf: Print-screen copy encoding format.

void read(xmls& config)
{
Expand All @@ -421,6 +422,7 @@ namespace netxs::ui
clip_preview_glow = config.take("clipboard/preview/shadow" , 7);
clip_preview_show = config.take("clipboard/preview/enabled", true);
clip_preview_size = config.take("clipboard/preview/size" , twod{ 80,25 });
clip_prtscrn_mime = config.take("clipboard/format" , mime::htmltext, xml::options::format);
dblclick_timeout = config.take("mouse/dblclick" , span{ 500ms });
tooltip_colors = config.take("tooltips" , cell{}.bgc(0xFFffffff).fgc(0xFF000000));
tooltip_timeout = config.take("tooltips/timeout" , span{ 2000ms });
Expand Down Expand Up @@ -508,7 +510,10 @@ namespace netxs::ui
data.s11n(xmap, gear.slot);
if (data.length())
{
gear.set_clipboard(gear.slot.size, data, mime::ansitext);
if (boss.props.clip_prtscrn_mime != mime::disabled)
{
gear.set_clipboard(gear.slot.size, data, boss.props.clip_prtscrn_mime);
}
}
};
boss.LISTEN(tier::release, e2::form::prop::filler, filler, memo)
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/desktopio/richtext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ namespace netxs::ui
static const auto frag = "EndFragment:"s;

auto crop = "<pre style=\"display:inline-block;"s;
crop += "font-size:14pt;font-family:'" + (font.empty() ? deffnt : font) + "',monospace;\">\n";
crop += "font-size:14pt;font-family:'" + (font.empty() ? deffnt : font) + "',monospace;line-height:1.0;\">\n";
auto dest = html_dest_t{};
for (auto& line_ptr : batch)
{
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/desktopio/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,7 @@ namespace netxs::os
auto copy = [&]()
{
auto done = fs::copy_file(file, dest, code);
if (done) log("The process image has been copied to '%path%'.", dest.string());
if (done) log("Process image has been copied to '%path%'.", dest.string());
else log("Failed to copy process image to '%path%'.", dest.string());
return done;
};
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/desktopio/terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace netxs::ui
def_tablen = std::max(1, config.take("tablen", si32{ 8 } ));
def_lucent = std::max(0, config.take("fields/lucent", si32{ 0xC0 } ));
def_margin = std::max(0, config.take("fields/size", si32{ 0 } ));
def_selmod = config.take("selection/mode", mime::textonly, xml::options::selmod);
def_selmod = config.take("selection/mode", mime::textonly, xml::options::format);
def_selalt = config.take("selection/rect", faux);
def_cur_on = config.take("cursor/show", true);
def_cursor = config.take("cursor/style", true, xml::options::cursor);
Expand Down
2 changes: 1 addition & 1 deletion src/netxs/desktopio/xml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ namespace netxs::xml
};
namespace options
{
static auto selmod = std::unordered_map<text, si32>
static auto format = std::unordered_map<text, si32>
{{ "none", mime::disabled },
{ "text", mime::textonly },
{ "ansi", mime::ansitext },
Expand Down
3 changes: 2 additions & 1 deletion src/vtm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,14 @@ R"==(
<timeout=3s/> <!-- Preview hiding timeout. Set it to zero to disable hiding. -->
<shadow=7 /> <!-- Preview shadow strength (0-10). -->
</preview>
<format=html /> <!-- text | ansi | rich | html | protected -->
</clipboard>
<mouse dblclick=500ms/>
<tooltips timeout=2000ms enabled=true fgc=pureblack bgc=purewhite/>
<debug overlay=off toggle="🐞"/> <!-- Display console debug info. -->
<regions enabled=0/> <!-- Highlight UI objects boundaries. -->
<keyboard>
<layout = QWERTY/> <!-- QWERTY, AZERTY, Dvorak, etc. -->
<layout = QWERTY/> <!-- Not implemented. QWERTY, AZERTY, Dvorak, etc. -->
</keyboard>
</client>
<term> <!-- Base configuration for the Term app. It can be partially overridden by the menu item's config subarg. -->
Expand Down

0 comments on commit 2a8e2c9

Please sign in to comment.