mirror of
https://github.com/FirestormViewer/phoenix-firestorm.git
synced 2026-08-14 00:48:30 +00:00
Restore lltabcontainer and llbutton to state before FIRE-36603
Feature needs more work before beta.
This commit is contained in:
@@ -1209,46 +1209,6 @@ bool LLButton::labelIsTruncated() const
|
||||
return getCurrentLabel().getString().size() > mLastDrawCharsCount;
|
||||
}
|
||||
|
||||
// <FS:minerjr> [FIRE-36603] - LLTabContainer - Add button label to the tool tip when too long
|
||||
// Check if the place holder text exists, and if it too is visually clipped.
|
||||
// Note: LLTextBase::truncate() tests UTF-8 byte length vs mMaxTextByteLength (storage limit), not visual ellipsing
|
||||
bool LLButton::isLabelTruncated() const
|
||||
{
|
||||
// let overlay image and text play well together
|
||||
S32 usable_text_width = getRect().getWidth() - mLeftHPad - mRightHPad;
|
||||
|
||||
// Handle an image overlay taking up the text space.
|
||||
if (mImageOverlay.notNull() && (mImageOverlayAlignment < LLFontGL::HCENTER))
|
||||
{
|
||||
// get max width and height (discard level 0)
|
||||
S32 overlay_width = mImageOverlay->getWidth();
|
||||
|
||||
F32 scale_factor =
|
||||
llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)mImageOverlay->getHeight(), 1.f);
|
||||
overlay_width = ll_round((F32)overlay_width * scale_factor);
|
||||
|
||||
usable_text_width -= (overlay_width + mImgOverlayLabelSpace);
|
||||
}
|
||||
|
||||
// Handle the text starting position on the button
|
||||
if (!getCurrentLabel().empty()) // Unselected label assignments
|
||||
{
|
||||
LL_DEBUGS() << "Tab Button: " << getCurrentLabel().getString() << " SL"
|
||||
<< mGLFont->maxDrawableChars(getCurrentLabel().getWString().c_str(), static_cast<F32>(usable_text_width)) << " UTW "
|
||||
<< getCurrentLabel().length() << LL_ENDL;
|
||||
// Find the max number of drawable characters for the string, with the usable text width, compared to the
|
||||
// total number of characters in the label text.
|
||||
if (mGLFont->maxDrawableChars(getCurrentLabel().getWString().c_str(), static_cast<F32>(usable_text_width)) <
|
||||
getCurrentLabel().length())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// </FS:minerjr> [FIRE-36603]
|
||||
|
||||
const LLUIString& LLButton::getCurrentLabel() const
|
||||
{
|
||||
return getToggleState() ? mSelectedLabel : mUnselectedLabel;
|
||||
|
||||
@@ -272,10 +272,6 @@ public:
|
||||
|
||||
S32 getLastDrawCharsCount() const { return mLastDrawCharsCount; }
|
||||
bool labelIsTruncated() const;
|
||||
// <FS:minerjr> [FIRE-36603] - LLTabContainer - Add button label to the tool tip when too long
|
||||
// The above function only works after rendering, and does not work when not first loading the button.
|
||||
bool isLabelTruncated() const;
|
||||
// </FS:minerjr> [FIRE-36603]
|
||||
const LLUIString& getCurrentLabel() const;
|
||||
|
||||
void setScaleImage(bool scale) { mScaleImage = scale; }
|
||||
|
||||
@@ -842,7 +842,6 @@ bool LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask)
|
||||
if (!tab_button->getVisible()) continue;
|
||||
S32 local_x = x - tab_button->getRect().mLeft;
|
||||
S32 local_y = y - tab_button->getRect().mBottom;
|
||||
if (tab_button->getRect().pointInRect(x, y)) // <FS:minerjr> [FIRE-36603] - The handleToolTip will display a tool tip always if not empty and does not do a bounds check.
|
||||
handled = tab_button->handleToolTip(local_x, local_y, mask);
|
||||
if( handled )
|
||||
{
|
||||
@@ -1352,23 +1351,6 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
|
||||
mScrollPos = mMaxScrollPos;
|
||||
}
|
||||
|
||||
// <FS:minerjr> [FIRE-36603] - LLTabContainer - Add button label to the tool tip when too long
|
||||
// If the text of the button is truncated, we want to set the tool tip of the UI element
|
||||
// to the label of the button/textbox.
|
||||
if (tuple && !getTabsHidden() &&
|
||||
tuple->mButton->getToolTip().empty() &&
|
||||
tuple->mButton->getName() != "placeholder" &&
|
||||
tuple->mPlaceholderText == nullptr &&
|
||||
tuple->mButton->getVisible() &&
|
||||
tuple->mButton->getEnabled()) // Only if it is a valid button to apply the tool tip to.
|
||||
{
|
||||
// If the button label is truncated, then we want to try to use the tool tip.
|
||||
if (tuple->mButton->isLabelTruncated())
|
||||
{
|
||||
tuple->mButton->setToolTip(tuple->mButton->getLabelSelected());
|
||||
}
|
||||
}
|
||||
// </FS:minerjr> [FIRE-36603]
|
||||
}
|
||||
|
||||
void LLTabContainer::addPlaceholder(LLPanel* child, const std::string& label)
|
||||
@@ -1931,23 +1913,6 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple)
|
||||
// tabs have changed size, might need to scroll to see current tab
|
||||
updateMaxScrollPos();
|
||||
}
|
||||
// <FS:minerjr> [FIRE-36603] - LLTabContainer - Add button label to the tool tip when too long
|
||||
// If the text of the button is truncated, we want to set the tool tip of the UI element
|
||||
// to the label of the button/textbox.
|
||||
if (tuple && !getTabsHidden() &&
|
||||
tuple->mButton->getToolTip().empty() &&
|
||||
tuple->mButton->getName() != "placeholder" &&
|
||||
tuple->mPlaceholderText == nullptr &&
|
||||
tuple->mButton->getVisible() &&
|
||||
tuple->mButton->getEnabled()) // Only if it is a valid button to apply the tool tip to.
|
||||
{
|
||||
// If the button label is truncated, then we want to try to use the tool tip.
|
||||
if (tuple->mButton->isLabelTruncated())
|
||||
{
|
||||
tuple->mButton->setToolTip(tuple->mButton->getLabelSelected());
|
||||
}
|
||||
}
|
||||
// </FS:minerjr> [FIRE-36603]
|
||||
}
|
||||
|
||||
void LLTabContainer::setTitle(const std::string& title)
|
||||
|
||||
Reference in New Issue
Block a user