summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llaccordionctrl.cpp24
-rw-r--r--indra/llui/llaccordionctrl.h1
-rw-r--r--indra/llui/llaccordionctrltab.cpp29
-rw-r--r--indra/llui/llaccordionctrltab.h7
-rw-r--r--indra/llui/llbutton.cpp30
-rw-r--r--indra/llui/llbutton.h8
-rw-r--r--indra/llui/llfloaterreg.cpp13
-rw-r--r--indra/llui/llfloaterreg.h4
-rw-r--r--indra/llui/llspinctrl.cpp11
-rw-r--r--indra/llui/lltabcontainer.cpp8
-rw-r--r--indra/llui/lltabcontainer.h5
11 files changed, 127 insertions, 13 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index 5d1d57cbb2..8e0245c451 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -65,6 +65,7 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
, mFitParent(params.fit_parent)
, mAutoScrolling( false )
, mAutoScrollRate( 0.f )
+ , mSelectedTab( NULL )
{
mSingleExpansion = params.single_expansion;
if(mFitParent && !mSingleExpansion)
@@ -76,6 +77,7 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
LLAccordionCtrl::LLAccordionCtrl() : LLPanel()
, mAutoScrolling( false )
, mAutoScrollRate( 0.f )
+ , mSelectedTab( NULL )
{
mSingleExpansion = false;
mFitParent = false;
@@ -689,6 +691,28 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info)
}
return 0;
}
+ else if(str_action == "select_current")
+ {
+ for(size_t i=0;i<mAccordionTabs.size();++i)
+ {
+ // Set selection to the currently focused tab.
+ if(mAccordionTabs[i]->hasFocus())
+ {
+ if (mAccordionTabs[i] != mSelectedTab)
+ {
+ if (mSelectedTab)
+ {
+ mSelectedTab->setSelected(false);
+ }
+ mSelectedTab = mAccordionTabs[i];
+ mSelectedTab->setSelected(true);
+ }
+
+ return 1;
+ }
+ }
+ return 0;
+ }
}
else if (info.has("scrollToShowRect"))
{
diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h
index ab7d6548ca..a029201c90 100644
--- a/indra/llui/llaccordionctrl.h
+++ b/indra/llui/llaccordionctrl.h
@@ -130,6 +130,7 @@ private:
bool mFitParent;
bool mAutoScrolling;
F32 mAutoScrollRate;
+ LLAccordionCtrlTab* mSelectedTab;
};
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index b09c108ec3..83e67980a3 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -76,6 +76,8 @@ public:
std::string getTitle();
void setTitle(const std::string& title, const std::string& hl);
+ void setSelected(bool is_selected) { mIsSelected = is_selected; }
+
virtual void onMouseEnter(S32 x, S32 y, MASK mask);
virtual void onMouseLeave(S32 x, S32 y, MASK mask);
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
@@ -103,6 +105,7 @@ private:
LLUIColor mHeaderBGColor;
bool mNeedsHighlight;
+ bool mIsSelected;
LLFrameTimer mAutoOpenTimer;
};
@@ -115,7 +118,8 @@ LLAccordionCtrlTab::LLAccordionCtrlTabHeader::LLAccordionCtrlTabHeader(
const LLAccordionCtrlTabHeader::Params& p)
: LLUICtrl(p)
, mHeaderBGColor(p.header_bg_color())
-,mNeedsHighlight(false),
+, mNeedsHighlight(false)
+, mIsSelected(false),
mImageCollapsed(p.header_collapse_img),
mImageCollapsedPressed(p.header_collapse_img_pressed),
mImageExpanded(p.header_expand_img),
@@ -187,7 +191,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw()
// Only show green "focus" background image if the accordion is open,
// because the user's mental model of focus is that it goes away after
// the accordion is closed.
- if (getParent()->hasFocus()
+ if (getParent()->hasFocus() || mIsSelected
/*&& !(collapsible && !expanded)*/ // WHY??
)
{
@@ -301,6 +305,7 @@ LLAccordionCtrlTab::Params::Params()
,header_image_focused("header_image_focused")
,header_text_color("header_text_color")
,fit_panel("fit_panel",true)
+ ,selection_enabled("selection_enabled", false)
{
mouse_opaque(false);
}
@@ -331,6 +336,11 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p)
mHeader = LLUICtrlFactory::create<LLAccordionCtrlTabHeader>(headerParams);
addChild(mHeader, 1);
+ if (p.selection_enabled)
+ {
+ LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLAccordionCtrlTab::selectOnFocusReceived, this));
+ }
+
reshape(100, 200,FALSE);
}
@@ -498,6 +508,15 @@ boost::signals2::connection LLAccordionCtrlTab::setFocusLostCallback(const focus
return boost::signals2::connection();
}
+void LLAccordionCtrlTab::setSelected(bool is_selected)
+{
+ LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
+ if (header)
+ {
+ header->setSelected(is_selected);
+ }
+}
+
LLView* LLAccordionCtrlTab::findContainerView()
{
for(child_list_const_iter_t it = getChildList()->begin();
@@ -513,6 +532,11 @@ LLView* LLAccordionCtrlTab::findContainerView()
return NULL;
}
+void LLAccordionCtrlTab::selectOnFocusReceived()
+{
+ if (getParent()) // A parent may not be set if tabs are added dynamically.
+ getParent()->notifyParent(LLSD().with("action", "select_current"));
+}
S32 LLAccordionCtrlTab::getHeaderHeight()
{
@@ -713,6 +737,7 @@ void LLAccordionCtrlTab::showAndFocusHeader()
{
LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
header->setFocus(true);
+ header->setSelected(true);
LLRect screen_rc;
LLRect selected_rc = header->getRect();
diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h
index f5b7fd0af6..83a9024a74 100644
--- a/indra/llui/llaccordionctrltab.h
+++ b/indra/llui/llaccordionctrltab.h
@@ -88,6 +88,8 @@ public:
Optional<bool> fit_panel;
+ Optional<bool> selection_enabled;
+
Optional<S32> padding_left;
Optional<S32> padding_right;
Optional<S32> padding_top;
@@ -121,6 +123,8 @@ public:
boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb);
boost::signals2::connection setFocusLostCallback(const focus_signal_t::slot_type& cb);
+ void setSelected(bool is_selected);
+
bool getCollapsible() {return mCollapsible;};
void setCollapsible(bool collapsible) {mCollapsible = collapsible;};
@@ -199,6 +203,9 @@ protected:
void drawChild(const LLRect& root_rect,LLView* child);
LLView* findContainerView ();
+
+ void selectOnFocusReceived();
+
private:
class LLAccordionCtrlTabHeader;
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 0255061b12..a8f72183fd 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -128,6 +128,7 @@ LLButton::LLButton(const LLButton::Params& p)
mImageSelected(p.image_selected),
mImageDisabled(p.image_disabled),
mImageDisabledSelected(p.image_disabled_selected),
+ mImageFlash(p.image_flash),
mImagePressed(p.image_pressed),
mImagePressedSelected(p.image_pressed_selected),
mImageHoverSelected(p.image_hover_selected),
@@ -635,14 +636,24 @@ void LLButton::draw()
if (mFlashing)
{
- LLColor4 flash_color = mFlashBgColor.get();
- use_glow_effect = TRUE;
- glow_type = LLRender::BT_ALPHA; // blend the glow
-
- if (mNeedsHighlight) // highlighted AND flashing
- glow_color = (glow_color*0.5f + flash_color*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity
+ // if we have icon for flashing, use it as image for button
+ if(flash && mImageFlash->getName() != "FlashIconAbsent")
+ {
+ // setting flash to false to avoid its further influence on glow
+ flash = false;
+ imagep = mImageFlash;
+ }
+ // else use usual flashing via flash_color
else
- glow_color = flash_color;
+ {
+ LLColor4 flash_color = mFlashBgColor.get();
+ use_glow_effect = TRUE;
+ glow_type = LLRender::BT_ALPHA; // blend the glow
+ if (mNeedsHighlight) // highlighted AND flashing
+ glow_color = (glow_color*0.5f + flash_color*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity
+ else
+ glow_color = flash_color;
+ }
}
if (mNeedsHighlight && !imagep)
@@ -1018,6 +1029,11 @@ void LLButton::setImageHoverUnselected(LLPointer<LLUIImage> image)
mImageHoverUnselected = image;
}
+void LLButton::setImageFlash(LLPointer<LLUIImage> image)
+{
+ mImageFlash = image;
+}
+
void LLButton::setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment, const LLColor4& color)
{
if (image_name.empty())
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index a4d81ed6c3..b251c3d65d 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -84,6 +84,7 @@ public:
image_hover_unselected,
image_disabled_selected,
image_disabled,
+ image_flash,
image_pressed,
image_pressed_selected,
image_overlay;
@@ -246,6 +247,7 @@ public:
void setImageHoverUnselected(LLPointer<LLUIImage> image);
void setImageDisabled(LLPointer<LLUIImage> image);
void setImageDisabledSelected(LLPointer<LLUIImage> image);
+ void setImageFlash(LLPointer<LLUIImage> image);
void setImagePressed(LLPointer<LLUIImage> image);
void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; }
@@ -310,6 +312,12 @@ private:
LLPointer<LLUIImage> mImagePressed;
LLPointer<LLUIImage> mImagePressedSelected;
+ /* There are two ways an image can flash- by making changes in color according to flash_color attribute
+ or by changing icon from current to the one specified in image_flash. Second way is used only if
+ the name of flash icon is different from "FlashIconAbsent" which is there by default. First way is used
+ otherwise. */
+ LLPointer<LLUIImage> mImageFlash;
+
LLUIColor mHighlightColor;
LLUIColor mFlashBgColor;
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 7588d8ab7a..85f9af126c 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -47,6 +47,7 @@ LLFloaterReg::instance_map_t LLFloaterReg::sInstanceMap;
LLFloaterReg::build_map_t LLFloaterReg::sBuildMap;
std::map<std::string,std::string> LLFloaterReg::sGroupMap;
bool LLFloaterReg::sBlockShowFloaters = false;
+std::set<std::string> LLFloaterReg::sAlwaysShowableList;
static LLFloaterRegListener sFloaterRegListener;
@@ -219,7 +220,9 @@ LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(const std::str
//static
LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus)
{
- if( sBlockShowFloaters )
+ if( sBlockShowFloaters
+ // see EXT-7090
+ && sAlwaysShowableList.find(name) == sAlwaysShowableList.end())
return 0;//
LLFloater* instance = getInstance(name, key);
if (instance)
@@ -403,6 +406,14 @@ void LLFloaterReg::registerControlVariables()
declareVisibilityControl(name);
}
}
+
+ const LLSD& exclude_list = LLUI::sSettingGroups["config"]->getLLSD("always_showable_floaters");
+ for (LLSD::array_const_iterator iter = exclude_list.beginArray();
+ iter != exclude_list.endArray();
+ iter++)
+ {
+ sAlwaysShowableList.insert(iter->asString());
+ }
}
// Callbacks
diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h
index 5cacf76771..f1ba41f638 100644
--- a/indra/llui/llfloaterreg.h
+++ b/indra/llui/llfloaterreg.h
@@ -76,6 +76,10 @@ private:
static build_map_t sBuildMap;
static std::map<std::string,std::string> sGroupMap;
static bool sBlockShowFloaters;
+ /**
+ * Defines list of floater names that can be shown despite state of sBlockShowFloaters.
+ */
+ static std::set<std::string> sAlwaysShowableList;
public:
// Registration
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index b47f21ed8a..c0d02fa8e9 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -127,7 +127,16 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p)
}
params.max_length_bytes(MAX_STRING_LENGTH);
params.commit_callback.function((boost::bind(&LLSpinCtrl::onEditorCommit, this, _2)));
- params.prevalidate_callback(&LLTextValidate::validateFloat);
+
+ if( mPrecision>0 )//should accept float numbers
+ {
+ params.prevalidate_callback(&LLTextValidate::validateFloat);
+ }
+ else //should accept int numbers
+ {
+ params.prevalidate_callback(&LLTextValidate::validateNonNegativeS32);
+ }
+
params.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
mEditor = LLUICtrlFactory::create<LLLineEditor> (params);
mEditor->setFocusReceivedCallback( boost::bind(&LLSpinCtrl::onEditorGainFocus, _1, this ));
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 30fc7babae..986cfe75a1 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -197,10 +197,13 @@ static LLDefaultChildRegistry::Register<LLTabContainer> r2("tab_container");
LLTabContainer::TabParams::TabParams()
: tab_top_image_unselected("tab_top_image_unselected"),
tab_top_image_selected("tab_top_image_selected"),
+ tab_top_image_flash("tab_top_image_flash"),
tab_bottom_image_unselected("tab_bottom_image_unselected"),
tab_bottom_image_selected("tab_bottom_image_selected"),
+ tab_bottom_image_flash("tab_bottom_image_flash"),
tab_left_image_unselected("tab_left_image_unselected"),
- tab_left_image_selected("tab_left_image_selected")
+ tab_left_image_selected("tab_left_image_selected"),
+ tab_left_image_flash("tab_left_image_flash")
{}
LLTabContainer::Params::Params()
@@ -879,16 +882,19 @@ void LLTabContainer::update_images(LLTabTuple* tuple, TabParams params, LLTabCon
{
tuple->mButton->setImageUnselected(static_cast<LLUIImage*>(params.tab_top_image_unselected));
tuple->mButton->setImageSelected(static_cast<LLUIImage*>(params.tab_top_image_selected));
+ tuple->mButton->setImageFlash(static_cast<LLUIImage*>(params.tab_top_image_flash));
}
else if (pos == LLTabContainer::BOTTOM)
{
tuple->mButton->setImageUnselected(static_cast<LLUIImage*>(params.tab_bottom_image_unselected));
tuple->mButton->setImageSelected(static_cast<LLUIImage*>(params.tab_bottom_image_selected));
+ tuple->mButton->setImageFlash(static_cast<LLUIImage*>(params.tab_bottom_image_flash));
}
else if (pos == LLTabContainer::LEFT)
{
tuple->mButton->setImageUnselected(static_cast<LLUIImage*>(params.tab_left_image_unselected));
tuple->mButton->setImageSelected(static_cast<LLUIImage*>(params.tab_left_image_selected));
+ tuple->mButton->setImageFlash(static_cast<LLUIImage*>(params.tab_left_image_flash));
}
}
}
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index 50ec2679f6..a2dc15aaf9 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -67,10 +67,13 @@ public:
{
Optional<LLUIImage*> tab_top_image_unselected,
tab_top_image_selected,
+ tab_top_image_flash,
tab_bottom_image_unselected,
tab_bottom_image_selected,
+ tab_bottom_image_flash,
tab_left_image_unselected,
- tab_left_image_selected;
+ tab_left_image_selected,
+ tab_left_image_flash;
TabParams();
};