From 17da58c0ca99bf586b03838936562cf5bfda1464 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 13 Oct 2024 18:31:46 +0400 Subject: [PATCH] chtooltip updates... again fix tile overflow add psg to hierarchy update hierarchy (ext.ops after fm) --- src/gui/guiConst.cpp | 18 +++++++++++++++++- src/gui/newSong.cpp | 1 + src/gui/sysManager.cpp | 3 ++- src/gui/sysMiscInfo.cpp | 11 ++++++++--- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index bf74d741f..85db71ae0 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -258,7 +258,23 @@ const char* chanNames[CHANNEL_TYPE_MAX+1]={ _N("Channels") // in case this makes l10n easier }; -unsigned char chanNamesHierarchy[CHANNEL_TYPE_MAX+1]={0,5,1,3,6,7,2,10,11,9,4,8,12,13}; +unsigned char chanNamesHierarchy[CHANNEL_TYPE_MAX+1]={ + CHANNEL_TYPE_FM, + CHANNEL_TYPE_OPERATOR, + CHANNEL_TYPE_SQUARE, + CHANNEL_TYPE_PULSE, + CHANNEL_TYPE_PSG, + CHANNEL_TYPE_WAVETABLE, + CHANNEL_TYPE_TRIANGLE, + CHANNEL_TYPE_SAW, + CHANNEL_TYPE_NOISE, + CHANNEL_TYPE_SLOPE, + CHANNEL_TYPE_WAVE, + CHANNEL_TYPE_DRUMS, + CHANNEL_TYPE_SAMPLE, + CHANNEL_TYPE_OTHER, + CHANNEL_TYPE_MAX +}; const FurnaceGUIColors fxColors[256]={ GUI_COLOR_PATTERN_EFFECT_MISC, // 00 diff --git a/src/gui/newSong.cpp b/src/gui/newSong.cpp index 344b0de61..84e45e987 100644 --- a/src/gui/newSong.cpp +++ b/src/gui/newSong.cpp @@ -65,6 +65,7 @@ void FurnaceGUI::drawSysDefs(std::vector& category, bool& acce if (isHovered && !alreadyHover) { alreadyHover=true; if (ImGui::BeginTooltip()) { + ImGui::Dummy(ImVec2(400.0f*dpiScale,0.0f)); std::map chipCounts; std::vector chips; for (FurnaceGUISysDefChip chip: i.orig) { diff --git a/src/gui/sysManager.cpp b/src/gui/sysManager.cpp index c2b7dc836..f4fe58c95 100644 --- a/src/gui/sysManager.cpp +++ b/src/gui/sysManager.cpp @@ -92,7 +92,8 @@ void FurnaceGUI::drawSysManager() { if (e->song.system[i]!=DIV_SYSTEM_NULL) { const DivSysDef* sysDef=e->getSystemDef(e->song.system[i]); if (ImGui::BeginTooltip()) { - ImGui::PushTextWrapPos(420.0f*dpiScale); // arbitrary constant + ImGui::Dummy(ImVec2(MIN(scrW*dpiScale,400.0f*dpiScale),0.0f)); + ImGui::PushTextWrapPos(MIN(scrW*dpiScale,400.0f*dpiScale)); // arbitrary constant ImGui::TextWrapped("%s",sysDef->description); ImGui::Separator(); drawSystemChannelInfoText(sysDef); diff --git a/src/gui/sysMiscInfo.cpp b/src/gui/sysMiscInfo.cpp index b55e13b70..af1cacdac 100644 --- a/src/gui/sysMiscInfo.cpp +++ b/src/gui/sysMiscInfo.cpp @@ -298,12 +298,17 @@ void FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef) { ImDrawList* dl=ImGui::GetWindowDrawList(); const ImVec2 p=ImGui::GetCursorScreenPos(); float scaler=5.0f*dpiScale; - float x=p.x+dpiScale; + float x=p.x, y=p.y; + float tooltipWidth=MIN(scrW*dpiScale,400.0f*dpiScale); for (int i=0; ichannels; i++) { - dl->AddRectFilled(ImVec2(x,p.y),ImVec2(x+1.5f*scaler,p.y+1.0f*scaler),ImGui::GetColorU32(uiColors[whichDef->chanTypes[i]+GUI_COLOR_CHANNEL_FM]),scaler); + dl->AddRectFilled(ImVec2(x,y),ImVec2(x+1.5f*scaler,y+1.0f*scaler),ImGui::GetColorU32(uiColors[whichDef->chanTypes[i]+GUI_COLOR_CHANNEL_FM]),scaler); x+=2.0f*scaler; + if ((x+1.5f*scaler)>tooltipWidth+p.x) { + x=p.x; + y+=1.5f*scaler; + } } - ImGui::Dummy(ImVec2(0,4*scaler)); + ImGui::Dummy(ImVec2(0,(y-p.y)+1.5f*scaler)); } void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {