Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions indra/llui/llscrolllistcell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{}
Expand Down Expand Up @@ -140,37 +141,56 @@ 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;
}


void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_color)
{
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;
Expand Down
2 changes: 2 additions & 0 deletions indra/llui/llscrolllistcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,13 @@ class LLScrollListIcon : public LLScrollListCell
/*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;
};


Expand Down
82 changes: 49 additions & 33 deletions indra/newview/llfloatergesture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -345,55 +359,57 @@ 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;

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);
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion indra/newview/skins/default/xui/en/floater_gesture.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@
multi_select="true"
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"
Expand Down