From 76554cb8a2bf8cc677e5711bef4c1a1fe5b28768 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 9 Nov 2024 19:44:28 -0500 Subject: [PATCH] GUI: prepare to fix text overflow --- src/gui/gui.cpp | 18 ++++++++++++++++++ src/gui/gui.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 966f13df6..5fad264b3 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -548,6 +548,24 @@ void FurnaceGUI::sameLineMaybe(float width) { if (ImGui::GetContentRegionAvail().xDC.CursorPos; + ImVec2 maxArea=ImVec2( + minArea.x+size.x, + minArea.y+size.y + ); + ImRect rect=ImRect(minArea,maxArea); + ImGuiStyle& style=ImGui::GetStyle(); + ImGui::ItemSize(size,style.FramePadding.y); + if (ImGui::ItemAdd(rect,id)) { + // TODO + dl->AddText(minArea,ImGui::GetColorU32(ImGuiCol_Text),text); + } +} + const char* FurnaceGUI::getSystemName(DivSystem which) { /* if (settings.chipNames) { diff --git a/src/gui/gui.h b/src/gui/gui.h index 00c7d8d09..fa5df0b5d 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2792,6 +2792,9 @@ class FurnaceGUI { // inverted checkbox bool InvCheckbox(const char* label, bool* value); + // scrolling text + void ScrollText(ImGuiID id, const char* text, const ImVec2& size=ImVec2(0,0), bool alwaysScroll=false); + // mixer stuff ImVec2 calcPortSetSize(String label, int ins, int outs); bool portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map& portPos);