summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/CMakeLists.txt10
-rw-r--r--indra/llui/llaccordionctrl.cpp8
-rw-r--r--indra/llui/llaccordionctrltab.cpp299
-rw-r--r--indra/llui/llaccordionctrltab.h31
-rw-r--r--indra/llui/llbutton.h1
-rw-r--r--indra/llui/llcombobox.cpp45
-rw-r--r--indra/llui/llcombobox.h35
-rw-r--r--indra/llui/llfloater.cpp7
-rw-r--r--indra/llui/llfloater.h4
-rw-r--r--indra/llui/llscrolllistcell.cpp4
-rw-r--r--indra/llui/llscrolllistcell.h5
-rw-r--r--indra/llui/llscrolllistctrl.cpp4
-rw-r--r--indra/llui/llscrolllistctrl.h5
-rw-r--r--indra/llui/lltabcontainer.cpp2
-rw-r--r--indra/llui/llurlentry.cpp17
-rw-r--r--indra/llui/llurlentry.h3
-rw-r--r--indra/llui/llurlregistry.cpp2
17 files changed, 416 insertions, 66 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index 853f6f173d..532b6b6524 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -209,6 +209,16 @@ set(llui_HEADER_FILES
set_source_files_properties(${llui_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
+SET(llurlentry_TEST_DEPENDENCIES
+ llurlmatch.cpp
+ llurlregistry.cpp
+ )
+
+set_source_files_properties(llurlentry.cpp
+ PROPERTIES LL_TEST_ADDITIONAL_SOURCE_FILES
+ "${llurlentry_TEST_DEPENDENCIES}"
+ )
+
list(APPEND llui_SOURCE_FILES ${llui_HEADER_FILES})
add_library (llui ${llui_SOURCE_FILES})
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index aa69dfe0cc..2ed1082f56 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -103,13 +103,6 @@ void LLAccordionCtrl::draw()
LLLocalClipRect clip(local_rect);
LLPanel::draw();
- /*
- S32 width = getRect().getWidth();
- S32 height = getRect().getHeight();
-
- gl_rect_2d(0, 0 , width - 1 ,height - 1,LLColor4::green,true);
- gl_line_2d(0, 0 , width - 1 ,height - 1,LLColor4::black);
- */
}
@@ -125,7 +118,6 @@ BOOL LLAccordionCtrl::postBuild()
scrollbar_size,
getRect().getHeight() - 1);
-
LLScrollbar::Params sbparams;
sbparams.name("scrollable vertical");
sbparams.rect(scroll_rect);
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index daa9e08f14..1067c3f1d5 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -33,8 +33,9 @@
#include "linden_common.h"
#include "lluictrl.h"
-
+#include "llscrollbar.h"
#include "llaccordionctrltab.h"
+#include "lllocalcliprect.h"
#include "lltextbox.h"
@@ -46,6 +47,8 @@ static const S32 HEADER_HEIGHT = 20;
static const S32 HEADER_IMAGE_LEFT_OFFSET = 5;
static const S32 HEADER_TEXT_LEFT_OFFSET = 30;
static const F32 AUTO_OPEN_TIME = 1.f;
+static const S32 VERTICAL_MULTIPLE = 16;
+static const S32 PARENT_BORDER_MARGIN = 5;
static LLDefaultChildRegistry::Register<LLAccordionCtrlTab> t1("accordion_tab");
@@ -277,6 +280,7 @@ LLAccordionCtrlTab::Params::Params()
,header_image_pressed("header_image_pressed")
,header_image_focused("header_image_focused")
,header_text_color("header_text_color")
+ ,fit_panel("fit_panel",true)
{
mouse_opaque(false);
}
@@ -293,6 +297,9 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p)
,mPaddingTop(p.padding_top)
,mPaddingBottom(p.padding_bottom)
,mCanOpenClose(true)
+ ,mFitPanel(p.fit_panel)
+ ,mContainerPanel(NULL)
+ ,mScrollbar(NULL)
{
mStoredOpenCloseState = false;
mWasStateStored = false;
@@ -321,54 +328,42 @@ void LLAccordionCtrlTab::setDisplayChildren(bool display)
mExpandedHeight : HEADER_HEIGHT);
setRect(rect);
- for(child_list_const_iter_t it = getChildList()->begin();
- getChildList()->end() != it; ++it)
- {
- LLView* child = *it;
- if(DD_HEADER_NAME == child->getName())
- continue;
+ if(mContainerPanel)
+ mContainerPanel->setVisible(getDisplayChildren());
- child->setVisible(getDisplayChildren());
+ if(mDisplayChildren)
+ {
+ adjustContainerPanel();
}
+ else
+ {
+ if(mScrollbar)
+ mScrollbar->setVisible(false);
+ }
+
}
void LLAccordionCtrlTab::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
{
LLRect headerRect;
- LLUICtrl::reshape(width, height, TRUE);
-
headerRect.setLeftTopAndSize(
0,height,width,HEADER_HEIGHT);
mHeader->setRect(headerRect);
mHeader->reshape(headerRect.getWidth(), headerRect.getHeight());
- for(child_list_const_iter_t it = getChildList()->begin();
- getChildList()->end() != it; ++it)
- {
- LLView* child = *it;
- if(DD_HEADER_NAME == child->getName())
- continue;
- if(!child->getVisible())
- continue;
-
- LLRect childRect = child->getRect();
- S32 childWidth = width - getPaddingLeft() - getPaddingRight();
- S32 childHeight = height - getHeaderHeight() - getPaddingTop() - getPaddingBottom();
+ if(!mDisplayChildren)
+ return;
- child->reshape(childWidth,childHeight);
-
- childRect.setLeftTopAndSize(
- getPaddingLeft(),
- childHeight + getPaddingBottom(),
- childWidth,
- childHeight);
+ LLRect childRect;
- child->setRect(childRect);
-
- break;//suppose that there is only one panel
- }
+ childRect.setLeftTopAndSize(
+ getPaddingLeft(),
+ height - getHeaderHeight() - getPaddingTop(),
+ width - getPaddingLeft() - getPaddingRight(),
+ height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() );
+ adjustContainerPanel(childRect);
}
void LLAccordionCtrlTab::changeOpenClose(bool is_open)
@@ -439,7 +434,7 @@ void LLAccordionCtrlTab::setAccordionView(LLView* panel)
}
-LLView* LLAccordionCtrlTab::getAccordionView()
+LLView* LLAccordionCtrlTab::findContainerView()
{
for(child_list_const_iter_t it = getChildList()->begin();
getChildList()->end() != it; ++it)
@@ -474,6 +469,43 @@ void LLAccordionCtrlTab::setHeaderVisible(bool value)
BOOL LLAccordionCtrlTab::postBuild()
{
mHeader->setVisible(mHeaderVisible);
+
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+ LLRect scroll_rect;
+ scroll_rect.setOriginAndSize(
+ getRect().getWidth() - scrollbar_size,
+ 1,
+ scrollbar_size,
+ getRect().getHeight() - 1);
+
+ mContainerPanel = findContainerView();
+
+ if(!mFitPanel)
+ {
+ LLScrollbar::Params sbparams;
+ sbparams.name("scrollable vertical");
+ sbparams.rect(scroll_rect);
+ sbparams.orientation(LLScrollbar::VERTICAL);
+ sbparams.doc_size(getRect().getHeight());
+ sbparams.doc_pos(0);
+ sbparams.page_size(getRect().getHeight());
+ sbparams.step_size(VERTICAL_MULTIPLE);
+ sbparams.follows.flags(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM);
+ sbparams.change_callback(boost::bind(&LLAccordionCtrlTab::onScrollPosChangeCallback, this, _1, _2));
+
+
+ mScrollbar = LLUICtrlFactory::create<LLScrollbar> (sbparams);
+ LLView::addChild( mScrollbar );
+ mScrollbar->setFollowsRight();
+ mScrollbar->setFollowsTop();
+ mScrollbar->setFollowsBottom();
+
+ mScrollbar->setVisible(false);
+ }
+
+ mContainerPanel->setVisible(mDisplayChildren);
+
return LLUICtrl::postBuild();
}
bool LLAccordionCtrlTab::notifyChildren (const LLSD& info)
@@ -562,6 +594,12 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent)
if( !header->hasFocus() )
return LLUICtrl::handleKey(key, mask, called_from_parent);
+ if ( (key == KEY_RETURN )&& mask == MASK_NONE)
+ {
+ changeOpenClose(getDisplayChildren());
+ return TRUE;
+ }
+
if ( (key == KEY_ADD || key == KEY_RIGHT)&& mask == MASK_NONE)
{
if(getDisplayChildren() == false)
@@ -622,6 +660,7 @@ void LLAccordionCtrlTab::storeOpenCloseState()
mStoredOpenCloseState = getDisplayChildren();
mWasStateStored = true;
}
+
void LLAccordionCtrlTab::restoreOpenCloseState()
{
if(!mWasStateStored)
@@ -632,3 +671,195 @@ void LLAccordionCtrlTab::restoreOpenCloseState()
}
mWasStateStored = false;
}
+
+void LLAccordionCtrlTab::adjustContainerPanel ()
+{
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
+
+ LLRect child_rect;
+ child_rect.setLeftTopAndSize(
+ getPaddingLeft(),
+ height - getHeaderHeight() - getPaddingTop(),
+ width - getPaddingLeft() - getPaddingRight(),
+ height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() );
+
+ adjustContainerPanel(child_rect);
+}
+
+void LLAccordionCtrlTab::adjustContainerPanel(const LLRect& child_rect)
+{
+ if(!mContainerPanel)
+ return;
+
+ if(!mFitPanel)
+ {
+ show_hide_scrollbar(child_rect);
+ updateLayout(child_rect);
+ }
+ else
+ {
+ mContainerPanel->reshape(child_rect.getWidth(),child_rect.getHeight());
+ mContainerPanel->setRect(child_rect);
+ }
+}
+
+S32 LLAccordionCtrlTab::getChildViewHeight()
+{
+ if(!mContainerPanel)
+ return 0;
+ return mContainerPanel->getRect().getHeight();
+}
+
+void LLAccordionCtrlTab::show_hide_scrollbar(const LLRect& child_rect)
+{
+ if(getChildViewHeight() > child_rect.getHeight() )
+ showScrollbar(child_rect);
+ else
+ hideScrollbar(child_rect);
+}
+void LLAccordionCtrlTab::showScrollbar(const LLRect& child_rect)
+{
+ if(!mContainerPanel || !mScrollbar)
+ return;
+ bool was_visible = mScrollbar->getVisible();
+ mScrollbar->setVisible(true);
+
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+ {
+ ctrlSetLeftTopAndSize(mScrollbar,child_rect.getWidth()-scrollbar_size,
+ child_rect.getHeight()-PARENT_BORDER_MARGIN,
+ scrollbar_size,
+ child_rect.getHeight()-2*PARENT_BORDER_MARGIN);
+ }
+
+ LLRect orig_rect = mContainerPanel->getRect();
+
+ mScrollbar->setPageSize(child_rect.getHeight());
+ mScrollbar->setDocParams(orig_rect.getHeight(),mScrollbar->getDocPos());
+
+ if(was_visible)
+ {
+ S32 scroll_pos = llmin(mScrollbar->getDocPos(), orig_rect.getHeight() - child_rect.getHeight() - 1);
+ mScrollbar->setDocPos(scroll_pos);
+ }
+ else//shrink child panel
+ {
+ updateLayout(child_rect);
+ }
+
+}
+
+void LLAccordionCtrlTab::hideScrollbar( const LLRect& child_rect )
+{
+ if(!mContainerPanel || !mScrollbar)
+ return;
+
+ if(mScrollbar->getVisible() == false)
+ return;
+ mScrollbar->setVisible(false);
+ mScrollbar->setDocPos(0);
+
+ //shrink child panel
+ updateLayout(child_rect);
+}
+
+void LLAccordionCtrlTab::onScrollPosChangeCallback(S32, LLScrollbar*)
+{
+ LLRect child_rect;
+
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
+
+ child_rect.setLeftTopAndSize(
+ getPaddingLeft(),
+ height - getHeaderHeight() - getPaddingTop(),
+ width - getPaddingLeft() - getPaddingRight(),
+ height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() );
+
+ updateLayout(child_rect);
+}
+
+void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
+{
+ if (child && child->getVisible() && child->getRect().isValid())
+ {
+ LLRect screen_rect;
+ localRectToScreen(child->getRect(),&screen_rect);
+
+ if ( root_rect.overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect))
+ {
+ glMatrixMode(GL_MODELVIEW);
+ LLUI::pushMatrix();
+ {
+ LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f);
+ child->draw();
+
+ }
+ LLUI::popMatrix();
+ }
+ }
+}
+
+void LLAccordionCtrlTab::draw()
+{
+ if(mFitPanel)
+ LLUICtrl::draw();
+ else
+ {
+ LLRect root_rect = getRootView()->getRect();
+ drawChild(root_rect,mHeader);
+ drawChild(root_rect,mScrollbar );
+ {
+ LLRect child_rect;
+
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
+
+ child_rect.setLeftTopAndSize(
+ getPaddingLeft(),
+ height - getHeaderHeight() - getPaddingTop(),
+ width - getPaddingLeft() - getPaddingRight(),
+ height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() );
+
+ LLLocalClipRect clip(child_rect);
+ drawChild(root_rect,mContainerPanel);
+ }
+
+
+ gGL.getTexUnit(0)->disable();
+ }
+}
+
+void LLAccordionCtrlTab::updateLayout ( const LLRect& child_rect )
+{
+ LLView* child = getAccordionView();
+ if(!mContainerPanel)
+ return;
+
+ S32 panel_top = child_rect.getHeight();
+ S32 panel_width = child_rect.getWidth();
+
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+ if(mScrollbar->getVisible() != false)
+ {
+ panel_top+=mScrollbar->getDocPos();
+ panel_width-=scrollbar_size;
+ }
+
+ //set sizes for first panels and dragbars
+ LLRect panel_rect = child->getRect();
+ ctrlSetLeftTopAndSize(mContainerPanel,child_rect.mLeft,panel_top,panel_width,panel_rect.getHeight());
+}
+void LLAccordionCtrlTab::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S32 width, S32 height)
+{
+ if(!panel)
+ return;
+ LLRect panel_rect = panel->getRect();
+ panel_rect.setLeftTopAndSize( left, top, width, height);
+ panel->reshape( width, height, 1);
+ panel->setRect(panel_rect);
+}
+
+
diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h
index 2e0260ab16..462ccc6d53 100644
--- a/indra/llui/llaccordionctrltab.h
+++ b/indra/llui/llaccordionctrltab.h
@@ -41,6 +41,7 @@ class LLUICtrlFactory;
class LLUIImage;
class LLButton;
class LLTextBox;
+class LLScrollbar;
@@ -84,6 +85,8 @@ public:
Optional<bool> header_visible;
+ Optional<bool> fit_panel;
+
Optional<S32> padding_left;
Optional<S32> padding_right;
Optional<S32> padding_top;
@@ -107,7 +110,7 @@ public:
//set LLAccordionCtrlTab panel
void setAccordionView(LLView* panel);
- LLView* getAccordionView();
+ LLView* getAccordionView() { return mContainerPanel; };
bool getCollapsible() {return mCollapsible;};
@@ -123,6 +126,8 @@ public:
S32 notify(const LLSD& info);
bool notifyChildren(const LLSD& info);
+ void draw();
+
void storeOpenCloseState ();
void restoreOpenCloseState ();
@@ -164,9 +169,26 @@ public:
void showAndFocusHeader();
-private:
+ void setFitPanel( bool fit ) { mFitPanel = true; }
-
+protected:
+ void adjustContainerPanel (const LLRect& child_rect);
+ void adjustContainerPanel ();
+ S32 getChildViewHeight ();
+
+ void onScrollPosChangeCallback(S32, LLScrollbar*);
+
+ void show_hide_scrollbar (const LLRect& child_rect);
+ void showScrollbar (const LLRect& child_rect);
+ void hideScrollbar (const LLRect& child_rect);
+
+ void updateLayout ( const LLRect& child_rect );
+ void ctrlSetLeftTopAndSize (LLView* panel, S32 left, S32 top, S32 width, S32 height);
+
+ void drawChild(const LLRect& root_rect,LLView* child);
+
+ LLView* findContainerView ();
+private:
class LLAccordionCtrlTabHeader;
LLAccordionCtrlTabHeader* mHeader; //Header
@@ -176,6 +198,7 @@ private:
bool mHeaderVisible;
bool mCanOpenClose;
+ bool mFitPanel;
S32 mPaddingLeft;
S32 mPaddingRight;
@@ -185,6 +208,8 @@ private:
bool mStoredOpenCloseState;
bool mWasStateStored;
+ LLScrollbar* mScrollbar;
+ LLView* mContainerPanel;
LLUIColor mDropdownBGColor;
};
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 6a0d8ef3d6..59b551a16d 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -216,6 +216,7 @@ public:
void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
LLPointer<LLUIImage> getImageOverlay() { return mImageOverlay; }
+ LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; }
void autoResize(); // resize with label of current btn state
void resize(LLUIString label); // resize with label input
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 9ec1a9f7c4..ce25ee32b3 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -702,19 +702,12 @@ void LLComboBox::onListMouseUp()
void LLComboBox::onItemSelected(const LLSD& data)
{
- const std::string name = mList->getSelectedItemLabel();
+ setValue(data);
- S32 cur_id = getCurrentIndex();
- mLastSelectedIndex = cur_id;
- if (cur_id != -1)
+ if (mAllowTextEntry && mLastSelectedIndex != -1)
{
- setLabel(name);
-
- if (mAllowTextEntry)
- {
- gFocusMgr.setKeyboardFocus(mTextEntry);
- mTextEntry->selectAll();
- }
+ gFocusMgr.setKeyboardFocus(mTextEntry);
+ mTextEntry->selectAll();
}
// hiding the list reasserts the old value stored in the text editor/dropdown button
@@ -1068,3 +1061,33 @@ BOOL LLComboBox::selectItemRange( S32 first, S32 last )
{
return mList->selectItemRange(first, last);
}
+
+
+static LLDefaultChildRegistry::Register<LLIconsComboBox> register_icons_combo_box("icons_combo_box");
+
+LLIconsComboBox::Params::Params()
+: icon_column("icon_column", ICON_COLUMN),
+ label_column("label_column", LABEL_COLUMN)
+{}
+
+LLIconsComboBox::LLIconsComboBox(const LLIconsComboBox::Params& p)
+: LLComboBox(p),
+ mIconColumnIndex(p.icon_column),
+ mLabelColumnIndex(p.label_column)
+{}
+
+void LLIconsComboBox::setValue(const LLSD& value)
+{
+ BOOL found = mList->selectByValue(value);
+ if (found)
+ {
+ LLScrollListItem* item = mList->getFirstSelected();
+ if (item)
+ {
+ mButton->setImageOverlay(mList->getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign());
+
+ setLabel(mList->getSelectedItemLabel(mLabelColumnIndex));
+ }
+ mLastSelectedIndex = mList->getFirstSelectedIndex();
+ }
+}
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index aa1e708bec..c694724248 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -221,6 +221,7 @@ protected:
LLPointer<LLUIImage> mArrowImage;
LLUIString mLabel;
BOOL mHasAutocompletedText;
+ S32 mLastSelectedIndex;
private:
BOOL mAllowTextEntry;
@@ -230,7 +231,37 @@ private:
commit_callback_t mPrearrangeCallback;
commit_callback_t mTextEntryCallback;
commit_callback_t mSelectionCallback;
- S32 mLastSelectedIndex;
- boost::signals2::connection mTopLostSignalConnection;
+ boost::signals2::connection mTopLostSignalConnection;
+};
+
+// A combo box with icons for the list of items.
+class LLIconsComboBox
+: public LLComboBox
+{
+public:
+ struct Params
+ : public LLInitParam::Block<Params, LLComboBox::Params>
+ {
+ Optional<S32> icon_column,
+ label_column;
+ Params();
+ };
+
+ /*virtual*/ void setValue(const LLSD& value);
+
+private:
+ enum EColumnIndex
+ {
+ ICON_COLUMN = 0,
+ LABEL_COLUMN
+ };
+
+ friend class LLUICtrlFactory;
+ LLIconsComboBox(const Params&);
+ virtual ~LLIconsComboBox() {};
+
+ S32 mIconColumnIndex;
+ S32 mLabelColumnIndex;
};
+
#endif
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index c45be34d43..4cb336f7ea 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1548,7 +1548,12 @@ void LLFloater::onClickClose( LLFloater* self )
{
if (!self)
return;
- self->closeFloater(false);
+ self->onClickCloseBtn();
+}
+
+void LLFloater::onClickCloseBtn()
+{
+ closeFloater(false);
}
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 19e8288807..c1e8813f87 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -307,6 +307,8 @@ protected:
void destroy() { die(); } // Don't call this directly. You probably want to call closeFloater()
+ virtual void onClickCloseBtn();
+
private:
void setForeground(BOOL b); // called only by floaterview
void cleanupHandles(); // remove handles to dead floaters
@@ -346,6 +348,7 @@ protected:
LLResizeBar* mResizeBar[4];
LLResizeHandle* mResizeHandle[4];
+ LLButton* mButtons[BUTTON_COUNT];
private:
LLRect mExpandedRect;
@@ -379,7 +382,6 @@ private:
handle_set_t mDependents;
bool mButtonsEnabled[BUTTON_COUNT];
- LLButton* mButtons[BUTTON_COUNT];
F32 mButtonScale;
BOOL mAutoFocus;
LLHandle<LLFloater> mSnappedTo;
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 3cc92baa8d..d17be8b94a 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -185,6 +185,8 @@ LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p)
{
sCount++;
+ mTextWidth = getWidth();
+
// initialize rounded rect image
if (!mRoundedRectImage)
{
@@ -340,7 +342,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
0,
LLFontGL::NO_SHADOW,
string_chars,
- getWidth(),
+ getTextWidth(),
&right_x,
TRUE);
}
diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h
index 5fecf5aade..b1c8901fc4 100644
--- a/indra/llui/llscrolllistcell.h
+++ b/indra/llui/llscrolllistcell.h
@@ -151,11 +151,16 @@ public:
/*virtual*/ const std::string & getToolTip() const;
/*virtual*/ BOOL needsToolTip() 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 setFontStyle(const U8 font_style);
private:
LLUIString mText;
+ S32 mTextWidth;
const LLFontGL* mFont;
LLColor4 mColor;
U8 mUseColor;
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 77caaaa425..18ec5b51dd 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -630,7 +630,9 @@ void LLScrollListCtrl::calcColumnWidths()
LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex);
if (!cellp) continue;
- column->mMaxContentWidth = llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth);
+ // get text value width only for text cells
+ column->mMaxContentWidth = cellp->isText() ?
+ llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth) : column->mMaxContentWidth;
}
max_item_width += column->mMaxContentWidth;
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index e819c5fdea..ebdc82115f 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -219,7 +219,10 @@ public:
void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change
void clearHighlightedItems();
- void mouseOverHighlightNthItem( S32 index );
+
+ virtual void mouseOverHighlightNthItem( S32 index );
+
+ S32 getHighlightedItemInx() const { return mHighlightedItem; }
void setDoubleClickCallback( callback_t cb ) { mOnDoubleClickCallback = cb; }
void setMaximumSelectCallback( callback_t cb) { mOnMaximumSelectCallback = cb; }
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 85ae13a889..30fc7babae 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1649,7 +1649,7 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple)
if(mCustomIconCtrlUsed)
{
LLCustomButtonIconCtrl* button = dynamic_cast<LLCustomButtonIconCtrl*>(tuple->mButton);
- LLIconCtrl* icon_ctrl = button->getIconCtrl();
+ LLIconCtrl* icon_ctrl = button ? button->getIconCtrl() : NULL;
image_overlay_width = icon_ctrl ? icon_ctrl->getRect().getWidth() : 0;
}
else
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 20c939874b..35428e4227 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -34,6 +34,8 @@
#include "linden_common.h"
#include "llurlentry.h"
#include "lluri.h"
+#include "llurlmatch.h"
+#include "llurlregistry.h"
#include "llcachename.h"
#include "lltrans.h"
@@ -308,6 +310,7 @@ LLUrlEntryAgent::LLUrlEntryAgent()
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_agent.xml";
mIcon = "Generic_Person";
+ mTooltip = LLTrans::getString("TooltipAgentUrl");
mColor = LLUIColorTable::instance().getColor("AgentLinkColor");
}
@@ -602,6 +605,20 @@ std::string LLUrlEntrySLLabel::getUrl(const std::string &string) const
return getUrlFromWikiLink(string);
}
+std::string LLUrlEntrySLLabel::getTooltip(const std::string &string) const
+{
+ // return a tooltip corresponding to the URL type instead of the generic one (EXT-4574)
+ std::string url = getUrl(string);
+ LLUrlMatch match;
+ if (LLUrlRegistry::instance().findUrl(url, match))
+ {
+ return match.getTooltip();
+ }
+
+ // unrecognized URL? should not happen
+ return LLUrlEntryBase::getTooltip(string);
+}
+
//
// LLUrlEntryWorldMap Describes secondlife:///<location> URLs
//
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 3abada0f24..c947ef7259 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -83,7 +83,7 @@ public:
LLUIColor getColor() const { return mColor; }
/// Given a matched Url, return a tooltip string for the hyperlink
- std::string getTooltip() const { return mTooltip; }
+ virtual std::string getTooltip(const std::string &string) const { return mTooltip; }
/// Return the name of a XUI file containing the context menu items
std::string getMenuName() const { return mMenuName; }
@@ -257,6 +257,7 @@ public:
LLUrlEntrySLLabel();
/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
/*virtual*/ std::string getUrl(const std::string &string) const;
+ /*virtual*/ std::string getTooltip(const std::string &string) const;
};
///
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 722dbe41b3..faa02e1904 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -174,7 +174,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
match.setValues(match_start, match_end,
match_entry->getUrl(url),
match_entry->getLabel(url, cb),
- match_entry->getTooltip(),
+ match_entry->getTooltip(url),
match_entry->getIcon(),
match_entry->getColor(),
match_entry->getMenuName(),