IMGUI API change for Text display

This commit is contained in:
Bruno Herbelin
2022-03-19 16:46:59 +01:00
parent f49d94948d
commit 5853495125
3 changed files with 12 additions and 12 deletions

View File

@@ -270,7 +270,7 @@ bool ImGuiToolkit::IconButton(const char* icon, const char *tooltip)
// draw with hovered color // draw with hovered color
const ImVec4* colors = ImGui::GetStyle().Colors; const ImVec4* colors = ImGui::GetStyle().Colors;
ImGui::PushStyleColor( ImGuiCol_Text, ImGui::IsItemHovered() ? colors[ImGuiCol_NavWindowingHighlight] : colors[ImGuiCol_Text] ); ImGui::PushStyleColor( ImGuiCol_Text, ImGui::IsItemHovered() ? colors[ImGuiCol_NavWindowingHighlight] : colors[ImGuiCol_Text] );
ImGui::Text(icon); ImGui::Text("%s", icon);
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::PopID(); ImGui::PopID();
@@ -558,7 +558,7 @@ void showToolTip(const char* desc, const char* shortcut)
if (shortcut) { if (shortcut) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.6, 0.6, 0.6, 0.9f)); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.6, 0.6, 0.6, 0.9f));
ImGui::Text(shortcut); ImGui::Text("%s", shortcut);
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
@@ -583,7 +583,7 @@ void ImGuiToolkit::HelpToolTip(const char* desc, const char* shortcut)
// Helper to display a little (?) mark which shows a tooltip when hovered. // Helper to display a little (?) mark which shows a tooltip when hovered.
void ImGuiToolkit::Indication(const char* desc, const char* icon, const char* shortcut) void ImGuiToolkit::Indication(const char* desc, const char* icon, const char* shortcut)
{ {
ImGui::TextDisabled( icon ); ImGui::TextDisabled("%s", icon );
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
showToolTip(desc, shortcut); showToolTip(desc, shortcut);
} }
@@ -1505,7 +1505,7 @@ void ImGuiToolkit::WindowText(const char* window_name, ImVec2 window_pos, const
| ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav)) | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
{ {
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
ImGui::Text(text); ImGui::Text("%s", text);
ImGui::PopFont(); ImGui::PopFont();
ImGui::End(); ImGui::End();
@@ -1874,7 +1874,7 @@ bool ImGuiToolkit::InputCodeMultiline(const char* label, std::string *str, const
// show label // show label
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text(label); ImGui::Text("%s", label);
return ret; return ret;
} }
@@ -1893,5 +1893,5 @@ void ImGuiToolkit::CodeMultiline(const char* label, const std::string &str, floa
ImGui::PopFont(); ImGui::PopFont();
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text(label); ImGui::Text("%s", label);
} }

View File

@@ -166,7 +166,7 @@ void ImGuiVisitor::visit(Scene &n)
void ImGuiVisitor::visit(Primitive &n) void ImGuiVisitor::visit(Primitive &n)
{ {
ImGui::PushID(std::to_string(n.id()).c_str()); ImGui::PushID(std::to_string(n.id()).c_str());
ImGui::Text("Primitive %d"); ImGui::Text("Primitive");
n.shader()->accept(*this); n.shader()->accept(*this);

View File

@@ -1066,7 +1066,7 @@ int UserInterface::RenderViewNavigator(int *shift)
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (ImGui::GetColumnWidth() - ImGui::CalcTextSize(Settings::application.views[v].name.c_str()).x) * 0.5f - ImGui::GetStyle().ItemSpacing.x); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (ImGui::GetColumnWidth() - ImGui::CalcTextSize(Settings::application.views[v].name.c_str()).x) * 0.5f - ImGui::GetStyle().ItemSpacing.x);
ImGuiToolkit::PushFont(Settings::application.current_view == 4 ? ImGuiToolkit::FONT_BOLD : ImGuiToolkit::FONT_DEFAULT); ImGuiToolkit::PushFont(Settings::application.current_view == 4 ? ImGuiToolkit::FONT_BOLD : ImGuiToolkit::FONT_DEFAULT);
ImGui::Text(Settings::application.views[v].name.c_str()); ImGui::Text("%s", Settings::application.views[v].name.c_str());
ImGui::PopFont(); ImGui::PopFont();
} }
@@ -4017,7 +4017,7 @@ void OutputPreview::Render()
ImGui::SetCursorScreenPos(draw_pos); ImGui::SetCursorScreenPos(draw_pos);
ImGui::Text(" " ICON_FA_TV " %d x %d px, %.d fps", output->width(), output->height(), int(Mixer::manager().fps()) ); ImGui::Text(" " ICON_FA_TV " %d x %d px, %.d fps", output->width(), output->height(), int(Mixer::manager().fps()) );
if (Settings::application.accept_connections) if (Settings::application.accept_connections)
ImGui::Text( " " ICON_FA_SHARE_ALT_SQUARE " %s (%d peer)", ImGui::Text( " " ICON_FA_SHARE_ALT_SQUARE " %s (%ld peer)",
Connection::manager().info().name.c_str(), Connection::manager().info().name.c_str(),
Streaming::manager().listStreams().size() ); Streaming::manager().listStreams().size() );
if (video_broadcaster_) if (video_broadcaster_)
@@ -4522,7 +4522,7 @@ void InputMappingInterface::SliderParametersCallback(SourceCallback *callback, S
Group tmp; edited->getTarget(&tmp); Group tmp; edited->getTarget(&tmp);
tmp.accept(info); tmp.accept(info);
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::Text(info.str().c_str()); ImGui::Text("%s", info.str().c_str());
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
@@ -5880,7 +5880,7 @@ void Navigator::RenderNewPannel()
++tooltip; ++tooltip;
if (tooltip>30) { if (tooltip>30) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::Text(filenametooltip.c_str()); ImGui::Text("%s", filenametooltip.c_str());
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
} }
@@ -6748,7 +6748,7 @@ void Navigator::RenderMainPannelVimix()
// draw thumbnail in tooltip // draw thumbnail in tooltip
ImGui::BeginTooltip(); ImGui::BeginTooltip();
_snap_thumbnail.Render(size.x); _snap_thumbnail.Render(size.x);
ImGui::Text(_snap_date.c_str()); ImGui::Text("%s", _snap_date.c_str());
ImGui::EndTooltip(); ImGui::EndTooltip();
++count_over; // prevents display twice on item overlap ++count_over; // prevents display twice on item overlap
} }