diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/llcombobox.cpp | 4 | ||||
-rw-r--r-- | linden/indra/llui/llcombobox.h | 2 | ||||
-rw-r--r-- | linden/indra/llui/llfloater.cpp | 5 | ||||
-rw-r--r-- | linden/indra/llui/llfloater.h | 4 | ||||
-rw-r--r-- | linden/indra/llui/llpanel.cpp | 18 | ||||
-rw-r--r-- | linden/indra/llui/llpanel.h | 6 | ||||
-rw-r--r-- | linden/indra/llui/llscrolllistctrl.cpp | 25 | ||||
-rw-r--r-- | linden/indra/llui/llscrolllistctrl.h | 2 |
8 files changed, 40 insertions, 26 deletions
diff --git a/linden/indra/llui/llcombobox.cpp b/linden/indra/llui/llcombobox.cpp index 48050db..9a2e13b 100644 --- a/linden/indra/llui/llcombobox.cpp +++ b/linden/indra/llui/llcombobox.cpp | |||
@@ -296,9 +296,9 @@ LLScrollListItem* LLComboBox::addSeparator(EAddPosition pos) | |||
296 | return mList->addSeparator(pos); | 296 | return mList->addSeparator(pos); |
297 | } | 297 | } |
298 | 298 | ||
299 | void LLComboBox::sortByName() | 299 | void LLComboBox::sortByName(BOOL ascending) |
300 | { | 300 | { |
301 | mList->sortByColumnIndex(0, TRUE); | 301 | mList->sortOnce(0, ascending); |
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
diff --git a/linden/indra/llui/llcombobox.h b/linden/indra/llui/llcombobox.h index a9dc1c1..f4cf0fb 100644 --- a/linden/indra/llui/llcombobox.h +++ b/linden/indra/llui/llcombobox.h | |||
@@ -115,7 +115,7 @@ public: | |||
115 | BOOL remove( S32 index ); // remove item by index, return TRUE if found and removed | 115 | BOOL remove( S32 index ); // remove item by index, return TRUE if found and removed |
116 | void removeall() { clearRows(); } | 116 | void removeall() { clearRows(); } |
117 | 117 | ||
118 | void sortByName(); // Sort the entries in the combobox by name | 118 | void sortByName(BOOL ascending = TRUE); // Sort the entries in the combobox by name |
119 | 119 | ||
120 | // Select current item by name using selectItemByLabel. Returns FALSE if not found. | 120 | // Select current item by name using selectItemByLabel. Returns FALSE if not found. |
121 | BOOL setSimple(const LLStringExplicit& name); | 121 | BOOL setSimple(const LLStringExplicit& name); |
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index e795ad2..9f8cd65 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp | |||
@@ -724,9 +724,8 @@ BOOL LLFloater::canSnapTo(const LLView* other_view) | |||
724 | 724 | ||
725 | if (other_view != getParent()) | 725 | if (other_view != getParent()) |
726 | { | 726 | { |
727 | LLFloater* other_floaterp = (LLFloater*)other_view; | 727 | const LLFloater* other_floaterp = dynamic_cast<const LLFloater*>(other_view); |
728 | 728 | if (other_floaterp && other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) | |
729 | if (other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) | ||
730 | { | 729 | { |
731 | // this is a dependent that is already snapped to us, so don't snap back to it | 730 | // this is a dependent that is already snapped to us, so don't snap back to it |
732 | return FALSE; | 731 | return FALSE; |
diff --git a/linden/indra/llui/llfloater.h b/linden/indra/llui/llfloater.h index 636125e..0be5d44 100644 --- a/linden/indra/llui/llfloater.h +++ b/linden/indra/llui/llfloater.h | |||
@@ -202,9 +202,9 @@ public: | |||
202 | 202 | ||
203 | void setSnapTarget(LLHandle<LLFloater> handle) { mSnappedTo = handle; } | 203 | void setSnapTarget(LLHandle<LLFloater> handle) { mSnappedTo = handle; } |
204 | void clearSnapTarget() { mSnappedTo.markDead(); } | 204 | void clearSnapTarget() { mSnappedTo.markDead(); } |
205 | LLHandle<LLFloater> getSnapTarget() { return mSnappedTo; } | 205 | LLHandle<LLFloater> getSnapTarget() const { return mSnappedTo; } |
206 | 206 | ||
207 | LLHandle<LLFloater> getHandle() { return mHandle; } | 207 | LLHandle<LLFloater> getHandle() const { return mHandle; } |
208 | 208 | ||
209 | static void closeFocusedFloater(); | 209 | static void closeFocusedFloater(); |
210 | 210 | ||
diff --git a/linden/indra/llui/llpanel.cpp b/linden/indra/llui/llpanel.cpp index f1ccb01..0389590 100644 --- a/linden/indra/llui/llpanel.cpp +++ b/linden/indra/llui/llpanel.cpp | |||
@@ -540,7 +540,7 @@ void LLPanel::initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory) | |||
540 | child->getAttributeString("name", string_name); | 540 | child->getAttributeString("name", string_name); |
541 | if (!string_name.empty()) | 541 | if (!string_name.empty()) |
542 | { | 542 | { |
543 | mUIStrings[string_name] = LLUIString(child->getTextContents()); | 543 | mUIStrings[string_name] = child->getTextContents(); |
544 | } | 544 | } |
545 | } | 545 | } |
546 | else | 546 | else |
@@ -612,7 +612,7 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form | |||
612 | if (found_it != mUIStrings.end()) | 612 | if (found_it != mUIStrings.end()) |
613 | { | 613 | { |
614 | // make a copy as format works in place | 614 | // make a copy as format works in place |
615 | LLUIString formatted_string = found_it->second; | 615 | LLUIString formatted_string = LLUIString(found_it->second); |
616 | formatted_string.setArgList(args); | 616 | formatted_string.setArgList(args); |
617 | return formatted_string.getString(); | 617 | return formatted_string.getString(); |
618 | } | 618 | } |
@@ -630,15 +630,23 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form | |||
630 | return LLStringUtil::null; | 630 | return LLStringUtil::null; |
631 | } | 631 | } |
632 | 632 | ||
633 | LLUIString LLPanel::getUIString(const std::string& name) const | 633 | std::string LLPanel::getString(const std::string& name) const |
634 | { | 634 | { |
635 | ui_string_map_t::const_iterator found_it = mUIStrings.find(name); | 635 | ui_string_map_t::const_iterator found_it = mUIStrings.find(name); |
636 | if (found_it != mUIStrings.end()) | 636 | if (found_it != mUIStrings.end()) |
637 | { | 637 | { |
638 | return found_it->second; | 638 | return found_it->second; |
639 | } | 639 | } |
640 | llerrs << "Failed to find string " << name << " in panel " << getName() << llendl; | 640 | std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate |
641 | return LLUIString(LLStringUtil::null); | 641 | if(LLUI::sQAMode) |
642 | { | ||
643 | llerrs << err_str << llendl; | ||
644 | } | ||
645 | else | ||
646 | { | ||
647 | llwarns << err_str << llendl; | ||
648 | } | ||
649 | return LLStringUtil::null; | ||
642 | } | 650 | } |
643 | 651 | ||
644 | 652 | ||
diff --git a/linden/indra/llui/llpanel.h b/linden/indra/llui/llpanel.h index 46cde5b..8ed739e 100644 --- a/linden/indra/llui/llpanel.h +++ b/linden/indra/llui/llpanel.h | |||
@@ -151,8 +151,8 @@ public: | |||
151 | void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory); | 151 | void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory); |
152 | void setPanelParameters(LLXMLNodePtr node, LLView *parentp); | 152 | void setPanelParameters(LLXMLNodePtr node, LLView *parentp); |
153 | 153 | ||
154 | std::string getString(const std::string& name, const LLStringUtil::format_map_t& args = LLUIString::sNullArgs) const; | 154 | std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const; |
155 | LLUIString getUIString(const std::string& name) const; | 155 | std::string getString(const std::string& name) const; |
156 | 156 | ||
157 | // ** Wrappers for setting child properties by name ** -TomY | 157 | // ** Wrappers for setting child properties by name ** -TomY |
158 | 158 | ||
@@ -261,7 +261,7 @@ private: | |||
261 | S32 mLastTabGroup; | 261 | S32 mLastTabGroup; |
262 | LLRootHandle<LLPanel> mPanelHandle; | 262 | LLRootHandle<LLPanel> mPanelHandle; |
263 | 263 | ||
264 | typedef std::map<std::string, LLUIString> ui_string_map_t; | 264 | typedef std::map<std::string, std::string> ui_string_map_t; |
265 | ui_string_map_t mUIStrings; | 265 | ui_string_map_t mUIStrings; |
266 | 266 | ||
267 | std::string mRequirementsError; | 267 | std::string mRequirementsError; |
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp index 6561bb5..e2623fb 100644 --- a/linden/indra/llui/llscrolllistctrl.cpp +++ b/linden/indra/llui/llscrolllistctrl.cpp | |||
@@ -67,9 +67,6 @@ struct SortScrollListItem | |||
67 | 67 | ||
68 | bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) | 68 | bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) |
69 | { | 69 | { |
70 | if ( mSortOrders.empty() ) | ||
71 | return i1 < i2; | ||
72 | |||
73 | // sort over all columns in order specified by mSortOrders | 70 | // sort over all columns in order specified by mSortOrders |
74 | S32 sort_result = 0; | 71 | S32 sort_result = 0; |
75 | for (sort_order_t::const_reverse_iterator it = mSortOrders.rbegin(); | 72 | for (sort_order_t::const_reverse_iterator it = mSortOrders.rbegin(); |
@@ -91,7 +88,8 @@ struct SortScrollListItem | |||
91 | } | 88 | } |
92 | } | 89 | } |
93 | 90 | ||
94 | return sort_result < 0; | 91 | // make sure to keep order when sort_result == 0 |
92 | return sort_result <= 0; | ||
95 | } | 93 | } |
96 | 94 | ||
97 | typedef std::vector<std::pair<S32, BOOL> > sort_order_t; | 95 | typedef std::vector<std::pair<S32, BOOL> > sort_order_t; |
@@ -2539,12 +2537,6 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void | |||
2539 | 2537 | ||
2540 | void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) | 2538 | void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) |
2541 | { | 2539 | { |
2542 | if (name.empty()) | ||
2543 | { | ||
2544 | sortItems(); | ||
2545 | return; | ||
2546 | } | ||
2547 | |||
2548 | std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name); | 2540 | std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name); |
2549 | if (itor != mColumns.end()) | 2541 | if (itor != mColumns.end()) |
2550 | { | 2542 | { |
@@ -2572,6 +2564,19 @@ void LLScrollListCtrl::sortItems() | |||
2572 | setSorted(TRUE); | 2564 | setSorted(TRUE); |
2573 | } | 2565 | } |
2574 | 2566 | ||
2567 | // for one-shot sorts, does not save sort column/order | ||
2568 | void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) | ||
2569 | { | ||
2570 | std::vector<std::pair<S32, BOOL> > sort_column; | ||
2571 | sort_column.push_back(std::make_pair(column, ascending)); | ||
2572 | |||
2573 | // do stable sort to preserve any previous sorts | ||
2574 | std::stable_sort( | ||
2575 | mItemList.begin(), | ||
2576 | mItemList.end(), | ||
2577 | SortScrollListItem(sort_column)); | ||
2578 | } | ||
2579 | |||
2575 | void LLScrollListCtrl::dirtyColumns() | 2580 | void LLScrollListCtrl::dirtyColumns() |
2576 | { | 2581 | { |
2577 | mColumnsDirty = TRUE; | 2582 | mColumnsDirty = TRUE; |
diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h index 6f26c8d..12b8e2c 100644 --- a/linden/indra/llui/llscrolllistctrl.h +++ b/linden/indra/llui/llscrolllistctrl.h | |||
@@ -622,6 +622,8 @@ public: | |||
622 | 622 | ||
623 | S32 selectMultiple( LLDynamicArray<LLUUID> ids ); | 623 | S32 selectMultiple( LLDynamicArray<LLUUID> ids ); |
624 | void sortItems(); | 624 | void sortItems(); |
625 | // sorts a list without affecting the permanent sort order (so further list insertions can be unsorted, for example) | ||
626 | void sortOnce(S32 column, BOOL ascending); | ||
625 | 627 | ||
626 | // manually call this whenever editing list items in place to flag need for resorting | 628 | // manually call this whenever editing list items in place to flag need for resorting |
627 | void setSorted(BOOL sorted) { mSorted = sorted; } | 629 | void setSorted(BOOL sorted) { mSorted = sorted; } |