Update bundled release imports

This commit is contained in:
vczh
2026-07-26 04:16:55 -07:00
parent 8eec8747a2
commit 713069dcbc
10 changed files with 2567 additions and 22 deletions
+42 -9
View File
@@ -36150,7 +36150,19 @@ GuiRemoteGraphicsRenderTarget
fontHeights.Add(key, fontHeight.height);
}
}
}
if (measuring.createdImages)
{
for (auto&& imageMetadata : *measuring.createdImages.Obj())
{
auto image = remote->imageService.GetImage(imageMetadata.id);
image->UpdateFromImageMetadata(imageMetadata);
}
}
if (measuring.fontHeights || measuring.createdImages)
{
// TODO: (enumerable) foreach:indexed(alterable(reversed))
for (vint i = renderersAskingForCache.Count() - 1; i >= 0; i--)
{
@@ -36168,15 +36180,6 @@ GuiRemoteGraphicsRenderTarget
}
}
if (measuring.createdImages)
{
for (auto&& imageMetadata : *measuring.createdImages.Obj())
{
auto image = remote->imageService.GetImage(imageMetadata.id);
image->UpdateFromImageMetadata(imageMetadata);
}
}
if (measuring.minSizes)
{
for (auto&& minSize : *measuring.minSizes.Obj())
@@ -36794,6 +36797,31 @@ Gui3DSplitterElementRenderer
{
}
void Gui3DSplitterElementRenderer::Render(Rect bounds)
{
switch (element->GetDirection())
{
case Gui3DSplitterElement::Horizontal:
if (bounds.Height() < 2)
{
auto y = bounds.y1 + bounds.Height() / 2 - 1;
bounds.y1 = y;
bounds.y2 = y + 2;
}
break;
case Gui3DSplitterElement::Vertical:
if (bounds.Width() < 2)
{
auto x = bounds.x1 + bounds.Width() / 2 - 1;
bounds.x1 = x;
bounds.x2 = x + 2;
}
break;
}
GuiRemoteProtocolElementRenderer<Gui3DSplitterElement, Gui3DSplitterElementRenderer, remoteprotocol::RendererType::SinkSplitter>::Render(bounds);
}
void Gui3DSplitterElementRenderer::SendUpdateElementMessages(bool fullContent, collections::List<remoteprotocol::OrdinaryElementDescVariant>& updatedElements)
{
ElementDesc_SinkSplitter arguments;
@@ -44112,6 +44140,11 @@ namespace vl::presentation::remote_renderer
GetCurrentController()->CallbackService()->UninstallListener(this);
}
bool GuiRemoteRendererSingle::IsDisconnectedFromCore()
{
return disconnectingFromCore;
}
void GuiRemoteRendererSingle::ForceExitByFatelError()
{
if (window)
+3 -1
View File
@@ -22497,6 +22497,7 @@ namespace vl::presentation::elements_remoteprotocol
public:
Gui3DSplitterElementRenderer();
void Render(Rect bounds) override;
void SendUpdateElementMessages(bool fullContent, collections::List<remoteprotocol::OrdinaryElementDescVariant>& updatedElements) override;
};
@@ -23628,7 +23629,7 @@ namespace vl::presentation::remote_renderer
INativeWindow* window = nullptr;
INativeScreen* screen = nullptr;
IGuiRemoteProtocolEvents* events = nullptr;
bool disconnectingFromCore = false;
atomic_vint disconnectingFromCore = false;
bool stoppedByFatalError = false;
Nullable<WString> fatalError;
WString titleBeforeFatalError;
@@ -23769,6 +23770,7 @@ namespace vl::presentation::remote_renderer
void RegisterMainWindow(INativeWindow* _window);
void UnregisterMainWindow();
bool IsDisconnectedFromCore();
void ForceExitByFatelError();
void RequestCoreForceExitByFatalError();
void RetainByFatalError(const WString& errorMessage);
+21 -10
View File
@@ -30,12 +30,14 @@ Console
void Console::Write(const wchar_t* string, vint length)
{
CHECK_ERROR(IsEnabled(), L"vl::console::Console::Write(const wchar_t*, vint)#Console operations are disabled.");
std::wstring s(string, string + length);
std::wcout << s << std::flush;
}
Nullable<WString> Console::TryRead()
{
CHECK_ERROR(IsEnabled(), L"vl::console::Console::TryRead()#Console operations are disabled.");
std::wstring s;
if (!std::getline(std::wcin, s, L'\n'))
{
@@ -59,6 +61,7 @@ Console
void Console::SetColor(bool red, bool green, bool blue, bool light)
{
CHECK_ERROR(IsEnabled(), L"vl::console::Console::SetColor(bool, bool, bool, bool)#Console operations are disabled.");
int color = (blue ? 1 : 0) * 4 + (green ? 1 : 0) * 2 + (red ? 1 : 0);
if (light)
wprintf(L"\x1B[00;3%dm", color);
@@ -68,6 +71,7 @@ Console
void Console::SetTitle(const WString& string)
{
CHECK_ERROR(IsEnabled(), L"vl::console::Console::SetTitle(const WString&)#Console operations are disabled.");
}
}
}
@@ -158,24 +162,27 @@ DateTime
vint milliseconds;
OSInternalToTime(osInternal, timer, milliseconds);
tm* timeinfo = localtime(&timer);
return ConvertTMToDateTime(timeinfo, milliseconds);
tm timeinfo;
localtime_r(&timer, &timeinfo);
return ConvertTMToDateTime(&timeinfo, milliseconds);
}
vuint64_t LocalTime() override
{
struct timeval tv;
gettimeofday(&tv, nullptr);
tm* timeinfo = localtime(&tv.tv_sec);
return ConvertTMTToOSInternal(timeinfo, tv.tv_usec / 1000);
tm timeinfo;
localtime_r(&tv.tv_sec, &timeinfo);
return ConvertTMTToOSInternal(&timeinfo, tv.tv_usec / 1000);
}
vuint64_t UtcTime() override
{
struct timeval tv;
gettimeofday(&tv, nullptr);
tm* timeinfo = gmtime(&tv.tv_sec);
return ConvertTMTToOSInternal(timeinfo, tv.tv_usec / 1000);
tm timeinfo;
gmtime_r(&tv.tv_sec, &timeinfo);
return ConvertTMTToOSInternal(&timeinfo, tv.tv_usec / 1000);
}
vuint64_t LocalToUtcTime(vuint64_t osInternal) override
@@ -184,8 +191,9 @@ DateTime
vint milliseconds;
OSInternalToTime(osInternal, timer, milliseconds);
tm* timeinfo = gmtime(&timer);
return ConvertTMTToOSInternal(timeinfo, milliseconds);
tm timeinfo;
gmtime_r(&timer, &timeinfo);
return ConvertTMTToOSInternal(&timeinfo, milliseconds);
}
vuint64_t UtcToLocalTime(vuint64_t osInternal) override
@@ -194,8 +202,11 @@ DateTime
vint milliseconds;
OSInternalToTime(osInternal, timer, milliseconds);
time_t localTimer = mktime(localtime(&timer));
time_t utcTimer = mktime(gmtime(&timer));
tm localTimeInfo, utcTimeInfo;
localtime_r(&timer, &localTimeInfo);
gmtime_r(&timer, &utcTimeInfo);
time_t localTimer = mktime(&localTimeInfo);
time_t utcTimer = mktime(&utcTimeInfo);
timer += localTimer - utcTimer;
TimeToOSInternal(timer, milliseconds, osInternal);
+4
View File
@@ -30,6 +30,7 @@ Console
void Console::Write(const wchar_t* string, vint length)
{
CHECK_ERROR(IsEnabled(), L"vl::console::Console::Write(const wchar_t*, vint)#Console operations are disabled.");
HANDLE outHandle = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD fileMode = 0;
DWORD written = 0;
@@ -50,6 +51,7 @@ Console
Nullable<WString> Console::TryRead()
{
CHECK_ERROR(IsEnabled(), L"vl::console::Console::TryRead()#Console operations are disabled.");
auto inHandle = GetStdHandle(STD_INPUT_HANDLE);
if (inHandle == INVALID_HANDLE_VALUE || inHandle == NULL)
{
@@ -139,6 +141,7 @@ Console
void Console::SetColor(bool red, bool green, bool blue, bool light)
{
CHECK_ERROR(IsEnabled(), L"vl::console::Console::SetColor(bool, bool, bool, bool)#Console operations are disabled.");
WORD attribute = 0;
if (red)attribute |= FOREGROUND_RED;
if (green)attribute |= FOREGROUND_GREEN;
@@ -150,6 +153,7 @@ Console
void Console::SetTitle(const WString& string)
{
CHECK_ERROR(IsEnabled(), L"vl::console::Console::SetTitle(const WString&)#Console operations are disabled.");
SetConsoleTitle(string.Buffer());
}
}
+20
View File
@@ -45,11 +45,31 @@ namespace vl
{
namespace console
{
bool& GetConsoleEnabled()
{
static bool enabled = true;
return enabled;
}
/***********************************************************************
Console
***********************************************************************/
void Console::Enable()
{
GetConsoleEnabled() = true;
}
void Console::Disable()
{
GetConsoleEnabled() = false;
}
bool Console::IsEnabled()
{
return GetConsoleEnabled();
}
void Console::Write(const wchar_t* string)
{
Write(string, wcslen(string));
+9
View File
@@ -8716,6 +8716,15 @@ namespace vl
class Console abstract
{
public:
/// <summary>Enable Console operations. This operation is idempotent.</summary>
static void Enable();
/// <summary>Disable Console operations. This operation is idempotent.</summary>
static void Disable();
/// <summary>Test whether Console operations are enabled.</summary>
static bool IsEnabled();
/// <summary>Write a string to the command-line window.</summary>
/// <param name="string">Content to write.</param>
/// <param name="length">Size of the content in wchar_t, not including the zero terminator.</param>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+990 -2
View File
File diff suppressed because it is too large Load Diff
+319
View File
@@ -7179,3 +7179,322 @@ namespace vl::inter_process::async_tcp_socket
#endif
/***********************************************************************
.\TUI\TUI.H
***********************************************************************/
/***********************************************************************
Author: Zihan Chen (vczh)
Licensed under https://github.com/vczh-libraries/License
***********************************************************************/
#ifndef VCZH_TUI
#define VCZH_TUI
namespace vl
{
namespace console
{
enum class TuiColorMode
{
Auto,
TrueColor,
Color256,
Color16,
};
struct TuiStartOptions
{
TuiColorMode colorMode = TuiColorMode::Auto;
};
struct TuiColor
{
vuint8_t r = 0;
vuint8_t g = 0;
vuint8_t b = 0;
auto operator<=>(const TuiColor&) const = default;
};
enum class TuiMergeableGlyph : vuint8_t
{
None = 0,
ThinLine = 1,
ThickLine = 2,
DoubleLine = 3,
};
struct TuiMergeablePixel
{
TuiMergeableGlyph up = TuiMergeableGlyph::None;
TuiMergeableGlyph down = TuiMergeableGlyph::None;
TuiMergeableGlyph left = TuiMergeableGlyph::None;
TuiMergeableGlyph right = TuiMergeableGlyph::None;
};
enum class TuiUnmergeableGlyph : vuint8_t
{
RoundCorner,
};
enum class TuiUnmergeableDirection : vuint8_t
{
LeftTop,
RightTop,
LeftBottom,
RightBottom,
};
struct TuiUnmergeablePixel
{
TuiUnmergeableGlyph glyph = TuiUnmergeableGlyph::RoundCorner;
TuiUnmergeableDirection direction = TuiUnmergeableDirection::LeftTop;
};
enum class TuiPixelGlyph : vuint8_t
{
Char,
Mergeable,
Unmergeable,
WideCharContinuation,
};
struct TuiPixel
{
TuiPixelGlyph glyph = TuiPixelGlyph::Char;
union
{
char32_t c = 0;
TuiMergeablePixel mergeable;
TuiUnmergeablePixel unmergeable;
};
TuiColor foregroundColor = { 255, 255, 255 };
TuiColor backgroundColor = { 0, 0, 0 };
char32_t GetChar32() const;
wchar_t GetWChar() const;
};
struct TuiMouseInfo
{
vint x = 0;
vint y = 0;
vint wheel = 0;
bool ctrl = false;
bool shift = false;
bool alt = false;
bool left = false;
bool middle = false;
bool right = false;
};
enum class TuiMouseButton
{
Left,
Middle,
Right,
};
struct TuiKeyInfo
{
vint code = 0;
bool ctrl = false;
bool shift = false;
bool alt = false;
bool capslock = false;
bool autoRepeatKeyDown = false;
};
struct TuiCharInfo
{
wchar_t code = 0;
bool ctrl = false;
bool shift = false;
bool alt = false;
bool capslock = false;
};
class ITuiCallback : public Interface
{
public:
virtual void Starting();
virtual void Stopping();
virtual void BufferSizeChanged();
virtual void MouseMove(const TuiMouseInfo& info);
virtual void MouseDown(TuiMouseButton button, const TuiMouseInfo& info);
virtual void MouseUp(TuiMouseButton button, const TuiMouseInfo& info);
virtual void MouseDoubleClick(TuiMouseButton button, const TuiMouseInfo& info);
virtual void MouseVerticalWheel(const TuiMouseInfo& info);
virtual void MouseHorizontalWheel(const TuiMouseInfo& info);
virtual void KeyDown(const TuiKeyInfo& info);
virtual void KeyUp(const TuiKeyInfo& info);
virtual void Char(const TuiCharInfo& info);
virtual void Timer();
};
struct TuiPrintOptions
{
TuiColor foregroundColor = { 255, 255, 255 };
TuiColor backgroundColor = { 0, 0, 0 };
};
struct TuiLineOptions
{
TuiMergeableGlyph glyph = TuiMergeableGlyph::ThinLine;
TuiColor foregroundColor = { 255, 255, 255 };
Nullable<TuiColor> backgroundColor;
};
enum class TuiRectCorner
{
Sharp,
Round,
};
struct TuiRectOptions
{
TuiMergeableGlyph glyph = TuiMergeableGlyph::ThinLine;
TuiColor foregroundColor = { 255, 255, 255 };
Nullable<TuiColor> backgroundColor;
TuiRectCorner corner = TuiRectCorner::Sharp;
};
namespace unittest
{
class ITuiBackend;
class ScopedTuiBackend;
}
class TUI abstract
{
friend class unittest::ScopedTuiBackend;
private:
class Impl;
class ListenerStorage;
static Impl* impl;
static ListenerStorage* listenerStorage;
static Ptr<unittest::ITuiBackend>* injectedBackend;
static Impl& GetImpl();
public:
static bool TryGetConsoleSize(vint& width, vint& height);
static void Start(const TuiStartOptions& options);
static bool RunOneCycle();
static void Stop();
static bool IsInUse();
static bool IsStopRequested();
static TuiColorMode GetColorMode();
static bool InstallListener(ITuiCallback* listener);
static bool UninstallListener(ITuiCallback* listener);
static void StartTimer(vint milliseconds);
static void StopTimer();
static TuiPixel* GetBuffer();
static vint GetBufferWidth();
static vint GetBufferHeight();
static vint MeasureChar(char32_t code);
static void RenderBuffer();
static void PrintChar(const TuiPrintOptions& options, char32_t code, vint x, vint y);
static void DrawLineV(const TuiLineOptions& options, vint x, vint y1, vint y2);
static void DrawLineH(const TuiLineOptions& options, vint x1, vint x2, vint y);
static void DrawRect(const TuiRectOptions& options, vint x1, vint y1, vint x2, vint y2);
static void Clear(TuiColor backgroundColor, vint x1, vint y1, vint x2, vint y2);
static void PrintChar(TuiPixel* buffer, vint width, vint height, const TuiPrintOptions& options, char32_t code, vint x, vint y);
static void DrawLineV(TuiPixel* buffer, vint width, vint height, const TuiLineOptions& options, vint x, vint y1, vint y2);
static void DrawLineH(TuiPixel* buffer, vint width, vint height, const TuiLineOptions& options, vint x1, vint x2, vint y);
static void DrawRect(TuiPixel* buffer, vint width, vint height, const TuiRectOptions& options, vint x1, vint y1, vint x2, vint y2);
static void Clear(TuiPixel* buffer, vint width, vint height, TuiColor backgroundColor, vint x1, vint y1, vint x2, vint y2);
};
namespace unittest
{
enum class TuiBackendEventType
{
None,
Resize,
MouseMove,
MouseDown,
MouseUp,
MouseDoubleClick,
MouseVerticalWheel,
MouseHorizontalWheel,
KeyDown,
KeyUp,
Char,
};
struct TuiBackendEvent
{
TuiBackendEventType type = TuiBackendEventType::None;
vint width = 0;
vint height = 0;
TuiMouseButton mouseButton = TuiMouseButton::Left;
TuiMouseInfo mouseInfo;
TuiKeyInfo keyInfo;
TuiCharInfo charInfo;
};
class ITuiBackend : public Interface
{
public:
virtual TuiColorMode Start(const TuiStartOptions& options) = 0;
virtual void Stop() = 0;
virtual bool TryGetConsoleSize(vint& width, vint& height) = 0;
virtual vuint64_t GetMonotonicTime() = 0;
virtual bool ReadEvent(vint milliseconds, TuiBackendEvent& event) = 0;
virtual void Render(const TuiPixel* buffer, vint width, vint height, TuiColorMode colorMode) = 0;
};
class ScopedTuiBackend
{
private:
Ptr<ITuiBackend>* previous = nullptr;
Ptr<ITuiBackend> current;
public:
NOT_COPYABLE(ScopedTuiBackend);
ScopedTuiBackend(Ptr<ITuiBackend> backend);
~ScopedTuiBackend() noexcept(false);
};
}
}
}
#endif
/***********************************************************************
.\TUI\TUI.INTERNAL.H
***********************************************************************/
/***********************************************************************
Author: Zihan Chen (vczh)
Licensed under https://github.com/vczh-libraries/License
***********************************************************************/
#ifndef VCZH_TUI_INTERNAL
#define VCZH_TUI_INTERNAL
namespace vl
{
namespace console
{
namespace tui_internal
{
extern bool IsScalar(char32_t code);
extern vint QuantizeColor(TuiColor color, TuiColorMode colorMode, const TuiColor* customColor16 = nullptr);
extern TuiColor GetCanonicalColor(vint index);
extern Ptr<unittest::ITuiBackend> CreateTuiBackend();
}
}
}
#endif