summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llaccordionctrl.cpp5
-rw-r--r--indra/llui/llbutton.cpp1
-rw-r--r--indra/llui/llflatlistview.cpp30
-rw-r--r--indra/llui/llflatlistview.h12
-rw-r--r--indra/llui/llnotifications.cpp10
-rw-r--r--indra/llui/lltextbase.cpp56
-rw-r--r--indra/llui/lltextbase.h18
-rw-r--r--indra/llui/lltexteditor.cpp2
-rw-r--r--indra/llui/lluictrl.cpp7
-rw-r--r--indra/llui/lluictrlfactory.h2
-rw-r--r--indra/llui/lluistring.cpp13
-rw-r--r--indra/llui/llview.h7
-rw-r--r--indra/llui/llviewquery.cpp14
-rw-r--r--indra/llui/llviewquery.h2
14 files changed, 56 insertions, 123 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index 673631f99a..28125ccaaf 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -40,6 +40,8 @@
#include "llfocusmgr.h"
#include "lllocalcliprect.h"
+#include "lltrans.h"
+
#include "boost/bind.hpp"
static const S32 DRAGGER_BAR_MARGIN = 4;
@@ -72,6 +74,7 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
{
initNoTabsWidget(params.no_matched_tabs_text);
+ mNoVisibleTabsOrigString = LLTrans::getString(params.no_visible_tabs_text.initial_value().asString());
mSingleExpansion = params.single_expansion;
if(mFitParent && !mSingleExpansion)
{
@@ -386,7 +389,7 @@ void LLAccordionCtrl::initNoTabsWidget(const LLTextBox::Params& tb_params)
{
LLTextBox::Params tp = tb_params;
tp.rect(getLocalRect());
- mNoMatchedTabsOrigString = tp.initial_value().asString();
+ mNoMatchedTabsOrigString = LLTrans::getString(tp.initial_value().asString());
mNoVisibleTabsHelpText = LLUICtrlFactory::create<LLTextBox>(tp, this);
}
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index aeedf62379..39e46a7ccb 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -1,4 +1,3 @@
-
/**
* @file llbutton.cpp
* @brief LLButton base class
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 3c79da64f9..6eb214cb93 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -157,7 +157,7 @@ bool LLFlatListView::insertItemAfter(LLPanel* after_item, LLPanel* item_to_add,
}
-bool LLFlatListView::removeItem(LLPanel* item, bool rearrange)
+bool LLFlatListView::removeItem(LLPanel* item)
{
if (!item) return false;
if (item->getParent() != mItemsPanel) return false;
@@ -165,22 +165,22 @@ bool LLFlatListView::removeItem(LLPanel* item, bool rearrange)
item_pair_t* item_pair = getItemPair(item);
if (!item_pair) return false;
- return removeItemPair(item_pair, rearrange);
+ return removeItemPair(item_pair);
}
-bool LLFlatListView::removeItemByValue(const LLSD& value, bool rearrange)
+bool LLFlatListView::removeItemByValue(const LLSD& value)
{
if (value.isUndefined()) return false;
item_pair_t* item_pair = getItemPair(value);
if (!item_pair) return false;
- return removeItemPair(item_pair, rearrange);
+ return removeItemPair(item_pair);
}
-bool LLFlatListView::removeItemByUUID(const LLUUID& uuid, bool rearrange)
+bool LLFlatListView::removeItemByUUID(const LLUUID& uuid)
{
- return removeItemByValue(LLSD(uuid), rearrange);
+ return removeItemByValue(LLSD(uuid));
}
LLPanel* LLFlatListView::getItemByValue(const LLSD& value) const
@@ -327,9 +327,6 @@ U32 LLFlatListView::size(const bool only_visible_items) const
void LLFlatListView::clear()
{
- // This will clear mSelectedItemPairs, calling all appropriate callbacks.
- resetSelection();
-
// do not use LLView::deleteAllChildren to avoid removing nonvisible items. drag-n-drop for ex.
for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it)
{
@@ -338,6 +335,7 @@ void LLFlatListView::clear()
delete *it;
}
mItemPairs.clear();
+ mSelectedItemPairs.clear();
// also set items panel height to zero. Reshape it to allow reshaping of non-item children
LLRect rc = mItemsPanel->getRect();
@@ -972,12 +970,11 @@ bool LLFlatListView::isSelected(item_pair_t* item_pair) const
return std::find(mSelectedItemPairs.begin(), it_end, item_pair) != it_end;
}
-bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
+bool LLFlatListView::removeItemPair(item_pair_t* item_pair)
{
llassert(item_pair);
bool deleted = false;
- bool selection_changed = false;
for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it)
{
item_pair_t* _item_pair = *it;
@@ -997,7 +994,6 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
if (selected_item_pair == item_pair)
{
it = mSelectedItemPairs.erase(it);
- selection_changed = true;
break;
}
}
@@ -1006,16 +1002,8 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
item_pair->first->die();
delete item_pair;
- if (rearrange)
- {
rearrangeItems();
notifyParentItemsRectChanged();
- }
-
- if (selection_changed && mCommitOnSelectionChange)
- {
- onCommit();
- }
return true;
}
@@ -1111,7 +1099,7 @@ void LLFlatListView::onFocusReceived()
{
if (size())
{
- mSelectedItemsBorder->setVisible(TRUE);
+ mSelectedItemsBorder->setVisible(TRUE);
}
gEditMenuHandler = this;
}
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 50d06fbc94..ded46d8122 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -117,9 +117,6 @@ public:
Params();
};
- // disable traversal when finding widget to hand focus off to
- /*virtual*/ BOOL canFocusChildren() const { return FALSE; }
-
/**
* Connects callback to signal called when Return key is pressed.
*/
@@ -152,19 +149,19 @@ public:
* Remove specified item
* @return true if the item was removed, false otherwise
*/
- virtual bool removeItem(LLPanel* item, bool rearrange = true);
+ virtual bool removeItem(LLPanel* item);
/**
* Remove an item specified by value
* @return true if the item was removed, false otherwise
*/
- virtual bool removeItemByValue(const LLSD& value, bool rearrange = true);
+ virtual bool removeItemByValue(const LLSD& value);
/**
* Remove an item specified by uuid
* @return true if the item was removed, false otherwise
*/
- virtual bool removeItemByUUID(const LLUUID& uuid, bool rearrange = true);
+ virtual bool removeItemByUUID(const LLUUID& uuid);
/**
* Get an item by value
@@ -265,7 +262,6 @@ public:
void setAllowSelection(bool can_select) { mAllowSelection = can_select; }
/** Sets flag whether onCommit should be fired if selection was changed */
- // FIXME: this should really be a separate signal, since "Commit" implies explicit user action, and selection changes can happen more indirectly.
void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; }
/** Get number of selected items in the list */
@@ -353,7 +349,7 @@ protected:
virtual bool isSelected(item_pair_t* item_pair) const;
- virtual bool removeItemPair(item_pair_t* item_pair, bool rearrange);
+ virtual bool removeItemPair(item_pair_t* item_pair);
/**
* Notify parent about changed size of internal controls with "size_changes" action
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 75b92e47da..4fa4da3f01 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -35,7 +35,6 @@
#include "llnotifications.h"
#include "llavatarnamecache.h"
-#include "llinstantmessage.h"
#include "llcachename.h"
#include "llxmlnode.h"
#include "lluictrl.h"
@@ -44,7 +43,6 @@
#include "llsdserialize.h"
#include "lltrans.h"
#include "llnotificationslistener.h"
-#include "llstring.h"
#include <algorithm>
#include <boost/regex.hpp>
@@ -1498,7 +1496,6 @@ void LLPostponedNotification::lookupName(LLPostponedNotification* thiz,
gCacheName->getGroup(id,
boost::bind(&LLPostponedNotification::onGroupNameCache,
thiz, _1, _2, _3));
- }
else
{
LLAvatarNameCache::get(id,
@@ -1519,13 +1516,6 @@ void LLPostponedNotification::onAvatarNameCache(const LLUUID& agent_id,
{
std::string name = av_name.getCompleteName();
- // from PE merge - we should figure out if this is the right thing to do
- if (name.empty())
- {
- llwarns << "Empty name received for Id: " << agent_id << llendl;
- name = SYSTEM_FROM;
- }
-
finalizeName(name);
}
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index f8e97f2b39..3d058f2c9d 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -66,10 +66,7 @@ bool LLTextBase::compare_segment_end::operator()(const LLTextSegmentPtr& a, cons
{
return a->getStart() < b->getStart();
}
- else
- {
- return a->getEnd() < b->getEnd();
- }
+ return a->getEnd() < b->getEnd();
}
@@ -177,7 +174,7 @@ LLTextBase::Params::Params()
LLTextBase::LLTextBase(const LLTextBase::Params &p)
: LLUICtrl(p, LLTextViewModelPtr(new LLTextViewModel)),
- mURLClickSignal(NULL),
+ mURLClickSignal(),
mMaxTextByteLength( p.max_text_length ),
mDefaultFont(p.font),
mFontShadow(p.font_shadow),
@@ -212,8 +209,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
mParseHTML(p.allow_html),
mParseHighlights(p.parse_highlights),
mBGVisible(p.bg_visible),
- mScroller(NULL),
- mStyleDirty(true)
+ mScroller(NULL)
{
if(p.allow_scroll)
{
@@ -252,8 +248,9 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
LLTextBase::~LLTextBase()
{
+ // Menu, like any other LLUICtrl, is deleted by its parent - gMenuHolder
+
mSegments.clear();
- delete mURLClickSignal;
}
void LLTextBase::initFromParams(const LLTextBase::Params& p)
@@ -299,18 +296,13 @@ bool LLTextBase::truncate()
return did_truncate;
}
-const LLStyle::Params& LLTextBase::getDefaultStyleParams()
+LLStyle::Params LLTextBase::getDefaultStyleParams()
{
- if (mStyleDirty)
- {
- mDefaultStyle
- .color(LLUIColor(&mFgColor))
- .readonly_color(LLUIColor(&mReadOnlyFgColor))
- .font(mDefaultFont)
- .drop_shadow(mFontShadow);
- mStyleDirty = false;
- }
- return mDefaultStyle;
+ return LLStyle::Params()
+ .color(LLUIColor(&mFgColor))
+ .readonly_color(LLUIColor(&mReadOnlyFgColor))
+ .font(mDefaultFont)
+ .drop_shadow(mFontShadow);
}
void LLTextBase::onValueChange(S32 start, S32 end)
@@ -869,12 +861,11 @@ BOOL LLTextBase::handleMouseUp(S32 x, S32 y, MASK mask)
if (cur_segment && cur_segment->handleMouseUp(x, y, mask))
{
// Did we just click on a link?
- if (mURLClickSignal
- && cur_segment->getStyle()
+ if (cur_segment->getStyle()
&& cur_segment->getStyle()->isLink())
{
// *TODO: send URL here?
- (*mURLClickSignal)(this, LLSD() );
+ mURLClickSignal(this, LLSD() );
}
return TRUE;
}
@@ -1048,14 +1039,12 @@ void LLTextBase::draw()
void LLTextBase::setColor( const LLColor4& c )
{
mFgColor = c;
- mStyleDirty = true;
}
//virtual
void LLTextBase::setReadOnlyColor(const LLColor4 &c)
{
mReadOnlyFgColor = c;
- mStyleDirty = true;
}
//virtual
@@ -1499,22 +1488,12 @@ void LLTextBase::getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg
LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index)
{
- if (index > getLength()) { return mSegments.end(); }
-
- // when there are no segments, we return the end iterator, which must be checked by caller
- if (mSegments.size() <= 1) { return mSegments.begin(); }
-
segment_set_t::iterator it = mSegments.upper_bound(new LLIndexSegment(index));
return it;
}
LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 index) const
{
- if (index > getLength()) { return mSegments.end(); }
-
- // when there are no segments, we return the end iterator, which must be checked by caller
- if (mSegments.size() <= 1) { return mSegments.begin(); }
-
LLTextBase::segment_set_t::const_iterator it = mSegments.upper_bound(new LLIndexSegment(index));
return it;
}
@@ -2373,15 +2352,6 @@ LLRect LLTextBase::getVisibleDocumentRect() const
}
}
-boost::signals2::connection LLTextBase::setURLClickedCallback(const commit_signal_t::slot_type& cb)
-{
- if (!mURLClickSignal)
- {
- mURLClickSignal = new commit_signal_t();
- }
- return mURLClickSignal->connect(cb);
-}
-
//
// LLTextSegment
//
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 63451a2ae0..3608808c27 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -361,7 +361,10 @@ public:
virtual void appendLineBreakSegment(const LLStyle::Params& style_params);
virtual void appendImageSegment(const LLStyle::Params& style_params);
virtual void appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
- boost::signals2::connection setURLClickedCallback(const commit_signal_t::slot_type& cb);
+
+public:
+ // Fired when a URL link is clicked
+ commit_signal_t mURLClickSignal;
protected:
// helper structs
@@ -454,7 +457,7 @@ protected:
void createDefaultSegment();
virtual void updateSegments();
void insertSegment(LLTextSegmentPtr segment_to_insert);
- const LLStyle::Params& getDefaultStyleParams();
+ LLStyle::Params getDefaultStyleParams();
// manage lines
S32 getLineStart( S32 line ) const;
@@ -498,12 +501,6 @@ protected:
LLRect mVisibleTextRect; // The rect in which text is drawn. Excludes borders.
LLRect mTextBoundingRect;
- // default text style
- LLStyle::Params mDefaultStyle;
- bool mStyleDirty;
- const LLFontGL* const mDefaultFont; // font that is used when none specified, can only be set by constructor
- const LLFontGL::ShadowType mFontShadow; // shadow style, can only be set by constructor
-
// colors
LLUIColor mCursorColor;
LLUIColor mFgColor;
@@ -530,6 +527,8 @@ protected:
LLFontGL::VAlign mVAlign;
F32 mLineSpacingMult; // multiple of line height used as space for a single line of text (e.g. 1.5 to get 50% padding)
S32 mLineSpacingPixels; // padding between lines
+ const LLFontGL* mDefaultFont; // font that is used when none specified
+ LLFontGL::ShadowType mFontShadow;
bool mBorderVisible;
bool mParseHTML; // make URLs interactive
bool mParseHighlights; // highlight user-defined keywords
@@ -552,9 +551,6 @@ protected:
bool mScrollNeeded; // need to change scroll region because of change to cursor position
S32 mScrollIndex; // index of first character to keep visible in scroll region
- // Fired when a URL link is clicked
- commit_signal_t* mURLClickSignal;
-
};
#endif
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 130cda3784..c9474d66b7 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -264,6 +264,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mContextMenu(NULL),
mShowContextMenu(p.show_context_menu)
{
+ mDefaultFont = p.font;
+
mSourceID.generate();
//FIXME: use image?
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index ff330f863a..3ade46d367 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -675,7 +675,7 @@ BOOL LLUICtrl::getIsChrome() const
class CompareByDefaultTabGroup: public LLCompareByTabOrder
{
public:
- CompareByDefaultTabGroup(const LLView::child_tab_order_t& order, S32 default_tab_group):
+ CompareByDefaultTabGroup(LLView::child_tab_order_t order, S32 default_tab_group):
LLCompareByTabOrder(order),
mDefaultTabGroup(default_tab_group) {}
private:
@@ -699,16 +699,13 @@ class LLUICtrl::DefaultTabGroupFirstSorter : public LLQuerySorter, public LLSing
{
public:
/*virtual*/ void operator() (LLView * parent, viewList_t &children) const
- {
+ {
children.sort(CompareByDefaultTabGroup(parent->getCtrlOrder(), parent->getDefaultTabGroup()));
}
};
-LLFastTimer::DeclareTimer FTM_FOCUS_FIRST_ITEM("Focus First Item");
-
BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash)
{
- LLFastTimer _(FTM_FOCUS_FIRST_ITEM);
// try to select default tab group child
LLCtrlQuery query = getTabOrderQuery();
// sort things such that the default tab group is at the front
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index dc43b311a7..c99acee48e 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -182,7 +182,7 @@ public:
void popFactoryFunctions();
template<typename T>
- static T* createWidget(const typename T::Params& params, LLView* parent = NULL)
+ static T* createWidget(typename T::Params& params, LLView* parent = NULL)
{
T* widget = NULL;
diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp
index ac9e71665f..f7a53e87de 100644
--- a/indra/llui/lluistring.cpp
+++ b/indra/llui/lluistring.cpp
@@ -135,16 +135,9 @@ void LLUIString::updateResult() const
mResult = mOrig;
// get the defailt args + local args
- if (mArgs.empty())
- {
- LLStringUtil::format(mResult, LLTrans::getDefaultArgs());
- }
- else
- {
- LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
- combined_args.insert(mArgs.begin(), mArgs.end());
- LLStringUtil::format(mResult, combined_args);
- }
+ LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
+ combined_args.insert(mArgs.begin(), mArgs.end());
+ LLStringUtil::format(mResult, combined_args);
}
void LLUIString::updateWResult() const
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 8e705ed701..aba6c310f1 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -265,7 +265,7 @@ public:
virtual BOOL postBuild() { return TRUE; }
- const child_tab_order_t& getCtrlOrder() const { return mCtrlOrder; }
+ child_tab_order_t getCtrlOrder() const { return mCtrlOrder; }
ctrl_list_t getCtrlList() const;
ctrl_list_t getCtrlListSorted() const;
@@ -620,13 +620,12 @@ public:
class LLCompareByTabOrder
{
public:
- LLCompareByTabOrder(const LLView::child_tab_order_t& order) : mTabOrder(order) {}
+ LLCompareByTabOrder(LLView::child_tab_order_t order) : mTabOrder(order) {}
virtual ~LLCompareByTabOrder() {}
bool operator() (const LLView* const a, const LLView* const b) const;
private:
virtual bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const { return a < b; }
- // ok to store a reference, as this should only be allocated on stack during view query operations
- const LLView::child_tab_order_t& mTabOrder;
+ LLView::child_tab_order_t mTabOrder;
};
template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) const
diff --git a/indra/llui/llviewquery.cpp b/indra/llui/llviewquery.cpp
index 1b44cc528e..bdb3d223a6 100644
--- a/indra/llui/llviewquery.cpp
+++ b/indra/llui/llviewquery.cpp
@@ -95,8 +95,8 @@ viewList_t LLViewQuery::run(LLView* view) const
if (pre.first)
{
post = runFilters(view, filtered_children, mPostFilters);
- }
}
+ }
if(pre.first && post.first)
{
@@ -119,12 +119,12 @@ void LLViewQuery::filterChildren(LLView * view, viewList_t & filtered_children)
(*mSorterp)(view, views); // sort the children per the sorter
}
for(LLView::child_list_iter_t iter = views.begin();
- iter != views.end();
- iter++)
- {
- viewList_t indiv_children = this->run(*iter);
- filtered_children.splice(filtered_children.end(), indiv_children);
- }
+ iter != views.end();
+ iter++)
+ {
+ viewList_t indiv_children = this->run(*iter);
+ filtered_children.insert(filtered_children.end(), indiv_children.begin(), indiv_children.end());
+ }
}
filterResult_t LLViewQuery::runFilters(LLView * view, const viewList_t children, const filterList_t filters) const
diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h
index 68af31933d..98d9bf8796 100644
--- a/indra/llui/llviewquery.h
+++ b/indra/llui/llviewquery.h
@@ -122,7 +122,7 @@ public:
viewList_t operator () (LLView * view) const { return run(view); }
// override this method to provide iteration over other types of children
- virtual void filterChildren(LLView * view, viewList_t& filtered_children) const;
+ virtual void filterChildren(LLView * view, viewList_t & filtered_children) const;
private: