From d0892a202560dd7f0df8e78237931c706ebe6791 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 20 Sep 2024 23:12:27 +0400 Subject: [PATCH 1/8] clickable URLs, quickstart in the welcome screen --- src/gui/tutorial.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp index 640dc795a..933224b93 100644 --- a/src/gui/tutorial.cpp +++ b/src/gui/tutorial.cpp @@ -31,6 +31,14 @@ #include #endif +#define CLICK_TO_COPY(t) ImGui::TextColored(uiColors[GUI_COLOR_ACCENT_PRIMARY],t);\ +if (ImGui::IsItemHovered()) {\ + ImGui::SetTooltip(\ + (strcmp(ImGui::GetClipboardText(),t)==0)?"copied!":"click to copy");\ + ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);\ +}\ +if (ImGui::IsItemClicked()) ImGui::SetClipboardText(t); + enum FurnaceCVObjectTypes { CV_NULL=0, CV_PLAYER, @@ -676,15 +684,23 @@ void FurnaceGUI::drawTutorial() { "- click on the Orders matrix to change the patterns of a channel (left click increases; right click decreases)" )); + ImGui::Separator(); + + ImGui::TextWrapped(_( + "if you are new to trackers, you may check the quick start guide:" + )); + CLICK_TO_COPY("https://github.com/tildearrow/furnace/blob/master/doc/1-intro/quickstart.md"); ImGui::TextWrapped(_( "if you need help, you may:\n" "- read the manual (a file called manual.pdf)\n" - "- ask for help in Discussions (https://github.com/tildearrow/furnace/discussions)" + "- ask for help in Discussions" )); + CLICK_TO_COPY("https://github.com/tildearrow/furnace/discussions") ImGui::Separator(); - ImGui::TextWrapped(_("if you find any issues, be sure to report them! the issue tracker is here: https://github.com/tildearrow/furnace/issues")); + ImGui::TextWrapped(_("if you find any issues, be sure to report them! the issue tracker is here:")); + CLICK_TO_COPY("https://github.com/tildearrow/furnace/issues") if (ImGui::Button(_("OK"))) { tutorial.protoWelcome=true; From c953ed94ca1be595b18c132c314cebbef8124173 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 20 Sep 2024 23:12:49 +0400 Subject: [PATCH 2/8] welcome screen menu opt in help --- src/gui/gui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index ac2e59fe4..84899225e 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -4694,6 +4694,7 @@ bool FurnaceGUI::loop() { if (ImGui::MenuItem(_("debug menu"),BIND_FOR(GUI_ACTION_WINDOW_DEBUG))) debugOpen=!debugOpen; if (ImGui::MenuItem(_("inspector"))) inspectorOpen=!inspectorOpen; if (ImGui::MenuItem(_("panic"),BIND_FOR(GUI_ACTION_PANIC))) e->syncReset(); + if (ImGui::MenuItem(_("welcome screen"))) tutorial.protoWelcome=false; if (ImGui::MenuItem(_("about..."),BIND_FOR(GUI_ACTION_WINDOW_ABOUT))) { aboutOpen=true; aboutScroll=0; From 7b8ab2ba7857a9ed3ac7052ed4b1004689d46de9 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 20 Sep 2024 23:18:59 +0400 Subject: [PATCH 3/8] hmm thenk --- src/gui/tutorial.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp index 933224b93..e4500e07d 100644 --- a/src/gui/tutorial.cpp +++ b/src/gui/tutorial.cpp @@ -33,8 +33,7 @@ #define CLICK_TO_COPY(t) ImGui::TextColored(uiColors[GUI_COLOR_ACCENT_PRIMARY],t);\ if (ImGui::IsItemHovered()) {\ - ImGui::SetTooltip(\ - (strcmp(ImGui::GetClipboardText(),t)==0)?"copied!":"click to copy");\ + ImGui::SetTooltip((strcmp(ImGui::GetClipboardText(),t)==0)?"copied!":"click to copy");\ ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);\ }\ if (ImGui::IsItemClicked()) ImGui::SetClipboardText(t); From 198e371435a67b9179e93d8eaa2ddf7f69801bdf Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sat, 21 Sep 2024 11:32:25 +0400 Subject: [PATCH 4/8] this should be better --- src/gui/gui.h | 4 +++- src/gui/tutorial.cpp | 28 ++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 542cc48ec..48952238b 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2276,13 +2276,15 @@ class FurnaceGUI { struct Tutorial { bool introPlayed; bool protoWelcome; + unsigned short popupTimer; Tutorial(): #ifdef SUPPORT_XP introPlayed(true), #else introPlayed(false), #endif - protoWelcome(false) { + protoWelcome(false), + popupTimer(65535) { } } tutorial; diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp index e4500e07d..69e8adc1a 100644 --- a/src/gui/tutorial.cpp +++ b/src/gui/tutorial.cpp @@ -31,12 +31,16 @@ #include #endif -#define CLICK_TO_COPY(t) ImGui::TextColored(uiColors[GUI_COLOR_ACCENT_PRIMARY],t);\ +#define CLICK_TO_OPEN(t) ImGui::TextColored(uiColors[GUI_COLOR_ACCENT_PRIMARY],t);\ if (ImGui::IsItemHovered()) {\ - ImGui::SetTooltip((strcmp(ImGui::GetClipboardText(),t)==0)?"copied!":"click to copy");\ + ImGui::SetTooltip("click to open, right click to copy");\ ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);\ }\ -if (ImGui::IsItemClicked()) ImGui::SetClipboardText(t); +if (ImGui::IsItemClicked()) SDL_OpenURL(t);\ +if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {\ + ImGui::SetClipboardText(t);\ + tutorial.popupTimer=0;\ +} enum FurnaceCVObjectTypes { CV_NULL=0, @@ -688,18 +692,18 @@ void FurnaceGUI::drawTutorial() { ImGui::TextWrapped(_( "if you are new to trackers, you may check the quick start guide:" )); - CLICK_TO_COPY("https://github.com/tildearrow/furnace/blob/master/doc/1-intro/quickstart.md"); + CLICK_TO_OPEN("https://github.com/tildearrow/furnace/blob/master/doc/1-intro/quickstart.md") ImGui::TextWrapped(_( "if you need help, you may:\n" "- read the manual (a file called manual.pdf)\n" "- ask for help in Discussions" )); - CLICK_TO_COPY("https://github.com/tildearrow/furnace/discussions") + CLICK_TO_OPEN("https://github.com/tildearrow/furnace/discussions") ImGui::Separator(); ImGui::TextWrapped(_("if you find any issues, be sure to report them! the issue tracker is here:")); - CLICK_TO_COPY("https://github.com/tildearrow/furnace/issues") + CLICK_TO_OPEN("https://github.com/tildearrow/furnace/issues") if (ImGui::Button(_("OK"))) { tutorial.protoWelcome=true; @@ -711,6 +715,18 @@ void FurnaceGUI::drawTutorial() { (canvasW-ImGui::GetWindowSize().x)*0.5, (canvasH-ImGui::GetWindowSize().y)*0.5 )); + + if (tutorial.popupTimer<40) { + ImDrawList* dl=ImGui::GetForegroundDrawList(); + const ImVec2 winPos=ImGui::GetWindowPos(); + const ImVec2 winSize=ImGui::GetWindowSize(); + const ImVec2 txtSize=ImGui::CalcTextSize("copied!"); + dl->AddText(ImVec2( + winPos.x+(winSize.x-txtSize.x)/2, + winPos.y+(winSize.y-txtSize.y*2) + ),ImGui::ColorConvertFloat4ToU32(uiColors[GUI_COLOR_ACCENT_SECONDARY]),"copied!"); + tutorial.popupTimer++; + } ImGui::EndPopup(); } From 07b41e03c8b30d60a8f0aeec4c0d8c17acc9a461 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 22 Sep 2024 11:55:54 +0400 Subject: [PATCH 5/8] change copied timer to deltatime --- src/gui/gui.h | 4 ++-- src/gui/tutorial.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 40da2c782..bb7a57e9c 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2277,7 +2277,7 @@ class FurnaceGUI { struct Tutorial { bool introPlayed; bool protoWelcome; - unsigned short popupTimer; + double popupTimer; Tutorial(): #ifdef SUPPORT_XP introPlayed(true), @@ -2285,7 +2285,7 @@ class FurnaceGUI { introPlayed(false), #endif protoWelcome(false), - popupTimer(65535) { + popupTimer(1.0f) { } } tutorial; diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp index 69e8adc1a..2c5c2ef50 100644 --- a/src/gui/tutorial.cpp +++ b/src/gui/tutorial.cpp @@ -716,16 +716,16 @@ void FurnaceGUI::drawTutorial() { (canvasH-ImGui::GetWindowSize().y)*0.5 )); - if (tutorial.popupTimer<40) { + if (tutorial.popupTimer<0.6f) { ImDrawList* dl=ImGui::GetForegroundDrawList(); const ImVec2 winPos=ImGui::GetWindowPos(); - const ImVec2 winSize=ImGui::GetWindowSize(); const ImVec2 txtSize=ImGui::CalcTextSize("copied!"); + const ImVec2 winSize=ImGui::GetWindowSize(); dl->AddText(ImVec2( winPos.x+(winSize.x-txtSize.x)/2, winPos.y+(winSize.y-txtSize.y*2) - ),ImGui::ColorConvertFloat4ToU32(uiColors[GUI_COLOR_ACCENT_SECONDARY]),"copied!"); - tutorial.popupTimer++; + ),ImGui::ColorConvertFloat4ToU32(uiColors[GUI_COLOR_TOGGLE_ON]),"copied!"); + tutorial.popupTimer+=ImGui::GetIO().DeltaTime; } ImGui::EndPopup(); } From 771cee405fccc31f4d4fb1811742ee85d43ec117 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Mon, 23 Sep 2024 19:55:57 +0400 Subject: [PATCH 6/8] separate copy "button" --- src/gui/tutorial.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp index 2c5c2ef50..4c5158b76 100644 --- a/src/gui/tutorial.cpp +++ b/src/gui/tutorial.cpp @@ -33,11 +33,14 @@ #define CLICK_TO_OPEN(t) ImGui::TextColored(uiColors[GUI_COLOR_ACCENT_PRIMARY],t);\ if (ImGui::IsItemHovered()) {\ - ImGui::SetTooltip("click to open, right click to copy");\ + ImGui::SetTooltip("click to open");\ ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);\ }\ if (ImGui::IsItemClicked()) SDL_OpenURL(t);\ -if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {\ +ImGui::SameLine();\ +ImGui::Text(ICON_FA_CLIPBOARD);\ +if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort)) ImGui::SetTooltip("click to copy");\ +if (ImGui::IsItemClicked()) {\ ImGui::SetClipboardText(t);\ tutorial.popupTimer=0;\ } From 0c16646b05500f98ee3097d3312a0412e13ef148 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Mon, 23 Sep 2024 23:33:52 +0400 Subject: [PATCH 7/8] mobile button and... ugh --- src/gui/editControls.cpp | 4 ++++ src/gui/tutorial.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/editControls.cpp b/src/gui/editControls.cpp index 40269259e..eb0dedae5 100644 --- a/src/gui/editControls.cpp +++ b/src/gui/editControls.cpp @@ -620,6 +620,10 @@ void FurnaceGUI::drawMobileControls() { mobileMenuPos=0.0f; aboutOpen=true; } + ImGui::SameLine(); + if (ImGui::Button(_("WelcPopup"))) { + tutorial.protoWelcome=false; + } if (ImGui::Button(_("Switch to Desktop Mode"))) { toggleMobileUI(!mobileUI); } diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp index 4c5158b76..2c752a63b 100644 --- a/src/gui/tutorial.cpp +++ b/src/gui/tutorial.cpp @@ -31,12 +31,13 @@ #include #endif +#ifndef IS_MOBILE #define CLICK_TO_OPEN(t) ImGui::TextColored(uiColors[GUI_COLOR_ACCENT_PRIMARY],t);\ if (ImGui::IsItemHovered()) {\ ImGui::SetTooltip("click to open");\ ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);\ }\ -if (ImGui::IsItemClicked()) SDL_OpenURL(t);\ +if (ImGui::IsItemClicked()) SDL_OpenURL(t); \ ImGui::SameLine();\ ImGui::Text(ICON_FA_CLIPBOARD);\ if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort)) ImGui::SetTooltip("click to copy");\ @@ -44,6 +45,9 @@ if (ImGui::IsItemClicked()) {\ ImGui::SetClipboardText(t);\ tutorial.popupTimer=0;\ } +#else +#define CLICK_TO_OPEN(t) ImGui::TextColored(uiColors[GUI_COLOR_ACCENT_PRIMARY],t); if (ImGui::IsItemClicked()) SDL_OpenURL(t); +#endif enum FurnaceCVObjectTypes { CV_NULL=0, From e06b3ada26b1b4b983fcfc3b04600412ed1f3991 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 25 Sep 2024 23:06:01 +0400 Subject: [PATCH 8/8] sure even though it can get longer when power-saving kicks in --- src/gui/gui.h | 2 +- src/gui/tutorial.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index bb7a57e9c..4bd5acd17 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2285,7 +2285,7 @@ class FurnaceGUI { introPlayed(false), #endif protoWelcome(false), - popupTimer(1.0f) { + popupTimer(10.0f) { } } tutorial; diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp index 2c752a63b..279718d05 100644 --- a/src/gui/tutorial.cpp +++ b/src/gui/tutorial.cpp @@ -723,7 +723,7 @@ void FurnaceGUI::drawTutorial() { (canvasH-ImGui::GetWindowSize().y)*0.5 )); - if (tutorial.popupTimer<0.6f) { + if (tutorial.popupTimer<2.0f) { ImDrawList* dl=ImGui::GetForegroundDrawList(); const ImVec2 winPos=ImGui::GetWindowPos(); const ImVec2 txtSize=ImGui::CalcTextSize("copied!");