summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2009-12-04 19:01:31 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2009-12-04 19:01:31 -0500
commit16efeb85817cce82e594cf8482f5e52385a59ad1 (patch)
tree85878d4b882faa0157d1be26dc6e0e28d582c218 /indra/llui
parentf017058345ba1bc2682051017d3f9c0d6ea3db72 (diff)
parent938c51d2a483962556ee183c24e2b3f635f2c56b (diff)
merge
--HG-- branch : avatar-pipeline
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llflatlistview.cpp96
-rw-r--r--indra/llui/llflatlistview.h6
-rw-r--r--indra/llui/llsearcheditor.cpp9
-rw-r--r--indra/llui/llsearcheditor.h1
-rw-r--r--indra/llui/lltextbase.cpp30
-rw-r--r--indra/llui/llview.cpp2
-rw-r--r--indra/llui/llview.h2
7 files changed, 106 insertions, 40 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index f4a5f1c990..d4c3cfb7b6 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -689,6 +689,17 @@ LLRect LLFlatListView::getSelectedItemsRect()
return rc;
}
+void LLFlatListView::selectFirstItem ()
+{
+ selectItemPair(mItemPairs.front(), true);
+}
+
+void LLFlatListView::selectLastItem ()
+{
+ selectItemPair(mItemPairs.back(), true);
+}
+
+
// virtual
bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selection)
{
@@ -696,53 +707,53 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti
if ( !mItemPairs.size() )
return false;
- item_pair_t* cur_sel_pair = NULL;
+
item_pair_t* to_sel_pair = NULL;
-
+ item_pair_t* cur_sel_pair = NULL;
if ( mSelectedItemPairs.size() )
{
// Take the last selected pair
cur_sel_pair = mSelectedItemPairs.back();
- }
- else
- {
- // If there weren't selected items then choose the first one bases on given direction
- cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front();
- // Force selection to first item
- to_sel_pair = cur_sel_pair;
- }
-
- // Bases on given direction choose next item to select
- if ( is_up_direction )
- {
- // Find current selected item position in mItemPairs list
- pairs_list_t::reverse_iterator sel_it = std::find(mItemPairs.rbegin(), mItemPairs.rend(), cur_sel_pair);
-
- for (;++sel_it != mItemPairs.rend();)
+ // Bases on given direction choose next item to select
+ if ( is_up_direction )
{
- // skip invisible items
- if ( (*sel_it)->first->getVisible() )
+ // Find current selected item position in mItemPairs list
+ pairs_list_t::reverse_iterator sel_it = std::find(mItemPairs.rbegin(), mItemPairs.rend(), cur_sel_pair);
+
+ for (;++sel_it != mItemPairs.rend();)
{
- to_sel_pair = *sel_it;
- break;
+ // skip invisible items
+ if ( (*sel_it)->first->getVisible() )
+ {
+ to_sel_pair = *sel_it;
+ break;
+ }
}
}
- }
- else
- {
- // Find current selected item position in mItemPairs list
- pairs_list_t::iterator sel_it = std::find(mItemPairs.begin(), mItemPairs.end(), cur_sel_pair);
-
- for (;++sel_it != mItemPairs.end();)
+ else
{
- // skip invisible items
- if ( (*sel_it)->first->getVisible() )
+ // Find current selected item position in mItemPairs list
+ pairs_list_t::iterator sel_it = std::find(mItemPairs.begin(), mItemPairs.end(), cur_sel_pair);
+
+ for (;++sel_it != mItemPairs.end();)
{
- to_sel_pair = *sel_it;
- break;
+ // skip invisible items
+ if ( (*sel_it)->first->getVisible() )
+ {
+ to_sel_pair = *sel_it;
+ break;
+ }
}
}
}
+ else
+ {
+ // If there weren't selected items then choose the first one bases on given direction
+ cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front();
+ // Force selection to first item
+ to_sel_pair = cur_sel_pair;
+ }
+
if ( to_sel_pair )
{
@@ -920,4 +931,23 @@ void LLFlatListView::onFocusLost()
mSelectedItemsBorder->setVisible(FALSE);
}
+//virtual
+void LLFlatListView::notify(const LLSD& info)
+{
+ if(info.has("action"))
+ {
+ std::string str_action = info["action"];
+ if(str_action == "select_first")
+ {
+ setFocus(true);
+ selectFirstItem();
+ }
+ else if(str_action == "select_last")
+ {
+ setFocus(true);
+ selectLastItem();
+ }
+ }
+}
+
//EOF
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 3867e910c0..9e1e0f90fc 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -279,6 +279,12 @@ public:
bool updateValue(const LLSD& old_value, const LLSD& new_value);
+
+ void selectFirstItem ();
+ void selectLastItem ();
+
+ virtual void notify(const LLSD& info) ;
+
protected:
/** Pairs LLpanel representing a single item LLPanel and LLSD associated with it */
diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp
index fad2b7bc99..6fa99df82e 100644
--- a/indra/llui/llsearcheditor.cpp
+++ b/indra/llui/llsearcheditor.cpp
@@ -141,6 +141,15 @@ void LLSearchEditor::clear()
}
}
+//virtual
+void LLSearchEditor::setFocus( BOOL b )
+{
+ if (mSearchEditor)
+ {
+ mSearchEditor->setFocus(b);
+ }
+}
+
void LLSearchEditor::onClearButtonClick(const LLSD& data)
{
setText(LLStringUtil::null);
diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h
index f395e7e816..bd2d595174 100644
--- a/indra/llui/llsearcheditor.h
+++ b/indra/llui/llsearcheditor.h
@@ -83,6 +83,7 @@ public:
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
virtual void setLabel( const LLStringExplicit &new_label );
virtual void clear();
+ virtual void setFocus( BOOL b );
void setKeystrokeCallback( commit_callback_t cb ) { mKeystrokeCallback = cb; }
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index db16670f79..82a3c5cf47 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -543,9 +543,17 @@ void LLTextBase::drawText()
line_end = next_start;
}
+ // A patch for EXT-1944 "Implement ellipses in message well"
+ // introduced a regression where text in SansSerif ending in the
+ // letter "r" is clipped. This may be due to an off-by-one in
+ // font width information out of FreeType with our fractional font
+ // sizes. For now, just make an extra pixel of space to resolve
+ // EXT-2971 "Letter R doesn't show when it's the last letter in a
+ // text block". See James/Richard for details.
+ const S32 FIX_CLIPPING_HACK = 1;
LLRect text_rect(line.mRect.mLeft + mTextRect.mLeft - scrolled_view_rect.mLeft,
line.mRect.mTop - scrolled_view_rect.mBottom + mTextRect.mBottom,
- llmin(mDocumentView->getRect().getWidth(), line.mRect.mRight) - scrolled_view_rect.mLeft,
+ llmin(mDocumentView->getRect().getWidth(), line.mRect.mRight) - scrolled_view_rect.mLeft + FIX_CLIPPING_HACK,
line.mRect.mBottom - scrolled_view_rect.mBottom + mTextRect.mBottom);
// draw a single line of text
@@ -2397,12 +2405,20 @@ void LLNormalTextSegment::setToolTip(const std::string& tooltip)
bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
{
- LLWString text = mEditor.getWText();
-
height = mFontHeight;
- width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
- // if last character is a newline, then return true, forcing line break
- llwchar last_char = text[mStart + first_char + num_chars - 1];
+ bool force_newline = false;
+ if (num_chars > 0)
+ {
+ LLWString text = mEditor.getWText();
+ width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
+ // if last character is a newline, then return true, forcing line break
+ llwchar last_char = text[mStart + first_char + num_chars - 1];
+ force_newline = (last_char == '\n');
+ }
+ else
+ {
+ width = 0;
+ }
LLUIImagePtr image = mStyle->getImage();
if( image.notNull())
@@ -2411,7 +2427,7 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt
height = llmax(height, image->getHeight());
}
- return num_chars >= 1 && last_char == '\n';
+ return force_newline;
}
S32 LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 23e4131e6d..6f8455774d 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -2533,6 +2533,7 @@ void LLView::setupParams(LLView::Params& p, LLView* parent)
else
{
p.rect.left = p.rect.left + parent_rect.getWidth()/2 - p.rect.width/2;
+ p.rect.right.setProvided(false); // recalculate the right
}
}
else
@@ -2553,6 +2554,7 @@ void LLView::setupParams(LLView::Params& p, LLView* parent)
else
{
p.rect.bottom = p.rect.bottom + parent_rect.getHeight()/2 - p.rect.height/2;
+ p.rect.top.setProvided(false); // recalculate the top
}
}
else
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index d485244a05..c611e4c85f 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -514,6 +514,8 @@ public:
virtual void notifyParent(const LLSD& info);
virtual void notifyChildren(const LLSD& info);
+ virtual void notify(const LLSD& info) {};
+
static const LLViewDrawContext& getDrawContext();
protected: