From 1f9c1dedecea7a837310ade1504f3132a78a3c19 Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Sun, 24 Jul 2022 22:11:08 +0200 Subject: [PATCH 1/4] ADD: Rando Item Tracker Personnal Note space --- .../randomizer/randomizer_item_tracker.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 3e7756e344..e4b93e85dc 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -827,6 +827,7 @@ void DrawItemTracker(bool& open) { if (ImGui::BeginTabBar("Item Tracker", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { int spacingX = CVar_GetS32("gRandoTrackIconSpacingX", 0); int spacingY = CVar_GetS32("gRandoTrackIconSpacingY", 0); + char trackerNotes[] = "This is a test"; if (ImGui::BeginTabItem("Item Tracker")) { @@ -973,6 +974,38 @@ void DrawItemTracker(bool& open) { ImGui::SameLine(spacingX * 5); DrawSong(QUEST_SONG_PRELUDE); ImGui::EndGroup(); + + // Item Tracker Custom Notes area + if (CVar_GetS32("gItemTrackerNotes", 0)) { + ImGui::BeginGroup(); + struct ItemTrackerNotes { + static int TrackerNotesResizeCallback(ImGuiInputTextCallbackData* data) { + if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) { + ImVector* itemTrackerNotes = (ImVector*)data->UserData; + IM_ASSERT(itemTrackerNotes->begin() == data->Buf); + itemTrackerNotes->resize( + data->BufSize); // NB: On resizing calls, generally data->BufSize == data->BufTextLen + 1 + data->Buf = itemTrackerNotes->begin(); + } + return 0; + } + static bool TrackerNotesInputTextMultiline(const char* label, ImVector* itemTrackerNotes, const ImVec2& size = ImVec2(0, 0), + ImGuiInputTextFlags flags = 0) { + IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); + return ImGui::InputTextMultiline(label, itemTrackerNotes->begin(), (size_t)itemTrackerNotes->size(), + size, flags | ImGuiInputTextFlags_CallbackResize, + ItemTrackerNotes::TrackerNotesResizeCallback, + (void*)itemTrackerNotes); + } + }; + static ImVector itemTrackerNotes; + if (itemTrackerNotes.empty()) { + itemTrackerNotes.push_back(0); + } + ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 16), ImGuiInputTextFlags_AllowTabInput); + ImGui::EndGroup(); + } + ImGui::EndTabItem(); } @@ -986,6 +1019,8 @@ void DrawItemTracker(bool& open) { SohImGui::EnhancementCheckbox("Display \"Ammo/MaxAmo\"", "gItemTrackerAmmoDisplay"); SohImGui::EnhancementCheckbox("Randomizer colors for Songs", "gItemTrackeSongColor"); SohImGui::Tooltip("Will dispaly non-warp songs with randomizer\ncolors instead of pure white"); + SohImGui::EnhancementCheckbox("Personnal notes space", "gItemTrackerNotes"); + SohImGui::Tooltip("Adds a personal space under the item list to\n write eyour own notes."); SohImGui::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gRandoTrackIconSize", 32, 128, ""); SohImGui::EnhancementSliderInt("X spacing : %dpx", "##ITEMTRACKERSPACINGX", "gRandoTrackIconSpacingX", minimalSpacingX, 256, From b81bcf435cb78f9957dfdd71b86426bafa297ef8 Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Sun, 24 Jul 2022 22:12:55 +0200 Subject: [PATCH 2/4] TWEAK: Removed placeholder old test --- soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index e4b93e85dc..cba52508d7 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -827,7 +827,6 @@ void DrawItemTracker(bool& open) { if (ImGui::BeginTabBar("Item Tracker", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { int spacingX = CVar_GetS32("gRandoTrackIconSpacingX", 0); int spacingY = CVar_GetS32("gRandoTrackIconSpacingY", 0); - char trackerNotes[] = "This is a test"; if (ImGui::BeginTabItem("Item Tracker")) { From 1e8f02a3eebf2e65f80ae098b8044efdcdc79016 Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Wed, 27 Jul 2022 23:01:57 +0200 Subject: [PATCH 3/4] Update randomizer_item_tracker.cpp --- soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index cba52508d7..5a699185ea 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -1019,7 +1019,7 @@ void DrawItemTracker(bool& open) { SohImGui::EnhancementCheckbox("Randomizer colors for Songs", "gItemTrackeSongColor"); SohImGui::Tooltip("Will dispaly non-warp songs with randomizer\ncolors instead of pure white"); SohImGui::EnhancementCheckbox("Personnal notes space", "gItemTrackerNotes"); - SohImGui::Tooltip("Adds a personal space under the item list to\n write eyour own notes."); + SohImGui::Tooltip("Adds a textbox under the item tracker to keep your own notes in"); SohImGui::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gRandoTrackIconSize", 32, 128, ""); SohImGui::EnhancementSliderInt("X spacing : %dpx", "##ITEMTRACKERSPACINGX", "gRandoTrackIconSpacingX", minimalSpacingX, 256, @@ -1050,4 +1050,4 @@ void DrawItemTracker(bool& open) { void InitItemTracker() { SohImGui::AddWindow("Randomizer", "Item Tracker", DrawItemTracker); -} \ No newline at end of file +} From ec468ed6e160154c7ba8ea769d776a24b621725f Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Wed, 27 Jul 2022 23:03:30 +0200 Subject: [PATCH 4/4] TWEAK: Typo --- soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 5a699185ea..689d5e79ec 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -1018,7 +1018,7 @@ void DrawItemTracker(bool& open) { SohImGui::EnhancementCheckbox("Display \"Ammo/MaxAmo\"", "gItemTrackerAmmoDisplay"); SohImGui::EnhancementCheckbox("Randomizer colors for Songs", "gItemTrackeSongColor"); SohImGui::Tooltip("Will dispaly non-warp songs with randomizer\ncolors instead of pure white"); - SohImGui::EnhancementCheckbox("Personnal notes space", "gItemTrackerNotes"); + SohImGui::EnhancementCheckbox("Personal notes space", "gItemTrackerNotes"); SohImGui::Tooltip("Adds a textbox under the item tracker to keep your own notes in"); SohImGui::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gRandoTrackIconSize", 32, 128, "");