summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2020-01-20 16:59:27 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2020-01-20 17:08:13 +0200
commitd624c3f0d5d3f2667c34059b91a0952cf47cb360 (patch)
tree945a704feacda01a470353bb6c02c6e497ece04c /indra
parentc5be566a6fbf121d1ca140586a02cda18f83b11b (diff)
SL-12595 The checkbox overlaps buttons in the 'Delete selected item?' notification
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llcheckboxctrl.cpp46
-rw-r--r--indra/llui/llcheckboxctrl.h17
-rw-r--r--indra/newview/skins/default/xui/en/panel_login.xml5
3 files changed, 55 insertions, 13 deletions
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index f5b64d58b0..6a51c4240b 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -47,10 +47,18 @@ static LLDefaultChildRegistry::Register<LLCheckBoxCtrl> r("check_box");
template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>(
const std::string& name, BOOL recurse) const;
+void LLCheckBoxCtrl::WordWrap::declareValues()
+{
+ declare("none", EWordWrap::WRAP_NONE);
+ declare("down", EWordWrap::WRAP_DOWN);
+ declare("up", EWordWrap::WRAP_UP);
+}
+
LLCheckBoxCtrl::Params::Params()
: initial_value("initial_value", false),
label_text("label_text"),
check_button("check_button"),
+ word_wrap("word_wrap", EWordWrap::WRAP_NONE),
radio_style("radio_style")
{}
@@ -59,14 +67,14 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p)
: LLUICtrl(p),
mTextEnabledColor(p.label_text.text_color()),
mTextDisabledColor(p.label_text.text_readonly_color()),
- mFont(p.font())
+ mFont(p.font()),
+ mWordWrap(p.word_wrap)
{
mViewModel->setValue(LLSD(p.initial_value));
mViewModel->resetDirty();
static LLUICachedControl<S32> llcheckboxctrl_spacing ("UICheckboxctrlSpacing", 0);
static LLUICachedControl<S32> llcheckboxctrl_hpad ("UICheckboxctrlHPad", 0);
static LLUICachedControl<S32> llcheckboxctrl_vpad ("UICheckboxctrlVPad", 0);
- static LLUICachedControl<S32> llcheckboxctrl_btn_size ("UICheckboxctrlBtnSize", 0);
// must be big enough to hold all children
setUseBoundingRect(TRUE);
@@ -85,17 +93,35 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p)
{
tbparams.font(p.font);
}
- mLabel = LLUICtrlFactory::create<LLTextBox> (tbparams);
+
+ mLabel = LLUICtrlFactory::create<LLTextBox>(tbparams);
+ if (mWordWrap != WRAP_NONE)
+ {
+ // Not setWordWrap(mWordWrap != WRAP_NONE) because there might be some old lurking code that sets it manually
+ mLabel->setWordWrap(true);
+ S32 new_width = getRect().getWidth() - p.check_button.rect().getWidth() - llcheckboxctrl_hpad;
+ LLRect label_rect = mLabel->getRect();
+ label_rect.mRight = label_rect.mLeft + new_width;
+ mLabel->setRect(label_rect);
+ }
mLabel->reshapeToFitText();
+
LLRect label_rect = mLabel->getRect();
if (mLabel->getLineCount() > 1)
{
- // reshapeToFitText uses LLView::reshape() which always reshapes
- // from bottom to top, but we want to extend the bottom
- // Note: might be better idea to use getRect().mTop of LLCheckBoxCtrl (+pad) as top point of new rect
- S32 delta = ll_round((F32)mLabel->getFont()->getLineHeight() * mLabel->getLineSpacingMult()) - label_rect.getHeight();
- label_rect.translate(0, delta);
- mLabel->setRect(label_rect);
+ if (mWordWrap == WRAP_DOWN)
+ {
+ // reshapeToFitText uses LLView::reshape() which always reshapes
+ // from bottom to top, but we want to extend the bottom
+ // Note: might be better idea to use getRect().mTop of LLCheckBoxCtrl (+pad) as top point of new rect
+ S32 delta = ll_round((F32)mLabel->getFont()->getLineHeight() * mLabel->getLineSpacingMult()) - label_rect.getHeight();
+ label_rect.translate(0, delta);
+ mLabel->setRect(label_rect);
+ }
+ // else
+ // WRAP_UP is essentially done by reshapeToFitText() (extends from bottom to top)
+ // howhever it doesn't respect rect of checkbox
+ // todo: this should be fixed, but there are at least couple checkboxes that use this feature as is.
}
addChild(mLabel);
@@ -165,7 +191,7 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
mLabel->reshapeToFitText();
LLRect label_rect = mLabel->getRect();
- if (label_top != label_rect.mTop)
+ if (label_top != label_rect.mTop && mWordWrap == WRAP_DOWN)
{
// reshapeToFitText uses LLView::reshape() which always reshapes
// from bottom to top, but we want to extend the bottom so
diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h
index 07ae9c3b18..eb5bd5b6da 100644
--- a/indra/llui/llcheckboxctrl.h
+++ b/indra/llui/llcheckboxctrl.h
@@ -50,6 +50,19 @@ class LLCheckBoxCtrl
, public ll::ui::SearchableControl
{
public:
+
+ enum EWordWrap
+ {
+ WRAP_NONE,
+ WRAP_UP,
+ WRAP_DOWN
+ };
+
+ struct WordWrap : public LLInitParam::TypeValuesHelper<EWordWrap, WordWrap>
+ {
+ static void declareValues();
+ };
+
struct Params
: public LLInitParam::Block<Params, LLUICtrl::Params>
{
@@ -58,6 +71,8 @@ public:
Optional<LLTextBox::Params> label_text;
Optional<LLButton::Params> check_button;
+ Optional<EWordWrap, WordWrap> word_wrap;
+
Ignored radio_style;
Params();
@@ -129,6 +144,8 @@ protected:
LLUIColor mTextEnabledColor;
LLUIColor mTextDisabledColor;
+
+ EWordWrap mWordWrap; // off, shifts text up, shifts text down
};
// Build time optimization, generate once in .cpp file
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index eab53c9985..58352509c4 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -148,11 +148,10 @@
left="408"
bottom_delta="0"
label="Remember password"
- label_text.word_wrap="true"
- label_text.width="150"
+ word_wrap="down"
check_button.bottom="3"
name="remember_password"
- width="170" />
+ width="165" />
<combo_box
allow_text_entry="false"
font="SansSerifTiny"