mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-16 17:13:52 +00:00
- Extract renderItemTooltip() (510 LOC) from ChatMarkupRenderer into dedicated ItemTooltipRenderer class; chat_markup_renderer.cpp 766→192 LOC - Extract formatChatMessage(), detectChannelPrefix(), inputTextCallback() from render(); render() 711→376 LOC - Consolidate replaceGenderPlaceholders() from 3 copies into chat_utils::replaceGenderPlaceholders(); remove 118 LOC duplicate from quest_log_screen.cpp, update 8 call sites in window_manager.cpp - Delete chat_panel_commands.cpp (359 LOC) — absorb sendChatMessage, executeMacroText, PortBot helpers into chat_panel.cpp; move evaluateMacroConditionals to macro_eval_convenience.cpp - Delete chat_panel_utils.cpp (229 LOC) — absorb small utilities into chat_panel.cpp - Replace 3 forward declarations of evaluateMacroConditionals with #include "ui/chat/macro_evaluator.hpp" Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
53 lines
1.6 KiB
C++
53 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "ui/chat/chat_markup_parser.hpp"
|
|
#include "ui/ui_services.hpp"
|
|
#include <vulkan/vulkan.h>
|
|
#include <functional>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace wowee {
|
|
namespace game { class GameHandler; }
|
|
namespace pipeline { class AssetManager; }
|
|
namespace ui {
|
|
|
|
class InventoryScreen;
|
|
class SpellbookScreen;
|
|
class QuestLogScreen;
|
|
|
|
/**
|
|
* Context needed by the renderer to display links, tooltips, and icons.
|
|
*/
|
|
struct MarkupRenderContext {
|
|
game::GameHandler* gameHandler = nullptr;
|
|
InventoryScreen* inventory = nullptr;
|
|
SpellbookScreen* spellbook = nullptr;
|
|
QuestLogScreen* questLog = nullptr;
|
|
pipeline::AssetManager* assetMgr = nullptr;
|
|
// Spell icon callback — same as ChatPanel::getSpellIcon
|
|
std::function<VkDescriptorSet(uint32_t, pipeline::AssetManager*)> getSpellIcon;
|
|
// Chat input buffer for shift-click link insertion
|
|
char* chatInputBuffer = nullptr;
|
|
size_t chatInputBufSize = 0;
|
|
bool* moveCursorToEnd = nullptr;
|
|
};
|
|
|
|
/**
|
|
* Renders parsed ChatSegments via ImGui.
|
|
*
|
|
* Extracted from ChatPanel::render() inline lambdas (Phase 2.2 of chat_panel_ref.md).
|
|
* Handles: colored text, item/spell/quest/achievement link tooltips+icons,
|
|
* URL click-to-open, shift-click link insertion.
|
|
*/
|
|
class ChatMarkupRenderer {
|
|
public:
|
|
/** Render a list of segments with ImGui. baseColor is the message-type color. */
|
|
void render(const std::vector<ChatSegment>& segments,
|
|
const ImVec4& baseColor,
|
|
const MarkupRenderContext& ctx) const;
|
|
};
|
|
|
|
} // namespace ui
|
|
} // namespace wowee
|