summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-07-17 23:17:29 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-07-17 23:18:04 +0300
commit4c848c8258aa0f8a29aed0bebf9cdbcf32a2c96f (patch)
tree6b0d38fd8d65d7d2a2689a8b9137e9e90af63986 /indra/llui
parentc37140dd89051317216bbf7a2cb08198c62535e0 (diff)
parentec4135da63a3f3877222fba4ecb59b15650371fe (diff)
Merge branch 'main' (DRTVWR-580) into DRTVWR-587-maint-V
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfolderviewitem.cpp2
-rw-r--r--indra/llui/lliconctrl.cpp26
-rw-r--r--indra/llui/lliconctrl.h3
-rw-r--r--indra/llui/lllayoutstack.cpp19
-rw-r--r--indra/llui/lllayoutstack.h1
-rw-r--r--indra/llui/llmenugl.cpp7
-rw-r--r--indra/llui/llmenugl.h1
-rw-r--r--indra/llui/llpanel.h1
-rw-r--r--indra/llui/lltextbase.cpp10
-rw-r--r--indra/llui/lltextbase.h2
-rw-r--r--indra/llui/lltextbox.cpp3
-rw-r--r--indra/llui/lluicolortable.cpp6
-rw-r--r--indra/llui/llview.cpp6
-rw-r--r--indra/llui/llview.h1
14 files changed, 74 insertions, 14 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index eba93beed9..e2b5279aab 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -395,7 +395,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height )
// it is purely visual, so it is fine to do at our laisure
refreshSuffix();
}
- mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + mLabelPaddingRight;
+ mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + mLabelPaddingRight;
mLabelWidthDirty = false;
}
diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp
index e01aba402e..2791377a5e 100644
--- a/indra/llui/lliconctrl.cpp
+++ b/indra/llui/lliconctrl.cpp
@@ -37,6 +37,8 @@
#include "lluiimage.h"
#include "llwindow.h"
+#include "llgltexture.h"
+
static LLDefaultChildRegistry::Register<LLIconCtrl> r("icon");
LLIconCtrl::Params::Params()
@@ -94,6 +96,22 @@ BOOL LLIconCtrl::handleHover(S32 x, S32 y, MASK mask)
return LLUICtrl::handleHover(x, y, mask);
}
+void LLIconCtrl::onVisibilityChange(BOOL new_visibility)
+{
+ LLUICtrl::onVisibilityChange(new_visibility);
+ if (mPriority == LLGLTexture::BOOST_ICON)
+ {
+ if (new_visibility)
+ {
+ loadImage(getValue(), mPriority);
+ }
+ else
+ {
+ mImagep = nullptr;
+ }
+ }
+}
+
// virtual
// value might be a string or a UUID
void LLIconCtrl::setValue(const LLSD& value)
@@ -110,6 +128,14 @@ void LLIconCtrl::setValue(const LLSD& value, S32 priority)
tvalue = LLSD(LLUUID(value.asString()));
}
LLUICtrl::setValue(tvalue);
+
+ loadImage(tvalue, priority);
+}
+
+void LLIconCtrl::loadImage(const LLSD& tvalue, S32 priority)
+{
+ if(mPriority == LLGLTexture::BOOST_ICON && !getVisible()) return;
+
if (tvalue.isUUID())
{
mImagep = LLUI::getUIImageByID(tvalue.asUUID(), priority);
diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h
index 9c3b517bca..5d6c544571 100644
--- a/indra/llui/lliconctrl.h
+++ b/indra/llui/lliconctrl.h
@@ -72,6 +72,7 @@ public:
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
// lluictrl overrides
+ void onVisibilityChange(BOOL new_visibility);
virtual void setValue(const LLSD& value );
std::string getImageName() const;
@@ -95,6 +96,8 @@ protected:
bool mInteractable;
private:
+ void loadImage(const LLSD& value, S32 priority);
+
LLUIColor mColor;
LLPointer<LLUIImage> mImagep;
};
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 77938edf27..ae9dba5945 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -282,6 +282,17 @@ void LLLayoutStack::draw()
}
}
+void LLLayoutStack::deleteAllChildren()
+{
+ mPanels.clear();
+ LLView::deleteAllChildren();
+
+ // Not really needed since nothing is left to
+ // display, but for the sake of consistency
+ updateFractionalSizes();
+ mNeedsLayout = true;
+}
+
void LLLayoutStack::removeChild(LLView* view)
{
LLLayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast<LLPanel*>(view));
@@ -289,12 +300,14 @@ void LLLayoutStack::removeChild(LLView* view)
if (embedded_panelp)
{
mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp));
- delete embedded_panelp;
+ LLView::removeChild(view);
updateFractionalSizes();
mNeedsLayout = true;
}
-
- LLView::removeChild(view);
+ else
+ {
+ LLView::removeChild(view);
+ }
}
BOOL LLLayoutStack::postBuild()
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index f772dbc6b4..22f11eb20f 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -67,6 +67,7 @@ public:
virtual ~LLLayoutStack();
/*virtual*/ void draw();
+ /*virtual*/ void deleteAllChildren();
/*virtual*/ void removeChild(LLView*);
/*virtual*/ BOOL postBuild();
/*virtual*/ bool addChild(LLView* child, S32 tab_group = 0);
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 5cb840fd61..33c4b6ec73 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1882,6 +1882,13 @@ bool LLMenuGL::addContextChild(LLView* view, S32 tab_group)
return false;
}
+
+void LLMenuGL::deleteAllChildren()
+{
+ mItems.clear();
+ LLUICtrl::deleteAllChildren();
+}
+
void LLMenuGL::removeChild( LLView* ctrl)
{
// previously a dynamic_cast with if statement to check validity
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index f84c4d41eb..9d3be8d94f 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -442,6 +442,7 @@ public:
/*virtual*/ void drawBackground(LLMenuItemGL* itemp, F32 alpha);
/*virtual*/ void setVisible(BOOL visible);
/*virtual*/ bool addChild(LLView* view, S32 tab_group = 0);
+ /*virtual*/ void deleteAllChildren();
/*virtual*/ void removeChild( LLView* ctrl);
/*virtual*/ BOOL postBuild();
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index b8f47ef6ba..8018365d3e 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -127,6 +127,7 @@ public:
virtual void clearCtrls(); // overridden in LLPanelObject and LLPanelVolume
// Border controls
+ const LLViewBorder* getBorder() const { return mBorder; }
void addBorder( LLViewBorder::Params p);
void addBorder();
void removeBorder();
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 82a3c01c6d..8732a7ce45 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -361,7 +361,7 @@ void LLTextBase::onValueChange(S32 start, S32 end)
{
}
-std::vector<LLRect> LLTextBase::getSelctionRects()
+std::vector<LLRect> LLTextBase::getSelectionRects()
{
// Nor supposed to be called without selection
llassert(hasSelection());
@@ -458,7 +458,7 @@ void LLTextBase::drawSelectionBackground()
// Draw selection even if we don't have keyboard focus for search/replace
if (hasSelection() && !mLineInfoList.empty())
{
- std::vector<LLRect> selection_rects = getSelctionRects();
+ std::vector<LLRect> selection_rects = getSelectionRects();
// Draw the selection box (we're using a box instead of reversing the colors on the selected text).
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1356,9 +1356,9 @@ void LLTextBase::draw()
drawCursor();
}
- mDocumentView->setVisible(FALSE);
+ mDocumentView->setVisibleDirect(FALSE);
LLUICtrl::draw();
- mDocumentView->setVisible(TRUE);
+ mDocumentView->setVisibleDirect(TRUE);
}
@@ -3464,7 +3464,7 @@ bool LLNormalTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& w
height = mFontHeight;
const LLWString &text = getWText();
// if last character is a newline, then return true, forcing line break
- width = mStyle->getFont()->getWidthF32(text.c_str(), mStart + first_char, num_chars);
+ width = mStyle->getFont()->getWidthF32(text.c_str(), mStart + first_char, num_chars, true);
}
return false;
}
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index e3cf56a5ee..3611ab0499 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -638,7 +638,7 @@ protected:
return mLabel.getString() + getToolTip();
}
- std::vector<LLRect> getSelctionRects();
+ std::vector<LLRect> getSelectionRects();
protected:
// text segmentation and flow
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index c567451973..521dabf9d4 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -171,7 +171,8 @@ void LLTextBox::reshapeToFitText(BOOL called_from_parent)
S32 width = getTextPixelWidth();
S32 height = getTextPixelHeight();
- reshape( width + 2 * mHPad, height + 2 * mVPad, called_from_parent );
+ //consider investigating reflow() to find missing width pixel (see SL-17045 changes)
+ reshape( width + 2 * mHPad + 1, height + 2 * mVPad, called_from_parent );
}
diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp
index 244f0c6f00..096336045c 100644
--- a/indra/llui/lluicolortable.cpp
+++ b/indra/llui/lluicolortable.cpp
@@ -200,7 +200,6 @@ LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& defa
void LLUIColorTable::setColor(const std::string& name, const LLColor4& color)
{
setColor(name, color, mUserSetColors);
- setColor(name, color, mLoadedColors);
}
bool LLUIColorTable::loadFromSettings()
@@ -229,6 +228,11 @@ void LLUIColorTable::saveUserSettings() const
it != mUserSetColors.end();
++it)
{
+ // Compare user color value with the default value, skip if equal
+ string_color_map_t::const_iterator itd = mLoadedColors.find(it->first);
+ if(itd != mLoadedColors.end() && itd->second == it->second)
+ continue;
+
ColorEntryParams color_entry;
color_entry.name = it->first;
color_entry.color.value = it->second;
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 9ba71913d0..3344300635 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -576,8 +576,10 @@ void LLView::deleteAllChildren()
while (!mChildList.empty())
{
- LLView* viewp = mChildList.front();
- delete viewp; // will remove the child from mChildList
+ LLView* viewp = mChildList.front();
+ viewp->mParentView = NULL;
+ delete viewp;
+ mChildList.pop_front();
}
}
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index bec45df78a..8aa97aac39 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -287,6 +287,7 @@ public:
void setAllChildrenEnabled(BOOL b);
virtual void setVisible(BOOL visible);
+ void setVisibleDirect(BOOL visible) { mVisible = visible; }
const BOOL& getVisible() const { return mVisible; }
virtual void setEnabled(BOOL enabled);
BOOL getEnabled() const { return mEnabled; }