Skip to content

Commit

Permalink
Fix realtime statistics
Browse files Browse the repository at this point in the history
Merge pull request #448 from o-sdn-o/vt-input-mode
  • Loading branch information
o-sdn-o authored Oct 27, 2023
2 parents 2dd89ed + d311554 commit 3fabbff
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 253 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
$MpCmdRun = "C:\Program Files\Windows Defender\MpCmdRun.exe"
Set-Service -Name wuauserv -StartupType Manual -Status Running
Remove-MpPreference -ExclusionPath (Get-MpPreference).ExclusionPath
Set-MpPreference -MAPSReporting Advanced
& '7z' a -tzip c:\vtm.zip $fileName
& $MpCmdRun -SignatureUpdate
& $MpCmdRun -Scan -ScanType 3 -File c:\vtm.zip
Expand Down
16 changes: 8 additions & 8 deletions src/netxs/desktopio/canvas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,17 +389,17 @@ namespace netxs
i == tint16::greenlt ? _vt16<greenlt> :
i == tint16::yellowlt ? _vt16<yellowlt> : 0;

static constexpr ui32 vtm16[] =
static constexpr auto vtm16 = std::to_array(
{
_vtm16<0>, _vtm16<1>, _vtm16<2>, _vtm16<3>, _vtm16<4>, _vtm16<5>, _vtm16<6>, _vtm16<7>,
_vtm16<8>, _vtm16<9>, _vtm16<10>, _vtm16<11>, _vtm16<12>, _vtm16<13>, _vtm16<14>, _vtm16<15>,
};
static constexpr ui32 vga16[] =
});
static constexpr auto vga16 = std::to_array(
{
_vt16<blackdk>, _vt16<bluedk>, _vt16<greendk>, _vt16<cyandk>, _vt16<reddk>, _vt16<magentadk>, _vt16<yellowdk>, _vt16<whitedk>,
_vt16<blacklt>, _vt16<bluelt>, _vt16<greenlt>, _vt16<cyanlt>, _vt16<redlt>, _vt16<magentalt>, _vt16<yellowlt>, _vt16<whitelt>,
};
static constexpr ui32 vt256[] =
});
static constexpr auto vt256 = std::to_array(
{
_vt16<0>, _vt16<1>, _vt16<2>, _vt16<3>, _vt16<4>, _vt16<5>, _vt16<6>, _vt16<7>,
_vt16<8>, _vt16<9>, _vt16<10>, _vt16<11>, _vt16<12>, _vt16<13>, _vt16<14>, _vt16<15>,
Expand Down Expand Up @@ -451,7 +451,7 @@ namespace netxs
0xFF444444, 0xFF4E4E4E, 0xFF585858, 0xFF626262, 0xFF6C6C6C, 0xFF767676,
0xFF808080, 0xFF8A8A8A, 0xFF949494, 0xFF9E9E9E, 0xFFA8A8A8, 0xFFB2B2B2,
0xFFBCBCBC, 0xFFC6C6C6, 0xFFD0D0D0, 0xFFDADADA, 0xFFE4E4E4, 0xFFEEEEEE,
};
});
friend auto& operator << (std::ostream& s, rgba c)
{
return s << "{" << (int)c.chan.r
Expand Down Expand Up @@ -563,7 +563,7 @@ namespace netxs
}();
static auto cache_bg = cache_fg;
auto& cache = fg ? cache_fg : cache_bg; // Fg and Bg are sorted differently.
auto c = lookup(cache, std::span{ rgba::vt256, 16 });
auto c = lookup(cache, std::span{ rgba::vt256.data(), 16 });
return netxs::swap_bits<0, 2>(c); // ANSI<->DOS color scheme reindex.
}
auto to_vtm16(bool fg = true) const // rgba: 4-bit Foreground color (vtm 16-color palette).
Expand Down Expand Up @@ -645,7 +645,7 @@ namespace netxs
});
return table;
}();
return lookup(cache, std::span{ rgba::vtm16, 8 });
return lookup(cache, std::span{ rgba::vtm16.data(), 8 });
}
};

Expand Down
22 changes: 14 additions & 8 deletions src/netxs/desktopio/console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,13 +591,19 @@ namespace netxs::ui
X(mouse_btn_6 , "left+right combo" ) \
X(last_event , "event" )

#define X(a, b) a,
enum prop { prop_list count };
#undef X
enum prop
{
#define X(a, b) a,
prop_list
#undef X
};

#define X(a, b) b,
text description[prop::count] = { prop_list };
#undef X
static constexpr auto description = std::to_array(
{
#define X(a, b) b##sv,
prop_list
#undef X
});
#undef prop_list

base& boss;
Expand All @@ -621,7 +627,7 @@ namespace netxs::ui

void shadow()
{
for (auto i = 0; i < prop::count; i++)
for (auto i = 0; i < description.size(); i++)
{
status[i].ease();
}
Expand All @@ -643,7 +649,6 @@ namespace netxs::ui
{
shadow();
status[prop::last_event].set(stress) = "size";

status[prop::win_size].set(stress) =
std::to_string(new_size.x) + " x " +
std::to_string(new_size.y);
Expand Down Expand Up @@ -673,6 +678,7 @@ namespace netxs::ui
utf::format(track.totals) + " bytes";

track.number++;
status.reindex();
canvas.output(status);
}
void stop()
Expand Down
10 changes: 9 additions & 1 deletion src/netxs/desktopio/directvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,15 @@ namespace netxs::directvt
STRUCT_macro(syspaste, (id_t, gear_id) (ui32, secbits) (ui32, format) (text, data))
STRUCT_macro(sysfocus, (id_t, gear_id) (bool, state) (bool, focus_combine) (bool, focus_force_group))
STRUCT_macro(syswinsz, (id_t, gear_id) (twod, winsize))
STRUCT_macro(syskeybd, (id_t, gear_id) (ui32, ctlstat) (bool, extflag) (ui32, virtcod) (ui32, scancod) (bool, pressed) (text, cluster) (bool, handled) (si32, keycode))
STRUCT_macro(syskeybd, (id_t, gear_id) // syskeybd: Devide id.
(ui32, ctlstat) // syskeybd: Keybd modifiers.
(bool, extflag) //todo deprecated
(ui32, virtcod) //todo deprecated
(ui32, scancod) // syskeybd: Scancode.
(bool, pressed) // syskeybd: Key is pressed.
(text, cluster) // syskeybd: Generated string.
(bool, handled) // syskeybd: Key event is handled.
(si32, keycode)) // syskeybd: Key id.
STRUCT_macro(sysmouse, (id_t, gear_id) // sysmouse: Devide id.
(ui32, ctlstat) // sysmouse: Keybd modifiers.
(ui32, enabled) // sysmouse: Mouse device health status.
Expand Down
1 change: 1 addition & 0 deletions src/netxs/desktopio/intmath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <array>
#include <optional>
#include <algorithm>
#include <limits>
Expand Down
13 changes: 6 additions & 7 deletions src/netxs/desktopio/richtext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2444,13 +2444,12 @@ namespace netxs::ui
X(menu_white, "Light menu color") \
X(menu_black, "Dark menu color")

#define X(a, b) a,
enum prop { prop_list count };
#undef X

//#define X(a, b) b,
//text description[prop::count] = { prop_list };
//#undef X
enum prop
{
#define X(a, b) a,
prop_list
#undef X
};
#undef prop_list

prop active = prop::brighter;
Expand Down
Loading

0 comments on commit 3fabbff

Please sign in to comment.