diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-10-30 18:08:25 +0200 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-10-30 22:14:52 +0200 |
| commit | 1d42bf740b07cfc76a43d3bcc558d627480d9472 (patch) | |
| tree | 2c3ea90205946a0053c4b8b7d4301e66d9ddc5de | |
| parent | fa055104fc66f7b8779b3d3d399cd9cbb4057e76 (diff) | |
#3670 Add a sortable status column to the list of gestures
| -rw-r--r-- | indra/llui/llscrolllistcell.cpp | 32 | ||||
| -rw-r--r-- | indra/llui/llscrolllistcell.h | 2 | ||||
| -rw-r--r-- | indra/newview/llfloatergesture.cpp | 82 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_gesture.xml | 6 |
4 files changed, 82 insertions, 40 deletions
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index a3108d77e8..bdf88768c3 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -98,6 +98,7 @@ const LLSD LLScrollListCell::getAltValue() const LLScrollListIcon::LLScrollListIcon(const LLScrollListCell::Params& p) : LLScrollListCell(p), mIcon(LLUI::getUIImage(p.value().asString())), + mIconSize(0), mColor(p.color), mAlignment(p.font_halign) {} @@ -140,20 +141,32 @@ void LLScrollListIcon::setValue(const LLSD& value) } } - void LLScrollListIcon::setColor(const LLColor4& color) { mColor = color; } +void LLScrollListIcon::setIconSize(S32 size) +{ + mIconSize = size; +} + S32 LLScrollListIcon::getWidth() const { // if no specified fix width, use width of icon - if (LLScrollListCell::getWidth() == 0 && mIcon.notNull()) + if (LLScrollListCell::getWidth() != 0) + { + return LLScrollListCell::getWidth(); + } + if (mIconSize != 0) + { + return mIconSize; + } + if (mIcon.notNull()) { return mIcon->getWidth(); } - return LLScrollListCell::getWidth(); + return 0; } @@ -161,16 +174,23 @@ void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_col { if (mIcon) { + S32 draw_width = mIcon->getWidth(); + S32 draw_height = mIcon->getHeight(); + if (mIconSize != 0) + { + draw_width = mIconSize; + draw_height = mIconSize; + } // else will draw full icon even if cell is smaller switch(mAlignment) { case LLFontGL::LEFT: - mIcon->draw(0, 0, mColor); + mIcon->draw(0, 0, draw_width, draw_height, mColor); break; case LLFontGL::RIGHT: - mIcon->draw(getWidth() - mIcon->getWidth(), 0, mColor); + mIcon->draw(getWidth() - draw_width, 0, draw_width, draw_height, mColor); break; case LLFontGL::HCENTER: - mIcon->draw((getWidth() - mIcon->getWidth()) / 2, 0, mColor); + mIcon->draw((getWidth() - draw_width) / 2, 0, draw_width, draw_height, mColor); break; default: break; diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index 7dded3c0b7..f0a0f216b4 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -197,11 +197,13 @@ public: /*virtual*/ const LLSD getValue() const; /*virtual*/ void setColor(const LLColor4&); /*virtual*/ void setValue(const LLSD& value); + void setIconSize(S32 size); private: LLPointer<LLUIImage> mIcon; LLColor4 mColor; LLFontGL::HAlign mAlignment; + S32 mIconSize; }; diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 936096d8fe..21ae98d380 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -320,15 +320,29 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur if (gesture) { + element["columns"][0]["column"] = "active"; + element["columns"][0]["type"] = "icon"; if (gesture->mPlaying) { font_style = "BOLD"; + element["columns"][0]["value"] = "Activate_Checkmark"; } + + // Only add "playing" if we've got the name, less confusing. JC item_name = gesture->mName; - element["columns"][0]["column"] = "trigger"; - element["columns"][0]["value"] = gesture->mTrigger; - element["columns"][0]["font"]["name"] = "SANSSERIF"; - element["columns"][0]["font"]["style"] = font_style; + if (item && gesture->mPlaying) + { + item_name += " " + getString("playing"); + } + element["columns"][1]["column"] = "name"; + element["columns"][1]["value"] = item_name; + element["columns"][1]["font"]["name"] = "SANSSERIF"; + element["columns"][1]["font"]["style"] = font_style; + + element["columns"][2]["column"] = "trigger"; + element["columns"][2]["value"] = gesture->mTrigger; + element["columns"][2]["font"]["name"] = "SANSSERIF"; + element["columns"][2]["font"]["style"] = font_style; std::string key_string; std::string buffer; @@ -345,45 +359,38 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur gesture->mKey); } - element["columns"][1]["column"] = "shortcut"; - element["columns"][1]["value"] = buffer; - element["columns"][1]["font"]["name"] = "SANSSERIF"; - element["columns"][1]["font"]["style"] = font_style; - // hidden column for sorting - element["columns"][2]["column"] = "key"; - element["columns"][2]["value"] = key_string; - element["columns"][2]["font"]["name"] = "SANSSERIF"; - element["columns"][2]["font"]["style"] = font_style; - - // Only add "playing" if we've got the name, less confusing. JC - if (item && gesture->mPlaying) - { - item_name += " " + getString("playing"); - } - element["columns"][3]["column"] = "name"; - element["columns"][3]["value"] = item_name; + element["columns"][3]["column"] = "key"; + element["columns"][3]["value"] = key_string; element["columns"][3]["font"]["name"] = "SANSSERIF"; element["columns"][3]["font"]["style"] = font_style; + + element["columns"][4]["column"] = "shortcut"; + element["columns"][4]["value"] = buffer; + element["columns"][4]["font"]["name"] = "SANSSERIF"; + element["columns"][4]["font"]["style"] = font_style; } else { - element["columns"][0]["column"] = "trigger"; + element["columns"][0]["column"] = "active"; + element["columns"][0]["type"] = "icon"; element["columns"][0]["value"] = ""; - element["columns"][0]["font"]["name"] = "SANSSERIF"; - element["columns"][0]["font"]["style"] = font_style; - element["columns"][1]["column"] = "shortcut"; - element["columns"][1]["value"] = "---"; + element["columns"][1]["column"] = "name"; + element["columns"][1]["value"] = item_name; element["columns"][1]["font"]["name"] = "SANSSERIF"; element["columns"][1]["font"]["style"] = font_style; - element["columns"][2]["column"] = "key"; - element["columns"][2]["value"] = "~~~"; + element["columns"][2]["column"] = "trigger"; + element["columns"][2]["value"] = ""; element["columns"][2]["font"]["name"] = "SANSSERIF"; element["columns"][2]["font"]["style"] = font_style; - element["columns"][3]["column"] = "name"; - element["columns"][3]["value"] = item_name; + element["columns"][3]["column"] = "key"; + element["columns"][3]["value"] = "~~~"; element["columns"][3]["font"]["name"] = "SANSSERIF"; element["columns"][3]["font"]["style"] = font_style; + element["columns"][4]["column"] = "shortcut"; + element["columns"][4]["value"] = "---"; + element["columns"][4]["font"]["name"] = "SANSSERIF"; + element["columns"][4]["font"]["style"] = font_style; } LL_DEBUGS("Gesture") << "Added gesture [" << item_name << "]" << LL_ENDL; @@ -391,9 +398,18 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur LLScrollListItem* sl_item = list->addElement(element, ADD_BOTTOM); if(sl_item) { - LLFontGL::StyleFlags style = LLGestureMgr::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL; - // *TODO find out why ["font"]["style"] does not affect font style - ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style); + if (LLGestureMgr::getInstance()->isGestureActive(item_id)) + { + // If gesture was not yet loaded, will have to set active state here + ((LLScrollListIcon*)sl_item->getColumn(0))->setValue("Activate_Checkmark"); + ((LLScrollListIcon*)sl_item->getColumn(0))->setIconSize(10); + ((LLScrollListText*)sl_item->getColumn(1))->setFontStyle(LLFontGL::BOLD); + } + else + { + ((LLScrollListIcon*)sl_item->getColumn(0))->setValue(""); + ((LLScrollListText*)sl_item->getColumn(1))->setFontStyle(LLFontGL::NORMAL); + } } } diff --git a/indra/newview/skins/default/xui/en/floater_gesture.xml b/indra/newview/skins/default/xui/en/floater_gesture.xml index 832716c600..51e740d687 100644 --- a/indra/newview/skins/default/xui/en/floater_gesture.xml +++ b/indra/newview/skins/default/xui/en/floater_gesture.xml @@ -35,9 +35,13 @@ top="20" name="gesture_list"> <scroll_list.columns + label="" + name="active" + width="10" /> + <scroll_list.columns label="Name" name="name" - width="153" /> + width="143" /> <scroll_list.columns label="Chat" name="trigger" |
