diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbutton.cpp | 23 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 5 | ||||
-rw-r--r-- | indra/llui/llemojidictionary.cpp | 10 | ||||
-rw-r--r-- | indra/llui/llemojidictionary.h | 14 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 18 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 4 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.h | 30 |
8 files changed, 73 insertions, 35 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 3354cb2db3..aeeff0b36f 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -68,6 +68,7 @@ LLButton::Params::Params() label_shadow("label_shadow", true), auto_resize("auto_resize", false), use_ellipses("use_ellipses", false), + use_font_color("use_font_color", false), image_unselected("image_unselected"), image_selected("image_selected"), image_hover_selected("image_hover_selected"), @@ -160,6 +161,7 @@ LLButton::LLButton(const LLButton::Params& p) mDropShadowedText(p.label_shadow), mAutoResize(p.auto_resize), mUseEllipses( p.use_ellipses ), + mUseFontColor( p.use_font_color), mHAlign(p.font_halign), mLeftHPad(p.pad_left), mRightHPad(p.pad_right), @@ -960,7 +962,7 @@ void LLButton::draw() LLFontGL::NORMAL, mDropShadowedText ? LLFontGL::DROP_SHADOW_SOFT : LLFontGL::NO_SHADOW, S32_MAX, text_width, - NULL, mUseEllipses); + NULL, mUseEllipses, mUseFontColor); } LLUICtrl::draw(); @@ -1020,6 +1022,16 @@ BOOL LLButton::toggleState() return flipped; } +void LLButton::setLabel( const std::string& label ) +{ + mUnselectedLabel = mSelectedLabel = label; +} + +void LLButton::setLabel( const LLUIString& label ) +{ + mUnselectedLabel = mSelectedLabel = label; +} + void LLButton::setLabel( const LLStringExplicit& label ) { setLabelUnselected(label); @@ -1051,14 +1063,7 @@ bool LLButton::labelIsTruncated() const const LLUIString& LLButton::getCurrentLabel() const { - if( getToggleState() ) - { - return mSelectedLabel; - } - else - { - return mUnselectedLabel; - } + return getToggleState() ? mSelectedLabel : mUnselectedLabel; } void LLButton::setImageUnselected(LLPointer<LLUIImage> image) diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index ccd31e90c0..257159f64f 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -73,6 +73,7 @@ public: Optional<bool> label_shadow; Optional<bool> auto_resize; Optional<bool> use_ellipses; + Optional<bool> use_font_color; // images Optional<LLUIImage*> image_unselected, @@ -174,6 +175,7 @@ public: void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; } void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; } void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } + void setUseFontColor( BOOL use_font_color) { mUseFontColor = use_font_color; } boost::signals2::connection setClickedCallback(const CommitCallbackParam& cb); @@ -238,6 +240,8 @@ public: void autoResize(); // resize with label of current btn state void resize(LLUIString label); // resize with label input + void setLabel(const std::string& label); + void setLabel(const LLUIString& label); void setLabel( const LLStringExplicit& label); virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); void setLabelUnselected(const LLStringExplicit& label); @@ -353,6 +357,7 @@ protected: bool mDropShadowedText; bool mAutoResize; bool mUseEllipses; + bool mUseFontColor; bool mBorderEnabled; bool mFlashing; diff --git a/indra/llui/llemojidictionary.cpp b/indra/llui/llemojidictionary.cpp index b70a9b2e7a..d306407484 100644 --- a/indra/llui/llemojidictionary.cpp +++ b/indra/llui/llemojidictionary.cpp @@ -175,6 +175,12 @@ LLWString LLEmojiDictionary::findMatchingEmojis(const std::string& needle) const return result; } +const LLEmojiDescriptor* LLEmojiDictionary::getDescriptorFromEmoji(llwchar emoji) const +{ + const auto it = mEmoji2Descr.find(emoji); + return (mEmoji2Descr.end() != it) ? it->second : nullptr; +} + const LLEmojiDescriptor* LLEmojiDictionary::getDescriptorFromShortCode(const std::string& short_code) const { const auto it = mShortCode2Descr.find(short_code); @@ -195,6 +201,10 @@ void LLEmojiDictionary::addEmoji(LLEmojiDescriptor&& descr) { mShortCode2Descr.insert(std::make_pair(shortCode, &mEmojis.back())); } + for (const std::string& category : descr.Categories) + { + mCategory2Descrs[category].push_back(&mEmojis.back()); + } } // ============================================================================ diff --git a/indra/llui/llemojidictionary.h b/indra/llui/llemojidictionary.h index adc22ced58..cbb0ac577d 100644 --- a/indra/llui/llemojidictionary.h +++ b/indra/llui/llemojidictionary.h @@ -56,20 +56,28 @@ class LLEmojiDictionary : public LLParamSingleton<LLEmojiDictionary>, public LLI ~LLEmojiDictionary() override {}; public: + typedef std::map<llwchar, const LLEmojiDescriptor*> emoji2descr_map_t; + typedef std::map<std::string, const LLEmojiDescriptor*> code2descr_map_t; + typedef std::map<std::string, std::vector<const LLEmojiDescriptor*>> cat2descrs_map_t; + static void initClass(); LLWString findMatchingEmojis(const std::string& needle) const; + const LLEmojiDescriptor* getDescriptorFromEmoji(llwchar emoji) const; const LLEmojiDescriptor* getDescriptorFromShortCode(const std::string& short_code) const; std::string getNameFromEmoji(llwchar ch) const; - const std::map<llwchar, const LLEmojiDescriptor*>& getEmoji2Descr() const { return mEmoji2Descr; } + const emoji2descr_map_t& getEmoji2Descr() const { return mEmoji2Descr; } + const code2descr_map_t& getShortCode2Descr() const { return mShortCode2Descr; } + const cat2descrs_map_t& getCategory2Descrs() const { return mCategory2Descrs; } private: void addEmoji(LLEmojiDescriptor&& descr); private: std::list<LLEmojiDescriptor> mEmojis; - std::map<llwchar, const LLEmojiDescriptor*> mEmoji2Descr; - std::map<std::string, const LLEmojiDescriptor*> mShortCode2Descr; + emoji2descr_map_t mEmoji2Descr; + code2descr_map_t mShortCode2Descr; + cat2descrs_map_t mCategory2Descrs; }; // ============================================================================ diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 346e89a101..98895d56dd 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1509,14 +1509,24 @@ BOOL LLFloater::isFrontmost() && floater_view->getFrontmost() == this); } -void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition) +void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition, BOOL resize) { mDependents.insert(floaterp->getHandle()); floaterp->mDependeeHandle = getHandle(); if (reposition) { - floaterp->setRect(gFloaterView->findNeighboringPosition(this, floaterp)); + LLRect rect = gFloaterView->findNeighboringPosition(this, floaterp); + if (resize) + { + const LLRect& base = getRect(); + if (rect.mTop == base.mTop) + rect.mBottom = base.mBottom; + else if (rect.mLeft == base.mLeft) + rect.mRight = base.mRight; + floaterp->reshape(rect.getWidth(), rect.getHeight(), FALSE); + } + floaterp->setRect(rect); floaterp->setSnapTarget(getHandle()); } gFloaterView->adjustToFitScreen(floaterp, FALSE, TRUE); @@ -1527,12 +1537,12 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition) } } -void LLFloater::addDependentFloater(LLHandle<LLFloater> dependent, BOOL reposition) +void LLFloater::addDependentFloater(LLHandle<LLFloater> dependent, BOOL reposition, BOOL resize) { LLFloater* dependent_floaterp = dependent.get(); if(dependent_floaterp) { - addDependentFloater(dependent_floaterp, reposition); + addDependentFloater(dependent_floaterp, reposition, resize); } } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 282f7a80ac..3699629ef8 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -255,8 +255,8 @@ public: std::string getShortTitle() const; virtual void setMinimized(BOOL b); void moveResizeHandlesToFront(); - void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE); - void addDependentFloater(LLHandle<LLFloater> dependent_handle, BOOL reposition = TRUE); + void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE, BOOL resize = FALSE); + void addDependentFloater(LLHandle<LLFloater> dependent_handle, BOOL reposition = TRUE, BOOL resize = FALSE); LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); } void removeDependentFloater(LLFloater* dependent); BOOL isMinimized() const { return mMinimized; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 2a6e8a6b76..f982dc99e8 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1269,7 +1269,7 @@ BOOL LLScrollListCtrl::selectItemByLabel(const std::string& label, BOOL case_sen LLScrollListItem* item = getItemByLabel(label, case_sensitive, column); bool found = NULL != item; - if(found) + if (found) { selectItem(item, -1); } @@ -2747,7 +2747,7 @@ BOOL LLScrollListCtrl::setSort(S32 column_idx, BOOL ascending) S32 LLScrollListCtrl::getLinesPerPage() { //if mPageLines is NOT provided display all item - if(mPageLines) + if (mPageLines) { return mPageLines; } diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 73b4fb036a..326589a329 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -253,7 +253,7 @@ public: S32 getItemIndex( LLScrollListItem* item ) const; S32 getItemIndex( const LLUUID& item_id ) const; - void setCommentText( const std::string& comment_text); + void setCommentText( const std::string& comment_text); LLScrollListItem* addSeparator(EAddPosition pos); // "Simple" interface: use this when you're creating a list that contains only unique strings, only @@ -263,7 +263,7 @@ public: BOOL selectItemByLabel( const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0 ); // FALSE if item not found BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE, S32 column = -1); BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE, S32 column = -1); - LLScrollListItem* getItemByLabel( const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0 ); + LLScrollListItem* getItemByLabel(const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0); const std::string getSelectedItemLabel(S32 column = 0) const; LLSD getSelectedValue(); @@ -322,7 +322,7 @@ public: virtual S32 getScrollPos() const; virtual void setScrollPos( S32 pos ); - S32 getSearchColumn(); + S32 getSearchColumn(); void setSearchColumn(S32 column) { mSearchColumn = column; } S32 getColumnIndexFromOffset(S32 x); S32 getColumnOffsetFromIndex(S32 index); @@ -371,13 +371,13 @@ public: // Used "internally" by the scroll bar. void onScrollChange( S32 new_pos, LLScrollbar* src ); - static void onClickColumn(void *userdata); + static void onClickColumn(void *userdata); - virtual void updateColumns(bool force_update = false); - S32 calcMaxContentWidth(); - bool updateColumnWidths(); + virtual void updateColumns(bool force_update = false); + S32 calcMaxContentWidth(); + bool updateColumnWidths(); - void setHeadingHeight(S32 heading_height); + void setHeadingHeight(S32 heading_height); /** * Sets max visible lines without scroolbar, if this value equals to 0, * then display all items. @@ -398,18 +398,20 @@ public: virtual void deselect(); virtual BOOL canDeselect() const; - void setNumDynamicColumns(S32 num) { mNumDynamicWidthColumns = num; } - void updateStaticColumnWidth(LLScrollListColumn* col, S32 new_width); - S32 getTotalStaticColumnWidth() { return mTotalStaticColumnWidth; } + void setNumDynamicColumns(S32 num) { mNumDynamicWidthColumns = num; } + void updateStaticColumnWidth(LLScrollListColumn* col, S32 new_width); + S32 getTotalStaticColumnWidth() { return mTotalStaticColumnWidth; } std::string getSortColumnName(); BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; } BOOL hasSortOrder() const; void clearSortOrder(); - void setAlternateSort() { mAlternateSort = true; } + void setAlternateSort() { mAlternateSort = TRUE; } - S32 selectMultiple( uuid_vec_t ids ); + void selectPrevItem(BOOL extend_selection = FALSE); + void selectNextItem(BOOL extend_selection = FALSE); + S32 selectMultiple(uuid_vec_t ids); // conceptually const, but mutates mItemList void updateSort() const; // sorts a list without affecting the permanent sort order (so further list insertions can be unsorted, for example) @@ -454,8 +456,6 @@ protected: void updateLineHeight(); private: - void selectPrevItem(BOOL extend_selection); - void selectNextItem(BOOL extend_selection); void drawItems(); void updateLineHeightInsert(LLScrollListItem* item); |