From d23267d33362f924186d10cb7a6d9519baec5260 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Sun, 31 Jan 2021 20:09:11 +0100 Subject: [PATCH] Cleanup tooltips. --- ImGuiToolkit.cpp | 10 +++------- ImGuiVisitor.cpp | 8 ++++---- UserInterfaceManager.cpp | 12 ++++++------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/ImGuiToolkit.cpp b/ImGuiToolkit.cpp index 3e293ff..10a2fcc 100644 --- a/ImGuiToolkit.cpp +++ b/ImGuiToolkit.cpp @@ -226,12 +226,8 @@ bool ImGuiToolkit::IconToggle(int i, int j, int i_toggle, int j_toggle, bool* to } int tooltipid = *toggle ? 1 : 0; - if (tooltips != nullptr && tooltips[tooltipid] != nullptr && ImGui::IsItemHovered()) - { - ImGui::BeginTooltip(); - ImGui::Text("%s", tooltips[tooltipid]); - ImGui::EndTooltip(); - } + if (tooltips != nullptr && IM_ARRAYSIZE(*tooltips) > 1 && ImGui::IsItemHovered()) + ImGuiToolkit::ToolTip(tooltips[tooltipid]); ImGui::PopID(); return ret; @@ -342,7 +338,7 @@ void ImGuiToolkit::ToolTip(const char* desc, const char* shortcut) { ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); ImGui::BeginTooltip(); - ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); + ImGui::PushTextWrapPos(ImGui::GetFontSize() * 13.0f); ImGui::TextUnformatted(desc); ImGui::PopTextWrapPos(); diff --git a/ImGuiVisitor.cpp b/ImGuiVisitor.cpp index 19f6306..6b0dd66 100644 --- a/ImGuiVisitor.cpp +++ b/ImGuiVisitor.cpp @@ -421,15 +421,15 @@ void ImGuiVisitor::visit (Source& s) // Inform on workspace ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y + ImGui::GetFrameHeightWithSpacing()) ); if (s.workspace() == Source::BACKGROUND) - ImGuiToolkit::HelpIcon("Background",10, 16); + ImGuiToolkit::HelpIcon(" in Background",10, 16); else if (s.workspace() == Source::FOREGROUND) - ImGuiToolkit::HelpIcon("Foreground",12, 16); + ImGuiToolkit::HelpIcon(" in Foreground",12, 16); else - ImGuiToolkit::HelpIcon("Stage",11, 16); + ImGuiToolkit::HelpIcon(" on Stage",11, 16); // locking ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y + 2.f * ImGui::GetFrameHeightWithSpacing()) ); - const char *tooltip[2] = {"Unlocked", "Locked"}; + const char *tooltip[2] = {"Unlocked\n(clic to toggle)", "Locked\n(clic to toggle)"}; bool l = s.locked(); if (ImGuiToolkit::IconToggle(15,6,17,6, &l, tooltip ) ) s.setLocked(l); diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 5fdeccf..4849f57 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -2254,8 +2254,8 @@ void Navigator::RenderSourcePannel(Source *s) ImGui::Text("Source"); ImGui::PopFont(); - ImGui::SetCursorPos(ImVec2(pannel_width_ - 35.f, 15.f)); - const char *tooltip[2] = {"Pin pannel\nCurrent: double-clic on source", "Un-pin Pannel\nCurrent: single-clic on source"}; + ImGui::SetCursorPos(ImVec2(pannel_width_ - 40.f, 15.f)); + const char *tooltip[2] = {"Panel unpined:\nDouble-clic on a source to open the source panel.", "Panel pined:\nSingle-clic on a source to open the source panel."}; ImGuiToolkit::IconToggle(5,2,4,2, &Settings::application.pannel_stick, tooltip ); static char buf5[128]; @@ -2533,7 +2533,7 @@ void Navigator::RenderNewPannel() // Indication ImGui::SameLine(); - ImGuiToolkit::HelpMarker("Create a source getting images from connected devices or machines;\n- webcams or frame grabbers\n- screen capture\n- vimix stream from connected machines"); + ImGuiToolkit::HelpMarker("Create a source getting images from connected devices or machines;\n- webcams or frame grabbers\n- screen capture\n- vimix shared stream"); } @@ -2602,7 +2602,7 @@ void Navigator::RenderTransitionPannel() if ( ImGui::Button( ICON_FA_DOOR_OPEN " Exit", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) Mixer::manager().setView(View::MIXING); ImGui::SameLine(); - ImGuiToolkit::HelpMarker("Exit transition leaves the output 'as is',\nwith the newly openned session as a source\nif the transition is not finished."); + ImGuiToolkit::HelpMarker("Exit transition leaves the output 'as is', with the newly openned session as a source if the transition is not finished."); } ImGui::End(); @@ -2624,7 +2624,7 @@ void Navigator::RenderMainPannel() // Icon to switch fullscreen ImGui::SetCursorPos(ImVec2(pannel_width_ - 40.f, 13.f)); - const char *tooltip[2] = {"Enter Fullscreen (" CTRL_MOD "Shift+F)", "Exit Fullscreen (" CTRL_MOD "Shift+F)"}; + const char *tooltip[2] = {"Enter Fullscreen " CTRL_MOD "Shift+F", "Exit Fullscreen " CTRL_MOD "Shift+F)"}; bool fs = Rendering::manager().mainWindow().isFullscreen(); if ( ImGuiToolkit::IconToggle(4,15,3,15, &fs, tooltip ) ) { Rendering::manager().mainWindow().toggleFullscreen(); @@ -2794,7 +2794,7 @@ void Navigator::RenderMainPannel() pos = ImGui::GetCursorPos(); ImGui::SameLine(); - ImGuiToolkit::HelpMarker("Quick access to Session files;\nSelect the history of recently\nopened files or a folder, and\ndouble-clic a filename to open."); + ImGuiToolkit::HelpMarker("Quick access to Session files;\nSelect the history of recently opened files or a folder, and double-clic a filename to open."); ImGui::SetCursorPos(pos); // done the selection !