From 8383d149f7b055ed542d739997ce587976d99025 Mon Sep 17 00:00:00 2001 From: scawful Date: Sun, 5 Oct 2025 17:54:04 -0400 Subject: [PATCH] refactor: Simplify Toolbar Measurement and Cleanup - Removed toolbar measurement functionality from Toolset, including overflow checks and logging, to streamline the code. - Eliminated unnecessary widget measurement calls in mode buttons and combo boxes, enhancing performance and clarity. - Updated CMake configuration to exclude the widget measurement source file, reflecting the current project structure. --- src/app/gui/editor_layout.cc | 28 ---------------------------- src/app/gui/gui_library.cmake | 1 - 2 files changed, 29 deletions(-) diff --git a/src/app/gui/editor_layout.cc b/src/app/gui/editor_layout.cc index 241c3ad8..8b12222c 100644 --- a/src/app/gui/editor_layout.cc +++ b/src/app/gui/editor_layout.cc @@ -29,32 +29,12 @@ void Toolset::Begin() { button_count_ = 0; current_line_width_ = 0.0f; - // Begin measurement for debugging and test automation - WidgetMeasurement::Instance().BeginToolbarMeasurement("OverworldToolbar"); } void Toolset::End() { // End the current line ImGui::NewLine(); - // End measurement and check for overflow - WidgetMeasurement::Instance().EndToolbarMeasurement(); - - float toolbar_width = WidgetMeasurement::Instance().GetToolbarWidth("OverworldToolbar"); - float available_width = ImGui::GetContentRegionAvail().x; - - // Log warning if toolbar overflows (for debugging) - if (toolbar_width > available_width && toolbar_width > 0) { - // Only log once per second to avoid spam - static float last_warning_time = 0.0f; - float current_time = ImGui::GetTime(); - if (current_time - last_warning_time > 1.0f) { - ImGui::SetTooltip("⚠️ Toolbar overflow: %.0fpx / %.0fpx available", - toolbar_width, available_width); - last_warning_time = current_time; - } - } - ImGui::PopStyleVar(3); ImGui::Separator(); in_toolbar_ = false; @@ -97,10 +77,6 @@ bool Toolset::ModeButton(const char* icon, bool selected, const char* tooltip) { ImGui::PopStyleColor(); } - // Measure this widget (without ID scope to avoid PopID issues) - std::string widget_id = tooltip ? tooltip : absl::StrFormat("Button_%d", button_count_); - WidgetMeasurement::Instance().MeasureLastItem(widget_id, "mode_button"); - if (tooltip && ImGui::IsItemHovered()) { ImGui::SetTooltip("%s", tooltip); } @@ -177,14 +153,10 @@ bool Toolset::AddProperty(const char* icon, const char* label, bool Toolset::AddCombo(const char* icon, int* current, const char* const items[], int count) { ImGui::Text("%s", icon); - WidgetMeasurement::Instance().MeasureLastItem("combo_icon", "text"); - ImGui::SameLine(0, 2); // Reduce spacing between icon and combo ImGui::SetNextItemWidth(100); // Slightly narrower for better fit bool changed = ImGui::Combo("##combo", current, items, count); - WidgetMeasurement::Instance().MeasureLastItem("combo_selector", "combo"); - ImGui::SameLine(); return changed; diff --git a/src/app/gui/gui_library.cmake b/src/app/gui/gui_library.cmake index 7b10c472..06781aa3 100644 --- a/src/app/gui/gui_library.cmake +++ b/src/app/gui/gui_library.cmake @@ -17,7 +17,6 @@ set( app/gui/widgets/widget_state_capture.cc app/gui/ui_helpers.cc app/gui/editor_layout.cc - app/gui/widgets/widget_measurement.cc # Canvas system components app/gui/canvas/canvas_modals.cc app/gui/canvas/canvas_context_menu.cc