summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-03-10 15:46:45 -0800
committerJames Cook <james@lindenlab.com>2010-03-10 15:46:45 -0800
commit60799effaee5dd9696704342e9c8a35881d22583 (patch)
tree28a10ccdc563ca4795d4018270ef36d50a6c3a1c /indra/llui
parent0ee6a6025cba2f63c5c33c20870f67afd62f6372 (diff)
parent347585cf975afac59ec6b9960e093acd015627f5 (diff)
Merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.h1
-rw-r--r--indra/llui/llcombobox.cpp41
-rw-r--r--indra/llui/llcombobox.h35
-rw-r--r--indra/llui/llscrolllistctrl.cpp4
-rw-r--r--indra/llui/lltextbase.cpp9
-rw-r--r--indra/llui/llui.cpp5
6 files changed, 24 insertions, 71 deletions
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 59b551a16d..6a0d8ef3d6 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -216,7 +216,6 @@ public:
void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
LLPointer<LLUIImage> getImageOverlay() { return mImageOverlay; }
- LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; }
void autoResize(); // resize with label of current btn state
void resize(LLUIString label); // resize with label input
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index c693c18d1a..466332a468 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -700,13 +700,20 @@ void LLComboBox::onListMouseUp()
void LLComboBox::onItemSelected(const LLSD& data)
{
- setValue(data);
+ const std::string name = mList->getSelectedItemLabel();
- if (mAllowTextEntry && mLastSelectedIndex != -1)
+ S32 cur_id = getCurrentIndex();
+ mLastSelectedIndex = cur_id;
+ if (cur_id != -1)
+ {
+ setLabel(name);
+
+ if (mAllowTextEntry)
{
gFocusMgr.setKeyboardFocus(mTextEntry);
mTextEntry->selectAll();
}
+ }
// hiding the list reasserts the old value stored in the text editor/dropdown button
hideList();
@@ -1059,33 +1066,3 @@ BOOL LLComboBox::selectItemRange( S32 first, S32 last )
{
return mList->selectItemRange(first, last);
}
-
-
-static LLDefaultChildRegistry::Register<LLIconsComboBox> register_icons_combo_box("icons_combo_box");
-
-LLIconsComboBox::Params::Params()
-: icon_column("icon_column", ICON_COLUMN),
- label_column("label_column", LABEL_COLUMN)
-{}
-
-LLIconsComboBox::LLIconsComboBox(const LLIconsComboBox::Params& p)
-: LLComboBox(p),
- mIconColumnIndex(p.icon_column),
- mLabelColumnIndex(p.label_column)
-{}
-
-void LLIconsComboBox::setValue(const LLSD& value)
-{
- BOOL found = mList->selectByValue(value);
- if (found)
- {
- LLScrollListItem* item = mList->getFirstSelected();
- if (item)
- {
- mButton->setImageOverlay(mList->getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign());
-
- setLabel(mList->getSelectedItemLabel(mLabelColumnIndex));
- }
- mLastSelectedIndex = mList->getFirstSelectedIndex();
- }
-}
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 7cac4cc738..3ed273404c 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -218,7 +218,6 @@ protected:
LLPointer<LLUIImage> mArrowImage;
LLUIString mLabel;
BOOL mHasAutocompletedText;
- S32 mLastSelectedIndex;
private:
BOOL mAllowTextEntry;
@@ -228,37 +227,7 @@ private:
commit_callback_t mPrearrangeCallback;
commit_callback_t mTextEntryCallback;
commit_callback_t mSelectionCallback;
- boost::signals2::connection mTopLostSignalConnection;
-};
-
-// A combo box with icons for the list of items.
-class LLIconsComboBox
-: public LLComboBox
-{
-public:
- struct Params
- : public LLInitParam::Block<Params, LLComboBox::Params>
- {
- Optional<S32> icon_column,
- label_column;
- Params();
- };
-
- /*virtual*/ void setValue(const LLSD& value);
-
-private:
- enum EColumnIndex
- {
- ICON_COLUMN = 0,
- LABEL_COLUMN
- };
-
- friend class LLUICtrlFactory;
- LLIconsComboBox(const Params&);
- virtual ~LLIconsComboBox() {};
-
- S32 mIconColumnIndex;
- S32 mLabelColumnIndex;
+ boost::signals2::connection mTopLostSignalConnection;
+ S32 mLastSelectedIndex;
};
-
#endif
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 18ec5b51dd..77caaaa425 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -630,9 +630,7 @@ void LLScrollListCtrl::calcColumnWidths()
LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex);
if (!cellp) continue;
- // get text value width only for text cells
- column->mMaxContentWidth = cellp->isText() ?
- llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth) : column->mMaxContentWidth;
+ column->mMaxContentWidth = llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth);
}
max_item_width += column->mMaxContentWidth;
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 385812416d..063caae5c9 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -396,8 +396,13 @@ void LLTextBase::drawSelectionBackground()
++rect_it)
{
LLRect selection_rect = *rect_it;
- selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom);
- gl_rect_2d(selection_rect, selection_color);
+ // Don't send empty rects to gl_rect_2d.
+ // Drawing degenerate rectangles seems to cause https://jira.secondlife.com/browse/EXT-6276 .
+ if(selection_rect.notEmpty())
+ {
+ selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom);
+ gl_rect_2d(selection_rect, selection_color);
+ }
}
}
}
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 5121ef5351..9134adc6d1 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -202,6 +202,11 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled )
{
+ // FIXME: Drawing degenerate rectangles (specifically, zero-width rectangles) was causing
+ // https://jira.secondlife.com/browse/EXT-6276 on the Mac (presumably it was doing something bad to the GL state).
+ // That was fixed by checking for this case in LLTextBase::drawSelectionBackground().
+ // It's possible we should check for degenerate rectangles here and not draw, but I wanted to do the minimal change for the moment.
+
stop_glerror();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);