From abc4a289493d6a9967198738393b608e21ded0d6 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sun, 27 Jul 2025 12:11:44 -0400 Subject: [PATCH] Tracker: File panel misc style fixes Change-Id: I6376e52d26ac05e0f591c2484a7c7301cee6166b Reviewed-on: https://review.haiku-os.org/c/haiku/+/9523 Tested-by: Commit checker robot Reviewed-by: John Scipione --- src/kits/tracker/FilePanelPriv.cpp | 57 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/kits/tracker/FilePanelPriv.cpp b/src/kits/tracker/FilePanelPriv.cpp index 42bc2dc2ad..9d5eefbfb3 100644 --- a/src/kits/tracker/FilePanelPriv.cpp +++ b/src/kits/tracker/FilePanelPriv.cpp @@ -1163,44 +1163,43 @@ TFilePanel::SetButtonLabel(file_panel_button selector, const char* text) { switch (selector) { case B_CANCEL_BUTTON: - { - BButton* button - = dynamic_cast(FindView("cancel button")); - if (button == NULL) - break; + { + BButton* button = dynamic_cast(FindView("cancel button")); + if (button == NULL) + break; + float old_width = button->StringWidth(button->Label()); + button->SetLabel(text); + float delta = old_width - button->StringWidth(text); + if (delta) { + button->MoveBy(delta, 0); + button->ResizeBy(-delta, 0); + } + break; + } + + case B_DEFAULT_BUTTON: + { + fButtonText = text; + float delta = 0; + BButton* button = dynamic_cast(FindView("default button")); + if (button != NULL) { float old_width = button->StringWidth(button->Label()); button->SetLabel(text); - float delta = old_width - button->StringWidth(text); + delta = old_width - button->StringWidth(text); if (delta) { button->MoveBy(delta, 0); button->ResizeBy(-delta, 0); } } - break; - case B_DEFAULT_BUTTON: - { - fButtonText = text; - float delta = 0; - BButton* button - = dynamic_cast(FindView("default button")); - if (button != NULL) { - float old_width = button->StringWidth(button->Label()); - button->SetLabel(text); - delta = old_width - button->StringWidth(text); - if (delta) { - button->MoveBy(delta, 0); - button->ResizeBy(-delta, 0); - } - } + // now must move cancel button + button = dynamic_cast(FindView("cancel button")); + if (button != NULL) + button->MoveBy(delta, 0); - // now must move cancel button - button = dynamic_cast(FindView("cancel button")); - if (button != NULL) - button->MoveBy(delta, 0); - } break; + } } } @@ -1211,8 +1210,7 @@ TFilePanel::SetSaveText(const char* text) if (text == NULL) return; - BTextControl* textControl - = dynamic_cast(FindView("text view")); + BTextControl* textControl = dynamic_cast(FindView("text view")); if (textControl != NULL) { textControl->SetText(text); if (textControl->TextView() != NULL) @@ -1410,6 +1408,7 @@ TFilePanel::MessageReceived(BMessage* message) HandleSaveButton(); } else HandleOpenButton(); + break; case B_OBSERVER_NOTICE_CHANGE: