Updates to LLScrollListCtrl and related inter-dependencies. Also added ability to set face texture to 'None' (LLUUID::null).

This commit is contained in:
Shyotl
2012-12-08 00:56:58 -06:00
parent f80394fc02
commit 9fb4e677a6
49 changed files with 1281 additions and 1081 deletions

View File

@@ -56,6 +56,7 @@ public:
}; };
LLDynamicArray(S32 size=0) : std::vector<Type>(size) { if (size < BlockSize) std::vector<Type>::reserve(BlockSize); } LLDynamicArray(S32 size=0) : std::vector<Type>(size) { if (size < BlockSize) std::vector<Type>::reserve(BlockSize); }
LLDynamicArray(const std::vector<Type>& copy) : std::vector<Type>(copy) {}
void reset() { std::vector<Type>::clear(); } void reset() { std::vector<Type>::clear(); }

View File

@@ -615,7 +615,7 @@ void LLComboBox::showList()
S32 min_width = getRect().getWidth(); S32 min_width = getRect().getWidth();
S32 max_width = llmax(min_width, MAX_COMBO_WIDTH); S32 max_width = llmax(min_width, MAX_COMBO_WIDTH);
// make sure we have up to date content width metrics // make sure we have up to date content width metrics
mList->calcColumnWidths(); mList->updateColumnWidths();
S32 list_width = llclamp(mList->getMaxContentWidth(), min_width, max_width); S32 list_width = llclamp(mList->getMaxContentWidth(), min_width, max_width);
if (mListPosition == BELOW) if (mListPosition == BELOW)
@@ -707,7 +707,7 @@ void LLComboBox::hideList()
mButton->setToggleState(FALSE); mButton->setToggleState(FALSE);
mList->setVisible(FALSE); mList->setVisible(FALSE);
mList->highlightNthItem(-1); mList->mouseOverHighlightNthItem(-1);
setUseBoundingRect(FALSE); setUseBoundingRect(FALSE);
if( gFocusMgr.getTopCtrl() == this ) if( gFocusMgr.getTopCtrl() == this )
@@ -731,7 +731,7 @@ void LLComboBox::onButtonDown(void *userdata)
if (last_selected_item) if (last_selected_item)
{ {
// highlight the original selection before potentially selecting a new item // highlight the original selection before potentially selecting a new item
self->mList->highlightNthItem(self->mList->getItemIndex(last_selected_item)); self->mList->mouseOverHighlightNthItem(self->mList->getItemIndex(last_selected_item));
} }
if( self->mPrearrangeCallback ) if( self->mPrearrangeCallback )
@@ -839,7 +839,7 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask)
if (last_selected_item) if (last_selected_item)
{ {
// highlight the original selection before potentially selecting a new item // highlight the original selection before potentially selecting a new item
mList->highlightNthItem(mList->getItemIndex(last_selected_item)); mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item));
} }
result = mList->handleKeyHere(key, mask); result = mList->handleKeyHere(key, mask);
@@ -873,7 +873,7 @@ BOOL LLComboBox::handleUnicodeCharHere(llwchar uni_char)
if (last_selected_item) if (last_selected_item)
{ {
// highlight the original selection before potentially selecting a new item // highlight the original selection before potentially selecting a new item
mList->highlightNthItem(mList->getItemIndex(last_selected_item)); mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item));
} }
result = mList->handleUnicodeCharHere(uni_char); result = mList->handleUnicodeCharHere(uni_char);
if (mList->getLastSelectedItem() != last_selected_item) if (mList->getLastSelectedItem() != last_selected_item)

View File

@@ -57,7 +57,7 @@ const BOOL BORDER_NO = FALSE;
* With or without border, * With or without border,
* Can contain LLUICtrls. * Can contain LLUICtrls.
*/ */
class LLPanel : public LLUICtrl, public boost::signals2::trackable class LLPanel : public LLUICtrl
{ {
public: public:

File diff suppressed because it is too large Load Diff

View File

@@ -51,6 +51,7 @@
#include "lldate.h" #include "lldate.h"
// <edit> // <edit>
#include "lllineeditor.h" #include "lllineeditor.h"
#include <boost/function.hpp>
// </edit> // </edit>
/* /*
@@ -69,13 +70,13 @@ public:
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const = 0; // truncate to given width, if possible virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const = 0; // truncate to given width, if possible
virtual S32 getWidth() const {return mWidth;} virtual S32 getWidth() const {return mWidth;}
virtual S32 getContentWidth() const { return 0; } virtual S32 getContentWidth() const { return 0; }
virtual S32 getHeight() const = 0; virtual S32 getHeight() const { return 0; }
virtual const LLSD getValue() const { return LLStringUtil::null; } virtual const LLSD getValue() const { return LLStringUtil::null; }
virtual void setValue(const LLSD& value) { } virtual void setValue(const LLSD& value) { }
virtual BOOL getVisible() const { return TRUE; } virtual BOOL getVisible() const { return TRUE; }
virtual void setWidth(S32 width) { mWidth = width; } virtual void setWidth(S32 width) { mWidth = width; }
virtual void highlightText(S32 offset, S32 num_chars) {} virtual void highlightText(S32 offset, S32 num_chars) {}
virtual BOOL isText() const = 0; virtual BOOL isText() const { return FALSE; }
virtual void setColor(const LLColor4&) {} virtual void setColor(const LLColor4&) {}
virtual void onCommit() {}; virtual void onCommit() {};
@@ -86,19 +87,6 @@ private:
S32 mWidth; S32 mWidth;
}; };
/*
* Draws a horizontal line.
*/
class LLScrollListSeparator : public LLScrollListCell
{
public:
LLScrollListSeparator(S32 width);
virtual ~LLScrollListSeparator() {};
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; // truncate to given width, if possible
virtual S32 getHeight() const;
virtual BOOL isText() const { return FALSE; }
};
/* /*
* Cell displaying a text label. * Cell displaying a text label.
*/ */
@@ -108,22 +96,27 @@ public:
LLScrollListText( const std::string& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE); LLScrollListText( const std::string& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE);
/*virtual*/ ~LLScrollListText(); /*virtual*/ ~LLScrollListText();
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
virtual S32 getContentWidth() const; /*virtual*/ S32 getContentWidth() const;
virtual S32 getHeight() const; /*virtual*/ S32 getHeight() const;
virtual void setValue(const LLSD& value); /*virtual*/ void setValue(const LLSD& value);
virtual const LLSD getValue() const; /*virtual*/ const LLSD getValue() const;
virtual BOOL getVisible() const; /*virtual*/ BOOL getVisible() const;
virtual void highlightText(S32 offset, S32 num_chars); /*virtual*/ void highlightText(S32 offset, S32 num_chars);
virtual void setColor(const LLColor4&); /*virtual*/ void setColor(const LLColor4&);
virtual BOOL isText() const; /*virtual*/ BOOL isText() const;
S32 getTextWidth() const { return mTextWidth;}
void setTextWidth(S32 value) { mTextWidth = value;}
virtual void setWidth(S32 width) { LLScrollListCell::setWidth(width); mTextWidth = width; }
void setText(const LLStringExplicit& text); void setText(const LLStringExplicit& text);
void setFontStyle(const U8 font_style) { mFontStyle = font_style; } void setFontStyle(const U8 font_style);
private: private:
LLUIString mText; LLUIString mText;
S32 mTextWidth;
const LLFontGL* mFont; const LLFontGL* mFont;
LLColor4 mColor; LLColor4 mColor;
U8 mUseColor; U8 mUseColor;
@@ -138,18 +131,6 @@ private:
static U32 sCount; static U32 sCount;
}; };
class LLScrollListDate : public LLScrollListText
{
public:
LLScrollListDate( const LLDate& date, const LLFontGL* font, S32 width=0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE);
virtual void setValue(const LLSD& value);
virtual const LLSD getValue() const;
private:
LLDate mDate;
};
/* /*
* Cell displaying an image. * Cell displaying an image.
*/ */
@@ -159,24 +140,22 @@ public:
LLScrollListIcon( LLUIImagePtr icon, S32 width = 0); LLScrollListIcon( LLUIImagePtr icon, S32 width = 0);
LLScrollListIcon(const LLSD& value, S32 width = 0); LLScrollListIcon(const LLSD& value, S32 width = 0);
/*virtual*/ ~LLScrollListIcon(); /*virtual*/ ~LLScrollListIcon();
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
virtual S32 getWidth() const; /*virtual*/ S32 getWidth() const;
virtual S32 getHeight() const { return mIcon ? mIcon->getHeight() : 0; } /*virtual*/ S32 getHeight() const;
virtual const LLSD getValue() const { return mIcon.isNull() ? LLStringUtil::null : mIcon->getName(); } /*virtual*/ const LLSD getValue() const;
virtual void setColor(const LLColor4&); /*virtual*/ void setColor(const LLColor4&);
virtual BOOL isText()const { return FALSE; } /*virtual*/ void setValue(const LLSD& value);
virtual void setValue(const LLSD& value);
// <edit> // <edit>
void setClickCallback(BOOL (*callback)(void*), void* user_data); void setClickCallback(boost::function<bool (void)> cb);
virtual BOOL handleClick(); virtual BOOL handleClick();
// </edit> // </edit>
private: private:
LLUIImagePtr mIcon; LLPointer<LLUIImage> mIcon;
LLColor4 mColor; LLColor4 mColor;
// <edit> // <edit>
BOOL (*mCallback)(void*); boost::function<bool (void)> mCallback;
void* mUserData;
// </edit> // </edit>
}; };
@@ -188,22 +167,33 @@ class LLScrollListCheck : public LLScrollListCell
public: public:
LLScrollListCheck( LLCheckBoxCtrl* check_box, S32 width = 0); LLScrollListCheck( LLCheckBoxCtrl* check_box, S32 width = 0);
/*virtual*/ ~LLScrollListCheck(); /*virtual*/ ~LLScrollListCheck();
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
virtual S32 getHeight() const { return 0; } /*virtual*/ S32 getHeight() const { return 0; }
virtual const LLSD getValue() const { return mCheckBox->getValue(); } /*virtual*/ const LLSD getValue() const;
virtual void setValue(const LLSD& value) { mCheckBox->setValue(value); } /*virtual*/ void setValue(const LLSD& value);
virtual void onCommit() { mCheckBox->onCommit(); } /*virtual*/ void onCommit();
virtual BOOL handleClick(); /*virtual*/ BOOL handleClick();
virtual void setEnabled(BOOL enable) { mCheckBox->setEnabled(enable); } /*virtual*/ void setEnabled(BOOL enable);
LLCheckBoxCtrl* getCheckBox() { return mCheckBox; } LLCheckBoxCtrl* getCheckBox() { return mCheckBox; }
virtual BOOL isText() const { return FALSE; }
private: private:
LLCheckBoxCtrl* mCheckBox; LLCheckBoxCtrl* mCheckBox;
}; };
class LLScrollListDate : public LLScrollListText
{
public:
LLScrollListDate( const LLDate& date, const LLFontGL* font, S32 width=0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE);
virtual void setValue(const LLSD& value);
virtual const LLSD getValue() const;
private:
LLDate mDate;
};
// <edit> // <edit>
class LLScrollListLineEditor : public LLScrollListCell class LLScrollListLineEditor : public LLScrollListCell
{ {
@@ -228,43 +218,12 @@ private:
}; };
// </edit> // </edit>
/* class LLScrollListColumn;
* A simple data class describing a column within a scroll list. class LLScrollColumnHeader : public LLComboBox
*/
class LLScrollListColumn
{ {
public: public:
LLScrollListColumn(); LLScrollColumnHeader(const std::string& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL *font = NULL);
LLScrollListColumn(const LLSD &sd, LLScrollListCtrl* parent); ~LLScrollColumnHeader();
void setWidth(S32 width);
S32 getWidth() const { return mWidth; }
// Public data is fine so long as this remains a simple struct-like data class.
// If it ever gets any smarter than that, these should all become private
// with protected or public accessor methods added as needed. -MG
std::string mName;
std::string mSortingColumn;
BOOL mSortAscending;
std::string mLabel;
F32 mRelWidth;
BOOL mDynamicWidth;
S32 mMaxContentWidth;
S32 mIndex;
LLScrollListCtrl* mParentCtrl;
class LLColumnHeader* mHeader;
LLFontGL::HAlign mFontAlignment;
private:
S32 mWidth;
};
class LLColumnHeader : public LLComboBox
{
public:
LLColumnHeader(const std::string& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL *font = NULL);
~LLColumnHeader();
/*virtual*/ void draw(); /*virtual*/ void draw();
/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
@@ -301,7 +260,44 @@ private:
LLColor4 mImageOverlayColor; LLColor4 mImageOverlayColor;
}; };
class LLScrollListItem /*
* A simple data class describing a column within a scroll list.
*/
class LLScrollListColumn
{
public:
typedef enum e_sort_direction
{
DESCENDING,
ASCENDING
} ESortDirection;
LLScrollListColumn();
LLScrollListColumn(const LLSD &sd, LLScrollListCtrl* parent);
void setWidth(S32 width);
S32 getWidth() const { return mWidth; }
// Public data is fine so long as this remains a simple struct-like data class.
// If it ever gets any smarter than that, these should all become private
// with protected or public accessor methods added as needed. -MG
std::string mName;
std::string mSortingColumn;
ESortDirection mSortDirection;
std::string mLabel;
F32 mRelWidth;
BOOL mDynamicWidth;
S32 mMaxContentWidth;
S32 mIndex;
LLScrollListCtrl* mParentCtrl;
LLScrollColumnHeader* mHeader;
LLFontGL::HAlign mFontAlignment;
private:
S32 mWidth;
};
class LLScrollListItem : public LLHandleProvider<LLScrollListItem>
{ {
public: public:
LLScrollListItem( BOOL enabled = TRUE, void* userdata = NULL, const LLUUID& uuid = LLUUID::null ) LLScrollListItem( BOOL enabled = TRUE, void* userdata = NULL, const LLUUID& uuid = LLUUID::null )
@@ -314,7 +310,7 @@ public:
void setSelected( BOOL b ) { mSelected = b; } void setSelected( BOOL b ) { mSelected = b; }
BOOL getSelected() const { return mSelected; } BOOL getSelected() const { return mSelected; }
void setEnabled( BOOL b ); void setEnabled( BOOL b ) { mEnabled = b; }
BOOL getEnabled() const { return mEnabled; } BOOL getEnabled() const { return mEnabled; }
void setUserdata( void* userdata ) { mUserdata = userdata; } void setUserdata( void* userdata ) { mUserdata = userdata; }
@@ -323,9 +319,12 @@ public:
void setToolTip(const std::string tool_tip) { mToolTip=tool_tip; } void setToolTip(const std::string tool_tip) { mToolTip=tool_tip; }
std::string getToolTip() { return mToolTip; } std::string getToolTip() { return mToolTip; }
LLUUID getUUID() const { return mItemValue.asUUID(); } virtual LLUUID getUUID() const { return mItemValue.asUUID(); }
LLSD getValue() const { return mItemValue; } LLSD getValue() const { return mItemValue; }
void setRect(LLRect rect) { mRectangle = rect; }
LLRect getRect() const { return mRectangle; }
// If width = 0, just use the width of the text. Otherwise override with // If width = 0, just use the width of the text. Otherwise override with
// specified width in pixels. // specified width in pixels.
void addColumn( const std::string& text, const LLFontGL* font, S32 width = 0 , U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, BOOL visible = TRUE) void addColumn( const std::string& text, const LLFontGL* font, S32 width = 0 , U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, BOOL visible = TRUE)
@@ -341,9 +340,9 @@ public:
void setColumn( S32 column, LLScrollListCell *cell ); void setColumn( S32 column, LLScrollListCell *cell );
S32 getNumColumns() const { return mColumns.size(); } S32 getNumColumns() const;
LLScrollListCell *getColumn(const S32 i) const { if (0 <= i && i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; } LLScrollListCell *getColumn(const S32 i) const;
std::string getContentsCSV() const; std::string getContentsCSV() const;
@@ -356,29 +355,7 @@ private:
LLSD mItemValue; LLSD mItemValue;
std::string mToolTip; std::string mToolTip;
std::vector<LLScrollListCell *> mColumns; std::vector<LLScrollListCell *> mColumns;
}; LLRect mRectangle;
/*
* A graphical control representing a scrollable table.
* Cells in the table can be simple text or more complicated things
* such as icons or even interactive elements like check boxes.
*/
class LLScrollListItemComment : public LLScrollListItem
{
public:
LLScrollListItemComment(const std::string& comment_string, const LLColor4& color);
/*virtual*/ void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding);
private:
LLColor4 mColor;
};
class LLScrollListItemSeparator : public LLScrollListItem
{
public:
LLScrollListItemSeparator();
/*virtual*/ void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding);
}; };
class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
@@ -386,13 +363,37 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
{ {
public: public:
typedef boost::function<void (void)> callback_t; typedef boost::function<void (void)> callback_t;
template<typename T> struct maximum
{
typedef T result_type;
template<typename InputIterator>
T operator()(InputIterator first, InputIterator last) const
{
// If there are no slots to call, just return the
// default-constructed value
if(first == last ) return T();
T max_value = *first++;
while (first != last) {
if (max_value < *first)
max_value = *first;
++first;
}
return max_value;
}
};
typedef boost::signals2::signal<S32 (S32,const LLScrollListItem*,const LLScrollListItem*),maximum<S32> > sort_signal_t;
LLScrollListCtrl( LLScrollListCtrl(
const std::string& name, const std::string& name,
const LLRect& rect, const LLRect& rect,
void (*commit_callback)(LLUICtrl*, void*), void (*commit_callback)(LLUICtrl*, void*),
void* callback_userdata, void* callback_userdata,
BOOL allow_multiple_selection, BOOL allow_multiple_selection,
BOOL draw_border = TRUE); BOOL draw_border = TRUE, bool draw_heading = false);
virtual ~LLScrollListCtrl(); virtual ~LLScrollListCtrl();
@@ -416,6 +417,7 @@ public:
virtual void setColumnLabel(const std::string& column, const std::string& label); virtual void setColumnLabel(const std::string& column, const std::string& label);
virtual LLScrollListColumn* getColumn(S32 index); virtual LLScrollListColumn* getColumn(S32 index);
virtual LLScrollListColumn* getColumn(const std::string& name);
virtual S32 getNumColumns() const { return mColumnsIndexed.size(); } virtual S32 getNumColumns() const { return mColumnsIndexed.size(); }
// Adds a single element, from an array of: // Adds a single element, from an array of:
@@ -466,7 +468,12 @@ public:
void deleteSelectedItems(); void deleteSelectedItems();
void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change
void highlightNthItem( S32 index ); void clearHighlightedItems();
virtual void mouseOverHighlightNthItem( S32 index );
S32 getHighlightedItemInx() const { return mHighlightedItem; }
void setDoubleClickCallback( callback_t cb ) { mOnDoubleClickCallback = cb; } void setDoubleClickCallback( callback_t cb ) { mOnDoubleClickCallback = cb; }
void setMaximumSelectCallback( callback_t cb ) { mOnMaximumSelectCallback = cb; } void setMaximumSelectCallback( callback_t cb ) { mOnMaximumSelectCallback = cb; }
void setSortChangedCallback( callback_t cb ) { mOnSortChangedCallback = cb; } void setSortChangedCallback( callback_t cb ) { mOnSortChangedCallback = cb; }
@@ -483,7 +490,7 @@ public:
S32 getItemIndex( LLScrollListItem* item ) const; S32 getItemIndex( LLScrollListItem* item ) const;
S32 getItemIndex( const LLUUID& item_id ) const; S32 getItemIndex( const LLUUID& item_id ) const;
LLScrollListItem* addCommentText( const std::string& comment_text, EAddPosition pos = ADD_BOTTOM); void setCommentText( const std::string& comment_text);
LLScrollListItem* addSeparator(EAddPosition pos); LLScrollListItem* addSeparator(EAddPosition pos);
// "Simple" interface: use this when you're creating a list that contains only unique strings, only // "Simple" interface: use this when you're creating a list that contains only unique strings, only
@@ -494,6 +501,7 @@ public:
BOOL selectItemByLabel( const std::string& item, BOOL case_sensitive = TRUE ); // FALSE if item not found BOOL selectItemByLabel( const std::string& item, BOOL case_sensitive = TRUE ); // FALSE if item not found
BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE); BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE);
BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE); BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE);
LLScrollListItem* getItemByLabel( const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0 );
const std::string getSelectedItemLabel(S32 column = 0) const; const std::string getSelectedItemLabel(S32 column = 0) const;
LLSD getSelectedValue(); LLSD getSelectedValue();
@@ -506,7 +514,8 @@ public:
LLScrollListItem* getFirstSelected() const; LLScrollListItem* getFirstSelected() const;
virtual S32 getFirstSelectedIndex() const; virtual S32 getFirstSelectedIndex() const;
std::vector<LLScrollListItem*> getAllSelected() const; std::vector<LLScrollListItem*> getAllSelected() const;
LLDynamicArray<LLUUID> getSelectedIDs(); uuid_vec_t getSelectedIDs(); //Helper. Much like getAllSelected, but just provides a LLUUID vec
S32 getNumSelected() const;
LLScrollListItem* getLastSelectedItem() const { return mLastSelected; } LLScrollListItem* getLastSelectedItem() const { return mLastSelected; }
// iterate over all items // iterate over all items
@@ -581,17 +590,26 @@ public:
LLRect getItemListRect() { return mItemListRect; } LLRect getItemListRect() { return mItemListRect; }
/// Returns rect, in local coords, of a given row/column
LLRect getCellRect(S32 row_index, S32 column_index);
// Used "internally" by the scroll bar. // Used "internally" by the scroll bar.
static void onScrollChange( S32 new_pos, LLScrollbar* src, void* userdata ); static void onScrollChange( S32 new_pos, LLScrollbar* src, void* userdata );
static void onClickColumn(void *userdata); static void onClickColumn(void *userdata);
void updateColumns(); virtual void updateColumns();
void calcColumnWidths(); S32 calcMaxContentWidth();
bool updateColumnWidths();
S32 getMaxContentWidth() { return mMaxContentWidth; } S32 getMaxContentWidth() { return mMaxContentWidth; }
void setDisplayHeading(BOOL display); void setDisplayHeading(BOOL display);
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.
*/
void setPageLines(S32 page_lines );
void setCollapseEmptyColumns(BOOL collapse); void setCollapseEmptyColumns(BOOL collapse);
LLScrollListItem* hitItem(S32 x,S32 y); LLScrollListItem* hitItem(S32 x,S32 y);
@@ -613,17 +631,25 @@ public:
std::string getSortColumnName(); std::string getSortColumnName();
BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; } BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; }
BOOL needsSorting(); BOOL hasSortOrder() const;
void clearSortOrder();
S32 selectMultiple( LLDynamicArray<LLUUID> ids ); S32 selectMultiple( uuid_vec_t ids );
void sortItems(); // 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) // sorts a list without affecting the permanent sort order (so further list insertions can be unsorted, for example)
void sortOnce(S32 column, BOOL ascending); void sortOnce(S32 column, BOOL ascending);
// manually call this whenever editing list items in place to flag need for resorting // manually call this whenever editing list items in place to flag need for resorting
void setSorted(BOOL sorted) { mSorted = sorted; } void setNeedsSort(bool val = true) { mSorted = !val; }
void dirtyColumns(); // some operation has potentially affected column layout or ordering void dirtyColumns(); // some operation has potentially affected column layout or ordering
boost::signals2::connection setSortCallback(sort_signal_t::slot_type cb )
{
if (!mSortCallback) mSortCallback = new sort_signal_t();
return mSortCallback->connect(cb);
}
protected: protected:
// "Full" interface: use this when you're creating a list that has one or more of the following: // "Full" interface: use this when you're creating a list that has one or more of the following:
// * contains icons // * contains icons
@@ -645,11 +671,13 @@ protected:
typedef std::deque<LLScrollListItem *> item_list; typedef std::deque<LLScrollListItem *> item_list;
item_list& getItemList() { return mItemList; } item_list& getItemList() { return mItemList; }
void updateLineHeight();
private: private:
void selectPrevItem(BOOL extend_selection); void selectPrevItem(BOOL extend_selection);
void selectNextItem(BOOL extend_selection); void selectNextItem(BOOL extend_selection);
void drawItems(); void drawItems();
void updateLineHeight();
void updateLineHeightInsert(LLScrollListItem* item); void updateLineHeightInsert(LLScrollListItem* item);
void reportInvalidInput(); void reportInvalidInput();
BOOL isRepeatedChars(const LLWString& string) const; BOOL isRepeatedChars(const LLWString& string) const;
@@ -657,10 +685,7 @@ private:
void deselectItem(LLScrollListItem* itemp); void deselectItem(LLScrollListItem* itemp);
void commitIfChanged(); void commitIfChanged();
BOOL setSort(S32 column, BOOL ascending); BOOL setSort(S32 column, BOOL ascending);
S32 getLinesPerPage();
S32 mCurIndex; // For get[First/Next]Data
S32 mCurSelectedIndex; // For get[First/Next]Selected
S32 mLineHeight; // the max height of a single line S32 mLineHeight; // the max height of a single line
S32 mScrollLines; // how many lines we've scrolled down S32 mScrollLines; // how many lines we've scrolled down
@@ -668,18 +693,19 @@ private:
S32 mHeadingHeight; // the height of the column header buttons, if visible S32 mHeadingHeight; // the height of the column header buttons, if visible
U32 mMaxSelectable; U32 mMaxSelectable;
LLScrollbar* mScrollbar; LLScrollbar* mScrollbar;
BOOL mAllowMultipleSelection; bool mAllowMultipleSelection;
BOOL mAllowKeyboardMovement; bool mAllowKeyboardMovement;
BOOL mCommitOnKeyboardMovement; bool mCommitOnKeyboardMovement;
BOOL mCommitOnSelectionChange; bool mCommitOnSelectionChange;
BOOL mSelectionChanged; bool mSelectionChanged;
BOOL mNeedsScroll; bool mNeedsScroll;
BOOL mMouseWheelOpaque; bool mMouseWheelOpaque;
BOOL mCanSelect; bool mCanSelect;
BOOL mDisplayColumnHeaders; bool mDisplayColumnHeaders;
BOOL mColumnsDirty; bool mColumnsDirty;
bool mColumnWidthsDirty;
item_list mItemList; mutable item_list mItemList;
LLScrollListItem *mLastSelected; LLScrollListItem *mLastSelected;
@@ -710,6 +736,8 @@ private:
S32 mHighlightedItem; S32 mHighlightedItem;
class LLViewBorder* mBorder; class LLViewBorder* mBorder;
LLView *mCommentTextView;
LLWString mSearchString; LLWString mSearchString;
LLFrameTimer mSearchTimer; LLFrameTimer mSearchTimer;
@@ -718,12 +746,12 @@ private:
S32 mTotalStaticColumnWidth; S32 mTotalStaticColumnWidth;
S32 mTotalColumnPadding; S32 mTotalColumnPadding;
BOOL mSorted; mutable bool mSorted;
typedef std::map<std::string, LLScrollListColumn> column_map_t; typedef std::map<std::string, LLScrollListColumn*> column_map_t;
column_map_t mColumns; column_map_t mColumns;
BOOL mDirty; bool mDirty;
S32 mOriginalSelection; S32 mOriginalSelection;
typedef std::vector<LLScrollListColumn*> ordered_columns_t; typedef std::vector<LLScrollListColumn*> ordered_columns_t;
@@ -732,8 +760,7 @@ private:
typedef std::pair<S32, BOOL> sort_column_t; typedef std::pair<S32, BOOL> sort_column_t;
std::vector<sort_column_t> mSortColumns; std::vector<sort_column_t> mSortColumns;
// HACK: Did we draw one selected item this frame? sort_signal_t* mSortCallback;
BOOL mDrewSelected;
}; // end class LLScrollListCtrl }; // end class LLScrollListCtrl

View File

@@ -30,7 +30,7 @@
#include "llfloaterchat.h" #include "llfloaterchat.h"
ASFloaterContactGroups* ASFloaterContactGroups::sInstance = NULL; ASFloaterContactGroups* ASFloaterContactGroups::sInstance = NULL;
LLDynamicArray<LLUUID> ASFloaterContactGroups::mSelectedUUIDs; uuid_vec_t ASFloaterContactGroups::mSelectedUUIDs;
LLSD ASFloaterContactGroups::mContactGroupData; LLSD ASFloaterContactGroups::mContactGroupData;
ASFloaterContactGroups::ASFloaterContactGroups() ASFloaterContactGroups::ASFloaterContactGroups()
@@ -40,7 +40,7 @@ ASFloaterContactGroups::ASFloaterContactGroups()
} }
// static // static
void ASFloaterContactGroups::show(LLDynamicArray<LLUUID> ids) void ASFloaterContactGroups::show(const uuid_vec_t& ids)
{ {
if (!sInstance) if (!sInstance)
sInstance = new ASFloaterContactGroups(); sInstance = new ASFloaterContactGroups();
@@ -84,7 +84,8 @@ void ASFloaterContactGroups::onBtnAdd(void* userdata)
self->createContactGroup(name); self->createContactGroup(name);
combo->selectByValue(name); combo->selectByValue(name);
} }
for (S32 i = (self->mSelectedUUIDs.count() - 1); i >= 0; --i) uuid_vec_t::reverse_iterator it = self->mSelectedUUIDs.rbegin();
for (;it != self->mSelectedUUIDs.rend();++it)
{ {
//self->addContactMember(combo->getSimple(), self->mSelectedUUIDs.get(i)); //self->addContactMember(combo->getSimple(), self->mSelectedUUIDs.get(i));
} }
@@ -98,19 +99,21 @@ void ASFloaterContactGroups::onBtnRemove(void* userdata)
if(self) if(self)
{ {
if (self->mSelectedUUIDs.count() > 0) if (!self->mSelectedUUIDs.empty())
{ {
LLScrollListCtrl* scroller = self->getChild<LLScrollListCtrl>("group_scroll_list"); LLScrollListCtrl* scroller = self->getChild<LLScrollListCtrl>("group_scroll_list");
if(scroller != NULL) if(scroller != NULL)
{ {
for (S32 i = (self->mSelectedUUIDs.count() - 1); i >= 0; --i) uuid_vec_t::size_type i = self->mSelectedUUIDs.size();
uuid_vec_t::reverse_iterator it = self->mSelectedUUIDs.rbegin();
for (;it != self->mSelectedUUIDs.rend();++it)
{ {
std::string i_str; std::string i_str;
LLResMgr::getInstance()->getIntegerString(i_str, i); LLResMgr::getInstance()->getIntegerString(i_str, --i);
LLChat msg("Adding index " + i_str + ": " + self->mSelectedUUIDs.get(i).asString()); LLChat msg("Adding index " + i_str + ": " + it->asString());
LLFloaterChat::addChat(msg); LLFloaterChat::addChat(msg);
self->addContactMember(scroller->getValue().asString(), self->mSelectedUUIDs.get(i)); self->addContactMember(scroller->getValue().asString(), *it);
} }
} }
} }

View File

@@ -29,7 +29,7 @@ public:
virtual ~ASFloaterContactGroups(); virtual ~ASFloaterContactGroups();
// by convention, this shows the floater and does instance management // by convention, this shows the floater and does instance management
static void show(LLDynamicArray<LLUUID> ids); static void show(const uuid_vec_t& ids);
void populateGroupList(); void populateGroupList();
void populateActiveGroupList(LLUUID to_add); void populateActiveGroupList(LLUUID to_add);
@@ -47,7 +47,7 @@ public:
private: private:
//assuming we just need one, which is typical //assuming we just need one, which is typical
static ASFloaterContactGroups* sInstance; static ASFloaterContactGroups* sInstance;
static LLDynamicArray<LLUUID> mSelectedUUIDs; static uuid_vec_t mSelectedUUIDs;
static LLSD mContactGroupData; static LLSD mContactGroupData;
}; };

View File

