Improv appearance of tooltips

Ensure uniform border size around tooltips with image, lighter color background for better visibility.
This commit is contained in:
Bruno Herbelin
2024-05-20 13:19:34 +02:00
parent 8d66913a8e
commit e7f388999d
3 changed files with 13 additions and 4 deletions

View File

@@ -1763,7 +1763,7 @@ void ImGuiToolkit::SetAccentColor(accent_color color)
colors[ImGuiCol_TextDisabled] = ImVec4(0.55f, 0.55f, 0.55f, 1.00f); colors[ImGuiCol_TextDisabled] = ImVec4(0.55f, 0.55f, 0.55f, 1.00f);
colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.13f, 0.13f, 0.94f); colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.13f, 0.13f, 0.94f);
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
colors[ImGuiCol_PopupBg] = ImVec4(0.13f, 0.13f, 0.13f, 1.00f); colors[ImGuiCol_PopupBg] = ImVec4(0.16f, 0.16f, 0.16f, 1.00f);
colors[ImGuiCol_Border] = ImVec4(0.69f, 0.69f, 0.69f, 0.25f); colors[ImGuiCol_Border] = ImVec4(0.69f, 0.69f, 0.69f, 0.25f);
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
colors[ImGuiCol_FrameBg] = ImVec4(0.39f, 0.39f, 0.39f, 0.55f); colors[ImGuiCol_FrameBg] = ImVec4(0.39f, 0.39f, 0.39f, 0.55f);

View File

@@ -3263,6 +3263,7 @@ void Navigator::Render()
if (!std::get<0>(tooltip).empty()) { if (!std::get<0>(tooltip).empty()) {
// pseudo timeout for showing tooltip // pseudo timeout for showing tooltip
if (_timeout_tooltip > IMGUI_TOOLTIP_TIMEOUT) { if (_timeout_tooltip > IMGUI_TOOLTIP_TIMEOUT) {
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.f, 8.f));
// if a pointer to a Source is provided in tupple // if a pointer to a Source is provided in tupple
Source *_s = std::get<2>(tooltip); Source *_s = std::get<2>(tooltip);
if (_s != nullptr) { if (_s != nullptr) {
@@ -3290,7 +3291,7 @@ void Navigator::Render()
// otherwise just show a standard tooltip [action - shortcut key] // otherwise just show a standard tooltip [action - shortcut key]
else else
ImGuiToolkit::ToolTip(std::get<0>(tooltip).c_str(), std::get<1>(tooltip).c_str()); ImGuiToolkit::ToolTip(std::get<0>(tooltip).c_str(), std::get<1>(tooltip).c_str());
ImGui::PopStyleVar();
} }
else else
++_timeout_tooltip; ++_timeout_tooltip;
@@ -4670,7 +4671,7 @@ void Navigator::RenderMainPannelSession()
width = height * se->frame()->aspectRatio() * ( se->frame()->projectionSize().x / se->frame()->projectionSize().y); width = height * se->frame()->aspectRatio() * ( se->frame()->projectionSize().x / se->frame()->projectionSize().y);
} }
// centered image // centered image
ImGui::SetCursorPos( ImVec2(pos.x + 0.5f * (preview_width-width), pos.y + 0.5f * (preview_height-height-space)) ); ImGui::SetCursorPos( ImVec2(pos.x + 0.5f * (preview_width-width), pos.y) );
ImGui::Image((void*)(uintptr_t) se->frame()->texture(), ImVec2(width, height)); ImGui::Image((void*)(uintptr_t) se->frame()->texture(), ImVec2(width, height));
// right side options for session // right side options for session
@@ -4724,6 +4725,7 @@ void Navigator::RenderMainPannelSession()
if (_thumbnail != nullptr) if (_thumbnail != nullptr)
_session_thumbnail.fill( _thumbnail ); _session_thumbnail.fill( _thumbnail );
} }
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.f, 8.f));
ImGui::BeginTooltip(); ImGui::BeginTooltip();
if (_session_thumbnail.filled()) { if (_session_thumbnail.filled()) {
_session_thumbnail.Render(230); _session_thumbnail.Render(230);
@@ -4733,6 +4735,7 @@ void Navigator::RenderMainPannelSession()
ImGui::Text(" Automatic thumbnail "); ImGui::Text(" Automatic thumbnail ");
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
ImGui::PopStyleVar();
} }
} }
@@ -4887,10 +4890,12 @@ void Navigator::RenderMainPannelSession()
_undo_thumbnail.reset(); _undo_thumbnail.reset();
} }
// draw thumbnail in tooltip // draw thumbnail in tooltip
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.f, 8.f));
ImGui::BeginTooltip(); ImGui::BeginTooltip();
_undo_thumbnail.Render(size.x); _undo_thumbnail.Render(size.x);
ImGui::Text("%s", text.c_str()); ImGui::Text("%s", text.c_str());
ImGui::EndTooltip(); ImGui::EndTooltip();
ImGui::PopStyleVar();
++count_over; // prevents display twice on item overlap ++count_over; // prevents display twice on item overlap
} }
@@ -5005,10 +5010,12 @@ void Navigator::RenderMainPannelSession()
current_over = _over; current_over = _over;
} }
// draw thumbnail in tooltip // draw thumbnail in tooltip
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.f, 8.f));
ImGui::BeginTooltip(); ImGui::BeginTooltip();
_snap_thumbnail.Render(size.x); _snap_thumbnail.Render(size.x);
ImGui::Text("%s", _snap_date.c_str()); ImGui::Text("%s", _snap_date.c_str());
ImGui::EndTooltip(); ImGui::EndTooltip();
ImGui::PopStyleVar();
++count_over; // prevents display twice on item overlap ++count_over; // prevents display twice on item overlap
} }
} }
@@ -5461,6 +5468,7 @@ void Navigator::RenderMainPannelPlaylist()
if ( !_file_info.empty()) { if ( !_file_info.empty()) {
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.f, 8.f));
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImVec2 p_ = ImGui::GetCursorScreenPos(); ImVec2 p_ = ImGui::GetCursorScreenPos();
_file_thumbnail.Render(240); _file_thumbnail.Render(240);
@@ -5470,6 +5478,7 @@ void Navigator::RenderMainPannelPlaylist()
ImGui::Text(ICON_FA_TAG); ImGui::Text(ICON_FA_TAG);
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
ImGui::PopStyleVar();
} }
} }

View File

@@ -239,7 +239,7 @@
#define SHORTCUT_SHADEREDITOR CTRL_MOD "E" #define SHORTCUT_SHADEREDITOR CTRL_MOD "E"
#define TOOLTIP_FULLSCREEN "Fullscreen " #define TOOLTIP_FULLSCREEN "Fullscreen "
#define SHORTCUT_FULLSCREEN CTRL_MOD "F" #define SHORTCUT_FULLSCREEN CTRL_MOD "F"
#define TOOLTIP_MAIN "Main menu " #define TOOLTIP_MAIN "Home panel "
#define SHORTCUT_MAIN "HOME" #define SHORTCUT_MAIN "HOME"
#define TOOLTIP_NEW_SOURCE "Insert " #define TOOLTIP_NEW_SOURCE "Insert "
#define SHORTCUT_NEW_SOURCE "INS" #define SHORTCUT_NEW_SOURCE "INS"