summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/CMakeLists.txt1
-rw-r--r--indra/llui/llbutton.cpp4
-rw-r--r--indra/llui/llbutton.h7
-rw-r--r--indra/llui/llcheckboxctrl.h15
-rw-r--r--indra/llui/llcombobox.cpp36
-rw-r--r--indra/llui/lllayoutstack.cpp8
-rw-r--r--indra/llui/llmenugl.cpp4
-rw-r--r--indra/llui/llmenugl.h2
-rw-r--r--indra/llui/llsearchablecontrol.h71
-rw-r--r--indra/llui/llsliderctrl.h15
-rw-r--r--indra/llui/lltabcontainer.cpp60
-rw-r--r--indra/llui/lltabcontainer.h2
-rw-r--r--indra/llui/lltextbase.cpp11
-rw-r--r--indra/llui/lltextbase.h8
-rw-r--r--indra/llui/lltexteditor.cpp22
-rw-r--r--indra/llui/lluictrl.h1
16 files changed, 248 insertions, 19 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index 54e4d296ab..730e277dec 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -202,6 +202,7 @@ set(llui_HEADER_FILES
llresizehandle.h
llresmgr.h
llrngwriter.h
+ llsearchablecontrol.h
llsearcheditor.h
llscrollbar.h
llscrollcontainer.h
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 510a2537b9..6b7a8a8b86 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -769,6 +769,10 @@ void LLButton::draw()
}
}
+ // Highlight if needed
+ if( ll::ui::SearchableControl::getHighlighted() )
+ label_color = ll::ui::SearchableControl::getHighlightColor();
+
// Unselected label assignments
LLWString label = getCurrentLabel();
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 7b4719866d..7629ed1fea 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -62,6 +62,7 @@ class LLUICtrlFactory;
class LLButton
: public LLUICtrl, public LLBadgeOwner
+, public ll::ui::SearchableControl
{
public:
struct Params
@@ -380,6 +381,12 @@ protected:
LLFlashTimer * mFlashingTimer;
bool mForceFlashing; // Stick flashing color even if button is pressed
bool mHandleRightMouse;
+
+protected:
+ virtual std::string _getSearchText() const
+ {
+ return getLabelUnselected() + getToolTip();
+ }
};
// Build time optimization, generate once in .cpp file
diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h
index 5ce45b2135..07ae9c3b18 100644
--- a/indra/llui/llcheckboxctrl.h
+++ b/indra/llui/llcheckboxctrl.h
@@ -47,6 +47,7 @@ class LLViewBorder;
class LLCheckBoxCtrl
: public LLUICtrl
+, public ll::ui::SearchableControl
{
public:
struct Params
@@ -92,6 +93,8 @@ public:
// LLCheckBoxCtrl interface
virtual BOOL toggle() { return mButton->toggleState(); } // returns new state
+ void setBtnFocus() { mButton->setFocus(TRUE); }
+
void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; }
void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; }
@@ -107,6 +110,18 @@ public:
virtual void resetDirty(); // Clear dirty state
protected:
+ virtual std::string _getSearchText() const
+ {
+ return getLabel() + getToolTip();
+ }
+
+ virtual void onSetHighlight() const // When highlight, really do highlight the label
+ {
+ if( mLabel )
+ mLabel->ll::ui::SearchableControl::setHighlighted( ll::ui::SearchableControl::getHighlighted() );
+ }
+
+protected:
// note: value is stored in toggle state of button
LLButton* mButton;
LLTextBox* mLabel;
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 00a933a0bb..b2ad38bddf 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -243,7 +243,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOO
item->setEnabled(enabled);
if (!mAllowTextEntry && mLabel.empty())
{
- selectFirstItem();
+ if (mControlVariable)
+ {
+ setValue(mControlVariable->getValue()); // selects the appropriate item
+ }
+ else
+ {
+ selectFirstItem();
+ }
}
return item;
}
@@ -255,7 +262,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAd
item->setEnabled(enabled);
if (!mAllowTextEntry && mLabel.empty())
{
- selectFirstItem();
+ if (mControlVariable)
+ {
+ setValue(mControlVariable->getValue()); // selects the appropriate item
+ }
+ else
+ {
+ selectFirstItem();
+ }
}
return item;
}
@@ -268,7 +282,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddP
item->setUserdata( userdata );
if (!mAllowTextEntry && mLabel.empty())
{
- selectFirstItem();
+ if (mControlVariable)
+ {
+ setValue(mControlVariable->getValue()); // selects the appropriate item
+ }
+ else
+ {
+ selectFirstItem();
+ }
}
return item;
}
@@ -280,7 +301,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, LLSD value, EAddPosit
item->setEnabled(enabled);
if (!mAllowTextEntry && mLabel.empty())
{
- selectFirstItem();
+ if (mControlVariable)
+ {
+ setValue(mControlVariable->getValue()); // selects the appropriate item
+ }
+ else
+ {
+ selectFirstItem();
+ }
}
return item;
}
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index ce8dbb1f66..955e7089f4 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -251,8 +251,14 @@ void LLLayoutStack::draw()
// always clip to stack itself
LLLocalClipRect clip(getLocalRect());
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
+ if ((!panelp->getVisible() || panelp->mCollapsed)
+ && (panelp->mVisibleAmt < 0.001f || !mAnimate))
+ {
+ // essentially invisible
+ continue;
+ }
// clip to layout rectangle, not bounding rectangle
LLRect clip_rect = panelp->getRect();
// scale clipping rectangle by visible amount
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index ddcce61123..4f8c83cba7 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -504,6 +504,10 @@ void LLMenuItemGL::draw( void )
color = mDisabledColor.get();
}
+ // Highlight if needed
+ if( ll::ui::SearchableControl::getHighlighted() )
+ color = ll::ui::SearchableControl::getHighlightColor();
+
// Draw the text on top.
if (mBriefItem)
{
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 6ca581fa86..aa87329020 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -48,7 +48,7 @@ extern S32 MENU_BAR_WIDTH;
// The LLMenuItemGL represents a single menu item in a menu.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLMenuItemGL : public LLUICtrl
+class LLMenuItemGL: public LLUICtrl, public ll::ui::SearchableControl
{
public:
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
diff --git a/indra/llui/llsearchablecontrol.h b/indra/llui/llsearchablecontrol.h
new file mode 100644
index 0000000000..f7f1ffa0a5
--- /dev/null
+++ b/indra/llui/llsearchablecontrol.h
@@ -0,0 +1,71 @@
+/**
+* @file llsearchablecontrol.h
+*
+* $LicenseInfo:firstyear=2019&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2019, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+* $/LicenseInfo$
+*/
+
+#ifndef LL_SEARCHABLE_CONTROL_H
+#define LL_SEARCHABLE_CONTROL_H
+
+#include "lluicolortable.h"
+#include "lluicolor.h"
+
+namespace ll
+{
+ namespace ui
+ {
+ class SearchableControl
+ {
+ mutable bool mIsHighlighed;
+ public:
+ SearchableControl()
+ : mIsHighlighed( false )
+ { }
+ virtual ~SearchableControl()
+ { }
+
+ LLColor4 getHighlightColor( ) const
+ {
+ static LLUIColor highlight_color = LLUIColorTable::instance().getColor("SearchableControlHighlightColor", LLColor4::red);
+ return highlight_color.get();
+ }
+
+ void setHighlighted( bool aVal ) const
+ {
+ mIsHighlighed = aVal;
+ onSetHighlight( );
+ }
+ bool getHighlighted( ) const
+ { return mIsHighlighed; }
+
+ std::string getSearchText() const
+ { return _getSearchText(); }
+ protected:
+ virtual std::string _getSearchText() const = 0;
+ virtual void onSetHighlight( ) const
+ { }
+ };
+ }
+}
+
+
+#endif
diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h
index 75fcdc4b71..541c167717 100644
--- a/indra/llui/llsliderctrl.h
+++ b/indra/llui/llsliderctrl.h
@@ -35,7 +35,7 @@
#include "lllineeditor.h"
-class LLSliderCtrl : public LLF32UICtrl
+class LLSliderCtrl: public LLF32UICtrl, public ll::ui::SearchableControl
{
public:
struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params>
@@ -134,6 +134,19 @@ public:
static void onEditorGainFocus(LLFocusableElement* caller, void *userdata);
static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
+protected:
+ virtual std::string _getSearchText() const
+ {
+ std::string strLabel;
+ if( mLabelBox )
+ strLabel = mLabelBox->getLabel();
+ return strLabel + getToolTip();
+ }
+ virtual void onSetHighlight() const // When highlight, really do highlight the label
+ {
+ if( mLabelBox )
+ mLabelBox->ll::ui::SearchableControl::setHighlighted( ll::ui::SearchableControl::getHighlighted() );
+ }
private:
void updateText();
void updateSliderRect();
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 1b2f09cff5..6521b883f8 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -76,7 +76,8 @@ public:
mButton(b),
mOldState(FALSE),
mPlaceholderText(placeholder),
- mPadding(0)
+ mPadding(0),
+ mVisible(true)
{}
LLTabContainer* mTabContainer;
@@ -85,6 +86,8 @@ public:
BOOL mOldState;
LLTextBox* mPlaceholderText;
S32 mPadding;
+
+ mutable bool mVisible;
};
//----------------------------------------------------------------------------
@@ -398,7 +401,10 @@ void LLTabContainer::draw()
{
break;
}
- target_pixel_scroll += (*iter)->mButton->getRect().getWidth();
+
+ if( (*iter)->mVisible )
+ target_pixel_scroll += (*iter)->mButton->getRect().getWidth();
+
cur_scroll_pos--;
}
@@ -467,6 +473,12 @@ void LLTabContainer::draw()
{
LLTabTuple* tuple = *iter;
+ if( !tuple->mVisible )
+ {
+ tuple->mButton->setVisible( false );
+ continue;
+ }
+
tuple->mButton->translate( left ? left - tuple->mButton->getRect().mLeft : 0,
top ? top - tuple->mButton->getRect().mTop : 0 );
if (top) top -= BTN_HEIGHT + tabcntrv_pad;
@@ -724,11 +736,11 @@ BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask)
{
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
- LLTabTuple* tuple = *iter;
- tuple->mButton->setVisible( TRUE );
- S32 local_x = x - tuple->mButton->getRect().mLeft;
- S32 local_y = y - tuple->mButton->getRect().mBottom;
- handled = tuple->mButton->handleToolTip( local_x, local_y, mask);
+ LLButton* tab_button = (*iter)->mButton;
+ if (!tab_button->getVisible()) continue;
+ S32 local_x = x - tab_button->getRect().mLeft;
+ S32 local_y = y - tab_button->getRect().mBottom;
+ handled = tab_button->handleToolTip(local_x, local_y, mask);
if( handled )
{
break;
@@ -1505,7 +1517,7 @@ BOOL LLTabContainer::setTab(S32 which)
}
BOOL is_visible = FALSE;
- if (selected_tuple->mButton->getEnabled())
+ if( selected_tuple->mButton->getEnabled() && selected_tuple->mVisible )
{
setCurrentPanelIndex(which);
@@ -2121,3 +2133,35 @@ S32 LLTabContainer::getTotalTabWidth() const
{
return mTotalTabWidth;
}
+
+void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible )
+{
+ for( tuple_list_t::const_iterator itr = mTabList.begin(); itr != mTabList.end(); ++itr )
+ {
+ LLTabTuple const *pTT = *itr;
+ if( pTT->mTabPanel == aPanel )
+ {
+ pTT->mVisible = aVisible;
+ break;
+ }
+ }
+
+ bool foundTab( false );
+ for( tuple_list_t::const_iterator itr = mTabList.begin(); itr != mTabList.end(); ++itr )
+ {
+ LLTabTuple const *pTT = *itr;
+ if( pTT->mVisible )
+ {
+ this->selectTab( itr - mTabList.begin() );
+ foundTab = true;
+ break;
+ }
+ }
+
+ if( foundTab )
+ this->setVisible( TRUE );
+ else
+ this->setVisible( FALSE );
+
+ updateMaxScrollPos();
+}
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index 4a5f08f5d3..6bf963313c 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -216,6 +216,8 @@ public:
S32 getMinTabWidth() const { return mMinTabWidth; }
S32 getMaxTabWidth() const { return mMaxTabWidth; }
+ void setTabVisibility( LLPanel const *aPanel, bool );
+
void startDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); }
void onTabBtn( const LLSD& data, LLPanel* panel );
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index c570285856..a23741b6dd 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1222,6 +1222,17 @@ void LLTextBase::draw()
gl_rect_2d(text_rect, bg_color % alpha, TRUE);
}
+ // Draw highlighted if needed
+ if( ll::ui::SearchableControl::getHighlighted() )
+ {
+ LLColor4 bg_color = ll::ui::SearchableControl::getHighlightColor();
+ LLRect bg_rect = mVisibleTextRect;
+ if( mScroller )
+ bg_rect.intersectWith( text_rect );
+
+ gl_rect_2d( text_rect, bg_color, TRUE );
+ }
+
bool should_clip = mClip || mScroller != NULL;
{ LLLocalClipRect clip(text_rect, should_clip);
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 5fdde445ef..9831c35858 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -275,7 +275,8 @@ typedef LLPointer<LLTextSegment> LLTextSegmentPtr;
class LLTextBase
: public LLUICtrl,
protected LLEditMenuHandler,
- public LLSpellCheckMenuHandler
+ public LLSpellCheckMenuHandler,
+ public ll::ui::SearchableControl
{
public:
friend class LLTextSegment;
@@ -617,6 +618,11 @@ protected:
void appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params, bool underline_on_hover_only = false);
S32 normalizeUri(std::string& uri);
+protected:
+ virtual std::string _getSearchText() const
+ {
+ return mLabel.getString() + getToolTip();
+ }
protected:
// text segmentation and flow
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 134b76c720..137167db2a 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -732,14 +732,30 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
setFocus(TRUE);
}
+
+ bool show_menu = false;
+
// Prefer editor menu if it has selection. See EXT-6806.
- if (hasSelection() || !LLTextBase::handleRightMouseDown(x, y, mask))
+ if (hasSelection())
{
- if(getShowContextMenu())
+ S32 click_pos = getDocIndexFromLocalCoord(x, y, FALSE);
+ if (click_pos > mSelectionStart && click_pos < mSelectionEnd)
{
- showContextMenu(x, y);
+ show_menu = true;
}
}
+
+ // Let segments handle the click, if nothing does, show editor menu
+ if (!show_menu && !LLTextBase::handleRightMouseDown(x, y, mask))
+ {
+ show_menu = true;
+ }
+
+ if (show_menu && getShowContextMenu())
+ {
+ showContextMenu(x, y);
+ }
+
return TRUE;
}
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index 550bee5c70..63baed6793 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -37,6 +37,7 @@
#include "llinitparam.h"
#include "llview.h"
#include "llviewmodel.h" // *TODO move dependency to .cpp file
+#include "llsearchablecontrol.h"
const BOOL TAKE_FOCUS_YES = TRUE;
const BOOL TAKE_FOCUS_NO = FALSE;