@@ -300,8 +300,6 @@ bool cmd_line_chat(std::string revised_text, EChatType type)
if(LLUUID::parseUUID(avatarKey, &tempUUID)) if(LLUUID::parseUUID(avatarKey, &tempUUID))
{ {
char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */ char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */
LLDynamicArray<LLUUID> ids;
ids.push_back(tempUUID);
std::string tpMsg="Join me!"; std::string tpMsg="Join me!";
LLMessageSystem* msg = gMessageSystem; LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_StartLure); msg->newMessageFast(_PREHASH_StartLure);
@@ -312,11 +310,8 @@ bool cmd_line_chat(std::string revised_text, EChatType type)
msg->addU8Fast(_PREHASH_LureType, (U8)0); msg->addU8Fast(_PREHASH_LureType, (U8)0);
msg->addStringFast(_PREHASH_Message, tpMsg); msg->addStringFast(_PREHASH_Message, tpMsg);
for(LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr)
{
msg->nextBlockFast(_PREHASH_TargetData); msg->nextBlockFast(_PREHASH_TargetData);
msg->addUUIDFast(_PREHASH_TargetID, *itr); msg->addUUIDFast(_PREHASH_TargetID, tempUUID);
}
gAgent.sendReliableMessage(); gAgent.sendReliableMessage();
snprintf(buffer,sizeof(buffer),"Offered TP to key %s",tempUUID.asString().c_str()); snprintf(buffer,sizeof(buffer),"Offered TP to key %s",tempUUID.asString().c_str());
cmdline_printchat(std::string(buffer)); cmdline_printchat(std::string(buffer));

View File

@@ -234,7 +234,7 @@ void JCFloaterAreaSearch::results()
if (!(sInstance->getVisible())) return; if (!(sInstance->getVisible())) return;
if (sRequested > 0 && sInstance->mLastUpdateTimer.getElapsedTimeF32() < min_refresh_interval) return; if (sRequested > 0 && sInstance->mLastUpdateTimer.getElapsedTimeF32() < min_refresh_interval) return;
//llinfos << "results()" << llendl; //llinfos << "results()" << llendl;
LLDynamicArray<LLUUID> selected = sInstance->mResultList->getSelectedIDs(); uuid_vec_t selected = sInstance->mResultList->getSelectedIDs();
S32 scrollpos = sInstance->mResultList->getScrollPos(); S32 scrollpos = sInstance->mResultList->getScrollPos();
sInstance->mResultList->deleteAllItems(); sInstance->mResultList->deleteAllItems();
S32 i; S32 i;
@@ -302,7 +302,7 @@ void JCFloaterAreaSearch::results()
} }
} }
sInstance->mResultList->sortItems(); sInstance->mResultList->updateSort();
sInstance->mResultList->selectMultiple(selected); sInstance->mResultList->selectMultiple(selected);
sInstance->mResultList->setScrollPos(scrollpos); sInstance->mResultList->setScrollPos(scrollpos);
sInstance->mCounterText->setText(llformat("%d listed/%d pending/%d total", sInstance->mResultList->getItemCount(), sRequested, sObjectDetails.size())); sInstance->mCounterText->setText(llformat("%d listed/%d pending/%d total", sInstance->mResultList->getItemCount(), sRequested, sObjectDetails.size()));

View File

@@ -208,7 +208,7 @@ BOOL LLFloaterScriptQueue::start()
buffer = getString ("Starting", args); buffer = getString ("Starting", args);
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
list->addCommentText(buffer); list->setCommentText(buffer);
return nextObject(); return nextObject();
} }
@@ -244,7 +244,7 @@ BOOL LLFloaterScriptQueue::nextObject()
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
mDone = TRUE; mDone = TRUE;
list->addCommentText(getString("Done")); list->setCommentText(getString("Done"));
childSetEnabled("close",TRUE); childSetEnabled("close",TRUE);
} }
return successful_start; return successful_start;
@@ -325,7 +325,7 @@ LLFloaterCompileQueue* LLFloaterCompileQueue::create(BOOL mono)
} }
LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output"); LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output");
list->addCommentText(message.c_str()); list->setCommentText(message.c_str());
} }
private: private:
@@ -520,7 +520,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
if(queue && (buffer.size() > 0)) if(queue && (buffer.size() > 0))
{ {
LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output"); LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output");
list->addCommentText(buffer); list->setCommentText(buffer);
} }
delete data; delete data;
} }
@@ -707,7 +707,7 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj,
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
std::string buffer; std::string buffer;
buffer = getString("Resetting") + LLTrans::getString(":") + " " + item->getName(); buffer = getString("Resetting") + LLTrans::getString(":") + " " + item->getName();
list->addCommentText(buffer); list->setCommentText(buffer);
LLMessageSystem* msg = gMessageSystem; LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ScriptReset); msg->newMessageFast(_PREHASH_ScriptReset);
msg->nextBlockFast(_PREHASH_AgentData); msg->nextBlockFast(_PREHASH_AgentData);
@@ -769,7 +769,7 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj,
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
std::string buffer; std::string buffer;
buffer = getString("Running") + LLTrans::getString(":") + " " + item->getName(); buffer = getString("Running") + LLTrans::getString(":") + " " + item->getName();
list->addCommentText(buffer); list->setCommentText(buffer);
LLMessageSystem* msg = gMessageSystem; LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_SetScriptRunning); msg->newMessageFast(_PREHASH_SetScriptRunning);
@@ -833,7 +833,7 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj,
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
std::string buffer; std::string buffer;
buffer = getString("NotRunning") + LLTrans::getString(":") + " " + item->getName(); buffer = getString("NotRunning") + LLTrans::getString(":") + " " + item->getName();
list->addCommentText(buffer); list->setCommentText(buffer);
LLMessageSystem* msg = gMessageSystem; LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_SetScriptRunning); msg->newMessageFast(_PREHASH_SetScriptRunning);

View File

@@ -610,7 +610,7 @@ void LLPanelActiveSpeakers::refreshSpeakers()
} }
// we potentially modified the sort order by touching the list items // we potentially modified the sort order by touching the list items
mSpeakerList->setSorted(FALSE); mSpeakerList->setNeedsSort();
LLPointer<LLSpeaker> selected_speakerp = mSpeakerMgr->findSpeaker(selected_id); LLPointer<LLSpeaker> selected_speakerp = mSpeakerMgr->findSpeaker(selected_id);
// update UI for selected participant // update UI for selected participant

View File

