diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-09-29 19:14:50 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-09-29 19:14:50 +0000 |
commit | d725e5b24075b2171f8a5b263969991e9b475078 (patch) | |
tree | f1422064fd0ab676dfa66d39b5d0f0b9e8ff1086 /indra/llui | |
parent | 66739da16407a8e56accc236bd3996c1963a6bcf (diff) |
QAR-872 Viewer 1.21 RC 3
merge viewer_1-21 96116-97380 -> release
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llcombobox.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llcombobox.h | 2 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 4 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 18 | ||||
-rw-r--r-- | indra/llui/llpanel.h | 6 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 25 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.h | 2 |
8 files changed, 40 insertions, 26 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 89ce68a32e..df5bcbe752 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -296,9 +296,9 @@ LLScrollListItem* LLComboBox::addSeparator(EAddPosition pos) return mList->addSeparator(pos); } -void LLComboBox::sortByName() +void LLComboBox::sortByName(BOOL ascending) { - mList->sortByColumnIndex(0, TRUE); + mList->sortOnce(0, ascending); } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index ce923e277d..7427a33129 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -115,7 +115,7 @@ public: BOOL remove( S32 index ); // remove item by index, return TRUE if found and removed void removeall() { clearRows(); } - void sortByName(); // Sort the entries in the combobox by name + void sortByName(BOOL ascending = TRUE); // Sort the entries in the combobox by name // Select current item by name using selectItemByLabel. Returns FALSE if not found. BOOL setSimple(const LLStringExplicit& name); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 7f8f54a44a..78a4362618 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -724,9 +724,8 @@ BOOL LLFloater::canSnapTo(const LLView* other_view) if (other_view != getParent()) { - LLFloater* other_floaterp = (LLFloater*)other_view; - - if (other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) + const LLFloater* other_floaterp = dynamic_cast<const LLFloater*>(other_view); + if (other_floaterp && other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) { // this is a dependent that is already snapped to us, so don't snap back to it return FALSE; diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 4ca15857b9..f3941ff7d1 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -202,9 +202,9 @@ public: void setSnapTarget(LLHandle<LLFloater> handle) { mSnappedTo = handle; } void clearSnapTarget() { mSnappedTo.markDead(); } - LLHandle<LLFloater> getSnapTarget() { return mSnappedTo; } + LLHandle<LLFloater> getSnapTarget() const { return mSnappedTo; } - LLHandle<LLFloater> getHandle() { return mHandle; } + LLHandle<LLFloater> getHandle() const { return mHandle; } static void closeFocusedFloater(); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 700558094b..f6c621444d 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -540,7 +540,7 @@ void LLPanel::initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory) child->getAttributeString("name", string_name); if (!string_name.empty()) { - mUIStrings[string_name] = LLUIString(child->getTextContents()); + mUIStrings[string_name] = child->getTextContents(); } } else @@ -612,7 +612,7 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form if (found_it != mUIStrings.end()) { // make a copy as format works in place - LLUIString formatted_string = found_it->second; + LLUIString formatted_string = LLUIString(found_it->second); formatted_string.setArgList(args); return formatted_string.getString(); } @@ -630,15 +630,23 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form return LLStringUtil::null; } -LLUIString LLPanel::getUIString(const std::string& name) const +std::string LLPanel::getString(const std::string& name) const { ui_string_map_t::const_iterator found_it = mUIStrings.find(name); if (found_it != mUIStrings.end()) { return found_it->second; } - llerrs << "Failed to find string " << name << " in panel " << getName() << llendl; - return LLUIString(LLStringUtil::null); + std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate + if(LLUI::sQAMode) + { + llerrs << err_str << llendl; + } + else + { + llwarns << err_str << llendl; + } + return LLStringUtil::null; } diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 1fe6a5679e..355e32f1cd 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -151,8 +151,8 @@ public: void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory); void setPanelParameters(LLXMLNodePtr node, LLView *parentp); - std::string getString(const std::string& name, const LLStringUtil::format_map_t& args = LLUIString::sNullArgs) const; - LLUIString getUIString(const std::string& name) const; + std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const; + std::string getString(const std::string& name) const; // ** Wrappers for setting child properties by name ** -TomY @@ -261,7 +261,7 @@ private: S32 mLastTabGroup; LLRootHandle<LLPanel> mPanelHandle; - typedef std::map<std::string, LLUIString> ui_string_map_t; + typedef std::map<std::string, std::string> ui_string_map_t; ui_string_map_t mUIStrings; std::string mRequirementsError; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 3c29795cb4..275cc65976 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -67,9 +67,6 @@ struct SortScrollListItem bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) { - if ( mSortOrders.empty() ) - return i1 < i2; - // sort over all columns in order specified by mSortOrders S32 sort_result = 0; for (sort_order_t::const_reverse_iterator it = mSortOrders.rbegin(); @@ -91,7 +88,8 @@ struct SortScrollListItem } } - return sort_result < 0; + // make sure to keep order when sort_result == 0 + return sort_result <= 0; } typedef std::vector<std::pair<S32, BOOL> > sort_order_t; @@ -2539,12 +2537,6 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) { - if (name.empty()) - { - sortItems(); - return; - } - std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name); if (itor != mColumns.end()) { @@ -2572,6 +2564,19 @@ void LLScrollListCtrl::sortItems() setSorted(TRUE); } +// for one-shot sorts, does not save sort column/order +void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) +{ + std::vector<std::pair<S32, BOOL> > sort_column; + sort_column.push_back(std::make_pair(column, ascending)); + + // do stable sort to preserve any previous sorts + std::stable_sort( + mItemList.begin(), + mItemList.end(), + SortScrollListItem(sort_column)); +} + void LLScrollListCtrl::dirtyColumns() { mColumnsDirty = TRUE; diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 9dfaf129f8..0128c01eba 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -622,6 +622,8 @@ public: S32 selectMultiple( LLDynamicArray<LLUUID> ids ); void sortItems(); + // sorts a list without affecting the permanent sort order (so further list insertions can be unsorted, for example) + void sortOnce(S32 column, BOOL ascending); // manually call this whenever editing list items in place to flag need for resorting void setSorted(BOOL sorted) { mSorted = sorted; } |