From 936b152298feb3321fccbe98d6e437d91c247787 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 19:22:39 +0000 Subject: [PATCH] Maintenance: Move the inline-only UITextViewer::AppendText (// INLINED) from UITextViewerLinks.cpp to UITextViewerMessages.cpp, next Batch #1654 by ragnarok-clanker: no function's compiled code changes; checked with 2 compiled unit(s). --- Source/UI/Text/UITextViewerLinks.cpp | 63 ---------------------- Source/UI/Text/UITextViewerMessages.cpp | 71 +++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 63 deletions(-) diff --git a/Source/UI/Text/UITextViewerLinks.cpp b/Source/UI/Text/UITextViewerLinks.cpp index b379977..9530277 100644 --- a/Source/UI/Text/UITextViewerLinks.cpp +++ b/Source/UI/Text/UITextViewerLinks.cpp @@ -160,66 +160,3 @@ void UITextViewer::AddLinks(const char* text, unsigned addedLines, int kind) { this->SendMsg(nullptr, 7, 0, 0, 0, 0); } } - -// INLINED -void UITextViewer::AppendText(char* text, int width, bool carriageReturns, bool pixels) { - auto& owner = this->m_text->list; - std::vector wrapped; - - if (width == 138) { - WrapPlainText(text, wrapped, 38, owner.codePage, owner.locale.inlineCharset); - - for (const auto& line : wrapped) { - this->AddLine(line.c_str()); - } - - this->unknown_00BC = (this->unknown_00BC & ~255) | 1; - this->Invalidate(); - return; - } - - const bool linked = HasTextLinks(text); - std::string display; - - if (linked) { - const std::string expanded = ExpandTextEscapes(text); - std::strcpy(text, expanded.c_str()); - display = DisplayTextTag(expanded, "", ""); - display = DisplayTextTag(std::move(display), "", ""); - display = DisplayTextTag(std::move(display), "", ""); - display = DisplayTextTag(std::move(display), "", ""); - display = RemoveTextLinkInfo(std::move(display)); - - if (this->m_text->chatConversions) { - display = this->ConvertChat(std::move(display)); - } - - std::string navigation; - DisplayNavigationLink(navigation, display); - display = DisplayTextTag(std::move(navigation), "", ""); - } else { - display = text; - } - - if (pixels) { - const int scrollWidth = carriageReturns ? this->verticalBar->geometry.width + 2 : 0; - WrapPixelText(*this->geometry.surface, owner.fonts, owner.locale, owner.codePage, display.c_str(), wrapped, this->geometry.width - scrollWidth - 4); - } else { - WrapRichText( - display.c_str(), wrapped, width == 0 ? 35 : width, carriageReturns, owner.codePage, owner.locale.inlineCharset, this->m_text->items.descriptions - ); - } - - for (const auto& line : wrapped) { - this->AddLine(line.c_str()); - } - - if (linked) { - for (int kind = 0; kind < 5; ++kind) { - this->AddLinks(text, static_cast(wrapped.size()), kind); - } - } - - this->unknown_00BC &= ~255; - this->Invalidate(); -} diff --git a/Source/UI/Text/UITextViewerMessages.cpp b/Source/UI/Text/UITextViewerMessages.cpp index 4e1f947..bd10a0a 100644 --- a/Source/UI/Text/UITextViewerMessages.cpp +++ b/Source/UI/Text/UITextViewerMessages.cpp @@ -3,7 +3,15 @@ #include "UI/Buttons/UITextButton.h" #include "UI/Text/UITextViewer.h" #include "UI/Window/WindowManagerWindows.h" +#include "Contents/Items/ItemNaming.h" +#include "UI/Text/ItemLinkDisplay.h" +#include "UI/Text/NavigationLink.h" +#include "UI/Text/PixelTextWrapping.h" +#include "UI/Text/TextMarkup.h" +#include "UI/Text/TextWrapping.h" +#include "Render/Text/TextContext.h" +#include #include #include #include @@ -101,6 +109,69 @@ void UITextViewer::Activate(UITextButton* button, int id) { } } +// INLINED +void UITextViewer::AppendText(char* text, int width, bool carriageReturns, bool pixels) { + auto& owner = this->m_text->list; + std::vector wrapped; + + if (width == 138) { + WrapPlainText(text, wrapped, 38, owner.codePage, owner.locale.inlineCharset); + + for (const auto& line : wrapped) { + this->AddLine(line.c_str()); + } + + this->unknown_00BC = (this->unknown_00BC & ~255) | 1; + this->Invalidate(); + return; + } + + const bool linked = HasTextLinks(text); + std::string display; + + if (linked) { + const std::string expanded = ExpandTextEscapes(text); + std::strcpy(text, expanded.c_str()); + display = DisplayTextTag(expanded, "", ""); + display = DisplayTextTag(std::move(display), "", ""); + display = DisplayTextTag(std::move(display), "", ""); + display = DisplayTextTag(std::move(display), "", ""); + display = RemoveTextLinkInfo(std::move(display)); + + if (this->m_text->chatConversions) { + display = this->ConvertChat(std::move(display)); + } + + std::string navigation; + DisplayNavigationLink(navigation, display); + display = DisplayTextTag(std::move(navigation), "", ""); + } else { + display = text; + } + + if (pixels) { + const int scrollWidth = carriageReturns ? this->verticalBar->geometry.width + 2 : 0; + WrapPixelText(*this->geometry.surface, owner.fonts, owner.locale, owner.codePage, display.c_str(), wrapped, this->geometry.width - scrollWidth - 4); + } else { + WrapRichText( + display.c_str(), wrapped, width == 0 ? 35 : width, carriageReturns, owner.codePage, owner.locale.inlineCharset, this->m_text->items.descriptions + ); + } + + for (const auto& line : wrapped) { + this->AddLine(line.c_str()); + } + + if (linked) { + for (int kind = 0; kind < 5; ++kind) { + this->AddLinks(text, static_cast(wrapped.size()), kind); + } + } + + this->unknown_00BC &= ~255; + this->Invalidate(); +} + // OFFSET: 0x00899E90 // FUNCTION: fn_11562 int UITextViewer::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) {