@@ -631,9 +631,9 @@ void LLFloaterAvatarList::expireAvatarList()
(it++)->getAlive(); (it++)->getAlive();
else else
{ {
std::swap(*it,mAvatars.back()); *it = mAvatars.back();
mAvatars.pop_back(); mAvatars.pop_back();
if(!mAvatars.size()) if(mAvatars.empty())
return; return;
} }
} }
@@ -674,7 +674,7 @@ void LLFloaterAvatarList::refreshAvatarList()
// We rebuild the list fully each time it's refreshed // We rebuild the list fully each time it's refreshed
// The assumption is that it's faster to refill it and sort than // The assumption is that it's faster to refill it and sort than
// to rebuild the whole list. // to rebuild the whole list.
LLDynamicArray<LLUUID> selected = mAvatarList->getSelectedIDs(); uuid_vec_t selected = mAvatarList->getSelectedIDs();
S32 scrollpos = mAvatarList->getScrollPos(); S32 scrollpos = mAvatarList->getScrollPos();
mAvatarList->deleteAllItems(); mAvatarList->deleteAllItems();
@@ -961,7 +961,7 @@ void LLFloaterAvatarList::refreshAvatarList()
} }
// finish // finish
mAvatarList->sortItems(); mAvatarList->updateSort();
mAvatarList->selectMultiple(selected); mAvatarList->selectMultiple(selected);
mAvatarList->setScrollPos(scrollpos); mAvatarList->setScrollPos(scrollpos);
@@ -974,8 +974,8 @@ void LLFloaterAvatarList::refreshAvatarList()
void LLFloaterAvatarList::onClickIM() void LLFloaterAvatarList::onClickIM()
{ {
//llinfos << "LLFloaterFriends::onClickIM()" << llendl; //llinfos << "LLFloaterFriends::onClickIM()" << llendl;
LLDynamicArray<LLUUID> ids = mAvatarList->getSelectedIDs(); const uuid_vec_t ids = mAvatarList->getSelectedIDs();
if (ids.size() > 0) if (!ids.empty())
{ {
if (ids.size() == 1) if (ids.size() == 1)
{ {
@@ -1004,7 +1004,7 @@ void LLFloaterAvatarList::onClickIM()
void LLFloaterAvatarList::onClickTeleportOffer() void LLFloaterAvatarList::onClickTeleportOffer()
{ {
LLDynamicArray<LLUUID> ids = mAvatarList->getSelectedIDs(); uuid_vec_t ids = mAvatarList->getSelectedIDs();
if (ids.size() > 0) if (ids.size() > 0)
{ {
handle_lure(ids); handle_lure(ids);
@@ -1106,7 +1106,7 @@ BOOL LLFloaterAvatarList::handleKeyHere(KEY key, MASK mask)
if (( KEY_RETURN == key ) && (MASK_SHIFT == mask)) if (( KEY_RETURN == key ) && (MASK_SHIFT == mask))
{ {
LLDynamicArray<LLUUID> ids = self->mAvatarList->getSelectedIDs(); uuid_vec_t ids = self->mAvatarList->getSelectedIDs();
if (ids.size() > 0) if (ids.size() > 0)
{ {
if (ids.size() == 1) if (ids.size() == 1)
@@ -1425,12 +1425,12 @@ static void cmd_estate_ban(const LLAvatarListEntry* entry) { LLPanelEstateInfo::
void LLFloaterAvatarList::doCommand(avlist_command_t func, bool single/*=false*/) void LLFloaterAvatarList::doCommand(avlist_command_t func, bool single/*=false*/)
{ {
LLDynamicArray<LLUUID> ids; uuid_vec_t ids;
if(!single) if(!single)
ids = mAvatarList->getSelectedIDs(); ids = mAvatarList->getSelectedIDs();
else else
ids.put(getSelectedID()); ids.push_back(getSelectedID());
for (LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr) for (uuid_vec_t::iterator itr = ids.begin(); itr != ids.end(); ++itr)
{ {
LLUUID& avid = *itr; LLUUID& avid = *itr;
if(avid.isNull()) if(avid.isNull())
@@ -1565,10 +1565,10 @@ void LLFloaterAvatarList::onClickEject()
void LLFloaterAvatarList::onClickMute() void LLFloaterAvatarList::onClickMute()
{ {
LLDynamicArray<LLUUID> ids = mAvatarList->getSelectedIDs(); uuid_vec_t ids = mAvatarList->getSelectedIDs();
if (ids.size() > 0) if (ids.size() > 0)
{ {
for (LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr) for (uuid_vec_t::iterator itr = ids.begin(); itr != ids.end(); ++itr)
{ {
LLUUID agent_id = *itr; LLUUID agent_id = *itr;

View File

@@ -499,6 +499,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
} }
LLSD element; LLSD element;
element["id"] = avatar_id; // value element["id"] = avatar_id; // value
element["columns"][0]["column"] = "name";
element["columns"][0]["value"] = avatar_name; element["columns"][0]["value"] = avatar_name;
search_results->addElement(element); search_results->addElement(element);
} }

View File

@@ -95,7 +95,7 @@ void LLFloaterBulkPermission::doApply()
LLSelectMgr::getInstance()->getSelection()->applyToNodes(&gatherer); LLSelectMgr::getInstance()->getSelection()->applyToNodes(&gatherer);
if(mObjectIDs.empty()) if(mObjectIDs.empty())
{ {
list->addCommentText(getString("nothing_to_modify_text")); list->setCommentText(getString("nothing_to_modify_text"));
} }
else else
{ {
@@ -180,7 +180,7 @@ void LLFloaterBulkPermission::onCommitCopy(LLUICtrl* ctrl, void* data)
BOOL LLFloaterBulkPermission::start() BOOL LLFloaterBulkPermission::start()
{ {
// note: number of top-level objects to modify is mObjectIDs.count(). // note: number of top-level objects to modify is mObjectIDs.count().
getChild<LLScrollListCtrl>("queue output")->addCommentText(getString("start_text")); getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("start_text"));
return nextObject(); return nextObject();
} }
@@ -203,7 +203,7 @@ BOOL LLFloaterBulkPermission::nextObject()
if(isDone() && !mDone) if(isDone() && !mDone)
{ {
getChild<LLScrollListCtrl>("queue output")->addCommentText(getString("done_text")); getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("done_text"));
mDone = TRUE; mDone = TRUE;
} }
return successful_start; return successful_start;
@@ -349,7 +349,7 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInv
status_text.setArg("[STATUS]", ""); status_text.setArg("[STATUS]", "");
} }
list->addCommentText(status_text.getString()); list->setCommentText(status_text.getString());
//TODO if we are an object inside an object we should check a recuse flag and if set //TODO if we are an object inside an object we should check a recuse flag and if set
//open the inventory of the object and recurse - Michelle2 Zenovka //open the inventory of the object and recurse - Michelle2 Zenovka

View File

@@ -78,8 +78,7 @@ const F32 CONTEXT_FADE_TIME = 0.08f;
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// default ctor // default ctor
LLFloaterColorPicker:: LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate )
LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate )
: LLFloater (std::string("Color Picker Floater")), : LLFloater (std::string("Color Picker Floater")),
mComponents ( 3 ), mComponents ( 3 ),
mMouseDownInLumRegion ( FALSE ), mMouseDownInLumRegion ( FALSE ),
@@ -124,10 +123,7 @@ LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate )
} }
} }
////////////////////////////////////////////////////////////////////////////// LLFloaterColorPicker::~LLFloaterColorPicker()
// dtor
LLFloaterColorPicker::
~LLFloaterColorPicker()
{ {
// destroy the UI we created // destroy the UI we created
destroyUI (); destroyUI ();
@@ -135,9 +131,7 @@ LLFloaterColorPicker::
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
void void LLFloaterColorPicker::createUI ()
LLFloaterColorPicker::
createUI ()
{ {
// build the majority of the gui using the factory builder // build the majority of the gui using the factory builder
LLUICtrlFactory::getInstance()->buildFloater ( this, "floater_color_picker.xml" ); LLUICtrlFactory::getInstance()->buildFloater ( this, "floater_color_picker.xml" );
@@ -184,9 +178,7 @@ createUI ()
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
void void LLFloaterColorPicker::showUI ()
LLFloaterColorPicker::
showUI ()
{ {
setVisible ( TRUE ); setVisible ( TRUE );
setFocus ( TRUE ); setFocus ( TRUE );
@@ -219,26 +211,24 @@ showUI ()
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// called after the dialog is rendered // called after the dialog is rendered
BOOL BOOL LLFloaterColorPicker::postBuild()
LLFloaterColorPicker::
postBuild()
{ {
mCancelBtn = getChild<LLButton>( "cancel_btn" ); mCancelBtn = getChild<LLButton>( "cancel_btn" );
mCancelBtn->setClickedCallback ( boost::bind(&LLFloaterColorPicker::onClickCancel,this) ); mCancelBtn->setClickedCallback ( onClickCancel, this );
mSelectBtn = getChild<LLButton>( "select_btn"); mSelectBtn = getChild<LLButton>( "select_btn");
mSelectBtn->setClickedCallback ( boost::bind(&LLFloaterColorPicker::onClickSelect,this) ); mSelectBtn->setClickedCallback ( onClickSelect, this );
mSelectBtn->setFocus ( TRUE ); mSelectBtn->setFocus ( TRUE );
mPipetteBtn = getChild<LLButton>("color_pipette" ); mPipetteBtn = getChild<LLButton>("color_pipette" );
mPipetteBtn->setImages(std::string("eye_button_inactive.tga"), std::string("eye_button_active.tga")); mPipetteBtn->setImages(std::string("eye_button_inactive.tga"), std::string("eye_button_active.tga"));
mPipetteBtn->setClickedCallback( boost::bind(&LLFloaterColorPicker::onClickPipette,this) ); mPipetteBtn->setClickedCallback( boost::bind(&LLFloaterColorPicker::onClickPipette,this ));
mApplyImmediateCheck = getChild<LLCheckBoxCtrl>("apply_immediate"); mApplyImmediateCheck = getChild<LLCheckBoxCtrl>("apply_immediate");
mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately")); mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately"));
mApplyImmediateCheck->setCommitCallback(boost::bind(&LLFloaterColorPicker::onImmediateCheck,this)); mApplyImmediateCheck->setCommitCallback(onImmediateCheck, this);
childSetCommitCallback("rspin", onTextCommit, (void*)this ); childSetCommitCallback("rspin", onTextCommit, (void*)this );
childSetCommitCallback("gspin", onTextCommit, (void*)this ); childSetCommitCallback("gspin", onTextCommit, (void*)this );
@@ -248,14 +238,14 @@ postBuild()
childSetCommitCallback("lspin", onTextCommit, (void*)this ); childSetCommitCallback("lspin", onTextCommit, (void*)this );
childSetCommitCallback("hexval", onHexCommit, (void*)this ); childSetCommitCallback("hexval", onHexCommit, (void*)this );
LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterColorPicker::onColorSelect, this, _1));
return TRUE; return TRUE;
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
void void LLFloaterColorPicker::initUI ( F32 rValIn, F32 gValIn, F32 bValIn )
LLFloaterColorPicker::
initUI ( F32 rValIn, F32 gValIn, F32 bValIn )
{ {
// start catching lose-focus events from entry widgets // start catching lose-focus events from entry widgets
enableTextCallbacks ( TRUE ); enableTextCallbacks ( TRUE );
@@ -277,9 +267,7 @@ initUI ( F32 rValIn, F32 gValIn, F32 bValIn )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
void void LLFloaterColorPicker::destroyUI ()
LLFloaterColorPicker::
destroyUI ()
{ {
// shut down pipette tool if active // shut down pipette tool if active
stopUsingPipette(); stopUsingPipette();
@@ -295,7 +283,7 @@ destroyUI ()
if ( mSwatchView ) if ( mSwatchView )
{ {
this->removeChild ( mSwatchView ); this->removeChild ( mSwatchView );
delete mSwatchView; mSwatchView->die();;
mSwatchView = NULL; mSwatchView = NULL;
} }
} }
@@ -303,9 +291,7 @@ destroyUI ()
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
F32 F32 LLFloaterColorPicker::hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn )
LLFloaterColorPicker::
hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn )
{ {
if ( valHUeIn < 0.0f ) valHUeIn += 1.0f; if ( valHUeIn < 0.0f ) valHUeIn += 1.0f;
if ( valHUeIn > 1.0f ) valHUeIn -= 1.0f; if ( valHUeIn > 1.0f ) valHUeIn -= 1.0f;
@@ -317,9 +303,7 @@ hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
void void LLFloaterColorPicker::hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32& bValOut )
LLFloaterColorPicker::
hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32& bValOut )
{ {
if ( sValIn < 0.00001f ) if ( sValIn < 0.00001f )
{ {
@@ -347,9 +331,7 @@ hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32&
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// mutator for original RGB value // mutator for original RGB value
void void LLFloaterColorPicker::setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn )
LLFloaterColorPicker::
setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn )
{ {
origR = origRIn; origR = origRIn;
origG = origGIn; origG = origGIn;
@@ -358,9 +340,7 @@ setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// accessor for original RGB value // accessor for original RGB value
void void LLFloaterColorPicker::getOrigRgb ( F32& origROut, F32& origGOut, F32& origBOut )
LLFloaterColorPicker::
getOrigRgb ( F32& origROut, F32& origGOut, F32& origBOut )
{ {
origROut = origR; origROut = origR;
origGOut = origG; origGOut = origG;
@@ -369,9 +349,7 @@ getOrigRgb ( F32& origROut, F32& origGOut, F32& origBOut )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// mutator for current RGB value // mutator for current RGB value
void void LLFloaterColorPicker::setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn )
LLFloaterColorPicker::
setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn )
{ {
// save current RGB // save current RGB
curR = curRIn; curR = curRIn;
@@ -391,9 +369,7 @@ setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// accessor for current RGB value // accessor for current RGB value
void void LLFloaterColorPicker::getCurRgb ( F32& curROut, F32& curGOut, F32& curBOut )
LLFloaterColorPicker::
getCurRgb ( F32& curROut, F32& curGOut, F32& curBOut )
{ {
curROut = curR; curROut = curR;
curGOut = curG; curGOut = curG;
@@ -402,9 +378,7 @@ getCurRgb ( F32& curROut, F32& curGOut, F32& curBOut )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// mutator for current HSL value // mutator for current HSL value
void void LLFloaterColorPicker::setCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn )
LLFloaterColorPicker::
setCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn )
{ {
// save current HSL // save current HSL
curH = curHIn; curH = curHIn;
@@ -417,9 +391,7 @@ setCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// accessor for current HSL value // accessor for current HSL value
void void LLFloaterColorPicker::getCurHsl ( F32& curHOut, F32& curSOut, F32& curLOut )
LLFloaterColorPicker::
getCurHsl ( F32& curHOut, F32& curSOut, F32& curLOut )
{ {
curHOut = curH; curHOut = curH;
curSOut = curS; curSOut = curS;
@@ -428,9 +400,7 @@ getCurHsl ( F32& curHOut, F32& curSOut, F32& curLOut )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// called when 'cancel' clicked // called when 'cancel' clicked
void void LLFloaterColorPicker::onClickCancel ( void* data )
LLFloaterColorPicker::
onClickCancel ( void* data )
{ {
if (data) if (data)
{ {
@@ -446,9 +416,7 @@ onClickCancel ( void* data )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// called when 'select' clicked // called when 'select' clicked
void void LLFloaterColorPicker::onClickSelect ( void* data )
LLFloaterColorPicker::
onClickSelect ( void* data )
{ {
if (data) if (data)
{ {
@@ -463,31 +431,23 @@ onClickSelect ( void* data )
} }
} }
void LLFloaterColorPicker::onClickPipette( void* data ) void LLFloaterColorPicker::onClickPipette()
{ {
LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data; BOOL pipette_active = mPipetteBtn->getToggleState();
if ( self)
{
BOOL pipette_active = self->mPipetteBtn->getToggleState();
pipette_active = !pipette_active; pipette_active = !pipette_active;
if (pipette_active) if (pipette_active)
{ {
LLToolPipette::getInstance()->setSelectCallback(onColorSelect, self);
LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance()); LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance());
} }
else else
{ {
LLToolMgr::getInstance()->clearTransientTool(); LLToolMgr::getInstance()->clearTransientTool();
} }
}
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// called when 'text is committed' - i,e. focus moves from a text field // called when 'text is committed' - i,e. focus moves from a text field
void void LLFloaterColorPicker::onTextCommit ( LLUICtrl* ctrl, void* data )
LLFloaterColorPicker::
onTextCommit ( LLUICtrl* ctrl, void* data )
{ {
if ( data ) if ( data )
{ {
@@ -499,22 +459,13 @@ onTextCommit ( LLUICtrl* ctrl, void* data )
} }
} }
void LLFloaterColorPicker::onImmediateCheck() void LLFloaterColorPicker::onImmediateCheck( LLUICtrl* ctrl, void* data)
{ {
gSavedSettings.setBOOL("ApplyColorImmediately", mApplyImmediateCheck->get()); LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data;
if (mApplyImmediateCheck->get())
{
LLColorSwatchCtrl::onColorChanged ( getSwatch(), LLColorSwatchCtrl::COLOR_CHANGE );
}
}
void LLFloaterColorPicker::onColorSelect( const LLTextureEntry& te, void *data )
{
LLFloaterColorPicker* self = (LLFloaterColorPicker*)data;
if (self) if (self)
{ {
self->setCurRgb(te.getColor().mV[VRED], te.getColor().mV[VGREEN], te.getColor().mV[VBLUE]); gSavedSettings.setBOOL("ApplyColorImmediately", self->mApplyImmediateCheck->get());
if (self->mApplyImmediateCheck->get()) if (self->mApplyImmediateCheck->get())
{ {
LLColorSwatchCtrl::onColorChanged ( self->getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); LLColorSwatchCtrl::onColorChanged ( self->getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
@@ -522,6 +473,15 @@ void LLFloaterColorPicker::onColorSelect( const LLTextureEntry& te, void *data )
} }
} }
void LLFloaterColorPicker::onColorSelect( const LLTextureEntry& te)
{
setCurRgb(te.getColor().mV[VRED], te.getColor().mV[VGREEN], te.getColor().mV[VBLUE]);
if (mApplyImmediateCheck->get())
{
LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
}
}
void LLFloaterColorPicker::onMouseCaptureLost() void LLFloaterColorPicker::onMouseCaptureLost()
{ {
setMouseDownInHueRegion(FALSE); setMouseDownInHueRegion(FALSE);
@@ -673,9 +633,7 @@ void LLFloaterColorPicker::draw()
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// find a complimentary color to the one passed in that can be used to highlight // find a complimentary color to the one passed in that can be used to highlight
const LLColor4& const LLColor4& LLFloaterColorPicker::getComplimentaryColor ( const LLColor4& backgroundColor )
LLFloaterColorPicker::
getComplimentaryColor ( const LLColor4& backgroundColor )
{ {
// going to base calculation on luminance // going to base calculation on luminance
F32 hVal, sVal, lVal; F32 hVal, sVal, lVal;
@@ -695,9 +653,7 @@ getComplimentaryColor ( const LLColor4& backgroundColor )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// draw color palette // draw color palette
void void LLFloaterColorPicker::drawPalette ()
LLFloaterColorPicker::
drawPalette ()
{ {
S32 curEntry = 0; S32 curEntry = 0;
@@ -759,9 +715,7 @@ std::string RGBToHex(int rNum, int gNum, int bNum)
} }
//Called when a hex value is entered into the Hex field - Convert and set values. //Called when a hex value is entered into the Hex field - Convert and set values.
void void LLFloaterColorPicker::onHexCommit ( LLUICtrl* ctrl, void* data )
LLFloaterColorPicker::
onHexCommit ( LLUICtrl* ctrl, void* data )
{ {
if ( data ) if ( data )
{ {
@@ -834,9 +788,7 @@ enableTextCallbacks ( BOOL stateIn )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
void void LLFloaterColorPicker::onTextEntryChanged ( LLUICtrl* ctrl )
LLFloaterColorPicker::
onTextEntryChanged ( LLUICtrl* ctrl )
{ {
// value in RGB boxes changed // value in RGB boxes changed
std::string name = ctrl->getName(); std::string name = ctrl->getName();
@@ -905,9 +857,7 @@ onTextEntryChanged ( LLUICtrl* ctrl )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
BOOL BOOL LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn )
LLFloaterColorPicker::
updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn )
{ {
if ( xPosIn >= mRGBViewerImageLeft && if ( xPosIn >= mRGBViewerImageLeft &&
xPosIn <= mRGBViewerImageLeft + mRGBViewerImageWidth && xPosIn <= mRGBViewerImageLeft + mRGBViewerImageWidth &&
@@ -943,9 +893,7 @@ updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
BOOL BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
LLFloaterColorPicker::
handleMouseDown ( S32 x, S32 y, MASK mask )
{ {
// make it the frontmost // make it the frontmost
gFloaterView->bringToFront(this); gFloaterView->bringToFront(this);
@@ -1047,9 +995,7 @@ handleMouseDown ( S32 x, S32 y, MASK mask )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
BOOL BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask )
LLFloaterColorPicker::
handleHover ( S32 x, S32 y, MASK mask )
{ {
// if we're the front most window // if we're the front most window
if ( isFrontmost () ) if ( isFrontmost () )
@@ -1125,9 +1071,7 @@ void LLFloaterColorPicker::onClose(bool app_quitting)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// reverts state once mouse button is released // reverts state once mouse button is released
BOOL BOOL LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask )
LLFloaterColorPicker::
handleMouseUp ( S32 x, S32 y, MASK mask )
{ {
getWindow()->setCursor ( UI_CURSOR_ARROW ); getWindow()->setCursor ( UI_CURSOR_ARROW );
@@ -1202,9 +1146,7 @@ handleMouseUp ( S32 x, S32 y, MASK mask )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// cancel current color selection, revert to original and close picker // cancel current color selection, revert to original and close picker
void void LLFloaterColorPicker::cancelSelection ()
LLFloaterColorPicker::
cancelSelection ()
{ {
// restore the previous color selection // restore the previous color selection
setCurRgb ( getOrigR (), getOrigG (), getOrigB () ); setCurRgb ( getOrigR (), getOrigG (), getOrigB () );

View File

@@ -123,11 +123,11 @@ class LLFloaterColorPicker
// callbacks // callbacks
static void onClickCancel ( void* data ); static void onClickCancel ( void* data );
static void onClickSelect ( void* data ); static void onClickSelect ( void* data );
static void onClickPipette ( void* data ); void onClickPipette ( );
static void onTextCommit ( LLUICtrl* ctrl, void* data ); static void onTextCommit ( LLUICtrl* ctrl, void* data );
static void onImmediateCheck ( LLUICtrl* ctrl, void* data );
static void onHexCommit ( LLUICtrl* ctrl, void* data ); static void onHexCommit ( LLUICtrl* ctrl, void* data );
void onImmediateCheck(); void onColorSelect( const LLTextureEntry& te );
static void onColorSelect( const LLTextureEntry& te, void *data );
private: private:
// turns on or off text entry commit call backs // turns on or off text entry commit call backs
void enableTextCallbacks ( BOOL stateIn ); void enableTextCallbacks ( BOOL stateIn );

View File

@@ -166,13 +166,7 @@ BOOL LLFloaterExploreSounds::tick()
// Save scroll pos and selection so they can be restored // Save scroll pos and selection so they can be restored
S32 scroll_pos = list->getScrollPos(); S32 scroll_pos = list->getScrollPos();
LLDynamicArray<LLUUID> selected_ids; uuid_vec_t selected_ids = list->getSelectedIDs();
std::vector<LLScrollListItem*> selected_items = list->getAllSelected();
std::vector<LLScrollListItem*>::iterator selection_iter = selected_items.begin();
std::vector<LLScrollListItem*>::iterator selection_end = selected_items.end();
for(; selection_iter != selection_end; ++selection_iter)
selected_ids.push_back((*selection_iter)->getUUID());
list->clearRows(); list->clearRows();
std::list<LLUUID> unique_asset_list; std::list<LLUUID> unique_asset_list;

View File

@@ -168,7 +168,7 @@ void LLPanelFriends::updateFriends(U32 changed_mask)
// if the maximum amount of friends are selected // if the maximum amount of friends are selected
mShowMaxSelectWarning = false; mShowMaxSelectWarning = false;
LLDynamicArray<LLUUID> selected_friends = getSelectedIDs(); const uuid_vec_t selected_friends = mFriendsList->getSelectedIDs();
if(changed_mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE)) if(changed_mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE))
{ {
refreshNames(changed_mask); refreshNames(changed_mask);
@@ -187,13 +187,13 @@ void LLPanelFriends::updateFriends(U32 changed_mask)
tick(); tick();
} }
} }
if(selected_friends.size() > 0) if(!selected_friends.empty())
{ {
// only non-null if friends was already found. This may fail, // only non-null if friends was already found. This may fail,
// but we don't really care here, because refreshUI() will // but we don't really care here, because refreshUI() will
// clean up the interface. // clean up the interface.
friends_list->setCurrentByID(selected_id); friends_list->setCurrentByID(selected_id);
for(LLDynamicArray<LLUUID>::iterator itr = selected_friends.begin(); itr != selected_friends.end(); ++itr) for(uuid_vec_t::const_iterator itr = selected_friends.begin(); itr != selected_friends.end(); ++itr)
{ {
friends_list->setSelectedByValue(*itr, true); friends_list->setSelectedByValue(*itr, true);
} }
@@ -587,7 +587,7 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh
void LLPanelFriends::refreshRightsChangeList() void LLPanelFriends::refreshRightsChangeList()
{ {
LLDynamicArray<LLUUID> friends = getSelectedIDs(); const uuid_vec_t friends = mFriendsList->getSelectedIDs();
S32 num_selected = friends.size(); S32 num_selected = friends.size();
bool can_offer_teleport = num_selected >= 1; bool can_offer_teleport = num_selected >= 1;
@@ -610,7 +610,7 @@ void LLPanelFriends::refreshRightsChangeList()
processing_label->setVisible(false); processing_label->setVisible(false);
} Making Dummy View -HgB */ } Making Dummy View -HgB */
const LLRelationship* friend_status = NULL; const LLRelationship* friend_status = NULL;
for(LLDynamicArray<LLUUID>::iterator itr = friends.begin(); itr != friends.end(); ++itr) for(uuid_vec_t::const_iterator itr = friends.begin(); itr != friends.end(); ++itr)
{ {
friend_status = LLAvatarTracker::instance().getBuddyInfo(*itr); friend_status = LLAvatarTracker::instance().getBuddyInfo(*itr);
if (friend_status) if (friend_status)
@@ -659,7 +659,7 @@ struct SortFriendsByID
void LLPanelFriends::refreshNames(U32 changed_mask) void LLPanelFriends::refreshNames(U32 changed_mask)
{ {
LLDynamicArray<LLUUID> selected_ids = getSelectedIDs(); const uuid_vec_t selected_ids = mFriendsList->getSelectedIDs();
S32 pos = mFriendsList->getScrollPos(); S32 pos = mFriendsList->getScrollPos();
// get all buddies we know about // get all buddies we know about
@@ -685,7 +685,7 @@ void LLPanelFriends::refreshNames(U32 changed_mask)
// Changed item in place, need to request sort and update columns // Changed item in place, need to request sort and update columns
// because we might have changed data in a column on which the user // because we might have changed data in a column on which the user
// has already sorted. JC // has already sorted. JC
mFriendsList->sortItems(); mFriendsList->updateSort();
// re-select items // re-select items
mFriendsList->selectMultiple(selected_ids); mFriendsList->selectMultiple(selected_ids);
@@ -787,18 +787,6 @@ void LLPanelFriends::refreshUI()
refreshRightsChangeList(); refreshRightsChangeList();
} }
LLDynamicArray<LLUUID> LLPanelFriends::getSelectedIDs()
{
LLUUID selected_id;
LLDynamicArray<LLUUID> friend_ids;
std::vector<LLScrollListItem*> selected = mFriendsList->getAllSelected();
for(std::vector<LLScrollListItem*>::iterator itr = selected.begin(); itr != selected.end(); ++itr)
{
friend_ids.push_back((*itr)->getUUID());
}
return friend_ids;
}
// static // static
void LLPanelFriends::onSelectName(LLUICtrl* ctrl, void* user_data) void LLPanelFriends::onSelectName(LLUICtrl* ctrl, void* user_data)
{ {
@@ -818,8 +806,8 @@ void LLPanelFriends::onClickProfile(void* user_data)
LLPanelFriends* panelp = (LLPanelFriends*)user_data; LLPanelFriends* panelp = (LLPanelFriends*)user_data;
//llinfos << "LLPanelFriends::onClickProfile()" << llendl; //llinfos << "LLPanelFriends::onClickProfile()" << llendl;
LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs(); const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs();
if(ids.size() > 0) if(!ids.empty())
{ {
LLUUID agent_id = ids[0]; LLUUID agent_id = ids[0];
BOOL online; BOOL online;
@@ -834,7 +822,7 @@ void LLPanelFriends::onClickAssign(void* user_data)
LLPanelFriends* panelp = (LLPanelFriends*)user_data; LLPanelFriends* panelp = (LLPanelFriends*)user_data;
if (panelp) if (panelp)
{ {
LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs(); const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs();
ASFloaterContactGroups::show(ids); ASFloaterContactGroups::show(ids);
} }
} }
@@ -885,8 +873,8 @@ void LLPanelFriends::onClickIM(void* user_data)
LLPanelFriends* panelp = (LLPanelFriends*)user_data; LLPanelFriends* panelp = (LLPanelFriends*)user_data;
//llinfos << "LLPanelFriends::onClickIM()" << llendl; //llinfos << "LLPanelFriends::onClickIM()" << llendl;
LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs(); const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs();
if(ids.size() > 0) if(!ids.empty())
{ {
if(ids.size() == 1) if(ids.size() == 1)
{ {
@@ -959,13 +947,12 @@ bool LLPanelFriends::callbackAddFriend(const LLSD& notification, const LLSD& res
} }
// static // static
void LLPanelFriends::onPickAvatar(const std::vector<std::string>& names, void LLPanelFriends::onPickAvatar( const uuid_vec_t& ids,
const std::vector<LLUUID>& ids, const std::vector<LLAvatarName>& names )
void* )
{ {
if (names.empty()) return; if (names.empty()) return;
if (ids.empty()) return; if (ids.empty()) return;
requestFriendshipDialog(ids[0], names[0]); requestFriendshipDialog(ids[0], names[0].getCompleteName());
} }
// static // static
@@ -1001,7 +988,7 @@ void LLPanelFriends::onClickAddFriend(void* user_data)
{ {
LLPanelFriends* panelp = (LLPanelFriends*)user_data; LLPanelFriends* panelp = (LLPanelFriends*)user_data;
LLFloater* root_floater = gFloaterView->getParentFloater(panelp); LLFloater* root_floater = gFloaterView->getParentFloater(panelp);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(onPickAvatar, user_data, FALSE, TRUE); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelFriends::onPickAvatar, _1, _2), FALSE, TRUE);
if (root_floater) if (root_floater)
{ {
root_floater->addDependentFloater(picker); root_floater->addDependentFloater(picker);
@@ -1014,9 +1001,9 @@ void LLPanelFriends::onClickRemove(void* user_data)
LLPanelFriends* panelp = (LLPanelFriends*)user_data; LLPanelFriends* panelp = (LLPanelFriends*)user_data;
//llinfos << "LLPanelFriends::onClickRemove()" << llendl; //llinfos << "LLPanelFriends::onClickRemove()" << llendl;
LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs(); const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs();
LLSD args; LLSD args;
if(ids.size() > 0) if(!ids.empty())
{ {
std::string msgType = "RemoveFromFriends"; std::string msgType = "RemoveFromFriends";
if(ids.size() == 1) if(ids.size() == 1)
@@ -1053,7 +1040,7 @@ void LLPanelFriends::onClickRemove(void* user_data)
} }
LLSD payload; LLSD payload;
for (LLDynamicArray<LLUUID>::iterator it = ids.begin(); for (uuid_vec_t::const_iterator it = ids.begin();
it != ids.end(); it != ids.end();
++it) ++it)
{ {
@@ -1257,8 +1244,8 @@ void LLPanelFriends::onClickOfferTeleport(void* user_data)
{ {
LLPanelFriends* panelp = (LLPanelFriends*)user_data; LLPanelFriends* panelp = (LLPanelFriends*)user_data;
LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs(); const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs();
if(ids.size() > 0) if(!ids.empty())
{ {
handle_lure(ids); handle_lure(ids);
} }
@@ -1269,8 +1256,8 @@ void LLPanelFriends::onClickPay(void* user_data)
{ {
LLPanelFriends* panelp = (LLPanelFriends*)user_data; LLPanelFriends* panelp = (LLPanelFriends*)user_data;
LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs(); const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs();
if(ids.size() == 1) if(!ids.empty())
{ {
handle_pay_by_id(ids[0]); handle_pay_by_id(ids[0]);
} }
@@ -1281,7 +1268,7 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command
if (ids.empty()) return; if (ids.empty()) return;
LLSD args; LLSD args;
if(ids.size() > 0) if(!ids.empty())
{ {
rights_map_t* rights = new rights_map_t(ids); rights_map_t* rights = new rights_map_t(ids);

View File

@@ -41,6 +41,7 @@
#include "lleventtimer.h" #include "lleventtimer.h"
#include "llcallingcard.h" #include "llcallingcard.h"
class LLAvatarName;
class LLFriendObserver; class LLFriendObserver;
class LLRelationship; class LLRelationship;
class LLScrollListItem; class LLScrollListItem;
@@ -126,15 +127,12 @@ private:
void confirmModifyRights(rights_map_t& ids, EGrantRevoke command); void confirmModifyRights(rights_map_t& ids, EGrantRevoke command);
void sendRightsGrant(rights_map_t& ids); void sendRightsGrant(rights_map_t& ids);
// return LLUUID::null if nothing is selected
LLDynamicArray<LLUUID> getSelectedIDs();
// callback methods // callback methods
static void onSelectName(LLUICtrl* ctrl, void* user_data); static void onSelectName(LLUICtrl* ctrl, void* user_data);
static void onChangeContactGroup(LLUICtrl* ctrl, void* user_data); static void onChangeContactGroup(LLUICtrl* ctrl, void* user_data);
static bool callbackAddFriend(const LLSD& notification, const LLSD& response); static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data); static void onPickAvatar(const uuid_vec_t& ids, const std::vector<LLAvatarName>& names );
static void onContactSearchEdit(const std::string& search_string, void* user_data); static void onContactSearchEdit(const std::string& search_string, void* user_data);
static void onClickIM(void* user_data); static void onClickIM(void* user_data);
static void onClickAssign(void* user_data); static void onClickAssign(void* user_data);

View File

@@ -1499,7 +1499,7 @@ void LLPanelLandObjects::onClickRefresh(void* userdata)
// ready the list for results // ready the list for results
self->mOwnerList->deleteAllItems(); self->mOwnerList->deleteAllItems();
self->mOwnerList->addCommentText(LLTrans::getString("Searching")); self->mOwnerList->setCommentText(LLTrans::getString("Searching"));
self->mOwnerList->setEnabled(FALSE); self->mOwnerList->setEnabled(FALSE);
self->mFirstReply = TRUE; self->mFirstReply = TRUE;
@@ -1526,8 +1526,6 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo
return; return;
} }
const LLFontGL* FONT = LLFontGL::getFontSansSerif();
// Extract all of the owners. // Extract all of the owners.
S32 rows = msg->getNumberOfBlocksFast(_PREHASH_Data); S32 rows = msg->getNumberOfBlocksFast(_PREHASH_Data);
//uuid_list_t return_ids; //uuid_list_t return_ids;
@@ -1568,44 +1566,64 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo
BOOL in_sim = (std::find(avatar_ids.begin(), avatar_ids.end(), owner_id) != avatar_ids.end()); BOOL in_sim = (std::find(avatar_ids.begin(), avatar_ids.end(), owner_id) != avatar_ids.end());
LLScrollListItem *row = new LLScrollListItem( TRUE, NULL, owner_id); LLSD item;
item["id"] = owner_id;
LLSD& row = item["columns"];
LLSD icon_column;
LLSD status_column;
icon_column["type"] = "icon";
icon_column["column"] = "type";
status_column["font"] = "SANSSERIF";
status_column["column"] = "online_status";
if (is_group_owned) if (is_group_owned)
{ {
row->addColumn(self->mIconGroup); icon_column["value"] = self->mIconGroup->getName();
row->addColumn(OWNER_GROUP, FONT); status_column["value"] = OWNER_GROUP;
} }
else if (in_sim) else if (in_sim)
{ {
row->addColumn(self->mIconAvatarInSim); icon_column["value"] = self->mIconAvatarInSim->getName();
row->addColumn(OWNER_INSIM, FONT); status_column["value"] = OWNER_INSIM;
} }
else if (is_online) else if (is_online)
{ {
row->addColumn(self->mIconAvatarOnline); icon_column["value"] = self->mIconAvatarOnline->getName();
row->addColumn(OWNER_ONLINE, FONT); status_column["value"] = OWNER_ONLINE;
} }
else // offline else // offline
{ {
row->addColumn(self->mIconAvatarOffline); icon_column["value"] = self->mIconAvatarOffline->getName();
row->addColumn(OWNER_OFFLINE, FONT); status_column["value"] = OWNER_OFFLINE;
} }
row.append(icon_column);
row.append(status_column);
// Placeholder for name. // Placeholder for name.
row->addColumn(LLStringUtil::null, FONT); LLAvatarName av_name;
LLAvatarNameCache::get(owner_id, &av_name);
LLSD name_column;
name_column["value"] = av_name.getCompleteName();
name_column["font"] = "SANSSERIF";
name_column["column"] = "name";
row.append(name_column);
object_count_str = llformat("%d", object_count); LLSD count_column;
row->addColumn(object_count_str, FONT); count_column["value"] = llformat("%d", object_count);
count_column["font"] = "SANSSERIF";
count_column["column"] = "count";
row.append(count_column);
row->addColumn(formatted_time((time_t)most_recent_time), FONT); LLSD time_column;
time_column["value"] = formatted_time((time_t)most_recent_time);
time_column["font"] = "SANSSERIF";
time_column["column"] = "mostrecent";
row.append(time_column);
if( is_group_owned )
if (is_group_owned)
{
self->mOwnerList->addGroupNameItem(row, ADD_BOTTOM); self->mOwnerList->addGroupNameItem(row, ADD_BOTTOM);
}
else else
{
self->mOwnerList->addNameItem(row, ADD_BOTTOM); self->mOwnerList->addNameItem(row, ADD_BOTTOM);
}
lldebugs << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent") lldebugs << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent")
<< ") owns " << object_count << " objects." << llendl; << ") owns " << object_count << " objects." << llendl;
@@ -1613,7 +1631,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo
// check for no results // check for no results
if (0 == self->mOwnerList->getItemCount()) if (0 == self->mOwnerList->getItemCount())
{ {
self->mOwnerList->addCommentText(LLTrans::getString("NoneFound")); self->mOwnerList->setCommentText(LLTrans::getString("NoneFound"));
} }
else else
{ {
@@ -2439,7 +2457,11 @@ void LLPanelLandAccess::refresh()
childSetLabelArg("GroupCheck", "[GROUP]", group_name ); childSetLabelArg("GroupCheck", "[GROUP]", group_name );
// Allow list // Allow list
if (mListAccess)
{ {
// Clear the sort order so we don't re-sort on every add.
mListAccess->clearSortOrder();
mListAccess->deleteAllItems();
S32 count = parcel->mAccessList.size(); S32 count = parcel->mAccessList.size();
childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",count)); childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",count));
childSetToolTipArg("AccessList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); childSetToolTipArg("AccessList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST));
@@ -2475,13 +2497,17 @@ void LLPanelLandAccess::refresh()
} }
suffix.append(" " + getString("remaining") + ")"); suffix.append(" " + getString("remaining") + ")");
} }
if (mListAccess)
mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix);
} }
mListAccess->sortByName(TRUE);
} }
// Ban List // Ban List
if(mListBanned)
{ {
// Clear the sort order so we don't re-sort on every add.
mListBanned->clearSortOrder();
mListBanned->deleteAllItems();
S32 count = parcel->mBanList.size(); S32 count = parcel->mBanList.size();
childSetToolTipArg("BannedList", "[LISTED]", llformat("%d",count)); childSetToolTipArg("BannedList", "[LISTED]", llformat("%d",count));
@@ -2520,6 +2546,7 @@ void LLPanelLandAccess::refresh()
} }
mListBanned->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); mListBanned->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix);
} }
mListBanned->sortByName(TRUE);
} }
if(parcel->getRegionDenyAnonymousOverride()) if(parcel->getRegionDenyAnonymousOverride())

View File

@@ -636,18 +636,18 @@ void LLFloaterMessageLog::refreshNetList()
{ {
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(1); LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(1);
icon->setValue("icon_net_close_circuit.tga"); icon->setValue("icon_net_close_circuit.tga");
icon->setClickCallback(onClickCloseCircuit, itemp); icon->setClickCallback(boost::bind(&LLFloaterMessageLog::onClickCloseCircuit, itemp));
} }
else else
{ {
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(1); LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(1);
icon->setValue("icon_net_close_circuit_gray.tga"); icon->setValue("icon_net_close_circuit_gray.tga");
icon->setClickCallback(NULL, NULL); //icon->setClickCallback(NULL);
} }
// Event queue isn't even supported yet... FIXME // Event queue isn't even supported yet... FIXME
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(2); LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(2);
icon->setValue("icon_net_close_eventpoll_gray.tga"); icon->setValue("icon_net_close_eventpoll_gray.tga");
icon->setClickCallback(NULL, NULL); //icon->setClickCallback(NULL);
} }
if(selected_id.notNull()) scrollp->selectByID(selected_id); if(selected_id.notNull()) scrollp->selectByID(selected_id);
if(scroll_pos < scrollp->getItemCount()) scrollp->setScrollPos(scroll_pos); if(scroll_pos < scrollp->getItemCount()) scrollp->setScrollPos(scroll_pos);

View File

@@ -92,7 +92,7 @@ void LLFloaterNewIM::addSpecial(const LLUUID& uuid, const std::string& name,
LLSD row; LLSD row;
row["id"] = uuid; row["id"] = uuid;
row["name"] = name; row["name"] = name;
row["target"] = "SPECIAL"; row["target"] = LLNameListCtrl::SPECIAL;
row["columns"][0]["value"] = name; row["columns"][0]["value"] = name;
row["columns"][0]["width"] = COL_1_WIDTH; row["columns"][0]["width"] = COL_1_WIDTH;
row["columns"][0]["font"] = "SANSSERIF"; row["columns"][0]["font"] = "SANSSERIF";
@@ -113,7 +113,7 @@ void LLFloaterNewIM::addGroup(const LLUUID& uuid, void* data, BOOL bold, BOOL on
{ {
LLSD row; LLSD row;
row["id"] = uuid; row["id"] = uuid;
row["target"] = "GROUP"; row["target"] = LLNameListCtrl::GROUP;
row["columns"][0]["value"] = ""; // name will be looked up row["columns"][0]["value"] = ""; // name will be looked up
row["columns"][0]["width"] = COL_1_WIDTH; row["columns"][0]["width"] = COL_1_WIDTH;
row["columns"][0]["font"] = "SANSSERIF"; row["columns"][0]["font"] = "SANSSERIF";
@@ -132,12 +132,10 @@ void LLFloaterNewIM::addGroup(const LLUUID& uuid, void* data, BOOL bold, BOOL on
void LLFloaterNewIM::addAgent(const LLUUID& uuid, void* data, BOOL online) void LLFloaterNewIM::addAgent(const LLUUID& uuid, void* data, BOOL online)
{ {
std::string fullname;
gCacheName->getFullName(uuid, fullname);
LLSD row; LLSD row;
row["id"] = uuid; row["id"] = uuid;
row["columns"][0]["value"] = fullname; row["target"] = LLNameListCtrl::INDIVIDUAL;
row["columns"][0]["value"] = "";
row["columns"][0]["width"] = COL_1_WIDTH; row["columns"][0]["width"] = COL_1_WIDTH;
row["columns"][0]["font"] = "SANSSERIF"; row["columns"][0]["font"] = "SANSSERIF";
row["columns"][0]["font-style"] = online ? "BOLD" : "NORMAL"; row["columns"][0]["font-style"] = online ? "BOLD" : "NORMAL";

View File

@@ -3200,7 +3200,8 @@ bool LLDispatchSetEstateAccess::operator()(
if (allowed_agent_name_list) if (allowed_agent_name_list)
{ {
//allowed_agent_name_list->deleteAllItems(); // Don't sort these as we add them, sort them when we are done.
allowed_agent_name_list->clearSortOrder();
for (S32 i = 0; i < num_allowed_agents && i < ESTATE_MAX_ACCESS_IDS; i++) for (S32 i = 0; i < num_allowed_agents && i < ESTATE_MAX_ACCESS_IDS; i++)
{ {
LLUUID id; LLUUID id;
@@ -3208,7 +3209,7 @@ bool LLDispatchSetEstateAccess::operator()(
allowed_agent_name_list->addNameItem(id); allowed_agent_name_list->addNameItem(id);
} }
panel->childSetEnabled("remove_allowed_avatar_btn", allowed_agent_name_list->getFirstSelected() ? TRUE : FALSE); panel->childSetEnabled("remove_allowed_avatar_btn", allowed_agent_name_list->getFirstSelected() ? TRUE : FALSE);
allowed_agent_name_list->sortByColumnIndex(0, TRUE); allowed_agent_name_list->sortByName(TRUE);
} }
} }
@@ -3225,6 +3226,8 @@ bool LLDispatchSetEstateAccess::operator()(
if (allowed_group_name_list) if (allowed_group_name_list)
{ {
// Don't sort these as we add them, sort them when we are done.
allowed_group_name_list->clearSortOrder();
allowed_group_name_list->deleteAllItems(); allowed_group_name_list->deleteAllItems();
for (S32 i = 0; i < num_allowed_groups && i < ESTATE_MAX_GROUP_IDS; i++) for (S32 i = 0; i < num_allowed_groups && i < ESTATE_MAX_GROUP_IDS; i++)
{ {
@@ -3233,7 +3236,7 @@ bool LLDispatchSetEstateAccess::operator()(
allowed_group_name_list->addGroupNameItem(id); allowed_group_name_list->addGroupNameItem(id);
} }
panel->childSetEnabled("remove_allowed_group_btn", allowed_group_name_list->getFirstSelected() ? TRUE : FALSE); panel->childSetEnabled("remove_allowed_group_btn", allowed_group_name_list->getFirstSelected() ? TRUE : FALSE);
allowed_group_name_list->sortByColumnIndex(0, TRUE); allowed_group_name_list->sortByName(TRUE);
} }
} }
@@ -3257,7 +3260,9 @@ bool LLDispatchSetEstateAccess::operator()(
if (banned_agent_name_list) if (banned_agent_name_list)
{ {
//banned_agent_name_list->deleteAllItems(); // Don't sort these as we add them, sort them when we are done.
banned_agent_name_list->clearSortOrder();
for (S32 i = 0; i < num_banned_agents && i < ESTATE_MAX_ACCESS_IDS; i++) for (S32 i = 0; i < num_banned_agents && i < ESTATE_MAX_ACCESS_IDS; i++)
{ {
LLUUID id; LLUUID id;
@@ -3265,7 +3270,7 @@ bool LLDispatchSetEstateAccess::operator()(
banned_agent_name_list->addNameItem(id); banned_agent_name_list->addNameItem(id);
} }
panel->childSetEnabled("remove_banned_avatar_btn", banned_agent_name_list->getFirstSelected() ? TRUE : FALSE); panel->childSetEnabled("remove_banned_avatar_btn", banned_agent_name_list->getFirstSelected() ? TRUE : FALSE);
banned_agent_name_list->sortByColumnIndex(0, TRUE); banned_agent_name_list->sortByName(TRUE);
} }
} }
@@ -3280,6 +3285,9 @@ bool LLDispatchSetEstateAccess::operator()(
panel->getChild<LLNameListCtrl>("estate_manager_name_list"); panel->getChild<LLNameListCtrl>("estate_manager_name_list");
if (estate_manager_name_list) if (estate_manager_name_list)
{ {
// Don't sort these as we add them, sort them when we are done.
estate_manager_name_list->clearSortOrder();
estate_manager_name_list->deleteAllItems(); // Clear existing entries estate_manager_name_list->deleteAllItems(); // Clear existing entries
// There should be only ESTATE_MAX_MANAGERS people in the list, but if the database gets more (SL-46107) don't // There should be only ESTATE_MAX_MANAGERS people in the list, but if the database gets more (SL-46107) don't
@@ -3292,7 +3300,7 @@ bool LLDispatchSetEstateAccess::operator()(
estate_manager_name_list->addNameItem(id); estate_manager_name_list->addNameItem(id);
} }
panel->childSetEnabled("remove_estate_manager_btn", estate_manager_name_list->getFirstSelected() ? TRUE : FALSE); panel->childSetEnabled("remove_estate_manager_btn", estate_manager_name_list->getFirstSelected() ? TRUE : FALSE);
estate_manager_name_list->sortByColumnIndex(0, TRUE); estate_manager_name_list->sortByName(TRUE);
} }
} }

View File

@@ -250,7 +250,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
if (total_count == 0 && list->getItemCount() == 0) if (total_count == 0 && list->getItemCount() == 0)
{ {
list->addCommentText(getString("none_descriptor")); list->setCommentText(getString("none_descriptor"));
} }
else else
{ {

View File

@@ -1593,7 +1593,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
else else
{ {
// if we found nothing, say "none" // if we found nothing, say "none"
list->addCommentText(LLTrans::getString("worldmap_results_none_found")); list->setCommentText(LLTrans::getString("worldmap_results_none_found"));
list->operateOnAll(LLCtrlListInterface::OP_DESELECT); list->operateOnAll(LLCtrlListInterface::OP_DESELECT);
} }
} }

View File

@@ -792,7 +792,7 @@ void LLGestureMgr::update()
if (gesture->mDoneCallback) if (gesture->mDoneCallback)
{ {
gesture->mDoneCallback(gesture, gesture->mCallbackData); gesture->mDoneCallback(gesture);
// callback might have deleted gesture, can't // callback might have deleted gesture, can't
// rely on this pointer any more // rely on this pointer any more
@@ -1299,7 +1299,7 @@ void LLGestureMgr::stopGesture(LLMultiGesture* gesture)
if (gesture->mDoneCallback) if (gesture->mDoneCallback)
{ {
gesture->mDoneCallback(gesture, gesture->mCallbackData); gesture->mDoneCallback(gesture);
// callback might have deleted gesture, can't // callback might have deleted gesture, can't
// rely on this pointer any more // rely on this pointer any more

View File

@@ -619,11 +619,11 @@ BOOL LLFloaterInventoryBackup::postBuild(void)
status_column["column"] = "status"; status_column["column"] = "status";
status_column["value"] = "Pending"; status_column["value"] = "Pending";
LLScrollListItem* scroll_itemp = list->addElement(element, ADD_BOTTOM); /*LLScrollListItem* scroll_itemp = */list->addElement(element, ADD_BOTTOM);
//hack to stop crashing //hack to stop crashing
LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(LIST_TYPE); //LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(LIST_TYPE);
icon->setClickCallback(NULL, NULL); //icon->setClickCallback(NULL);
} }
// Setup and go! // Setup and go!

View File

@@ -32,13 +32,16 @@
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "llnamelistctrl.h"
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
#include "llnamelistctrl.h" #include "llavatarnamecache.h"
#include "llcachename.h" #include "llcachename.h"
#include "llagent.h" #include "llagent.h"
#include "llinventory.h" #include "llinventory.h"
#include "lltrans.h"
static LLRegisterWidget<LLNameListCtrl> r("name_list"); static LLRegisterWidget<LLNameListCtrl> r("name_list");
@@ -51,12 +54,14 @@ LLNameListCtrl::LLNameListCtrl(const std::string& name,
void* userdata, void* userdata,
BOOL allow_multiple_selection, BOOL allow_multiple_selection,
BOOL draw_border, BOOL draw_border,
bool draw_heading,
S32 name_column_index, S32 name_column_index,
const std::string& tooltip) const std::string& tooltip)
: LLScrollListCtrl(name, rect, cb, userdata, allow_multiple_selection, : LLScrollListCtrl(name, rect, cb, userdata, allow_multiple_selection,
draw_border), draw_border,draw_heading),
mNameColumnIndex(name_column_index), mNameColumnIndex(name_column_index),
mAllowCallingCardDrop(FALSE) mAllowCallingCardDrop(FALSE),
mShortNames(FALSE)
{ {
setToolTip(tooltip); setToolTip(tooltip);
LLNameListCtrl::sInstances.insert(this); LLNameListCtrl::sInstances.insert(this);
@@ -71,19 +76,22 @@ LLNameListCtrl::~LLNameListCtrl()
// public // public
BOOL LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos, LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos,
BOOL enabled, std::string const& suffix) BOOL enabled, const std::string& suffix)
{ {
//llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl; //llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl;
std::string fullname; LLSD item;
BOOL result = gCacheName->getFullName(agent_id, fullname); item["id"] = agent_id;
item["enabled"] = enabled;
item["target"] = INDIVIDUAL;
item["suffix"] = suffix;
LLSD& column = item["columns"][0];
column["value"] = "";
column["font"] = "SANSSERIF";
column["column"] = "name";
fullname.append(suffix); return addNameItemRow(item, pos);
addStringUUIDItem(fullname, agent_id, pos, enabled);
return result;
} }
// virtual, public // virtual, public
@@ -134,79 +142,99 @@ BOOL LLNameListCtrl::handleDragAndDrop(
return handled; return handled;
} }
// public // public
void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos, void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos,
BOOL enabled) BOOL enabled)
{ {
//llinfos << "LLNameListCtrl::addGroupNameItem " << group_id << llendl; LLSD item;
std::string group_name; item["id"] = group_id;
gCacheName->getGroupName(group_id, group_name); item["enabled"] = enabled;
addStringUUIDItem(group_name, group_id, pos, enabled); item["target"] = GROUP;
LLSD& column = item["columns"][0];
column["value"] = "";
column["font"] = "SANSSERIF";
column["column"] = "name";
addNameItemRow(item, pos);
} }
// public // public
void LLNameListCtrl::addGroupNameItem(LLScrollListItem* item, EAddPosition pos) void LLNameListCtrl::addGroupNameItem(LLSD& item, EAddPosition pos)
{ {
//llinfos << "LLNameListCtrl::addGroupNameItem " << item->getUUID() << llendl; item["target"] = GROUP;
addNameItemRow(item, pos);
std::string group_name;
gCacheName->getGroupName(item->getUUID(), group_name);
LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex);
((LLScrollListText*)cell)->setText( std::string(group_name) );
addItem(item, pos);
} }
BOOL LLNameListCtrl::addNameItem(LLScrollListItem* item, EAddPosition pos) LLScrollListItem* LLNameListCtrl::addNameItem(LLSD& item, EAddPosition pos)
{ {
//llinfos << "LLNameListCtrl::addNameItem " << item->getUUID() << llendl; item["target"] = INDIVIDUAL;
return addNameItemRow(item, pos);
std::string fullname;
BOOL result = gCacheName->getFullName(item->getUUID(), fullname);
LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex);
((LLScrollListText*)cell)->setText( fullname );
addItem(item, pos);
// this column is resizable
LLScrollListColumn* columnp = getColumn(mNameColumnIndex);
if (columnp && columnp->mHeader)
{
columnp->mHeader->setHasResizableElement(TRUE);
}
return result;
} }
LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos, void* userdata) LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos, void* userdata)
{ {
return addNameItemRow(value, pos, userdata);
}
LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLSD& value, EAddPosition pos, void* userdata)
{
LLScrollListItem* item = LLScrollListCtrl::addElement(value, pos, userdata); LLScrollListItem* item = LLScrollListCtrl::addElement(value, pos, userdata);
if (!item) return NULL;
LLUUID id = item->getUUID();
// use supplied name by default // use supplied name by default
std::string fullname = value["name"].asString(); std::string fullname = value["name"].asString();
if (value["target"].asString() == "GROUP") switch(value["target"].asInteger())
{ {
gCacheName->getGroupName(item->getUUID(), fullname); case GROUP:
gCacheName->getGroupName(id, fullname);
// fullname will be "nobody" if group not found // fullname will be "nobody" if group not found
} break;
else if (value["target"].asString() == "SPECIAL") case SPECIAL:
{
// just use supplied name // just use supplied name
} break;
else // normal resident case INDIVIDUAL:
{ {
std::string name; LLAvatarName av_name;
if (gCacheName->getFullName(item->getUUID(), name)) if (id.isNull())
{ {
fullname = name; fullname = LLTrans::getString("AvatarNameNobody");
} }
else if (LLAvatarNameCache::get(id, &av_name))
{
if (mShortNames)
fullname = av_name.mDisplayName;
else
fullname = av_name.getCompleteName();
}
else
{
fullname = " ( " + LLTrans::getString("LoadingData") + " ) ";
// ...schedule a callback
LLAvatarNameCache::get(id,
boost::bind(&LLNameListCtrl::onAvatarNameCache,
this, _1, _2, item->getHandle()));
}
break;
}
default:
break;
} }
LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); // Append optional suffix.
((LLScrollListText*)cell)->setText( fullname ); std::string suffix = value["suffix"];
if(!suffix.empty())
{
fullname.append(suffix);
}
LLScrollListCell* cell = item->getColumn(mNameColumnIndex);
if (cell && !fullname.empty() && cell->getValue().asString().empty())
{
cell->setValue(fullname);
}
dirtyColumns(); dirtyColumns();
@@ -223,54 +251,53 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos
// public // public
void LLNameListCtrl::removeNameItem(const LLUUID& agent_id) void LLNameListCtrl::removeNameItem(const LLUUID& agent_id)
{ {
BOOL item_exists = selectByID( agent_id ); // Find the item specified with agent_id.
if(item_exists) S32 idx = -1;
for (item_list::iterator it = getItemList().begin(); it != getItemList().end(); it++)
{ {
S32 index = getItemIndex(getFirstSelected()); LLScrollListItem* item = *it;
if(index >= 0) if (item->getUUID() == agent_id)
{ {
deleteSingleItem(index); idx = getItemIndex(item);
break;
} }
} }
// Remove it.
if (idx >= 0)
{
selectNthItem(idx); // not sure whether this is needed, taken from previous implementation
deleteSingleItem(idx);
}
} }
// public void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id,
void LLNameListCtrl::refresh(const LLUUID& agent_id, const std::string& full_name) const LLAvatarName& av_name,
LLHandle<LLScrollListItem> item)
{ {
//llinfos << "LLNameListCtrl::refresh " << id << " '" << first << " " std::string name;
// << last << "'" << llendl; if (mShortNames)
name = av_name.mDisplayName;
else
name = av_name.getCompleteName();
LLScrollListItem* list_item = item.get();
// TODO: scan items for that ID, fix if necessary if (list_item && list_item->getUUID() == agent_id)
item_list::iterator iter;
for (iter = getItemList().begin(); iter != getItemList().end(); iter++)
{ {
LLScrollListItem* item = *iter; LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex);
if (item->getUUID() == agent_id)
{
LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex);
if (cell) if (cell)
{ {
((LLScrollListText*)cell)->setText( full_name ); cell->setValue(name);
} setNeedsSort();
} }
} }
dirtyColumns(); dirtyColumns();
} }
void LLNameListCtrl::sortByName(BOOL ascending)
// static
void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& full_name)
{ {
std::set<LLNameListCtrl*>::iterator it; sortByColumnIndex(mNameColumnIndex,ascending);
for (it = LLNameListCtrl::sInstances.begin();
it != LLNameListCtrl::sInstances.end();
++it)
{
LLNameListCtrl* ctrl = *it;
ctrl->refresh(id, full_name);
}
} }
// virtual // virtual
@@ -320,9 +347,9 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
NULL, NULL,
multi_select, multi_select,
draw_border, draw_border,
name_column_index); draw_heading,
name_column_index
name_list->setDisplayHeading(draw_heading); );
if (node->hasAttribute("heading_height")) if (node->hasAttribute("heading_height"))
{ {
S32 heading_height; S32 heading_height;
@@ -439,7 +466,7 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
while(token_iter != tokens.end()) while(token_iter != tokens.end())
{ {
const std::string& line = *token_iter; const std::string& line = *token_iter;
name_list->addCommentText(line); name_list->setCommentText(line);
++token_iter; ++token_iter;
} }

View File

@@ -37,17 +37,26 @@
#include "llscrolllistctrl.h" #include "llscrolllistctrl.h"
class LLAvatarName;
class LLNameListCtrl class LLNameListCtrl
: public LLScrollListCtrl : public LLScrollListCtrl, public LLInstanceTracker<LLNameListCtrl>
{ {
public: public:
typedef enum e_name_type
{
INDIVIDUAL,
GROUP,
SPECIAL
} ENameType;
LLNameListCtrl(const std::string& name, LLNameListCtrl(const std::string& name,
const LLRect& rect, const LLRect& rect,
LLUICtrlCallback callback, LLUICtrlCallback callback,
void* userdata, void* userdata,
BOOL allow_multiple_selection, BOOL allow_multiple_selection,
BOOL draw_border = TRUE, BOOL draw_border = TRUE,
bool draw_heading = false,
S32 name_column_index = 0, S32 name_column_index = 0,
const std::string& tooltip = LLStringUtil::null); const std::string& tooltip = LLStringUtil::null);
virtual ~LLNameListCtrl(); virtual ~LLNameListCtrl();
@@ -57,36 +66,38 @@ public:
// Add a user to the list by name. It will be added, the name // Add a user to the list by name. It will be added, the name
// requested from the cache, and updated as necessary. // requested from the cache, and updated as necessary.
BOOL addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM, LLScrollListItem* addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM,
BOOL enabled = TRUE, std::string const& suffix = LLStringUtil::null); BOOL enabled = TRUE, std::string const& suffix = LLStringUtil::null);
BOOL addNameItem(LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM); LLScrollListItem* addNameItem(LLSD& item, EAddPosition pos = ADD_BOTTOM);
virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); /*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
LLScrollListItem* addNameItemRow(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
// Add a user to the list by name. It will be added, the name // Add a user to the list by name. It will be added, the name
// requested from the cache, and updated as necessary. // requested from the cache, and updated as necessary.
void addGroupNameItem(const LLUUID& group_id, EAddPosition pos = ADD_BOTTOM, void addGroupNameItem(const LLUUID& group_id, EAddPosition pos = ADD_BOTTOM,
BOOL enabled = TRUE); BOOL enabled = TRUE);
void addGroupNameItem(LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM);
void addGroupNameItem(LLSD& item, EAddPosition pos = ADD_BOTTOM);
void removeNameItem(const LLUUID& agent_id); void removeNameItem(const LLUUID& agent_id);
void refresh(const LLUUID& agent_id, const std::string& full_name); // LLView interface
/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
static void refreshAll(const LLUUID& id, const std::string& full_name);
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop, EDragAndDropType cargo_type, void *cargo_data, BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
EAcceptance *accept, EAcceptance *accept,
std::string& tooltip_msg); std::string& tooltip_msg);
void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; } void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; }
void sortByName(BOOL ascending);
private: private:
static std::set<LLNameListCtrl*> sInstances; static std::set<LLNameListCtrl*> sInstances;
void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, LLHandle<LLScrollListItem> item);
S32 mNameColumnIndex; S32 mNameColumnIndex;
BOOL mAllowCallingCardDrop; BOOL mAllowCallingCardDrop;
bool mShortNames; // display name only, no SLID
}; };
#endif #endif

View File

@@ -320,7 +320,7 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType
// } // }
if (0 == pAvatarGroups->group_list.size()) if (0 == pAvatarGroups->group_list.size())
{ {
group_list->addCommentText(getString("None")); group_list->setCommentText(getString("None"));
} }
for(LLAvatarGroups::group_list_t::const_iterator it = pAvatarGroups->group_list.begin(); for(LLAvatarGroups::group_list_t::const_iterator it = pAvatarGroups->group_list.begin();

View File

@@ -212,7 +212,7 @@ void LLPanelDirBrowser::updateResultCount()
// add none found response // add none found response
if (list->getItemCount() == 0) if (list->getItemCount() == 0)
{ {
list->addCommentText(LLTrans::getString("NoneFound")); list->setCommentText(LLTrans::getString("NoneFound"));
list->operateOnAll(LLCtrlListInterface::OP_DESELECT); list->operateOnAll(LLCtrlListInterface::OP_DESELECT);
} }
} }
@@ -1222,7 +1222,7 @@ void LLPanelDirBrowser::setupNewSearch()
// ready the list for results // ready the list for results
list->operateOnAll(LLCtrlListInterface::OP_DELETE); list->operateOnAll(LLCtrlListInterface::OP_DELETE);
list->addCommentText(LLTrans::getString("Searching")); list->setCommentText(LLTrans::getString("Searching"));
childDisable("results"); childDisable("results");
mResultsReceived = 0; mResultsReceived = 0;

View File

@@ -544,7 +544,7 @@ void LLPanelFace::getState()
bool identical; bool identical;
LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control");
texture_ctrl->setFallbackImageName( "" ); //Singu Note: Don't show the 'locked' image when the texid is null.
// Texture // Texture
{ {
LLUUID id; LLUUID id;
@@ -552,8 +552,14 @@ void LLPanelFace::getState()
{ {
LLUUID get(LLViewerObject* object, S32 te) LLUUID get(LLViewerObject* object, S32 te)
{ {
LLViewerTexture* image = object->getTEImage(te); //LLViewerTexture* image = object->getTEImage(te);
LLTextureEntry* image = object->getTE(te); //Singu Note: Use this instead of the above.
//The above actually returns LLViewerFetchedTexture::sDefaultImagep when
//the texture id is null, which gives us IMG_DEFAULT, not LLUUID::null
//Such behavior prevents the 'None' button from ever greying out in the face panel.
return image ? image->getID() : LLUUID::null; return image ? image->getID() : LLUUID::null;
} }
} func; } func;
identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id );

View File

@@ -854,6 +854,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
LLSD row; LLSD row;
row["columns"][0]["value"] = pending.str(); row["columns"][0]["value"] = pending.str();
row["columns"][0]["column"] = "name";
mListVisibleMembers->setEnabled(FALSE); mListVisibleMembers->setEnabled(FALSE);
mListVisibleMembers->addElement(row); mListVisibleMembers->addElement(row);
@@ -918,7 +919,7 @@ void LLPanelGroupGeneral::updateMembers()
sSDTime += sd_timer.getElapsedTimeF32(); sSDTime += sd_timer.getElapsedTimeF32();
element_timer.reset(); element_timer.reset();
mListVisibleMembers->addElement(row);//, ADD_SORTED); mListVisibleMembers->addNameItem(row);
sElementTime += element_timer.getElapsedTimeF32(); sElementTime += element_timer.getElapsedTimeF32();
} }
sAllTime += all_timer.getElapsedTimeF32(); sAllTime += all_timer.getElapsedTimeF32();

View File

@@ -138,9 +138,10 @@ void LLPanelGroupInvite::impl::addUsers(const std::vector<std::string>& names,
//add the name to the names list //add the name to the names list
LLSD row; LLSD row;
row["id"] = id; row["id"] = id;
row["columns"][0]["column"] = "name";
row["columns"][0]["value"] = name; row["columns"][0]["value"] = name;
mInvitees->addElement(row); mInvitees->addNameItem(row);
} }
} }

View File

@@ -676,7 +676,7 @@ BOOL LLPanelGroupLandMoney::postBuild()
{ {
if ( mImplementationp->mGroupParcelsp ) if ( mImplementationp->mGroupParcelsp )
{ {
mImplementationp->mGroupParcelsp->addCommentText( mImplementationp->mGroupParcelsp->setCommentText(
mImplementationp->mCantViewParcelsText); mImplementationp->mCantViewParcelsText);
mImplementationp->mGroupParcelsp->setEnabled(FALSE); mImplementationp->mGroupParcelsp->setEnabled(FALSE);
} }

View File

@@ -450,7 +450,7 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
if (1 == count && id.isNull()) if (1 == count && id.isNull())
{ {
// Only one entry, the dummy entry. // Only one entry, the dummy entry.
mNoticesList->addCommentText(mNoNoticesStr); mNoticesList->setCommentText(mNoNoticesStr);
mNoticesList->setEnabled(FALSE); mNoticesList->setEnabled(FALSE);
return; return;
} }
@@ -493,7 +493,7 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
mNoticesList->addElement(row, ADD_BOTTOM); mNoticesList->addElement(row, ADD_BOTTOM);
} }
mNoticesList->sortItems(); mNoticesList->updateSort();
} }
void LLPanelGroupNotices::onSelectNotice(LLUICtrl* ctrl, void* data) void LLPanelGroupNotices::onSelectNotice(LLUICtrl* ctrl, void* data)

View File

@@ -1615,7 +1615,7 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc)
retrieved << "Retrieving role member mappings..."; retrieved << "Retrieving role member mappings...";
} }
mMembersList->setEnabled(FALSE); mMembersList->setEnabled(FALSE);
mMembersList->addCommentText(retrieved.str()); mMembersList->setCommentText(retrieved.str());
} }
} }
@@ -1680,7 +1680,7 @@ void LLPanelGroupMembersSubTab::updateMembers()
row["columns"][2]["value"] = mMemberProgress->second->getOnlineStatus(); row["columns"][2]["value"] = mMemberProgress->second->getOnlineStatus();
row["columns"][2]["font"] = "SANSSERIF_SMALL"; row["columns"][2]["font"] = "SANSSERIF_SMALL";
mMembersList->addElement(row);//, ADD_SORTED); mMembersList->addNameItem(row);
mHasMatch = TRUE; mHasMatch = TRUE;
} }
} }
@@ -1694,7 +1694,7 @@ void LLPanelGroupMembersSubTab::updateMembers()
else else
{ {
mMembersList->setEnabled(FALSE); mMembersList->setEnabled(FALSE);
mMembersList->addCommentText(std::string("No match.")); mMembersList->setCommentText(std::string("No match."));
} }
} }
else else

View File

@@ -916,19 +916,19 @@ void LLPanelGroupVoting::impl::addPendingActiveScrollListItem(unsigned int curre
<< current << current
<< "\\" << expected << ")"; << "\\" << expected << ")";
mProposals->addCommentText(pending.str()); mProposals->setCommentText(pending.str());
} }
void LLPanelGroupVoting::impl::addNoActiveScrollListItem(EAddPosition pos) void LLPanelGroupVoting::impl::addNoActiveScrollListItem(EAddPosition pos)
{ {
// *TODO: translate // *TODO: translate
mProposals->addCommentText(std::string("There are currently no active proposals"), pos); mProposals->setCommentText(std::string("There are currently no active proposals"));
} }
void LLPanelGroupVoting::impl::addNoHistoryScrollListItem(EAddPosition pos) void LLPanelGroupVoting::impl::addNoHistoryScrollListItem(EAddPosition pos)
{ {
// *TODO: translate // *TODO: translate
mVotesHistory->addCommentText(std::string("There are currently no archived proposals"), pos); mVotesHistory->setCommentText(std::string("There are currently no archived proposals"));
} }
void LLPanelGroupVoting::impl::addPendingHistoryScrollListItem(unsigned int current, void LLPanelGroupVoting::impl::addPendingHistoryScrollListItem(unsigned int current,
@@ -941,7 +941,7 @@ void LLPanelGroupVoting::impl::addPendingHistoryScrollListItem(unsigned int curr
<< current << current
<< "\\" << expected << ")"; << "\\" << expected << ")";
mVotesHistory->addCommentText(pending.str()); mVotesHistory->setCommentText(pending.str());
} }

View File

@@ -1321,8 +1321,8 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect,
void LLPreviewLSL::callbackLSLCompileSucceeded() void LLPreviewLSL::callbackLSLCompileSucceeded()
{ {
llinfos << "LSL Bytecode saved" << llendl; llinfos << "LSL Bytecode saved" << llendl;
mScriptEd->mErrorList->addCommentText(LLTrans::getString("CompileSuccessful")); mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful"));
mScriptEd->mErrorList->addCommentText(LLTrans::getString("SaveComplete")); mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete"));
closeIfNeeded(); closeIfNeeded();
} }
@@ -1931,8 +1931,8 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id,
bool is_script_running) bool is_script_running)
{ {
lldebugs << "LSL Bytecode saved" << llendl; lldebugs << "LSL Bytecode saved" << llendl;
mScriptEd->mErrorList->addCommentText(LLTrans::getString("CompileSuccessful")); mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful"));
mScriptEd->mErrorList->addCommentText(LLTrans::getString("SaveComplete")); mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete"));
closeIfNeeded(); closeIfNeeded();
} }
@@ -2518,7 +2518,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename,
else else
{ {
llinfos << "Compile worked!" << llendl; llinfos << "Compile worked!" << llendl;
mScriptEd->mErrorList->addCommentText(LLTrans::getString("CompileSuccessfulSaving")); mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessfulSaving"));
if(gAssetStorage) if(gAssetStorage)
{ {
llinfos << "LLLiveLSLEditor::saveAsset " llinfos << "LLLiveLSLEditor::saveAsset "
@@ -2593,7 +2593,7 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use
if(self) if(self)
{ {
// Tell the user that the compile worked. // Tell the user that the compile worked.
self->mScriptEd->mErrorList->addCommentText(LLTrans::getString("SaveComplete")); self->mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete"));
// close the window if this completes both uploads // close the window if this completes both uploads
self->getWindow()->decBusyCount(); self->getWindow()->decBusyCount();
self->mPendingUploads--; self->mPendingUploads--;

View File

@@ -1593,7 +1593,10 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
// Texture picker defaults aren't inventory items // Texture picker defaults aren't inventory items
// * Don't need to worry about permissions for them // * Don't need to worry about permissions for them
// * Can just apply the texture and be done with it. // * Can just apply the texture and be done with it.
objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); //objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
objectp->setTETexture(te, mImageID); //Singu note: setTETexture will allow the real id to be passed to LLPrimitive::setTETexture,
// even if it's null. setTEImage would actually pass down IMG_DEFAULT under such a case,
// which we don't want.
} }
return true; return true;
} }
@@ -1756,7 +1759,10 @@ BOOL LLSelectMgr::selectionRevertTextures()
} }
else else
{ {
object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); //object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
object->setTETexture(te, id); //Singu note: setTETexture will allow the real id to be passed to LLPrimitive::setTETexture,
// even if it's null. setTEImage would actually pass down IMG_DEFAULT under such a case,
// which we don't want.
} }
} }
} }

View File

@@ -307,7 +307,6 @@ bool process_login_success_response(std::string &password);
void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group) void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group)
{ {
LLNameListCtrl::refreshAll(id, full_name);
LLNameBox::refreshAll(id, full_name, is_group); LLNameBox::refreshAll(id, full_name, is_group);
LLNameEditor::refreshAll(id, full_name, is_group); LLNameEditor::refreshAll(id, full_name, is_group);

View File

@@ -161,18 +161,19 @@ public:
static void onBtnSetToDefault( void* userdata ); static void onBtnSetToDefault( void* userdata );
static void onBtnSelect( void* userdata ); static void onBtnSelect( void* userdata );
static void onBtnCancel( void* userdata ); static void onBtnCancel( void* userdata );
static void onBtnPipette( void* userdata ); void onBtnPipette( );
static void onBtnUUID( void* userdata ); static void onBtnUUID( void* userdata );
//static void onBtnRevert( void* userdata ); //static void onBtnRevert( void* userdata );
static void onBtnWhite( void* userdata ); static void onBtnWhite( void* userdata );
static void onBtnNone( void* userdata );
static void onBtnInvisible( void* userdata ); static void onBtnInvisible( void* userdata );
static void onBtnAlpha( void* userdata ); static void onBtnAlpha( void* userdata );
static void onBtnClear( void* userdata ); static void onBtnClear( void* userdata );
static void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data); void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
static void onShowFolders(LLUICtrl* ctrl, void* userdata); static void onShowFolders(LLUICtrl* ctrl, void* userdata);
static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata); static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata);
static void onSearchEdit(const std::string& search_string, void* user_data ); static void onSearchEdit(const std::string& search_string, void* user_data );
static void onTextureSelect( const LLTextureEntry& te, void *data ); void onTextureSelect( const LLTextureEntry& te );
// tag: vaa emerald local_asset_browser [begin] // tag: vaa emerald local_asset_browser [begin]
// static void onBtnLocal( void* userdata ); // static void onBtnLocal( void* userdata );
@@ -250,81 +251,9 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), mNonImmediateFilterPermMask(non_immediate_filter_perm_mask),
mContextConeOpacity(0.f) mContextConeOpacity(0.f)
{ {
mCanApplyImmediately = can_apply_immediately;
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml"); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml");
mTentativeLabel = getChild<LLTextBox>("Multiple");
mResolutionLabel = getChild<LLTextBox>("unknown");
childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this);
childSetAction("Alpha", LLFloaterTexturePicker::onBtnAlpha,this);
childSetAction("Blank", LLFloaterTexturePicker::onBtnWhite,this);
childSetAction("Invisible", LLFloaterTexturePicker::onBtnInvisible,this);
// tag: vaa emerald local_asset_browser [begin]
// childSetAction("Local", LLFloaterTexturePicker::onBtnLocal, this);
// childSetAction("Server", LLFloaterTexturePicker::onBtnServer, this);
childSetAction("Add", LLFloaterTexturePicker::onBtnAdd, this);
childSetAction("Remove", LLFloaterTexturePicker::onBtnRemove, this);
childSetAction("Browser", LLFloaterTexturePicker::onBtnBrowser, this);
mLocalScrollCtrl = getChild<LLScrollListCtrl>("local_name_list");
mLocalScrollCtrl->setCallbackUserData(this);
mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit);
LocalAssetBrowser::UpdateTextureCtrlList( mLocalScrollCtrl );
// tag: vaa emerald local_asset_browser [end]
childSetCommitCallback("show_folders_check", onShowFolders, this);
childSetVisible("show_folders_check", FALSE);
mSearchEdit = getChild<LLSearchEditor>("inventory search editor");
mSearchEdit->setSearchCallback(onSearchEdit, this);
mInventoryPanel = getChild<LLInventoryPanel>("inventory panel");
if(mInventoryPanel)
{
U32 filter_types = 0x0;
filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
mInventoryPanel->setFilterTypes(filter_types);
//mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss.
mInventoryPanel->setFilterPermMask(immediate_filter_perm_mask);
mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, _1, _2, (void*)this));
mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
mInventoryPanel->setAllowMultiSelect(FALSE);
// store this filter as the default one
mInventoryPanel->getRootFolder()->getFilter()->markDefault();
// Commented out to stop opening all folders with textures
// mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE);
// don't put keyboard focus on selected item, because the selection callback
// will assume that this was user input
mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO);
}
mCanApplyImmediately = can_apply_immediately;
mNoCopyTextureSelected = FALSE;
childSetValue("apply_immediate_check", gSavedSettings.getBOOL("ApplyTextureImmediately"));
childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this);
if (!can_apply_immediately)
{
childSetEnabled("show_folders_check", FALSE);
}
childSetAction("Pipette", LLFloaterTexturePicker::onBtnPipette,this);
childSetAction("ApplyUUID", LLFloaterTexturePicker::onBtnUUID,this);
childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this);
childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this);
// update permission filter once UI is fully initialized
updateFilterPermMask();
setCanMinimize(FALSE); setCanMinimize(FALSE);
@@ -532,7 +461,80 @@ BOOL LLFloaterTexturePicker::postBuild()
setTitle(pick + mLabel); setTitle(pick + mLabel);
} }
mTentativeLabel = getChild<LLTextBox>("Multiple");
mResolutionLabel = getChild<LLTextBox>("unknown");
childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this);
childSetAction("None", LLFloaterTexturePicker::onBtnNone,this);
childSetAction("Alpha", LLFloaterTexturePicker::onBtnAlpha,this);
childSetAction("Blank", LLFloaterTexturePicker::onBtnWhite,this);
childSetAction("Invisible", LLFloaterTexturePicker::onBtnInvisible,this);
// tag: vaa emerald local_asset_browser [begin]
// childSetAction("Local", LLFloaterTexturePicker::onBtnLocal, this);
// childSetAction("Server", LLFloaterTexturePicker::onBtnServer, this);
childSetAction("Add", LLFloaterTexturePicker::onBtnAdd, this);
childSetAction("Remove", LLFloaterTexturePicker::onBtnRemove, this);
childSetAction("Browser", LLFloaterTexturePicker::onBtnBrowser, this);
mLocalScrollCtrl = getChild<LLScrollListCtrl>("local_name_list");
mLocalScrollCtrl->setCallbackUserData(this);
mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit);
LocalAssetBrowser::UpdateTextureCtrlList( mLocalScrollCtrl );
// tag: vaa emerald local_asset_browser [end]
childSetCommitCallback("show_folders_check", onShowFolders, this);
childSetVisible("show_folders_check", FALSE);
mSearchEdit = getChild<LLSearchEditor>("inventory search editor");
mSearchEdit->setSearchCallback(onSearchEdit, this);
mInventoryPanel = getChild<LLInventoryPanel>("inventory panel");
if(mInventoryPanel)
{
U32 filter_types = 0x0;
filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
mInventoryPanel->setFilterTypes(filter_types);
//mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss.
mInventoryPanel->setFilterPermMask(mImmediateFilterPermMask);
mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, this, _1, _2));
mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
mInventoryPanel->setAllowMultiSelect(FALSE);
// store this filter as the default one
mInventoryPanel->getRootFolder()->getFilter()->markDefault();
// Commented out to stop opening all folders with textures
// mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE);
// don't put keyboard focus on selected item, because the selection callback
// will assume that this was user input
mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO);
}
mNoCopyTextureSelected = FALSE;
childSetValue("apply_immediate_check", gSavedSettings.getBOOL("ApplyTextureImmediately"));
childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this);
if (!mCanApplyImmediately)
{
childSetEnabled("show_folders_check", FALSE);
}
getChild<LLUICtrl>("Pipette")->setCommitCallback( boost::bind(&LLFloaterTexturePicker::onBtnPipette, this));
childSetAction("ApplyUUID", LLFloaterTexturePicker::onBtnUUID,this);
childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this);
childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this);
// update permission filter once UI is fully initialized
updateFilterPermMask();
LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1));
return TRUE; return TRUE;
} }
@@ -624,6 +626,7 @@ void LLFloaterTexturePicker::draw()
childSetEnabled("Default", mImageAssetID != mOwner->getDefaultImageAssetID()); childSetEnabled("Default", mImageAssetID != mOwner->getDefaultImageAssetID());
childSetEnabled("Blank", mImageAssetID != mWhiteImageAssetID ); childSetEnabled("Blank", mImageAssetID != mWhiteImageAssetID );
childSetEnabled("None", mOwner->getAllowNoTexture() && !mImageAssetID.isNull() );
childSetEnabled("Invisible", mOwner->getAllowInvisibleTexture() && mImageAssetID != mInvisibleImageAssetID ); childSetEnabled("Invisible", mOwner->getAllowInvisibleTexture() && mImageAssetID != mInvisibleImageAssetID );
childSetEnabled("Alpha", mImageAssetID != mAlphaImageAssetID ); childSetEnabled("Alpha", mImageAssetID != mAlphaImageAssetID );
@@ -758,6 +761,13 @@ void LLFloaterTexturePicker::onBtnWhite(void* userdata)
self->commitIfImmediateSet(); self->commitIfImmediateSet();
} }
// static
void LLFloaterTexturePicker::onBtnNone(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setImageID( LLUUID::null );
self->commitIfImmediateSet();
}
// static // static
void LLFloaterTexturePicker::onBtnInvisible(void* userdata) void LLFloaterTexturePicker::onBtnInvisible(void* userdata)
@@ -876,26 +886,18 @@ void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl *ctrl, void *userdata)
// tag: vaa emerald local_asset_browser [end] // tag: vaa emerald local_asset_browser [end]
// static void LLFloaterTexturePicker::onBtnPipette()
void LLFloaterTexturePicker::onBtnPipette( void* userdata )
{ {
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; BOOL pipette_active = getChild<LLUICtrl>("Pipette")->getValue().asBoolean();
if ( self)
{
BOOL pipette_active = self->childGetValue("Pipette").asBoolean();
pipette_active = !pipette_active; pipette_active = !pipette_active;
if (pipette_active) if (pipette_active)
{ {
LLToolPipette::getInstance()->setSelectCallback(onTextureSelect, self);
LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance()); LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance());
} }
else else
{ {
LLToolMgr::getInstance()->clearTransientTool(); LLToolMgr::getInstance()->clearTransientTool();
} }
}
} }
// static // static
@@ -916,33 +918,32 @@ void LLFloaterTexturePicker::onBtnUUID( void* userdata )
} }
// static // static
void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data) void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
{ {
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)data;
if (items.size()) if (items.size())
{ {
LLFolderViewItem* first_item = items.front(); LLFolderViewItem* first_item = items.front();
LLInventoryItem* itemp = gInventory.getItem(first_item->getListener()->getUUID()); LLInventoryItem* itemp = gInventory.getItem(first_item->getListener()->getUUID());
self->mNoCopyTextureSelected = FALSE; mNoCopyTextureSelected = FALSE;
if (itemp) if (itemp)
{ {
// <dogmode> // <dogmode>
if (itemp->getPermissions().getMaskOwner() & PERM_ALL) if (itemp->getPermissions().getMaskOwner() & PERM_ALL)
self->childSetValue("texture_uuid", self->mImageAssetID); childSetValue("texture_uuid", mImageAssetID);
else else
self->childSetValue("texture_uuid", LLUUID::null.asString()); childSetValue("texture_uuid", LLUUID::null.asString());
// </dogmode> // </dogmode>
if (!itemp->getPermissions().allowCopyBy(gAgent.getID())) if (!itemp->getPermissions().allowCopyBy(gAgent.getID()))
{ {
self->mNoCopyTextureSelected = TRUE; mNoCopyTextureSelected = TRUE;
} }
self->mImageAssetID = itemp->getAssetUUID(); mImageAssetID = itemp->getAssetUUID();
self->mIsDirty = TRUE; mIsDirty = TRUE;
if (user_action) if (user_action)
{ {
// only commit intentional selections, not implicit ones // only commit intentional selections, not implicit ones
self->commitIfImmediateSet(); commitIfImmediateSet();
} }
} }
} }
@@ -1017,32 +1018,28 @@ void LLFloaterTexturePicker::onSearchEdit(const std::string& search_string, void
picker->mInventoryPanel->setFilterSubString(upper_case_search_string); picker->mInventoryPanel->setFilterSubString(upper_case_search_string);
} }
//static void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *data )
{ {
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)data; LLUUID inventory_item_id = findItemID(te.getID(), TRUE);
if (inventory_item_id.notNull())
LLUUID inventory_item_id = self->findItemID(te.getID(), TRUE);
if (self && inventory_item_id.notNull())
{ {
LLToolPipette::getInstance()->setResult(TRUE, ""); LLToolPipette::getInstance()->setResult(TRUE, "");
self->setImageID(te.getID()); setImageID(te.getID());
self->mNoCopyTextureSelected = FALSE;
mNoCopyTextureSelected = FALSE;
LLInventoryItem* itemp = gInventory.getItem(inventory_item_id); LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID())) if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
{ {
// no copy texture // no copy texture
self->mNoCopyTextureSelected = TRUE; mNoCopyTextureSelected = TRUE;
} }
else else
{ {
self->childSetValue("texture_uuid", inventory_item_id.asString()); childSetValue("texture_uuid", inventory_item_id.asString());
} }
self->commitIfImmediateSet(); commitIfImmediateSet();
} }
else else
{ {

View File

@@ -1089,14 +1089,17 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,
{ {
return; return;
} }
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id); //LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id);
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT );
S32 num_faces = hit_obj->getNumTEs(); S32 num_faces = hit_obj->getNumTEs();
for( S32 face = 0; face < num_faces; face++ ) for( S32 face = 0; face < num_faces; face++ )
{ {
// update viewer side image in anticipation of update from simulator // update viewer side image in anticipation of update from simulator
hit_obj->setTEImage(face, image); //hit_obj->setTEImage(face, image);
hit_obj->setTETexture(face, asset_id); //Singu note: setTETexture will allow the real id to be passed to LLPrimitive::setTETexture,
// even if it's null. setTEImage would actually pass down IMG_DEFAULT under such a case,
// which we don't want.
dialog_refresh_all(); dialog_refresh_all();
} }
// send the update to the simulator // send the update to the simulator
@@ -1157,9 +1160,12 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
return; return;
} }
// update viewer side image in anticipation of update from simulator // update viewer side image in anticipation of update from simulator
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id); //LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id);
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT );
hit_obj->setTEImage(hit_face, image); //hit_obj->setTEImage(hit_face, image);
hit_obj->setTETexture(hit_face, asset_id); //Singu note: setTETexture will allow the real id to be passed to LLPrimitive::setTETexture,
// even if it's null. setTEImage would actually pass down IMG_DEFAULT under such a case,
// which we don't want.
dialog_refresh_all(); dialog_refresh_all();
// send the update to the simulator // send the update to the simulator

View File

@@ -55,8 +55,6 @@ LLToolPipette::LLToolPipette()
: LLTool(std::string("Pipette")), : LLTool(std::string("Pipette")),
mSuccess(TRUE) mSuccess(TRUE)
{ {
mSelectCallback = NULL;
mUserData = NULL;
} }
@@ -106,6 +104,15 @@ BOOL LLToolPipette::handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky
return TRUE; return TRUE;
} }
void LLToolPipette::setTextureEntry(const LLTextureEntry* entry)
{
if (entry)
{
mTextureEntry = *entry;
mSignal(mTextureEntry);
}
}
void LLToolPipette::pickCallback(const LLPickInfo& pick_info) void LLToolPipette::pickCallback(const LLPickInfo& pick_info)
{ {
LLViewerObject* hit_obj = pick_info.getObject(); LLViewerObject* hit_obj = pick_info.getObject();
@@ -118,18 +125,9 @@ void LLToolPipette::pickCallback(const LLPickInfo& pick_info)
{ {
//TODO: this should highlight the selected face only //TODO: this should highlight the selected face only
LLSelectMgr::getInstance()->highlightObjectOnly(hit_obj); LLSelectMgr::getInstance()->highlightObjectOnly(hit_obj);
LLToolPipette::getInstance()->mTextureEntry = *hit_obj->getTE(pick_info.mObjectFace); const LLTextureEntry* entry = hit_obj->getTE(pick_info.mObjectFace);
if (LLToolPipette::getInstance()->mSelectCallback) LLToolPipette::getInstance()->setTextureEntry(entry);
{
LLToolPipette::getInstance()->mSelectCallback(LLToolPipette::getInstance()->mTextureEntry, LLToolPipette::getInstance()->mUserData);
} }
}
}
void LLToolPipette::setSelectCallback(select_callback callback, void* user_data)
{
mSelectCallback = callback;
mUserData = user_data;
} }
void LLToolPipette::setResult(BOOL success, const std::string& msg) void LLToolPipette::setResult(BOOL success, const std::string& msg)

View File

@@ -56,18 +56,19 @@ public:
virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky_rect_screen); virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky_rect_screen);
typedef void (*select_callback)(const LLTextureEntry& te, void *data); // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots
void setSelectCallback(select_callback callback, void* user_data); typedef boost::signals2::signal<void (const LLTextureEntry& te)> signal_t;
void setToolSelectCallback(const signal_t::slot_type& cb) { mSignal.connect(cb); }
void setResult(BOOL success, const std::string& msg); void setResult(BOOL success, const std::string& msg);
void setTextureEntry(const LLTextureEntry* entry);
static void pickCallback(const LLPickInfo& pick_info); static void pickCallback(const LLPickInfo& pick_info);
protected: protected:
LLTextureEntry mTextureEntry; LLTextureEntry mTextureEntry;
select_callback mSelectCallback; signal_t mSignal;
BOOL mSuccess; BOOL mSuccess;
std::string mTooltipMsg; std::string mTooltipMsg;
void* mUserData;
}; };
#endif //LL_LLTOOLPIPETTE_H #endif //LL_LLTOOLPIPETTE_H

View File

@@ -773,7 +773,7 @@ Only large parcels can be listed in search.
mouse_opaque="true" name="Snapshot:" v_pad="0" width="278"> mouse_opaque="true" name="Snapshot:" v_pad="0" width="278">
Snapshot: Snapshot:
</text> </text>
<texture_picker allow_no_texture="false" bottom="-349" can_apply_immediately="false" <texture_picker allow_no_texture="true" bottom="-349" can_apply_immediately="false"
default_image_name="" enabled="true" follows="left|top" height="135" default_image_name="" enabled="true" follows="left|top" height="135"
label="" left="10" mouse_opaque="true" name="snapshot_ctrl" label="" left="10" mouse_opaque="true" name="snapshot_ctrl"
tool_tip="Click to choose a picture" width="180" /> tool_tip="Click to choose a picture" width="180" />

View File

@@ -30,6 +30,9 @@
<button bottom="-252" enabled="false" follows="left|bottom" font="SansSerifSmall" <button bottom="-252" enabled="false" follows="left|bottom" font="SansSerifSmall"
halign="center" height="20" label="Invisible" label_selected="Invisible" left="72" halign="center" height="20" label="Invisible" label_selected="Invisible" left="72"
mouse_opaque="true" name="Invisible" scale_image="true" width="64" /> mouse_opaque="true" name="Invisible" scale_image="true" width="64" />
<button bottom="-276" enabled="true" follows="left|bottom" font="SansSerifSmall"
halign="center" height="20" label="None" label_selected="None" left="4"
mouse_opaque="true" name="None" scale_image="true" width="64" />
<check_box bottom="-305" enabled="true" follows="left|bottom" font="SansSerifSmall" <check_box bottom="-305" enabled="true" follows="left|bottom" font="SansSerifSmall"
height="20" initial_value="true" label="Show Folders" left="4" height="20" initial_value="true" label="Show Folders" left="4"
mouse_opaque="true" name="show_folders_check" radio_style="false" mouse_opaque="true" name="show_folders_check" radio_style="false"

View File

@@ -1261,7 +1261,7 @@
<panel border="true" bottom="-383" follows="left|top|right|bottom" height="367" <panel border="true" bottom="-383" follows="left|top|right|bottom" height="367"
label="Texture" left="1" mouse_opaque="false" name="Texture" width="270"> label="Texture" left="1" mouse_opaque="false" name="Texture" width="270">
<texture_picker allow_no_texture="false" allow_invisible_texture="true" bottom="-90" can_apply_immediately="true" <texture_picker allow_no_texture="true" allow_invisible_texture="true" bottom="-90" can_apply_immediately="true"
default_image_name="Default" follows="left|top" height="80" label="Texture" default_image_name="Default" follows="left|top" height="80" label="Texture"
left="10" mouse_opaque="true" name="texture control" left="10" mouse_opaque="true" name="texture control"
tool_tip="Click to choose a picture" width="64" /> tool_tip="Click to choose a picture" width="64" />