diff --git a/imgui.cpp b/imgui.cpp index c50a894..2bdb859 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -591,7 +591,6 @@ //------------------------------------------------------------------------- static void LogRenderedText(const ImVec2& ref_pos, const char* text, const char* text_end = NULL); -static const char* FindTextDisplayEnd(const char* text, const char* text_end = NULL); static void PushMultiItemsWidths(int components, float w_full = 0.0f); static float GetDraggedColumnOffset(int column_index); @@ -2510,7 +2509,7 @@ } // Find the optional ## from which we stop displaying text. -static const char* FindTextDisplayEnd(const char* text, const char* text_end) +const char* ImGui::FindTextDisplayEnd(const char* text, const char* text_end) { const char* text_display_end = text; if (!text_end) @@ -2549,7 +2548,7 @@ ImGuiWindow* window = ImGui::GetCurrentWindowRead(); if (!text_end) - text_end = FindTextDisplayEnd(text, text_end); + text_end = ImGui::FindTextDisplayEnd(text, text_end); const bool log_new_line = ref_pos.y > window->DC.LogLinePosY+1; window->DC.LogLinePosY = ref_pos.y; @@ -2603,7 +2602,7 @@ const char* text_display_end; if (hide_text_after_hash) { - text_display_end = FindTextDisplayEnd(text, text_end); + text_display_end = ImGui::FindTextDisplayEnd(text, text_end); } else { @@ -2642,7 +2641,7 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, ImGuiAlign align, const ImVec2* clip_min, const ImVec2* clip_max) { // Hide anything after a '##' string - const char* text_display_end = FindTextDisplayEnd(text, text_end); + const char* text_display_end = ImGui::FindTextDisplayEnd(text, text_end); const int text_len = (int)(text_display_end - text); if (text_len == 0) return; @@ -2749,7 +2748,7 @@ const char* text_display_end; if (hide_text_after_double_hash) - text_display_end = FindTextDisplayEnd(text, text_end); // Hide anything after a '##' string + text_display_end = ImGui::FindTextDisplayEnd(text, text_end); // Hide anything after a '##' string else text_display_end = text_end; @@ -6334,7 +6333,7 @@ } ImGui::PopID(); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -6376,7 +6375,7 @@ } ImGui::PopID(); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -6556,7 +6555,7 @@ } ImGui::PopID(); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -6595,7 +6594,7 @@ ImGui::PopItemWidth(); ImGui::SameLine(0, g.Style.ItemInnerSpacing.x); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); ImGui::PopID(); @@ -6634,7 +6633,7 @@ } ImGui::PopID(); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -6673,7 +6672,7 @@ ImGui::PopItemWidth(); ImGui::SameLine(0, g.Style.ItemInnerSpacing.x); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); ImGui::PopID(); @@ -7893,7 +7892,7 @@ ImGui::PopID(); window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -7936,7 +7935,7 @@ ImGui::PopID(); window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -8647,7 +8646,7 @@ g.ColorEditModeStorage.SetInt(id, (edit_mode + 1) % 3); // Don't set local copy of 'edit_mode' right away! } - const char* label_display_end = FindTextDisplayEnd(label); + const char* label_display_end = ImGui::FindTextDisplayEnd(label); if (label != label_display_end) { ImGui::SameLine(0, (window->DC.ColorEditMode == ImGuiColorEditMode_UserSelectShowButton) ? -1.0f : style.ItemInnerSpacing.x); diff --git a/imgui.cpp b/imgui.cpp index c50a894..2bdb859 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -591,7 +591,6 @@ //------------------------------------------------------------------------- static void LogRenderedText(const ImVec2& ref_pos, const char* text, const char* text_end = NULL); -static const char* FindTextDisplayEnd(const char* text, const char* text_end = NULL); static void PushMultiItemsWidths(int components, float w_full = 0.0f); static float GetDraggedColumnOffset(int column_index); @@ -2510,7 +2509,7 @@ } // Find the optional ## from which we stop displaying text. -static const char* FindTextDisplayEnd(const char* text, const char* text_end) +const char* ImGui::FindTextDisplayEnd(const char* text, const char* text_end) { const char* text_display_end = text; if (!text_end) @@ -2549,7 +2548,7 @@ ImGuiWindow* window = ImGui::GetCurrentWindowRead(); if (!text_end) - text_end = FindTextDisplayEnd(text, text_end); + text_end = ImGui::FindTextDisplayEnd(text, text_end); const bool log_new_line = ref_pos.y > window->DC.LogLinePosY+1; window->DC.LogLinePosY = ref_pos.y; @@ -2603,7 +2602,7 @@ const char* text_display_end; if (hide_text_after_hash) { - text_display_end = FindTextDisplayEnd(text, text_end); + text_display_end = ImGui::FindTextDisplayEnd(text, text_end); } else { @@ -2642,7 +2641,7 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, ImGuiAlign align, const ImVec2* clip_min, const ImVec2* clip_max) { // Hide anything after a '##' string - const char* text_display_end = FindTextDisplayEnd(text, text_end); + const char* text_display_end = ImGui::FindTextDisplayEnd(text, text_end); const int text_len = (int)(text_display_end - text); if (text_len == 0) return; @@ -2749,7 +2748,7 @@ const char* text_display_end; if (hide_text_after_double_hash) - text_display_end = FindTextDisplayEnd(text, text_end); // Hide anything after a '##' string + text_display_end = ImGui::FindTextDisplayEnd(text, text_end); // Hide anything after a '##' string else text_display_end = text_end; @@ -6334,7 +6333,7 @@ } ImGui::PopID(); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -6376,7 +6375,7 @@ } ImGui::PopID(); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -6556,7 +6555,7 @@ } ImGui::PopID(); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -6595,7 +6594,7 @@ ImGui::PopItemWidth(); ImGui::SameLine(0, g.Style.ItemInnerSpacing.x); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); ImGui::PopID(); @@ -6634,7 +6633,7 @@ } ImGui::PopID(); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -6673,7 +6672,7 @@ ImGui::PopItemWidth(); ImGui::SameLine(0, g.Style.ItemInnerSpacing.x); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); ImGui::PopID(); @@ -7893,7 +7892,7 @@ ImGui::PopID(); window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -7936,7 +7935,7 @@ ImGui::PopID(); window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y); - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); + ImGui::TextUnformatted(label, ImGui::FindTextDisplayEnd(label)); ImGui::EndGroup(); return value_changed; @@ -8647,7 +8646,7 @@ g.ColorEditModeStorage.SetInt(id, (edit_mode + 1) % 3); // Don't set local copy of 'edit_mode' right away! } - const char* label_display_end = FindTextDisplayEnd(label); + const char* label_display_end = ImGui::FindTextDisplayEnd(label); if (label != label_display_end) { ImGui::SameLine(0, (window->DC.ColorEditMode == ImGuiColorEditMode_UserSelectShowButton) ? -1.0f : style.ItemInnerSpacing.x); diff --git a/imgui_internal.h b/imgui_internal.h index f6300e7..d6fc78a 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -683,6 +683,8 @@ IMGUI_API void SetHoveredID(ImGuiID id); IMGUI_API void KeepAliveID(ImGuiID id); + const char* FindTextDisplayEnd(const char* text, const char* text_end = NULL); + IMGUI_API void EndFrame(); // Automatically called by Render() IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);