From fce0d168ae3e2e4380dc9aebbd5f68cd1f465f11 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 11 Dec 2009 13:48:35 -0800 Subject: EXT-3233 Button label vertical placement cannot be adjusted via xml Added bottom_pad attribute to widgets/button.xml and removed old LLBUTTON_VPAD global and ButtonVPad saved setting. Reviewed with Richard. --- indra/llui/llbutton.cpp | 7 +++++-- indra/llui/llbutton.h | 3 ++- indra/llui/lltabcontainer.cpp | 2 +- indra/newview/app_settings/settings.xml | 11 ----------- indra/newview/llappviewer.cpp | 1 - indra/newview/skins/default/xui/en/widgets/button.xml | 1 + 6 files changed, 9 insertions(+), 16 deletions(-) (limited to 'indra') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 7721137e29..e9f6288f44 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -63,7 +63,6 @@ template class LLButton* LLView::getChild( // globals loaded from settings.xml S32 LLBUTTON_H_PAD = 0; -S32 LLBUTTON_V_PAD = 0; S32 BTN_HEIGHT_SMALL= 0; S32 BTN_HEIGHT = 0; @@ -93,6 +92,7 @@ LLButton::Params::Params() flash_color("flash_color"), pad_right("pad_right", LLUI::sSettingGroups["config"]->getS32("ButtonHPad")), pad_left("pad_left", LLUI::sSettingGroups["config"]->getS32("ButtonHPad")), + pad_bottom("pad_bottom"), click_callback("click_callback"), mouse_down_callback("mouse_down_callback"), mouse_up_callback("mouse_up_callback"), @@ -148,6 +148,7 @@ LLButton::LLButton(const LLButton::Params& p) mHAlign(p.font_halign), mLeftHPad(p.pad_left), mRightHPad(p.pad_right), + mBottomVPad(p.pad_bottom), mHoverGlowStrength(p.hover_glow_amount), mCommitOnReturn(p.commit_on_return), mFadeWhenDisabled(FALSE), @@ -839,7 +840,9 @@ void LLButton::draw() // LLFontGL::render expects S32 max_chars variable but process in a separate way -1 value. // Due to U32_MAX is equal to S32 -1 value I have rest this value for non-ellipses mode. // Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars. - mLastDrawCharsCount = mGLFont->render(label, 0, (F32)x, (F32)(LLBUTTON_V_PAD + y_offset), + mLastDrawCharsCount = mGLFont->render(label, 0, + (F32)x, + (F32)(mBottomVPad + y_offset), label_color % alpha, mHAlign, LLFontGL::BOTTOM, LLFontGL::NORMAL, diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 4c7400220d..5e28b8cdff 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -49,7 +49,6 @@ // PLEASE please use these "constants" when building your own buttons. // They are loaded from settings.xml at run time. extern S32 LLBUTTON_H_PAD; -extern S32 LLBUTTON_V_PAD; extern S32 BTN_HEIGHT_SMALL; extern S32 BTN_HEIGHT; @@ -105,6 +104,7 @@ public: // layout Optional pad_right; Optional pad_left; + Optional pad_bottom; // under text label // callbacks Optional click_callback, // alias -> commit_callback @@ -310,6 +310,7 @@ private: LLFontGL::HAlign mHAlign; S32 mLeftHPad; S32 mRightHPad; + S32 mBottomVPad; // under text label F32 mHoverGlowStrength; F32 mCurGlowStrength; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index d7d61cf6cb..2d9106923e 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -906,7 +906,7 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) if (placeholder) { - btn_rect.translate(0, -LLBUTTON_V_PAD-2); + btn_rect.translate(0, -3); // *TODO: make configurable LLTextBox::Params params; params.name(trimmed_label); params.rect(btn_rect); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 289e900eaf..a31842bf10 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1068,17 +1068,6 @@ Value 23 - ButtonVPad - - Comment - Default vertical spacing between buttons (pixels) - Persist - 1 - Type - S32 - Value - 1 - CacheLocation Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9a1b749ba7..13754eb06d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -391,7 +391,6 @@ bool handleCrashSubmitBehaviorChanged(const LLSD& newvalue) static void settings_to_globals() { LLBUTTON_H_PAD = gSavedSettings.getS32("ButtonHPad"); - LLBUTTON_V_PAD = gSavedSettings.getS32("ButtonVPad"); BTN_HEIGHT_SMALL = gSavedSettings.getS32("ButtonHeightSmall"); BTN_HEIGHT = gSavedSettings.getS32("ButtonHeight"); diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml index 28ed560543..d7aa71a441 100644 --- a/indra/newview/skins/default/xui/en/widgets/button.xml +++ b/indra/newview/skins/default/xui/en/widgets/button.xml @@ -18,5 +18,6 @@ font="SansSerifSmall" hover_glow_amount="0.15" halign="center" + pad_bottom="2" scale_image="true"> -- cgit v1.2.3