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.
master
James Cook 2009-12-11 13:48:35 -08:00
parent ae9ca1be63
commit fce0d168ae
6 changed files with 9 additions and 16 deletions

View File

@ -63,7 +63,6 @@ template class LLButton* LLView::getChild<class LLButton>(
// 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,

View File

@ -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<S32> pad_right;
Optional<S32> pad_left;
Optional<S32> pad_bottom; // under text label
// callbacks
Optional<CommitCallbackParam> 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;

View File

@ -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);

View File

@ -1068,17 +1068,6 @@
<key>Value</key>
<integer>23</integer>
</map>
<key>ButtonVPad</key>
<map>
<key>Comment</key>
<string>Default vertical spacing between buttons (pixels)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>CacheLocation</key>
<map>
<key>Comment</key>

View File

@ -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");

View File

@ -18,5 +18,6 @@
font="SansSerifSmall"
hover_glow_amount="0.15"
halign="center"
pad_bottom="2"
scale_image="true">
</button>