summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2009-11-24 23:21:57 -0600
committerDave Parks <davep@lindenlab.com>2009-11-24 23:21:57 -0600
commite264f00c833805e1f813bc1d0b2cfd7a1bf7b272 (patch)
tree1a64a520502d2ed2c7dadc2316e543ae9e9a91d2 /indra/llui
parentc9e153c182dae9472a2b87cddfec8c47b30b06b9 (diff)
parent5b5354c933aa7b1ceeb307853c24fba28d4e31bf (diff)
Merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp53
-rw-r--r--indra/llui/llbutton.h12
-rw-r--r--indra/llui/llcheckboxctrl.h1
-rw-r--r--indra/llui/llcombobox.cpp26
-rw-r--r--indra/llui/llcombobox.h7
-rw-r--r--indra/llui/llconsole.cpp5
-rw-r--r--indra/llui/lldockablefloater.cpp17
-rw-r--r--indra/llui/lldockcontrol.cpp7
-rw-r--r--indra/llui/lldockcontrol.h1
-rw-r--r--indra/llui/llflatlistview.cpp241
-rw-r--r--indra/llui/llflatlistview.h27
-rw-r--r--indra/llui/llfloater.cpp93
-rw-r--r--indra/llui/llfloater.h1
-rw-r--r--indra/llui/llfloaterreg.cpp2
-rw-r--r--indra/llui/llfloaterreglistener.cpp30
-rw-r--r--indra/llui/llfloaterreglistener.h6
-rw-r--r--indra/llui/llfocusmgr.cpp43
-rw-r--r--indra/llui/llfocusmgr.h16
-rw-r--r--indra/llui/llhelp.h2
-rw-r--r--indra/llui/lllayoutstack.cpp17
-rw-r--r--indra/llui/lllayoutstack.h15
-rw-r--r--indra/llui/lllineeditor.cpp46
-rw-r--r--indra/llui/lllineeditor.h7
-rw-r--r--indra/llui/llmenubutton.cpp4
-rw-r--r--indra/llui/llmenugl.cpp17
-rw-r--r--indra/llui/llmultislider.cpp37
-rw-r--r--indra/llui/llmultislider.h9
-rw-r--r--indra/llui/llmultisliderctrl.cpp4
-rw-r--r--indra/llui/llnotificationslistener.cpp8
-rw-r--r--indra/llui/llnotificationslistener.h4
-rw-r--r--indra/llui/llpanel.cpp25
-rw-r--r--indra/llui/llpanel.h6
-rw-r--r--indra/llui/llresizebar.cpp6
-rw-r--r--indra/llui/llresizehandle.cpp6
-rw-r--r--indra/llui/llscrolllistcell.cpp22
-rw-r--r--indra/llui/llscrolllistcell.h8
-rw-r--r--indra/llui/llscrolllistctrl.cpp2
-rw-r--r--indra/llui/llslider.cpp168
-rw-r--r--indra/llui/llslider.h30
-rw-r--r--indra/llui/llsliderctrl.cpp7
-rw-r--r--indra/llui/llsliderctrl.h4
-rw-r--r--indra/llui/llspinctrl.cpp6
-rw-r--r--indra/llui/llstyle.cpp1
-rw-r--r--indra/llui/llstyle.h7
-rw-r--r--indra/llui/lltabcontainer.cpp45
-rw-r--r--indra/llui/lltextbase.cpp46
-rw-r--r--indra/llui/lltextbase.h5
-rw-r--r--indra/llui/lltextbox.cpp4
-rw-r--r--indra/llui/lltextbox.h2
-rw-r--r--indra/llui/lltexteditor.cpp33
-rw-r--r--indra/llui/lltexteditor.h2
-rw-r--r--indra/llui/lltoggleablemenu.cpp9
-rw-r--r--indra/llui/lltoggleablemenu.h3
-rw-r--r--indra/llui/lltooltip.cpp39
-rw-r--r--indra/llui/lltooltip.h25
-rw-r--r--indra/llui/lluicolortable.cpp23
-rw-r--r--indra/llui/lluictrl.cpp179
-rw-r--r--indra/llui/lluictrl.h42
-rw-r--r--indra/llui/lluictrlfactory.cpp8
-rw-r--r--indra/llui/lluictrlfactory.h7
-rw-r--r--indra/llui/lluiimage.cpp7
-rw-r--r--indra/llui/llurlentry.cpp77
-rw-r--r--indra/llui/llurlentry.h25
-rw-r--r--indra/llui/llurlregistry.cpp2
64 files changed, 1238 insertions, 401 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index bbaf908d2e..8930e32055 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -146,8 +146,12 @@ LLButton::LLButton(const LLButton::Params& p)
mHoverGlowStrength(p.hover_glow_amount),
mCommitOnReturn(p.commit_on_return),
mFadeWhenDisabled(FALSE),
- mForcePressedState(FALSE),
- mLastDrawCharsCount(0)
+ mForcePressedState(false),
+ mLastDrawCharsCount(0),
+ mMouseDownSignal(NULL),
+ mMouseUpSignal(NULL),
+ mHeldDownSignal(NULL)
+
{
static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0);
static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>());
@@ -215,13 +219,28 @@ LLButton::LLButton(const LLButton::Params& p)
}
if (p.click_callback.isProvided())
- initCommitCallback(p.click_callback, mCommitSignal); // alias -> commit_callback
+ {
+ setCommitCallback(initCommitCallback(p.click_callback)); // alias -> commit_callback
+ }
if (p.mouse_down_callback.isProvided())
- initCommitCallback(p.mouse_down_callback, mMouseDownSignal);
+ {
+ setMouseDownCallback(initCommitCallback(p.mouse_down_callback));
+ }
if (p.mouse_up_callback.isProvided())
- initCommitCallback(p.mouse_up_callback, mMouseUpSignal);
+ {
+ setMouseUpCallback(initCommitCallback(p.mouse_up_callback));
+ }
if (p.mouse_held_callback.isProvided())
- initCommitCallback(p.mouse_held_callback, mHeldDownSignal);
+ {
+ setHeldDownCallback(initCommitCallback(p.mouse_held_callback));
+ }
+}
+
+LLButton::~LLButton()
+{
+ delete mMouseDownSignal;
+ delete mMouseUpSignal;
+ delete mHeldDownSignal;
}
// HACK: Committing a button is the same as instantly clicking it.
@@ -232,9 +251,9 @@ void LLButton::onCommit()
// panel containing it. Therefore we need to call LLUICtrl::onCommit()
// LAST, otherwise this becomes deleted memory.
- mMouseDownSignal(this, LLSD());
+ if (mMouseDownSignal) (*mMouseDownSignal)(this, LLSD());
- mMouseUpSignal(this, LLSD());
+ if (mMouseUpSignal) (*mMouseUpSignal)(this, LLSD());
if (getSoundFlags() & MOUSE_DOWN)
{
@@ -257,19 +276,23 @@ void LLButton::onCommit()
boost::signals2::connection LLButton::setClickedCallback( const commit_signal_t::slot_type& cb )
{
- return mCommitSignal.connect(cb);
+ if (!mCommitSignal) mCommitSignal = new commit_signal_t();
+ return mCommitSignal->connect(cb);
}
boost::signals2::connection LLButton::setMouseDownCallback( const commit_signal_t::slot_type& cb )
{
- return mMouseDownSignal.connect(cb);
+ if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t();
+ return mMouseDownSignal->connect(cb);
}
boost::signals2::connection LLButton::setMouseUpCallback( const commit_signal_t::slot_type& cb )
{
- return mMouseUpSignal.connect(cb);
+ if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t();
+ return mMouseUpSignal->connect(cb);
}
boost::signals2::connection LLButton::setHeldDownCallback( const commit_signal_t::slot_type& cb )
{
- return mHeldDownSignal.connect(cb);
+ if (!mHeldDownSignal) mHeldDownSignal = new commit_signal_t();
+ return mHeldDownSignal->connect(cb);
}
@@ -351,7 +374,7 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask)
*/
LLUICtrl::handleMouseDown(x, y, mask);
- mMouseDownSignal(this, LLSD());
+ if(mMouseDownSignal) (*mMouseDownSignal)(this, LLSD());
mMouseDownTimer.start();
mMouseDownFrame = (S32) LLFrameTimer::getFrameCount();
@@ -383,7 +406,7 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask)
LLUICtrl::handleMouseUp(x, y, mask);
// Regardless of where mouseup occurs, handle callback
- mMouseUpSignal(this, LLSD());
+ if(mMouseUpSignal) (*mMouseUpSignal)(this, LLSD());
resetMouseDownTimer();
@@ -493,7 +516,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
{
LLSD param;
param["count"] = mMouseHeldDownCount++;
- mHeldDownSignal(this, param);
+ if (mHeldDownSignal) (*mHeldDownSignal)(this, param);
}
}
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 08f289092f..8c3b4bd859 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -128,6 +128,8 @@ protected:
LLButton(const Params&);
public:
+
+ ~LLButton();
// For backward compatability only
typedef boost::function<void(void*)> button_callback_t;
@@ -238,7 +240,7 @@ public:
static void setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname);
static void showHelp(LLUICtrl* ctrl, const LLSD& sdname);
- void setForcePressedState(BOOL b) { mForcePressedState = b; }
+ void setForcePressedState(bool b) { mForcePressedState = b; }
protected:
LLPointer<LLUIImage> getImageUnselected() const { return mImageUnselected; }
@@ -251,9 +253,9 @@ private:
void resetMouseDownTimer();
private:
- commit_signal_t mMouseDownSignal;
- commit_signal_t mMouseUpSignal;
- commit_signal_t mHeldDownSignal;
+ commit_signal_t* mMouseDownSignal;
+ commit_signal_t* mMouseUpSignal;
+ commit_signal_t* mHeldDownSignal;
const LLFontGL* mGLFont;
@@ -315,7 +317,7 @@ private:
BOOL mNeedsHighlight;
BOOL mCommitOnReturn;
BOOL mFadeWhenDisabled;
- BOOL mForcePressedState;
+ bool mForcePressedState;
LLFrameTimer mFlashingTimer;
};
diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h
index 2f8e8fdd23..b14e66b915 100644
--- a/indra/llui/llcheckboxctrl.h
+++ b/indra/llui/llcheckboxctrl.h
@@ -107,6 +107,7 @@ public:
std::string getLabel() const;
void setFont( const LLFontGL* font ) { mFont = font; }
+ const LLFontGL* getFont() { return mFont; }
virtual void setControlName(const std::string& control_name, LLView* context);
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 36e309d639..f29e8785eb 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -102,14 +102,14 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mMaxChars(p.max_chars),
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
- mSelectionCallback(p.selection_callback()),
mListPosition(p.list_position),
mLastSelectedIndex(-1)
{
// Text label button
LLButton::Params button_params = (mAllowTextEntry ? p.combo_button : p.drop_down_button);
- button_params.mouse_down_callback.function(boost::bind(&LLComboBox::onButtonDown, this));
+ button_params.mouse_down_callback.function(
+ boost::bind(&LLComboBox::onButtonMouseDown, this));
button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT);
button_params.rect(p.rect);
@@ -140,6 +140,10 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mList = LLUICtrlFactory::create<LLScrollListCtrl>(params);
addChild(mList);
+ // Mouse-down on button will transfer mouse focus to the list
+ // Grab the mouse-up event and make sure the button state is correct
+ mList->setMouseUpCallback(boost::bind(&LLComboBox::onListMouseUp, this));
+
for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items().begin();
it != p.items().end();
++it)
@@ -644,7 +648,7 @@ void LLComboBox::hideList()
}
}
-void LLComboBox::onButtonDown()
+void LLComboBox::onButtonMouseDown()
{
if (!mList->getVisible())
{
@@ -670,6 +674,10 @@ void LLComboBox::onButtonDown()
if (mButton->hasMouseCapture())
{
gFocusMgr.setMouseCapture(mList);
+
+ // But keep the "pressed" look, which buttons normally lose when they
+ // lose focus
+ mButton->setForcePressedState(true);
}
}
else
@@ -679,6 +687,12 @@ void LLComboBox::onButtonDown()
}
+void LLComboBox::onListMouseUp()
+{
+ // In some cases this is the termination of a mouse click that started on
+ // the button, so clear its pressed state
+ mButton->setForcePressedState(false);
+}
//------------------------------------------------------------------
// static functions
@@ -706,12 +720,6 @@ void LLComboBox::onItemSelected(const LLSD& data)
// commit does the reverse, asserting the value in the list
onCommit();
-
- // call the callback if it exists
- if(mSelectionCallback)
- {
- mSelectionCallback(this, data);
- }
}
BOOL LLComboBox::handleToolTip(S32 x, S32 y, MASK mask)
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 6285ca5170..4f27588467 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -82,8 +82,7 @@ public:
allow_new_values;
Optional<S32> max_chars;
Optional<commit_callback_t> prearrange_callback,
- text_entry_callback,
- selection_callback;
+ text_entry_callback;
Optional<EPreferredPosition, PreferredPositionValues> list_position;
@@ -200,11 +199,11 @@ public:
void setPrearrangeCallback( commit_callback_t cb ) { mPrearrangeCallback = cb; }
void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; }
- void setSelectionCallback( commit_callback_t cb ) { mSelectionCallback = cb; }
void setButtonVisible(BOOL visible);
- void onButtonDown();
+ void onButtonMouseDown();
+ void onListMouseUp();
void onItemSelected(const LLSD& data);
void onTextCommit(const LLSD& data);
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index 48c76cf105..fa0abd55d0 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -392,9 +392,4 @@ void LLConsole::addLine(const LLWString& wline, F32 size, const LLColor4 &color)
Paragraph paragraph(wline, color, mTimer.getElapsedTimeF32(), mFont, (F32)getRect().getWidth() );
mParagraphs.push_back ( paragraph );
-
-#if LL_WINDOWS && LL_LCD_COMPILE
- // add to LCD screen
- AddNewDebugConsoleToLCD(wline);
-#endif
}
diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp
index f56cb2eee7..9c69e4f2b6 100644
--- a/indra/llui/lldockablefloater.cpp
+++ b/indra/llui/lldockablefloater.cpp
@@ -127,26 +127,19 @@ void LLDockableFloater::setVisible(BOOL visible)
mDockControl.get()->repositionDockable();
}
+ if (visible)
+ {
+ LLFloater::setFrontmost(TRUE);
+ }
LLFloater::setVisible(visible);
}
void LLDockableFloater::setMinimized(BOOL minimize)
{
- if(minimize && isDocked())
+ if(minimize)
{
setVisible(FALSE);
}
-
- if (minimize)
- {
- setCanDock(false);
- }
- else if (!minimize && mDockControl.get() != NULL && mDockControl.get()->isDockVisible())
- {
- setCanDock(true);
- }
-
- LLFloater::setMinimized(minimize);
}
LLView * LLDockableFloater::getDockWidget()
diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index 35a854267a..456a2925a3 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -256,7 +256,6 @@ void LLDockControl::on()
{
if (isDockVisible())
{
- mDockableFloater->setCanDrag(false);
mEnabled = true;
mRecalculateDocablePosition = true;
}
@@ -264,10 +263,14 @@ void LLDockControl::on()
void LLDockControl::off()
{
- mDockableFloater->setCanDrag(true);
mEnabled = false;
}
+void LLDockControl::forceRecalculatePosition()
+{
+ mRecalculateDocablePosition = true;
+}
+
void LLDockControl::drawToungue()
{
if (mEnabled)
diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h
index eaedb4c307..30a45bedc7 100644
--- a/indra/llui/lldockcontrol.h
+++ b/indra/llui/lldockcontrol.h
@@ -63,6 +63,7 @@ public:
public:
void on();
void off();
+ void forceRecalculatePosition();
void setDock(LLView* dockWidget);
LLView* getDock()
{
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 19f203b80c..8de3a8a96f 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -94,6 +94,9 @@ bool LLFlatListView::addItem(LLPanel * item, const LLSD& value /*= LLUUID::null*
item->setMouseDownCallback(boost::bind(&LLFlatListView::onItemMouseClick, this, new_pair, _4));
item->setRightMouseDownCallback(boost::bind(&LLFlatListView::onItemRightMouseClick, this, new_pair, _4));
+ // Children don't accept the focus
+ item->setTabStop(false);
+
rearrangeItems();
notifyParentItemsRectChanged();
return true;
@@ -282,6 +285,9 @@ void LLFlatListView::resetSelection(bool no_commit_on_deselection /*= false*/)
{
onCommit();
}
+
+ // Stretch selected items rect to ensure it won't be clipped
+ mSelectedItemsBorder->setRect(getSelectedItemsRect().stretch(-1));
}
void LLFlatListView::setNoItemsCommentText(const std::string& comment_text)
@@ -381,8 +387,34 @@ LLFlatListView::LLFlatListView(const LLFlatListView::Params& p)
//we don't need to stretch in vertical direction on reshaping by a parent
//no bottom following!
mItemsPanel->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP);
+
+ LLViewBorder::Params params;
+ params.name("scroll border");
+ params.rect(getSelectedItemsRect());
+ params.visible(false);
+ params.bevel_style(LLViewBorder::BEVEL_IN);
+ mSelectedItemsBorder = LLUICtrlFactory::create<LLViewBorder> (params);
+ mItemsPanel->addChild( mSelectedItemsBorder );
};
+// virtual
+void LLFlatListView::draw()
+{
+ // Highlight border if a child of this container has keyboard focus
+ if( mSelectedItemsBorder->getVisible() )
+ {
+ mSelectedItemsBorder->setKeyboardFocusHighlight( hasFocus() );
+ }
+ LLScrollContainer::draw();
+}
+
+// virtual
+BOOL LLFlatListView::postBuild()
+{
+ setTabStop(true);
+ return LLScrollContainer::postBuild();
+}
+
void LLFlatListView::rearrangeItems()
{
static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
@@ -444,6 +476,9 @@ void LLFlatListView::rearrangeItems()
// move top for next item in list
item_new_top -= (rc.getHeight() + mItemPad);
}
+
+ // Stretch selected items rect to ensure it won't be clipped
+ mSelectedItemsBorder->setRect(getSelectedItemsRect().stretch(-1));
}
void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
@@ -473,6 +508,64 @@ void LLFlatListView::onItemRightMouseClick(item_pair_t* item_pair, MASK mask)
onItemMouseClick(item_pair, mask);
}
+BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
+{
+ BOOL reset_selection = (mask != MASK_SHIFT);
+ BOOL handled = FALSE;
+ switch (key)
+ {
+ case KEY_RETURN:
+ {
+ if (mSelectedItemPairs.size() && mask == MASK_NONE)
+ {
+ mOnReturnSignal(this, getValue());
+ handled = TRUE;
+ }
+ break;
+ }
+ case KEY_UP:
+ {
+ if ( !selectNextItemPair(true, reset_selection) && reset_selection)
+ {
+ // If case we are in accordion tab notify parent to go to the previous accordion
+ notifyParent(LLSD().insert("action","select_prev"));
+ }
+ break;
+ }
+ case KEY_DOWN:
+ {
+ if ( !selectNextItemPair(false, reset_selection) && reset_selection)
+ {
+ // If case we are in accordion tab notify parent to go to the next accordion
+ notifyParent(LLSD().insert("action","select_next"));
+ }
+ break;
+ }
+ case 'A':
+ {
+ if(MASK_CONTROL & mask)
+ {
+ selectAll();
+ handled = TRUE;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ if ( key == KEY_UP || key == KEY_DOWN )
+ {
+ LLRect selcted_rect = getLastSelectedItemRect().stretch(1);
+ LLRect visible_rect = getVisibleContentRect();
+ if ( !visible_rect.contains (selcted_rect) )
+ scrollToShowRect(selcted_rect);
+ handled = TRUE;
+ }
+
+ return handled ? handled : LLScrollContainer::handleKeyHere(key, mask);
+}
+
LLFlatListView::item_pair_t* LLFlatListView::getItemPair(LLPanel* item) const
{
llassert(item);
@@ -552,6 +645,143 @@ bool LLFlatListView::selectItemPair(item_pair_t* item_pair, bool select)
onCommit();
}
+ setFocus(TRUE);
+
+ // Stretch selected items rect to ensure it won't be clipped
+ mSelectedItemsBorder->setRect(getSelectedItemsRect().stretch(-1));
+
+ return true;
+}
+
+LLRect LLFlatListView::getLastSelectedItemRect()
+{
+ if (!mSelectedItemPairs.size())
+ {
+ return LLRect::null;
+ }
+
+ return mSelectedItemPairs.back()->first->getRect();
+}
+
+LLRect LLFlatListView::getSelectedItemsRect()
+{
+ if (!mSelectedItemPairs.size())
+ {
+ return LLRect::null;
+ }
+ LLRect rc = getLastSelectedItemRect();
+ for ( pairs_const_iterator_t
+ it = mSelectedItemPairs.begin(),
+ it_end = mSelectedItemPairs.end();
+ it != it_end; ++it )
+ {
+ rc.unionWith((*it)->first->getRect());
+ }
+ return rc;
+}
+
+// virtual
+bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selection)
+{
+ // No items - no actions!
+ if ( !mItemPairs.size() )
+ return false;
+
+ item_pair_t* cur_sel_pair = NULL;
+ item_pair_t* to_sel_pair = NULL;
+
+ if ( mSelectedItemPairs.size() )
+ {
+ // Take the last selected pair
+ cur_sel_pair = mSelectedItemPairs.back();
+ }
+ else
+ {
+ // If there weren't selected items then choose the first one bases on given direction
+ cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front();
+ // Force selection to first item
+ to_sel_pair = cur_sel_pair;
+ }
+
+ // Bases on given direction choose next item to select
+ if ( is_up_direction )
+ {
+ // Find current selected item position in mItemPairs list
+ pairs_list_t::reverse_iterator sel_it = std::find(mItemPairs.rbegin(), mItemPairs.rend(), cur_sel_pair);
+
+ for (;++sel_it != mItemPairs.rend();)
+ {
+ // skip invisible items
+ if ( (*sel_it)->first->getVisible() )
+ {
+ to_sel_pair = *sel_it;
+ break;
+ }
+ }
+ }
+ else
+ {
+ // Find current selected item position in mItemPairs list
+ pairs_list_t::iterator sel_it = std::find(mItemPairs.begin(), mItemPairs.end(), cur_sel_pair);
+
+ for (;++sel_it != mItemPairs.end();)
+ {
+ // skip invisible items
+ if ( (*sel_it)->first->getVisible() )
+ {
+ to_sel_pair = *sel_it;
+ break;
+ }
+ }
+ }
+
+ if ( to_sel_pair )
+ {
+ bool select = true;
+
+ if ( reset_selection )
+ {
+ // Reset current selection if we were asked about it
+ resetSelection();
+ }
+ else
+ {
+ // If item already selected and no reset request than we should deselect last selected item.
+ select = (mSelectedItemPairs.end() == std::find(mSelectedItemPairs.begin(), mSelectedItemPairs.end(), to_sel_pair));
+ }
+
+ // Select/Deselect next item
+ selectItemPair(select ? to_sel_pair : cur_sel_pair, select);
+
+ return true;
+ }
+ return false;
+}
+
+bool LLFlatListView::selectAll()
+{
+ if (!mAllowSelection)
+ return false;
+
+ mSelectedItemPairs.clear();
+
+ for (pairs_const_iterator_t it= mItemPairs.begin(); it != mItemPairs.end(); ++it)
+ {
+ item_pair_t* item_pair = *it;
+ mSelectedItemPairs.push_back(item_pair);
+ //a way of notifying panel of selection state changes
+ LLPanel* item = item_pair->first;
+ item->setValue(SELECTED_EVENT);
+ }
+
+ if (mCommitOnSelectionChange)
+ {
+ onCommit();
+ }
+
+ // Stretch selected items rect to ensure it won't be clipped
+ mSelectedItemsBorder->setRect(getSelectedItemsRect().stretch(-1));
+
return true;
}
@@ -670,4 +900,15 @@ void LLFlatListView::getValues(std::vector<LLSD>& values) const
}
}
+// virtual
+void LLFlatListView::onFocusReceived()
+{
+ mSelectedItemsBorder->setVisible(TRUE);
+}
+// virtual
+void LLFlatListView::onFocusLost()
+{
+ mSelectedItemsBorder->setVisible(FALSE);
+}
+
//EOF
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 97772bc677..3867e910c0 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -50,7 +50,7 @@ class LLTextBox;
* is ignored. The option "keep_one_selected" forces at least one item to be selected at any time (only for mouse events on items)
* since any item of the list was selected.
*
- * Examples of using this control are presented in Picks panel (Me Profile and Profile View), where this control is used to
+ * Examples of using this control are presented in Picks panel (My Profile and Profile View), where this control is used to
* manage the list of pick items.
*
* ASSUMPTIONS AND STUFF
@@ -113,6 +113,10 @@ public:
virtual ~LLFlatListView() { clear(); };
+ /**
+ * Connects callback to signal called when Return key is pressed.
+ */
+ boost::signals2::connection setReturnCallback( const commit_signal_t::slot_type& cb ) { return mOnReturnSignal.connect(cb); }
/** Overridden LLPanel's reshape, height is ignored, the list sets its height to accommodate all items */
virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
@@ -318,6 +322,10 @@ protected:
virtual bool selectItemPair(item_pair_t* item_pair, bool select);
+ virtual bool selectNextItemPair(bool is_up_direction, bool reset_selection);
+
+ virtual bool selectAll();
+
virtual bool isSelected(item_pair_t* item_pair) const;
virtual bool removeItemPair(item_pair_t* item_pair);
@@ -331,6 +339,19 @@ protected:
*/
void notifyParentItemsRectChanged();
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
+
+ virtual BOOL postBuild();
+
+ virtual void onFocusReceived();
+
+ virtual void onFocusLost();
+
+ virtual void draw();
+
+ LLRect getLastSelectedItemRect();
+
+ LLRect getSelectedItemsRect();
private:
@@ -381,6 +402,10 @@ private:
LLRect mPrevNotifyParentRect;
LLTextBox* mNoItemsCommentTextbox;
+
+ LLViewBorder* mSelectedItemsBorder;
+
+ commit_signal_t mOnReturnSignal;
};
#endif
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index f2cdad8854..262afbe661 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1888,41 +1888,50 @@ void LLFloaterView::reshapeFloater(S32 width, S32 height, BOOL called_from_paren
// dependents use same follow flags as their "dependee"
continue;
}
- LLRect r = floaterp->getRect();
-
- // Compute absolute distance from each edge of screen
- S32 left_offset = llabs(r.mLeft - 0);
- S32 right_offset = llabs(old_width - r.mRight);
-
- S32 top_offset = llabs(old_height - r.mTop);
- S32 bottom_offset = llabs(r.mBottom - 0);
// Make if follow the edge it is closest to
U32 follow_flags = 0x0;
- if (left_offset < right_offset)
+ if (floaterp->isMinimized())
{
- follow_flags |= FOLLOWS_LEFT;
+ follow_flags |= (FOLLOWS_LEFT | FOLLOWS_TOP);
}
else
{
- follow_flags |= FOLLOWS_RIGHT;
- }
+ LLRect r = floaterp->getRect();
- // "No vertical adjustment" usually means that the bottom of the view
- // has been pushed up or down. Hence we want the floaters to follow
- // the top.
- if (!adjust_vertical)
- {
- follow_flags |= FOLLOWS_TOP;
- }
- else if (top_offset < bottom_offset)
- {
- follow_flags |= FOLLOWS_TOP;
- }
- else
- {
- follow_flags |= FOLLOWS_BOTTOM;
+ // Compute absolute distance from each edge of screen
+ S32 left_offset = llabs(r.mLeft - 0);
+ S32 right_offset = llabs(old_width - r.mRight);
+
+ S32 top_offset = llabs(old_height - r.mTop);
+ S32 bottom_offset = llabs(r.mBottom - 0);
+
+
+ if (left_offset < right_offset)
+ {
+ follow_flags |= FOLLOWS_LEFT;
+ }
+ else
+ {
+ follow_flags |= FOLLOWS_RIGHT;
+ }
+
+ // "No vertical adjustment" usually means that the bottom of the view
+ // has been pushed up or down. Hence we want the floaters to follow
+ // the top.
+ if (!adjust_vertical)
+ {
+ follow_flags |= FOLLOWS_TOP;
+ }
+ else if (top_offset < bottom_offset)
+ {
+ follow_flags |= FOLLOWS_TOP;
+ }
+ else
+ {
+ follow_flags |= FOLLOWS_BOTTOM;
+ }
}
floaterp->setFollows(follow_flags);
@@ -2172,16 +2181,16 @@ void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom)
const LLFloater::Params& default_params = LLFloater::getDefaultParams();
S32 floater_header_size = default_params.header_height;
static LLUICachedControl<S32> minimized_width ("UIMinimizedWidth", 0);
- S32 col = 0;
LLRect snap_rect_local = getLocalSnapRect();
- for(S32 row = snap_rect_local.mBottom;
- row < snap_rect_local.getHeight() - floater_header_size;
- row += floater_header_size ) //loop rows
- {
- for(col = snap_rect_local.mLeft;
- col < snap_rect_local.getWidth() - minimized_width;
- col += minimized_width)
+ for(S32 col = snap_rect_local.mLeft;
+ col < snap_rect_local.getWidth() - minimized_width;
+ col += minimized_width)
+ {
+ for(S32 row = snap_rect_local.mTop - floater_header_size;
+ row > floater_header_size;
+ row -= floater_header_size ) //loop rows
{
+
bool foundGap = TRUE;
for(child_list_const_iter_t child_it = getChildList()->begin();
child_it != getChildList()->end();
@@ -2517,8 +2526,12 @@ void LLFloaterView::pushVisibleAll(BOOL visible, const skip_list_t& skip_list)
void LLFloaterView::popVisibleAll(const skip_list_t& skip_list)
{
- for (child_list_const_iter_t child_iter = getChildList()->begin();
- child_iter != getChildList()->end(); ++child_iter)
+ // make a copy of the list since some floaters change their
+ // order in the childList when changing visibility.
+ child_list_t child_list_copy = *getChildList();
+
+ for (child_list_const_iter_t child_iter = child_list_copy.begin();
+ child_iter != child_list_copy.end(); ++child_iter)
{
LLView *view = *child_iter;
if (skip_list.find(view) == skip_list.end())
@@ -2629,10 +2642,14 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
// open callback
if (p.open_callback.isProvided())
- initCommitCallback(p.open_callback, mOpenSignal);
+ {
+ mOpenSignal.connect(initCommitCallback(p.open_callback));
+ }
// close callback
if (p.close_callback.isProvided())
- initCommitCallback(p.close_callback, mCloseSignal);
+ {
+ mCloseSignal.connect(initCommitCallback(p.close_callback));
+ }
}
LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 95c8dd84f6..1b98dddddc 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -195,6 +195,7 @@ public:
/// The static isShown() can accept a NULL pointer (which of course
/// returns false). When non-NULL, it calls the non-static isShown().
static bool isShown(const LLFloater* floater);
+ BOOL isFirstLook() { return mFirstLook; } // EXT-2653: This function is necessary to prevent overlapping for secondary showed toasts
BOOL isFrontmost();
BOOL isDependent() { return !mDependeeHandle.isDead(); }
void setCanMinimize(BOOL can_minimize);
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 03925f922c..eb67e3a561 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -46,7 +46,7 @@ LLFloaterReg::instance_map_t LLFloaterReg::sInstanceMap;
LLFloaterReg::build_map_t LLFloaterReg::sBuildMap;
std::map<std::string,std::string> LLFloaterReg::sGroupMap;
-static LLFloaterRegListener sFloaterRegListener("LLFloaterReg");
+static LLFloaterRegListener sFloaterRegListener;
//*******************************************************
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index 57d148b5af..029d3b6810 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -21,19 +21,35 @@
#include "llfloater.h"
#include "llbutton.h"
-LLFloaterRegListener::LLFloaterRegListener(const std::string& pumpName):
- LLDispatchListener(pumpName, "op")
+LLFloaterRegListener::LLFloaterRegListener():
+ LLEventAPI("LLFloaterReg",
+ "LLFloaterReg listener to (e.g.) show/hide LLFloater instances")
{
- add("getBuildMap", &LLFloaterRegListener::getBuildMap, LLSD().insert("reply", LLSD()));
+ add("getBuildMap",
+ "Return on [\"reply\"] data about all registered LLFloaterReg floater names",
+ &LLFloaterRegListener::getBuildMap,
+ LLSD().insert("reply", LLSD()));
LLSD requiredName;
requiredName["name"] = LLSD();
- add("showInstance", &LLFloaterRegListener::showInstance, requiredName);
- add("hideInstance", &LLFloaterRegListener::hideInstance, requiredName);
- add("toggleInstance", &LLFloaterRegListener::toggleInstance, requiredName);
+ add("showInstance",
+ "Ask to display the floater specified in [\"name\"]",
+ &LLFloaterRegListener::showInstance,
+ requiredName);
+ add("hideInstance",
+ "Ask to hide the floater specified in [\"name\"]",
+ &LLFloaterRegListener::hideInstance,
+ requiredName);
+ add("toggleInstance",
+ "Ask to toggle the state of the floater specified in [\"name\"]",
+ &LLFloaterRegListener::toggleInstance,
+ requiredName);
LLSD requiredNameButton;
requiredNameButton["name"] = LLSD();
requiredNameButton["button"] = LLSD();
- add("clickButton", &LLFloaterRegListener::clickButton, requiredNameButton);
+ add("clickButton",
+ "Simulate clicking the named [\"button\"] in the visible floater named in [\"name\"]",
+ &LLFloaterRegListener::clickButton,
+ requiredNameButton);
}
void LLFloaterRegListener::getBuildMap(const LLSD& event) const
diff --git a/indra/llui/llfloaterreglistener.h b/indra/llui/llfloaterreglistener.h
index 304ecd1090..a38117f6b0 100644
--- a/indra/llui/llfloaterreglistener.h
+++ b/indra/llui/llfloaterreglistener.h
@@ -12,18 +12,18 @@
#if ! defined(LL_LLFLOATERREGLISTENER_H)
#define LL_LLFLOATERREGLISTENER_H
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
#include <string>
class LLSD;
/// Event API wrapper for LLFloaterReg
-class LLFloaterRegListener: public LLDispatchListener
+class LLFloaterRegListener: public LLEventAPI
{
public:
/// As all public LLFloaterReg methods are static, there's no point in
/// binding an LLFloaterReg instance.
- LLFloaterRegListener(const std::string& pumpName);
+ LLFloaterRegListener();
private:
void getBuildMap(const LLSD& event) const;
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index 00a80478cf..35fbc7b0a8 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -41,6 +41,10 @@ const F32 FOCUS_FADE_TIME = 0.3f;
// NOTE: the LLFocusableElement implementation has been moved here from lluictrl.cpp.
LLFocusableElement::LLFocusableElement()
+: mFocusLostCallback(NULL),
+ mFocusReceivedCallback(NULL),
+ mFocusChangedCallback(NULL),
+ mTopLostCallback(NULL)
{
}
@@ -59,23 +63,27 @@ BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa
// virtual
LLFocusableElement::~LLFocusableElement()
{
+ delete mFocusLostCallback;
+ delete mFocusReceivedCallback;
+ delete mFocusChangedCallback;
+ delete mTopLostCallback;
}
void LLFocusableElement::onFocusReceived()
{
- mFocusReceivedCallback(this);
- mFocusChangedCallback(this);
+ if (mFocusReceivedCallback) (*mFocusReceivedCallback)(this);
+ if (mFocusChangedCallback) (*mFocusChangedCallback)(this);
}
void LLFocusableElement::onFocusLost()
{
- mFocusLostCallback(this);
- mFocusChangedCallback(this);
+ if (mFocusLostCallback) (*mFocusLostCallback)(this);
+ if (mFocusChangedCallback) (*mFocusChangedCallback)(this);
}
void LLFocusableElement::onTopLost()
{
- mTopLostCallback(this);
+ if (mTopLostCallback) (*mTopLostCallback)(this);
}
BOOL LLFocusableElement::hasFocus() const
@@ -87,6 +95,31 @@ void LLFocusableElement::setFocus(BOOL b)
{
}
+boost::signals2::connection LLFocusableElement::setFocusLostCallback( const focus_signal_t::slot_type& cb)
+{
+ if (!mFocusLostCallback) mFocusLostCallback = new focus_signal_t();
+ return mFocusLostCallback->connect(cb);
+}
+
+boost::signals2::connection LLFocusableElement::setFocusReceivedCallback(const focus_signal_t::slot_type& cb)
+{
+ if (!mFocusReceivedCallback) mFocusReceivedCallback = new focus_signal_t();
+ return mFocusReceivedCallback->connect(cb);
+}
+
+boost::signals2::connection LLFocusableElement::setFocusChangedCallback(const focus_signal_t::slot_type& cb)
+{
+ if (!mFocusChangedCallback) mFocusChangedCallback = new focus_signal_t();
+ return mFocusChangedCallback->connect(cb);
+}
+
+boost::signals2::connection LLFocusableElement::setTopLostCallback(const focus_signal_t::slot_type& cb)
+{
+ if (!mTopLostCallback) mTopLostCallback = new focus_signal_t();
+ return mTopLostCallback->connect(cb);
+}
+
+
LLFocusMgr gFocusMgr;
diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h
index 2fa4e124fb..83ecd1d301 100644
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -56,10 +56,10 @@ public:
typedef boost::signals2::signal<void(LLFocusableElement*)> focus_signal_t;
- boost::signals2::connection setFocusLostCallback( const focus_signal_t::slot_type& cb) { return mFocusLostCallback.connect(cb);}
- boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb) { return mFocusReceivedCallback.connect(cb);}
- boost::signals2::connection setFocusChangedCallback(const focus_signal_t::slot_type& cb) { return mFocusChangedCallback.connect(cb);}
- void setTopLostCallback(const focus_signal_t::slot_type& cb) { mTopLostCallback.connect(cb);}
+ boost::signals2::connection setFocusLostCallback( const focus_signal_t::slot_type& cb);
+ boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb);
+ boost::signals2::connection setFocusChangedCallback(const focus_signal_t::slot_type& cb);
+ boost::signals2::connection setTopLostCallback(const focus_signal_t::slot_type& cb);
// These were brought up the hierarchy from LLView so that we don't have to use dynamic_cast when dealing with keyboard focus.
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
@@ -69,10 +69,10 @@ protected:
virtual void onFocusReceived();
virtual void onFocusLost();
virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere
- focus_signal_t mFocusLostCallback;
- focus_signal_t mFocusReceivedCallback;
- focus_signal_t mFocusChangedCallback;
- focus_signal_t mTopLostCallback;
+ focus_signal_t* mFocusLostCallback;
+ focus_signal_t* mFocusReceivedCallback;
+ focus_signal_t* mFocusChangedCallback;
+ focus_signal_t* mTopLostCallback;
};
diff --git a/indra/llui/llhelp.h b/indra/llui/llhelp.h
index c06d29a4bd..82c3bc385f 100644
--- a/indra/llui/llhelp.h
+++ b/indra/llui/llhelp.h
@@ -40,6 +40,8 @@ class LLHelp
virtual void showTopic(const std::string &topic) = 0;
// return default (fallback) topic name suitable for showTopic()
virtual std::string defaultTopic() = 0;
+ // return topic to use before the user logs in
+ virtual std::string preLoginTopic() = 0;
};
#endif // headerguard
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 5999e1a29e..1fb618adee 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -413,6 +413,19 @@ void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL au
}
}
+bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp)
+{
+ LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+
+ if (panel)
+ {
+ if (min_widthp) *min_widthp = panel->mMinWidth;
+ if (min_heightp) *min_heightp = panel->mMinHeight;
+ }
+
+ return NULL != panel;
+}
+
static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks");
void LLLayoutStack::updateLayout(BOOL force_resize)
{
@@ -792,8 +805,8 @@ void LLLayoutStack::calcMinExtents()
//static
void LLLayoutStack::updateClass()
{
- for (LLInstanceTracker::instance_iter it = beginInstances(); it != endInstances(); ++it)
+ for (LLLayoutStack::instance_iter it = beginInstances(); it != endInstances(); ++it)
{
- (*it)->updateLayout();
+ it->updateLayout();
}
}
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 8475079f5e..abd5436018 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -38,7 +38,7 @@
class LLPanel;
-class LLLayoutStack : public LLView, LLInstanceTracker<LLLayoutStack>
+class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
{
public:
struct Params : public LLInitParam::Block<Params, LLView::Params>
@@ -81,8 +81,16 @@ public:
S32 getNumPanels() { return mPanels.size(); }
void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize);
-
-
+
+ /**
+ * Gets minimal width and/or height of the specified by name panel.
+ *
+ * If it is necessary to get only the one dimension pass NULL for another one.
+ * @returns true if specified by panel_name internal panel exists, false otherwise.
+ */
+ bool getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp);
+
+ void updateLayout(BOOL force_resize = FALSE);
static void updateClass();
protected:
@@ -92,7 +100,6 @@ protected:
private:
struct LayoutPanel;
- void updateLayout(BOOL force_resize = FALSE);
void calcMinExtents();
S32 getDefaultHeight(S32 cur_height);
S32 getDefaultWidth(S32 cur_width);
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 75905d0927..bd5734312a 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -84,8 +84,8 @@ void LLLineEditor::PrevalidateNamedFuncs::declareValues()
declare("non_negative_s32", LLLineEditor::prevalidateNonNegativeS32);
declare("alpha_num", LLLineEditor::prevalidateAlphaNum);
declare("alpha_num_space", LLLineEditor::prevalidateAlphaNumSpace);
- declare("printable_not_pipe", LLLineEditor::prevalidatePrintableNotPipe);
- declare("printable_no_space", LLLineEditor::prevalidatePrintableNoSpace);
+ declare("ascii_printable_no_pipe", LLLineEditor::prevalidateASCIIPrintableNoPipe);
+ declare("ascii_printable_no_space", LLLineEditor::prevalidateASCIIPrintableNoSpace);
}
LLLineEditor::Params::Params()
@@ -323,6 +323,19 @@ void LLLineEditor::setMaxTextLength(S32 max_text_length)
mMaxLengthBytes = max_len;
}
+void LLLineEditor::getTextPadding(S32 *left, S32 *right)
+{
+ *left = mTextPadLeft;
+ *right = mTextPadRight;
+}
+
+void LLLineEditor::setTextPadding(S32 left, S32 right)
+{
+ mTextPadLeft = left;
+ mTextPadRight = right;
+ updateTextPadding();
+}
+
void LLLineEditor::updateTextPadding()
{
static LLUICachedControl<S32> line_editor_hpad ("UILineEditorHPad", 0);
@@ -626,7 +639,8 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
// delay cursor flashing
mKeystrokeTimer.reset();
- mMouseDownSignal(this,x,y,mask);
+ if (mMouseDownSignal)
+ (*mMouseDownSignal)(this,x,y,mask);
return TRUE;
}
@@ -742,7 +756,8 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask)
}
// We won't call LLUICtrl::handleMouseUp to avoid double calls of childrenHandleMouseUp().Just invoke the signal manually.
- mMouseUpSignal(this,x,y, mask);
+ if (mMouseUpSignal)
+ (*mMouseUpSignal)(this,x,y, mask);
return handled;
}
@@ -2186,20 +2201,28 @@ BOOL LLLineEditor::prevalidateAlphaNumSpace(const LLWString &str)
return rv;
}
+// Used for most names of things stored on the server, due to old file-formats
+// that used the pipe (|) for multiline text storage. Examples include
+// inventory item names, parcel names, object names, etc.
// static
-BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
+BOOL LLLineEditor::prevalidateASCIIPrintableNoPipe(const LLWString &str)
{
BOOL rv = TRUE;
S32 len = str.length();
if(len == 0) return rv;
while(len--)
{
- if('|' == str[len])
+ llwchar wc = str[len];
+ if (wc < 0x20
+ || wc > 0x7f
+ || wc == '|')
{
rv = FALSE;
break;
}
- if(!((' ' == str[len]) || LLStringOps::isAlnum((char)str[len]) || LLStringOps::isPunct((char)str[len])))
+ if(!(wc == ' '
+ || LLStringOps::isAlnum((char)wc)
+ || LLStringOps::isPunct((char)wc) ) )
{
rv = FALSE;
break;
@@ -2209,15 +2232,19 @@ BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
}
+// Used for avatar names
// static
-BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
+BOOL LLLineEditor::prevalidateASCIIPrintableNoSpace(const LLWString &str)
{
BOOL rv = TRUE;
S32 len = str.length();
if(len == 0) return rv;
while(len--)
{
- if(LLStringOps::isSpace(str[len]))
+ llwchar wc = str[len];
+ if (wc < 0x20
+ || wc > 0x7f
+ || LLStringOps::isSpace(wc))
{
rv = FALSE;
break;
@@ -2232,6 +2259,7 @@ BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
return rv;
}
+
// static
BOOL LLLineEditor::prevalidateASCII(const LLWString &str)
{
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index d3daa941cf..4c4b00094d 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -226,6 +226,9 @@ public:
void setKeystrokeCallback(callback_t callback, void* user_data);
void setMaxTextLength(S32 max_text_length);
+ // Manipulate left and right padding for text
+ void getTextPadding(S32 *left, S32 *right);
+ void setTextPadding(S32 left, S32 right);
// Prevalidation controls which keystrokes can affect the editor
void setPrevalidate( LLLinePrevalidateFunc func );
@@ -235,8 +238,8 @@ public:
static BOOL prevalidateNonNegativeS32(const LLWString &str);
static BOOL prevalidateAlphaNum(const LLWString &str );
static BOOL prevalidateAlphaNumSpace(const LLWString &str );
- static BOOL prevalidatePrintableNotPipe(const LLWString &str);
- static BOOL prevalidatePrintableNoSpace(const LLWString &str);
+ static BOOL prevalidateASCIIPrintableNoPipe(const LLWString &str);
+ static BOOL prevalidateASCIIPrintableNoSpace(const LLWString &str);
static BOOL prevalidateASCII(const LLWString &str);
static BOOL postvalidateFloat(const std::string &str);
diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp
index a657ed039a..cdbd17e4dc 100644
--- a/indra/llui/llmenubutton.cpp
+++ b/indra/llui/llmenubutton.cpp
@@ -133,11 +133,11 @@ void LLMenuButton::draw()
if (mMenuVisibleLastFrame)
{
- setForcePressedState(TRUE);
+ setForcePressedState(true);
}
LLButton::draw();
- setForcePressedState(FALSE);
+ setForcePressedState(false);
}
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index de9a854f63..f8935d03ac 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -760,21 +760,25 @@ void LLMenuItemCallGL::initFromParams(const Params& p)
{
if (p.on_visible.isProvided())
{
- initVisibleCallback(p.on_visible, mVisibleSignal);
+ mVisibleSignal.connect(initVisibleCallback(p.on_visible));
}
if (p.on_enable.isProvided())
{
- initEnableCallback(p.on_enable, mEnableSignal);
+ setEnableCallback(initEnableCallback(p.on_enable));
// Set the enabled control variable (for backwards compatability)
if (p.on_enable.control_name.isProvided() && !p.on_enable.control_name().empty())
{
LLControlVariable* control = findControl(p.on_enable.control_name());
if (control)
+ {
setEnabledControlVariable(control);
+ }
}
}
if (p.on_click.isProvided())
- initCommitCallback(p.on_click, mCommitSignal);
+ {
+ setCommitCallback(initCommitCallback(p.on_click));
+ }
LLUICtrl::initFromParams(p);
}
@@ -795,7 +799,10 @@ void LLMenuItemCallGL::updateEnabled( void )
if (mEnabledControlVariable)
{
if (!enabled)
- mEnabledControlVariable->set(false); // callback overrides control variable; this will call setEnabled()
+ {
+ // callback overrides control variable; this will call setEnabled()
+ mEnabledControlVariable->set(false);
+ }
}
else
{
@@ -854,7 +861,7 @@ void LLMenuItemCheckGL::initFromParams(const Params& p)
{
if (p.on_check.isProvided())
{
- initEnableCallback(p.on_check, mCheckSignal);
+ setCheckCallback(initEnableCallback(p.on_check));
// Set the control name (for backwards compatability)
if (p.on_check.control_name.isProvided() && !p.on_check.control_name().empty())
{
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
index 68e496aed1..1891bca36c 100644
--- a/indra/llui/llmultislider.cpp
+++ b/indra/llui/llmultislider.cpp
@@ -84,17 +84,30 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p)
mThumbCenterSelectedColor(p.thumb_center_selected_color()),
mDisabledThumbColor(p.thumb_disabled_color()),
mTriangleColor(p.triangle_color()),
- mThumbWidth(p.thumb_width)
+ mThumbWidth(p.thumb_width),
+ mMouseDownSignal(NULL),
+ mMouseUpSignal(NULL)
{
mValue.emptyMap();
mCurSlider = LLStringUtil::null;
if (p.mouse_down_callback.isProvided())
- initCommitCallback(p.mouse_down_callback, mMouseDownSignal);
+ {
+ setMouseDownCallback(initCommitCallback(p.mouse_down_callback));
+ }
if (p.mouse_up_callback.isProvided())
- initCommitCallback(p.mouse_up_callback, mMouseUpSignal);
+ {
+ setMouseUpCallback(initCommitCallback(p.mouse_up_callback));
+ }
+}
+
+LLMultiSlider::~LLMultiSlider()
+{
+ delete mMouseDownSignal;
+ delete mMouseUpSignal;
}
+
void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event)
{
// exit if not there
@@ -325,7 +338,8 @@ BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask)
{
gFocusMgr.setMouseCapture( NULL );
- mMouseUpSignal( this, LLSD() );
+ if (mMouseUpSignal)
+ (*mMouseUpSignal)( this, LLSD() );
handled = TRUE;
make_ui_sound("UISndClickRelease");
@@ -345,7 +359,8 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask)
{
setFocus(TRUE);
}
- mMouseDownSignal( this, LLSD() );
+ if (mMouseDownSignal)
+ (*mMouseDownSignal)( this, LLSD() );
if (MASK_CONTROL & mask) // if CTRL is modifying
{
@@ -557,3 +572,15 @@ void LLMultiSlider::draw()
LLF32UICtrl::draw();
}
+
+boost::signals2::connection LLMultiSlider::setMouseDownCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t();
+ return mMouseDownSignal->connect(cb);
+}
+
+boost::signals2::connection LLMultiSlider::setMouseUpCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t();
+ return mMouseUpSignal->connect(cb);
+}
diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h
index da633cc1cd..f8e43a0470 100644
--- a/indra/llui/llmultislider.h
+++ b/indra/llui/llmultislider.h
@@ -67,6 +67,7 @@ protected:
LLMultiSlider(const Params&);
friend class LLUICtrlFactory;
public:
+ virtual ~LLMultiSlider();
void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE);
F32 getSliderValue(const std::string& name) const;
@@ -78,8 +79,8 @@ public:
/*virtual*/ void setValue(const LLSD& value);
/*virtual*/ LLSD getValue() const { return mValue; }
- boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); }
- boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(cb); }
+ boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb );
+ boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb );
bool findUnusedValue(F32& initVal);
const std::string& addSlider();
@@ -116,8 +117,8 @@ protected:
LLUIColor mDisabledThumbColor;
LLUIColor mTriangleColor;
- commit_signal_t mMouseDownSignal;
- commit_signal_t mMouseUpSignal;
+ commit_signal_t* mMouseDownSignal;
+ commit_signal_t* mMouseUpSignal;
};
#endif // LL_MULTI_SLIDER_H
diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp
index a9f462173d..87938c19d4 100644
--- a/indra/llui/llmultisliderctrl.cpp
+++ b/indra/llui/llmultisliderctrl.cpp
@@ -344,7 +344,7 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata)
if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() )
{
self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it.
- if( self->mValidateSignal( self, val ) )
+ if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) )
{
success = TRUE;
}
@@ -378,7 +378,7 @@ void LLMultiSliderCtrl::onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata)
F32 new_val = self->mMultiSlider->getCurSliderValue();
self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it.
- if( self->mValidateSignal( self, new_val ) )
+ if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) )
{
success = TRUE;
}
diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp
index 75f4d6177d..fe4fbe7510 100644
--- a/indra/llui/llnotificationslistener.cpp
+++ b/indra/llui/llnotificationslistener.cpp
@@ -16,10 +16,14 @@
#include "llnotifications.h"
LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) :
- LLDispatchListener("LLNotifications", "op"),
+ LLEventAPI("LLNotifications",
+ "LLNotifications listener to (e.g.) pop up a notification"),
mNotifications(notifications)
{
- add("requestAdd", &LLNotificationsListener::requestAdd);
+ add("requestAdd",
+ "Add a notification with specified [\"name\"], [\"substitutions\"] and [\"payload\"].\n"
+ "If optional [\"reply\"] specified, arrange to send user response on that LLEventPump.",
+ &LLNotificationsListener::requestAdd);
}
void LLNotificationsListener::requestAdd(const LLSD& event_data) const
diff --git a/indra/llui/llnotificationslistener.h b/indra/llui/llnotificationslistener.h
index 6f71a7c781..9b405d7b4b 100644
--- a/indra/llui/llnotificationslistener.h
+++ b/indra/llui/llnotificationslistener.h
@@ -12,12 +12,12 @@
#ifndef LL_LLNOTIFICATIONSLISTENER_H
#define LL_LLNOTIFICATIONSLISTENER_H
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
class LLNotifications;
class LLSD;
-class LLNotificationsListener : public LLDispatchListener
+class LLNotificationsListener : public LLEventAPI
{
public:
LLNotificationsListener(LLNotifications & notifications);
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 89c4656297..063822dd56 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -106,7 +106,8 @@ LLPanel::LLPanel(const LLPanel::Params& p)
mHelpTopic(p.help_topic),
mCommitCallbackRegistrar(false),
mEnableCallbackRegistrar(false),
- mXMLFilename(p.filename)
+ mXMLFilename(p.filename),
+ mVisibleSignal(NULL)
// *NOTE: Be sure to also change LLPanel::initFromParams(). We have too
// many classes derived from LLPanel to retrofit them all to pass in params.
{
@@ -118,6 +119,11 @@ LLPanel::LLPanel(const LLPanel::Params& p)
mPanelHandle.bind(this);
}
+LLPanel::~LLPanel()
+{
+ delete mVisibleSignal;
+}
+
// virtual
BOOL LLPanel::isPanel() const
{
@@ -332,7 +338,8 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
void LLPanel::handleVisibilityChange ( BOOL new_visibility )
{
LLUICtrl::handleVisibilityChange ( new_visibility );
- mVisibleSignal(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
+ if (mVisibleSignal)
+ (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
}
void LLPanel::setFocus(BOOL b)
@@ -424,7 +431,9 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
// visible callback
if (p.visible_callback.isProvided())
- initCommitCallback(p.visible_callback, mVisibleSignal);
+ {
+ setVisibleCallback(initCommitCallback(p.visible_callback));
+ }
for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings().begin();
it != p.strings().end();
@@ -907,3 +916,13 @@ void LLPanel::childSetControlName(const std::string& id, const std::string& cont
view->setControlName(control_name, NULL);
}
}
+
+boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mVisibleSignal)
+ {
+ mVisibleSignal = new commit_signal_t();
+ }
+
+ return mVisibleSignal->connect(cb);
+}
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index c213809d68..0a0fed82fb 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -109,7 +109,7 @@ protected:
public:
// LLPanel(const std::string& name, const LLRect& rect = LLRect(), BOOL bordered = TRUE);
- /*virtual*/ ~LLPanel() {}
+ /*virtual*/ ~LLPanel();
// LLView interface
/*virtual*/ BOOL isPanel() const;
@@ -241,6 +241,8 @@ public:
void setXMLFilename(std::string filename) { mXMLFilename = filename; };
std::string getXMLFilename() { return mXMLFilename; };
+ boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb );
+
protected:
// Override to set not found list
LLButton* getDefaultButton() { return mDefaultBtn; }
@@ -249,7 +251,7 @@ protected:
EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar;
VisibleCallbackRegistry::ScopedRegistrar mVisibleCallbackRegistrar;
- commit_signal_t mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD()
+ commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD()
std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer
diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp
index 304ac64f31..a7cf9be277 100644
--- a/indra/llui/llresizebar.cpp
+++ b/indra/llui/llresizebar.cpp
@@ -143,6 +143,12 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
if( valid_rect.localPointInRect( screen_x, screen_y ) && mResizingView )
{
+ // undock floater when user resize it
+ if (((LLFloater*)getParent())->isDocked())
+ {
+ ((LLFloater*)getParent())->setDocked(false, false);
+ }
+
// Resize the parent
LLRect orig_rect = mResizingView->getRect();
LLRect scaled_rect = orig_rect;
diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp
index 7449c339a0..6239a8f721 100644
--- a/indra/llui/llresizehandle.cpp
+++ b/indra/llui/llresizehandle.cpp
@@ -135,6 +135,12 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
LLView* resizing_view = getParent();
if( resizing_view )
{
+ // undock floater when user resize it
+ if (((LLFloater*)getParent())->isDocked())
+ {
+ ((LLFloater*)getParent())->setDocked(false, false);
+ }
+
// Resize the parent
LLRect orig_rect = resizing_view->getRect();
LLRect scaled_rect = orig_rect;
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index a7c268758a..544352176a 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -71,7 +71,8 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_
LLScrollListCell::LLScrollListCell(const LLScrollListCell::Params& p)
-: mWidth(p.width)
+: mWidth(p.width),
+ mToolTip(p.tool_tip)
{}
// virtual
@@ -204,13 +205,28 @@ BOOL LLScrollListText::isText() const
return TRUE;
}
+// virtual
+const std::string &LLScrollListText::getToolTip() const
+{
+ // If base class has a tooltip, return that
+ if (! LLScrollListCell::getToolTip().empty())
+ return LLScrollListCell::getToolTip();
+
+ // ...otherwise, return the value itself as the tooltip
+ return mText.getString();
+}
+
+// virtual
BOOL LLScrollListText::needsToolTip() const
{
- // show tooltips for truncated text
+ // If base class has a tooltip, return that
+ if (LLScrollListCell::needsToolTip())
+ return LLScrollListCell::needsToolTip();
+
+ // ...otherwise, show tooltips for truncated text
return mFont->getWidth(mText.getString()) > getWidth();
}
-
//virtual
BOOL LLScrollListText::getVisible() const
{
diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h
index 758623f121..5fecf5aade 100644
--- a/indra/llui/llscrolllistcell.h
+++ b/indra/llui/llscrolllistcell.h
@@ -66,6 +66,7 @@ public:
Optional<void*> userdata;
Optional<LLSD> value;
+ Optional<std::string> tool_tip;
Optional<const LLFontGL*> font;
Optional<LLColor4> font_color;
@@ -80,6 +81,7 @@ public:
enabled("enabled", true),
visible("visible", true),
value("value"),
+ tool_tip("tool_tip", ""),
font("font", LLFontGL::getFontSansSerifSmall()),
font_color("font_color", LLColor4::black),
color("color", LLColor4::white),
@@ -101,11 +103,13 @@ public:
virtual S32 getHeight() const { return 0; }
virtual const LLSD getValue() const;
virtual void setValue(const LLSD& value) { }
+ virtual const std::string &getToolTip() const { return mToolTip; }
+ virtual void setToolTip(const std::string &str) { mToolTip = str; }
virtual BOOL getVisible() const { return TRUE; }
virtual void setWidth(S32 width) { mWidth = width; }
virtual void highlightText(S32 offset, S32 num_chars) {}
virtual BOOL isText() const { return FALSE; }
- virtual BOOL needsToolTip() const { return FALSE; }
+ virtual BOOL needsToolTip() const { return ! mToolTip.empty(); }
virtual void setColor(const LLColor4&) {}
virtual void onCommit() {};
@@ -114,6 +118,7 @@ public:
private:
S32 mWidth;
+ std::string mToolTip;
};
class LLScrollListSpacer : public LLScrollListCell
@@ -143,6 +148,7 @@ public:
/*virtual*/ void setColor(const LLColor4&);
/*virtual*/ BOOL isText() const;
+ /*virtual*/ const std::string & getToolTip() const;
/*virtual*/ BOOL needsToolTip() const;
void setText(const LLStringExplicit& text);
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 1c2c02e1cc..a53a30b501 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -1565,7 +1565,7 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
// display tooltip exactly over original cell, in same font
LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(hit_cell->getValue().asString())
+ .message(hit_cell->getToolTip())
.font(LLFontGL::getFontSansSerifSmall())
.pos(LLCoordGL(sticky_rect.mLeft - 5, sticky_rect.mTop + 6))
.delay_time(0.2f)
diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp
index f86776384a..a6f729b396 100644
--- a/indra/llui/llslider.cpp
+++ b/indra/llui/llslider.cpp
@@ -47,14 +47,17 @@ static LLDefaultChildRegistry::Register<LLSlider> r1("slider_bar");
// have ambigious template lookup problem
LLSlider::Params::Params()
-: track_color("track_color"),
+: orientation ("orientation", std::string ("horizontal")),
+ track_color("track_color"),
thumb_outline_color("thumb_outline_color"),
thumb_center_color("thumb_center_color"),
thumb_image("thumb_image"),
thumb_image_pressed("thumb_image_pressed"),
thumb_image_disabled("thumb_image_disabled"),
- track_image("track_image"),
- track_highlight_image("track_highlight_image"),
+ track_image_horizontal("track_image_horizontal"),
+ track_image_vertical("track_image_vertical"),
+ track_highlight_horizontal_image("track_highlight_horizontal_image"),
+ track_highlight_vertical_image("track_highlight_vertical_image"),
mouse_down_callback("mouse_down_callback"),
mouse_up_callback("mouse_up_callback")
{
@@ -64,14 +67,19 @@ LLSlider::Params::Params()
LLSlider::LLSlider(const LLSlider::Params& p)
: LLF32UICtrl(p),
mMouseOffset( 0 ),
+ mOrientation ((p.orientation() == "horizontal") ? HORIZONTAL : VERTICAL),
mTrackColor(p.track_color()),
mThumbOutlineColor(p.thumb_outline_color()),
mThumbCenterColor(p.thumb_center_color()),
mThumbImage(p.thumb_image),
mThumbImagePressed(p.thumb_image_pressed),
mThumbImageDisabled(p.thumb_image_disabled),
- mTrackImage(p.track_image),
- mTrackHighlightImage(p.track_highlight_image)
+ mTrackImageHorizontal(p.track_image_horizontal),
+ mTrackImageVertical(p.track_image_vertical),
+ mTrackHighlightHorizontalImage(p.track_highlight_horizontal_image),
+ mTrackHighlightVerticalImage(p.track_highlight_vertical_image),
+ mMouseDownSignal(NULL),
+ mMouseUpSignal(NULL)
{
mViewModel->setValue(p.initial_value);
updateThumbRect();
@@ -80,9 +88,19 @@ LLSlider::LLSlider(const LLSlider::Params& p)
setValue(getValueF32());
if (p.mouse_down_callback.isProvided())
- initCommitCallback(p.mouse_down_callback, mMouseDownSignal);
+ {
+ setMouseDownCallback(initCommitCallback(p.mouse_down_callback));
+ }
if (p.mouse_up_callback.isProvided())
- initCommitCallback(p.mouse_up_callback, mMouseUpSignal);
+ {
+ setMouseUpCallback(initCommitCallback(p.mouse_up_callback));
+ }
+}
+
+LLSlider::~LLSlider()
+{
+ delete mMouseDownSignal;
+ delete mMouseUpSignal;
}
void LLSlider::setValue(F32 value, BOOL from_event)
@@ -111,14 +129,29 @@ void LLSlider::updateThumbRect()
S32 thumb_width = mThumbImage ? mThumbImage->getWidth() : DEFAULT_THUMB_SIZE;
S32 thumb_height = mThumbImage ? mThumbImage->getHeight() : DEFAULT_THUMB_SIZE;
- S32 left_edge = (thumb_width / 2);
- S32 right_edge = getRect().getWidth() - (thumb_width / 2);
-
- S32 x = left_edge + S32( t * (right_edge - left_edge) );
- mThumbRect.mLeft = x - (thumb_width / 2);
- mThumbRect.mRight = mThumbRect.mLeft + thumb_width;
- mThumbRect.mBottom = getLocalRect().getCenterY() - (thumb_height / 2);
- mThumbRect.mTop = mThumbRect.mBottom + thumb_height;
+
+ if ( mOrientation == HORIZONTAL )
+ {
+ S32 left_edge = (thumb_width / 2);
+ S32 right_edge = getRect().getWidth() - (thumb_width / 2);
+
+ S32 x = left_edge + S32( t * (right_edge - left_edge) );
+ mThumbRect.mLeft = x - (thumb_width / 2);
+ mThumbRect.mRight = mThumbRect.mLeft + thumb_width;
+ mThumbRect.mBottom = getLocalRect().getCenterY() - (thumb_height / 2);
+ mThumbRect.mTop = mThumbRect.mBottom + thumb_height;
+ }
+ else
+ {
+ S32 top_edge = (thumb_height / 2);
+ S32 bottom_edge = getRect().getHeight() - (thumb_height / 2);
+
+ S32 y = top_edge + S32( t * (bottom_edge - top_edge) );
+ mThumbRect.mLeft = getLocalRect().getCenterX() - (thumb_width / 2);
+ mThumbRect.mRight = mThumbRect.mLeft + thumb_width;
+ mThumbRect.mBottom = y - (thumb_height / 2);
+ mThumbRect.mTop = mThumbRect.mBottom + thumb_height;
+ }
}
@@ -138,18 +171,32 @@ BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask)
{
if( hasMouseCapture() )
{
- S32 thumb_half_width = mThumbImage->getWidth()/2;
- S32 left_edge = thumb_half_width;
- S32 right_edge = getRect().getWidth() - (thumb_half_width);
+ if ( mOrientation == HORIZONTAL )
+ {
+ S32 thumb_half_width = mThumbImage->getWidth()/2;
+ S32 left_edge = thumb_half_width;
+ S32 right_edge = getRect().getWidth() - (thumb_half_width);
+
+ x += mMouseOffset;
+ x = llclamp( x, left_edge, right_edge );
- x += mMouseOffset;
- x = llclamp( x, left_edge, right_edge );
+ F32 t = F32(x - left_edge) / (right_edge - left_edge);
+ setValueAndCommit(t * (mMaxValue - mMinValue) + mMinValue );
+ }
+ else // mOrientation == VERTICAL
+ {
+ S32 thumb_half_height = mThumbImage->getHeight()/2;
+ S32 top_edge = thumb_half_height;
+ S32 bottom_edge = getRect().getHeight() - (thumb_half_height);
- F32 t = F32(x - left_edge) / (right_edge - left_edge);
- setValueAndCommit(t * (mMaxValue - mMinValue) + mMinValue );
+ y += mMouseOffset;
+ y = llclamp(y, top_edge, bottom_edge);
+ F32 t = F32(y - top_edge) / (bottom_edge - top_edge);
+ setValueAndCommit(t * (mMaxValue - mMinValue) + mMinValue );
+ }
getWindow()->setCursor(UI_CURSOR_ARROW);
- lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;
+ lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;
}
else
{
@@ -167,7 +214,8 @@ BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask)
{
gFocusMgr.setMouseCapture( NULL );
- mMouseUpSignal( this, getValueF32() );
+ if (mMouseUpSignal)
+ (*mMouseUpSignal)( this, getValueF32() );
handled = TRUE;
make_ui_sound("UISndClickRelease");
@@ -187,7 +235,8 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask)
{
setFocus(TRUE);
}
- mMouseDownSignal( this, getValueF32() );
+ if (mMouseDownSignal)
+ (*mMouseDownSignal)( this, getValueF32() );
if (MASK_CONTROL & mask) // if CTRL is modifying
{
@@ -198,7 +247,9 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask)
// Find the offset of the actual mouse location from the center of the thumb.
if (mThumbRect.pointInRect(x,y))
{
- mMouseOffset = (mThumbRect.mLeft + mThumbImage->getWidth()/2) - x;
+ mMouseOffset = (mOrientation == HORIZONTAL)
+ ? (mThumbRect.mLeft + mThumbImage->getWidth()/2) - x
+ : (mThumbRect.mBottom + mThumbImage->getHeight()/2) - y;
}
else
{
@@ -220,15 +271,12 @@ BOOL LLSlider::handleKeyHere(KEY key, MASK mask)
BOOL handled = FALSE;
switch(key)
{
- case KEY_UP:
case KEY_DOWN:
- // eat up and down keys to be consistent
- handled = TRUE;
- break;
case KEY_LEFT:
setValueAndCommit(getValueF32() - getIncrement());
handled = TRUE;
break;
+ case KEY_UP:
case KEY_RIGHT:
setValueAndCommit(getValueF32() + getIncrement());
handled = TRUE;
@@ -239,6 +287,17 @@ BOOL LLSlider::handleKeyHere(KEY key, MASK mask)
return handled;
}
+BOOL LLSlider::handleScrollWheel(S32 x, S32 y, S32 clicks)
+{
+ if ( mOrientation == VERTICAL )
+ {
+ F32 new_val = getValueF32() - clicks * getIncrement();
+ setValueAndCommit(new_val);
+ return TRUE;
+ }
+ return LLF32UICtrl::handleScrollWheel(x,y,clicks);
+}
+
void LLSlider::draw()
{
F32 alpha = getDrawContext().mAlpha;
@@ -252,13 +311,36 @@ void LLSlider::draw()
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
// Track
- LLRect track_rect(mThumbImage->getWidth() / 2,
- getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2),
- getRect().getWidth() - mThumbImage->getWidth() / 2,
- getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) );
- LLRect highlight_rect(track_rect.mLeft, track_rect.mTop, mThumbRect.getCenterX(), track_rect.mBottom);
- mTrackImage->draw(track_rect, LLColor4::white % alpha);
- mTrackHighlightImage->draw(highlight_rect, LLColor4::white % alpha);
+ LLPointer<LLUIImage>& trackImage = ( mOrientation == HORIZONTAL )
+ ? mTrackImageHorizontal
+ : mTrackImageVertical;
+
+ LLPointer<LLUIImage>& trackHighlightImage = ( mOrientation == HORIZONTAL )
+ ? mTrackHighlightHorizontalImage
+ : mTrackHighlightVerticalImage;
+
+ LLRect track_rect;
+ LLRect highlight_rect;
+
+ if ( mOrientation == HORIZONTAL )
+ {
+ track_rect.set(mThumbImage->getWidth() / 2,
+ getLocalRect().getCenterY() + (trackImage->getHeight() / 2),
+ getRect().getWidth() - mThumbImage->getWidth() / 2,
+ getLocalRect().getCenterY() - (trackImage->getHeight() / 2) );
+ highlight_rect.set(track_rect.mLeft, track_rect.mTop, mThumbRect.getCenterX(), track_rect.mBottom);
+ }
+ else
+ {
+ track_rect.set(getLocalRect().getCenterX() - (trackImage->getWidth() / 2),
+ getRect().getHeight(),
+ getLocalRect().getCenterX() + (trackImage->getWidth() / 2),
+ 0);
+ highlight_rect.set(track_rect.mLeft, track_rect.mTop, track_rect.mRight, track_rect.mBottom);
+ }
+
+ trackImage->draw(track_rect, LLColor4::white % alpha);
+ trackHighlightImage->draw(highlight_rect, LLColor4::white % alpha);
// Thumb
if (hasFocus())
@@ -296,3 +378,15 @@ void LLSlider::draw()
LLUICtrl::draw();
}
+
+boost::signals2::connection LLSlider::setMouseDownCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t();
+ return mMouseDownSignal->connect(cb);
+}
+
+boost::signals2::connection LLSlider::setMouseUpCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t();
+ return mMouseUpSignal->connect(cb);
+}
diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h
index e2a94e4d8c..45f8f81e40 100644
--- a/indra/llui/llslider.h
+++ b/indra/llui/llslider.h
@@ -39,8 +39,12 @@
class LLSlider : public LLF32UICtrl
{
public:
+ enum ORIENTATION { HORIZONTAL, VERTICAL };
+
struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params>
{
+ Optional<std::string> orientation;
+
Optional<LLUIColor> track_color,
thumb_outline_color,
thumb_center_color;
@@ -48,8 +52,10 @@ public:
Optional<LLUIImage*> thumb_image,
thumb_image_pressed,
thumb_image_disabled,
- track_image,
- track_highlight_image;
+ track_image_horizontal,
+ track_image_vertical,
+ track_highlight_horizontal_image,
+ track_highlight_vertical_image;
Optional<CommitCallbackParam> mouse_down_callback,
mouse_up_callback;
@@ -61,6 +67,7 @@ protected:
LLSlider(const Params&);
friend class LLUICtrlFactory;
public:
+ virtual ~LLSlider();
void setValue( F32 value, BOOL from_event = FALSE );
// overrides for LLF32UICtrl methods
virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); }
@@ -70,13 +77,14 @@ public:
virtual void setMinValue(F32 min_value) { LLF32UICtrl::setMinValue(min_value); updateThumbRect(); }
virtual void setMaxValue(F32 max_value) { LLF32UICtrl::setMaxValue(max_value); updateThumbRect(); }
- boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); }
- boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(cb); }
+ boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb );
+ boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb );
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleKeyHere(KEY key, MASK mask);
+ virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
virtual void draw();
private:
@@ -90,16 +98,20 @@ private:
LLPointer<LLUIImage> mThumbImage;
LLPointer<LLUIImage> mThumbImagePressed;
LLPointer<LLUIImage> mThumbImageDisabled;
- LLPointer<LLUIImage> mTrackImage;
- LLPointer<LLUIImage> mTrackHighlightImage;
+ LLPointer<LLUIImage> mTrackImageHorizontal;
+ LLPointer<LLUIImage> mTrackImageVertical;
+ LLPointer<LLUIImage> mTrackHighlightHorizontalImage;
+ LLPointer<LLUIImage> mTrackHighlightVerticalImage;
+
+ const ORIENTATION mOrientation;
- LLRect mThumbRect;
+ LLRect mThumbRect;
LLUIColor mTrackColor;
LLUIColor mThumbOutlineColor;
LLUIColor mThumbCenterColor;
- commit_signal_t mMouseDownSignal;
- commit_signal_t mMouseUpSignal;
+ commit_signal_t* mMouseDownSignal;
+ commit_signal_t* mMouseUpSignal;
};
#endif // LL_LLSLIDER_H
diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp
index ed22c0a47f..01c274bb4e 100644
--- a/indra/llui/llsliderctrl.cpp
+++ b/indra/llui/llsliderctrl.cpp
@@ -122,7 +122,8 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p)
slider_p.min_value.setIfNotProvided(p.min_value);
slider_p.max_value.setIfNotProvided(p.max_value);
slider_p.increment.setIfNotProvided(p.increment);
-
+ slider_p.orientation.setIfNotProvided(p.orientation);
+
slider_p.commit_callback.function(&LLSliderCtrl::onSliderCommit);
slider_p.control_name(p.control_name);
slider_p.mouse_down_callback( p.mouse_down_callback );
@@ -260,7 +261,7 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata )
if( self->mSlider->getMinValue() <= val && val <= self->mSlider->getMaxValue() )
{
self->setValue( val ); // set the value temporarily so that the callback can retrieve it.
- if( self->mValidateSignal( self, val ) )
+ if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) )
{
success = TRUE;
}
@@ -294,7 +295,7 @@ void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata )
F32 new_val = self->mSlider->getValueF32();
self->mValue = new_val; // set the value temporarily so that the callback can retrieve it.
- if( self->mValidateSignal( self, new_val ) )
+ if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) )
{
success = TRUE;
}
diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h
index 4a1574d502..c425849782 100644
--- a/indra/llui/llsliderctrl.h
+++ b/indra/llui/llsliderctrl.h
@@ -46,6 +46,7 @@ class LLSliderCtrl : public LLF32UICtrl
public:
struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params>
{
+ Optional<std::string> orientation;
Optional<S32> label_width;
Optional<S32> text_width;
Optional<bool> show_text;
@@ -78,7 +79,8 @@ public:
value_text("value_text"),
slider_label("slider_label"),
mouse_down_callback("mouse_down_callback"),
- mouse_up_callback("mouse_up_callback")
+ mouse_up_callback("mouse_up_callback"),
+ orientation("orientation", std::string ("horizontal"))
{}
};
protected:
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index bedf16a397..d6d46654d5 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -190,7 +190,7 @@ void LLSpinCtrl::onUpBtn( const LLSD& data )
F32 saved_val = (F32)getValue().asReal();
setValue(val);
- if( !mValidateSignal( this, val ) )
+ if( mValidateSignal && !(*mValidateSignal)( this, val ) )
{
setValue( saved_val );
reportInvalidData();
@@ -224,7 +224,7 @@ void LLSpinCtrl::onDownBtn( const LLSD& data )
F32 saved_val = (F32)getValue().asReal();
setValue(val);
- if( !mValidateSignal( this, val ) )
+ if( mValidateSignal && !(*mValidateSignal)( this, val ) )
{
setValue( saved_val );
reportInvalidData();
@@ -316,7 +316,7 @@ void LLSpinCtrl::onEditorCommit( const LLSD& data )
F32 saved_val = getValueF32();
setValue(val);
- if( mValidateSignal( this, val ) )
+ if( !mValidateSignal || (*mValidateSignal)( this, val ) )
{
success = TRUE;
onCommit();
diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp
index fd3f88d1f6..71511f69a4 100644
--- a/indra/llui/llstyle.cpp
+++ b/indra/llui/llstyle.cpp
@@ -51,6 +51,7 @@ LLStyle::Params::Params()
LLStyle::LLStyle(const LLStyle::Params& p)
: mVisible(p.visible),
mColor(p.color()),
+ mReadOnlyColor(p.readonly_color()),
mFont(p.font()),
mLink(p.link_href),
mDropShadow(p.drop_shadow),
diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h
index c769964136..ee9ca730e9 100644
--- a/indra/llui/llstyle.h
+++ b/indra/llui/llstyle.h
@@ -46,7 +46,8 @@ public:
{
Optional<bool> visible;
Optional<LLFontGL::ShadowType> drop_shadow;
- Optional<LLUIColor> color;
+ Optional<LLUIColor> color,
+ readonly_color;
Optional<const LLFontGL*> font;
Optional<LLUIImage*> image;
Optional<std::string> link_href;
@@ -57,6 +58,8 @@ public:
const LLColor4& getColor() const { return mColor; }
void setColor(const LLColor4 &color) { mColor = color; }
+ const LLColor4& getReadOnlyColor() const { return mReadOnlyColor; }
+
BOOL isVisible() const;
void setVisible(BOOL is_visible);
@@ -81,6 +84,7 @@ public:
return
mVisible == rhs.mVisible
&& mColor == rhs.mColor
+ && mReadOnlyColor == rhs.mReadOnlyColor
&& mFont == rhs.mFont
&& mLink == rhs.mLink
&& mImagep == rhs.mImagep
@@ -104,6 +108,7 @@ protected:
private:
BOOL mVisible;
LLUIColor mColor;
+ LLUIColor mReadOnlyColor;
std::string mFontName;
const LLFontGL* mFont; // cached for performance
std::string mLink;
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index b67f753d39..d7d61cf6cb 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -346,7 +346,13 @@ void LLTabContainer::draw()
}
}
- LLPanel::draw();
+ {
+ LLRect clip_rect = getLocalRect();
+ clip_rect.mLeft+=(LLPANEL_BORDER_WIDTH + 2);
+ clip_rect.mRight-=(LLPANEL_BORDER_WIDTH + 2);
+ LLLocalClipRect clip(clip_rect);
+ LLPanel::draw();
+ }
// if tabs are hidden, don't draw them and leave them in the invisible state
if (!getTabsHidden())
@@ -358,24 +364,6 @@ void LLTabContainer::draw()
tuple->mButton->setVisible( TRUE );
}
- // Draw some of the buttons...
- LLRect clip_rect = getLocalRect();
- if (has_scroll_arrows)
- {
- // ...but clip them.
- if (mIsVertical)
- {
- clip_rect.mBottom = mNextArrowBtn->getRect().mTop + 3*tabcntrv_pad;
- clip_rect.mTop = mPrevArrowBtn->getRect().mBottom - 3*tabcntrv_pad;
- }
- else
- {
- clip_rect.mLeft = mPrevArrowBtn->getRect().mRight;
- clip_rect.mRight = mNextArrowBtn->getRect().mLeft;
- }
- }
- LLLocalClipRect clip(clip_rect);
-
S32 max_scroll_visible = getTabCount() - getMaxScrollPos() + getScrollPos();
S32 idx = 0;
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
@@ -1039,6 +1027,11 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
{
LLUICtrl::addChild(child, 1);
}
+
+ sendChildToFront(mPrevArrowBtn);
+ sendChildToFront(mNextArrowBtn);
+ sendChildToFront(mJumpPrevArrowBtn);
+ sendChildToFront(mJumpNextArrowBtn);
if( select )
{
@@ -1346,12 +1339,12 @@ BOOL LLTabContainer::selectTab(S32 which)
cbdata = selected_tuple->mTabPanel->getName();
BOOL res = FALSE;
- if( mValidateSignal( this, cbdata ) )
+ if( !mValidateSignal || (*mValidateSignal)( this, cbdata ) )
{
res = setTab(which);
- if (res)
+ if (res && mCommitSignal)
{
- mCommitSignal(this, cbdata);
+ (*mCommitSignal)(this, cbdata);
}
}
@@ -1672,23 +1665,23 @@ void LLTabContainer::initButtons()
S32 btn_top = (getTabPosition() == TOP ) ? getRect().getHeight() - getTopBorderHeight() : tabcntr_arrow_btn_size + 1;
LLRect left_arrow_btn_rect;
- left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1+tabcntr_arrow_btn_size, btn_top + arrow_fudge, tabcntr_arrow_btn_size, tabcntr_arrow_btn_size );
+ left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1+tabcntr_arrow_btn_size, btn_top + arrow_fudge, tabcntr_arrow_btn_size, mTabHeight );
LLRect jump_left_arrow_btn_rect;
- jump_left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1, btn_top + arrow_fudge, tabcntr_arrow_btn_size, tabcntr_arrow_btn_size );
+ jump_left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1, btn_top + arrow_fudge, tabcntr_arrow_btn_size, mTabHeight );
S32 right_pad = tabcntr_arrow_btn_size + LLPANEL_BORDER_WIDTH + 1;
LLRect right_arrow_btn_rect;
right_arrow_btn_rect.setLeftTopAndSize( getRect().getWidth() - mRightTabBtnOffset - right_pad - tabcntr_arrow_btn_size,
btn_top + arrow_fudge,
- tabcntr_arrow_btn_size, tabcntr_arrow_btn_size );
+ tabcntr_arrow_btn_size, mTabHeight );
LLRect jump_right_arrow_btn_rect;
jump_right_arrow_btn_rect.setLeftTopAndSize( getRect().getWidth() - mRightTabBtnOffset - right_pad,
btn_top + arrow_fudge,
- tabcntr_arrow_btn_size, tabcntr_arrow_btn_size );
+ tabcntr_arrow_btn_size, mTabHeight );
LLButton::Params p;
p.name(std::string("Jump Left Arrow"));
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 97ba691341..7bf10d774c 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -60,6 +60,11 @@ LLTextBase::line_info::line_info(S32 index_start, S32 index_end, LLRect rect, S3
bool LLTextBase::compare_segment_end::operator()(const LLTextSegmentPtr& a, const LLTextSegmentPtr& b) const
{
+ // sort empty spans (e.g. 11-11) after previous non-empty spans (e.g. 5-11)
+ if (a->getEnd() == b->getEnd())
+ {
+ return a->getStart() < b->getStart();
+ }
return a->getEnd() < b->getEnd();
}
@@ -286,8 +291,7 @@ bool LLTextBase::truncate()
LLStyle::Params LLTextBase::getDefaultStyle()
{
- LLColor4 text_color = ( mReadOnly ? mReadOnlyFgColor.get() : mFgColor.get() );
- return LLStyle::Params().color(text_color).font(mDefaultFont).drop_shadow(mFontShadow);
+ return LLStyle::Params().color(mFgColor.get()).readonly_color(mReadOnlyFgColor.get()).font(mDefaultFont).drop_shadow(mFontShadow);
}
void LLTextBase::onValueChange(S32 start, S32 end)
@@ -995,6 +999,12 @@ void LLTextBase::setColor( const LLColor4& c )
mFgColor = c;
}
+//virtual
+void LLTextBase::setReadOnlyColor(const LLColor4 &c)
+{
+ mReadOnlyFgColor = c;
+}
+
//virtual
void LLTextBase::setValue(const LLSD& value )
{
@@ -1446,7 +1456,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
}
}
-void LLTextBase::setText(const LLStringExplicit &utf8str)
+void LLTextBase::setText(const LLStringExplicit &utf8str ,const LLStyle::Params& input_params)
{
// clear out the existing text and segments
getViewModel()->setDisplay(LLWStringUtil::null);
@@ -1461,7 +1471,7 @@ void LLTextBase::setText(const LLStringExplicit &utf8str)
std::string text(utf8str);
LLStringUtil::removeCRLF(text);
- appendText(text, false);
+ appendText(text, false, input_params);
onValueChange(0, getLength());
}
@@ -1500,10 +1510,14 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c
LLStyle::Params link_params = style_params;
link_params.color = match.getColor();
+ link_params.readonly_color = match.getColor();
// apply font name from requested style_params
std::string font_name = LLFontGL::nameFromFont(style_params.font());
- link_params.font.name.setIfNotProvided(font_name);
- link_params.font.style = "UNDERLINE";
+ std::string font_size = LLFontGL::sizeFromFont(style_params.font());
+ link_params.font.name(font_name);
+ link_params.font.size(font_size);
+ link_params.font.style("UNDERLINE");
+
link_params.link_href = match.getUrl();
// output the text before the Url
@@ -2051,16 +2065,16 @@ void LLTextBase::updateRects()
mContentsRect.unionWith(line_iter->mRect);
}
- mContentsRect.mLeft = 0;
+ S32 delta_pos_x = -mContentsRect.mLeft;
mContentsRect.mTop += mVPad;
S32 delta_pos = -mContentsRect.mBottom;
// move line segments to fit new document rect
for (line_list_t::iterator it = mLineInfoList.begin(); it != mLineInfoList.end(); ++it)
{
- it->mRect.translate(0, delta_pos);
+ it->mRect.translate(delta_pos_x, delta_pos);
}
- mContentsRect.translate(0, delta_pos);
+ mContentsRect.translate(delta_pos_x, delta_pos);
}
// update document container dimensions according to text contents
@@ -2232,7 +2246,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
const LLFontGL* font = mStyle->getFont();
- LLColor4 color = mStyle->getColor() % alpha;
+ LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % alpha;
font = mStyle->getFont();
@@ -2370,7 +2384,17 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt
height = mFontHeight;
width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
- return num_chars >= 1 && text[mStart + num_chars - 1] == '\n';
+ // if last character is a newline, then return true, forcing line break
+ llwchar last_char = text[mStart + first_char + num_chars - 1];
+
+ LLUIImagePtr image = mStyle->getImage();
+ if( image.notNull())
+ {
+ width += image->getWidth();
+ height = llmax(height, image->getHeight());
+ }
+
+ return num_chars >= 1 && last_char == '\n';
}
S32 LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 8cae8fde22..c376a73615 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -118,6 +118,8 @@ public:
// LLUICtrl interface
/*virtual*/ BOOL acceptsTextInput() const { return !mReadOnly; }
/*virtual*/ void setColor( const LLColor4& c );
+ virtual void setReadOnlyColor(const LLColor4 &c);
+
/*virtual*/ void setValue(const LLSD& value );
/*virtual*/ LLTextViewModel* getViewModel() const;
@@ -135,8 +137,9 @@ public:
// Text accessors
// TODO: add optional style parameter
- virtual void setText(const LLStringExplicit &utf8str); // uses default style
+ virtual void setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style
virtual std::string getText() const;
+ void setMaxTextLength(S32 length) { mMaxTextByteLength = length; }
// wide-char versions
void setWText(const LLWString& text);
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 00f1d833a3..4c4123cf45 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -112,12 +112,12 @@ BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask)
return handled;
}
-void LLTextBox::setText(const LLStringExplicit& text)
+void LLTextBox::setText(const LLStringExplicit& text , const LLStyle::Params& input_params )
{
// does string argument insertion
mText.assign(text);
- LLTextBase::setText(mText.getString());
+ LLTextBase::setText(mText.getString(), input_params );
}
void LLTextBox::setClickedCallback( boost::function<void (void*)> cb, void* userdata /*= NULL */ )
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index 73f8a7c299..01b4bfa5ed 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -58,7 +58,7 @@ public:
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /*virtual*/ void setText( const LLStringExplicit& text );
+ /*virtual*/ void setText( const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params() );
void setRightAlign() { mHAlign = LLFontGL::RIGHT; }
void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 3ce5a0320b..3f4ef24f82 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -311,12 +311,12 @@ LLTextEditor::~LLTextEditor()
// LLTextEditor
// Public methods
-void LLTextEditor::setText(const LLStringExplicit &utf8str)
+void LLTextEditor::setText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params)
{
blockUndo();
deselect();
- LLTextBase::setText(utf8str);
+ LLTextBase::setText(utf8str, input_params);
resetDirty();
}
@@ -750,8 +750,10 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
{
if( mIsSelecting )
{
- mScroller->autoScroll(x, y);
-
+ if(mScroller)
+ {
+ mScroller->autoScroll(x, y);
+ }
S32 clamped_x = llclamp(x, mTextRect.mLeft, mTextRect.mRight);
S32 clamped_y = llclamp(y, mTextRect.mBottom, mTextRect.mTop);
setCursorAtLocalPos( clamped_x, clamped_y, true );
@@ -799,7 +801,10 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
{
if( mIsSelecting )
{
- mScroller->autoScroll(x, y);
+ if(mScroller)
+ {
+ mScroller->autoScroll(x, y);
+ }
S32 clamped_x = llclamp(x, mTextRect.mLeft, mTextRect.mRight);
S32 clamped_y = llclamp(y, mTextRect.mBottom, mTextRect.mTop);
setCursorAtLocalPos( clamped_x, clamped_y, true );
@@ -1696,7 +1701,15 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
*/
if (mReadOnly)
{
- handled = mScroller->handleKeyHere( key, mask );
+ if(mScroller)
+ {
+ handled = mScroller->handleKeyHere( key, mask );
+ }
+ else
+ {
+ handled = handleNavigationKey( key, mask );
+ }
+
}
else
{
@@ -2005,7 +2018,8 @@ void LLTextEditor::setEnabled(BOOL enabled)
bool read_only = !enabled;
if (read_only != mReadOnly)
{
- mReadOnly = read_only;
+ //mReadOnly = read_only;
+ LLTextBase::setReadOnly(read_only);
updateSegments();
updateAllowingLanguageInput();
}
@@ -2134,9 +2148,8 @@ void LLTextEditor::drawPreeditMarker()
void LLTextEditor::drawLineNumbers()
{
LLGLSUIDefault gls_ui;
-
- LLRect scrolled_view_rect = mScroller->getVisibleContentRect();
- LLRect content_rect = mScroller->getContentWindowRect();
+ LLRect scrolled_view_rect = getVisibleDocumentRect();
+ LLRect content_rect = getTextRect();
LLLocalClipRect clip(content_rect);
S32 first_line = getFirstVisibleLine();
S32 num_lines = getLineCount();
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 10fc94dedc..fb014b86bf 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -168,7 +168,7 @@ public:
void appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
// Non-undoable
- void setText(const LLStringExplicit &utf8str);
+ void setText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params = LLStyle::Params());
// Removes text from the end of document
diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp
index 717e135412..5df1d35383 100644
--- a/indra/llui/lltoggleablemenu.cpp
+++ b/indra/llui/lltoggleablemenu.cpp
@@ -40,6 +40,7 @@ static LLDefaultChildRegistry::Register<LLToggleableMenu> r("toggleable_menu");
LLToggleableMenu::LLToggleableMenu(const LLToggleableMenu::Params& p)
: LLMenuGL(p),
+ mButtonRect(),
mClosedByButtonClick(false)
{
}
@@ -56,13 +57,19 @@ void LLToggleableMenu::handleVisibilityChange (BOOL curVisibilityIn)
}
}
-void LLToggleableMenu::setButtonRect(const LLRect& rect, LLView* current_view)
+void LLToggleableMenu::setButtonRect(const LLRect& rect, LLView* current_view)
{
LLRect screen;
current_view->localRectToScreen(rect, &screen);
mButtonRect = screen;
}
+void LLToggleableMenu::setButtonRect(LLView* current_view)
+{
+ LLRect rect = current_view->getLocalRect();
+ setButtonRect(rect, current_view);
+}
+
bool LLToggleableMenu::toggleVisibility()
{
if (mClosedByButtonClick)
diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h
index 3cd66e04a8..9d8c5261b9 100644
--- a/indra/llui/lltoggleablemenu.h
+++ b/indra/llui/lltoggleablemenu.h
@@ -49,8 +49,11 @@ protected:
public:
virtual void handleVisibilityChange (BOOL curVisibilityIn);
+ const LLRect& getButtonRect() const { return mButtonRect; }
+
// Converts the given local button rect to a screen rect
void setButtonRect(const LLRect& rect, LLView* current_view);
+ void setButtonRect(LLView* current_view);
// Returns "true" if menu was not closed by button click
// and is not still visible. If menu is visible toggles
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index fe1c2ba67c..959313a5b6 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -139,6 +139,10 @@ void LLToolTipView::drawStickyRect()
{
gl_rect_2d(LLToolTipMgr::instance().getMouseNearRect(), LLColor4::white, false);
}
+
+// defaults for floater param block pulled from widgets/floater.xml
+static LLWidgetNameRegistry::StaticRegistrar sRegisterInspectorParams(&typeid(LLInspector::Params), "inspector");
+
//
// LLToolTip
//
@@ -159,6 +163,7 @@ LLToolTip::Params::Params()
visible_time_far("visible_time_far", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeFar" )),
sticky_rect("sticky_rect"),
image("image"),
+ text_color("text_color"),
time_based_media("time_based_media", false),
web_based_media("web_based_media", false),
media_playing("media_playing", false)
@@ -168,7 +173,6 @@ LLToolTip::Params::Params()
LLToolTip::LLToolTip(const LLToolTip::Params& p)
: LLPanel(p),
- mMaxWidth(p.max_width),
mHasClickCallback(p.click_callback.isProvided()),
mPadding(p.padding),
mTextBox(NULL),
@@ -177,15 +181,13 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
mHomePageButton(NULL)
{
LLTextBox::Params params;
- params.initial_value = "tip_text";
params.name = params.initial_value().asString();
// bake textbox padding into initial rect
params.rect = LLRect (mPadding, mPadding + 1, mPadding + 1, mPadding);
- params.follows.flags = FOLLOWS_ALL;
params.h_pad = 0;
params.v_pad = 0;
params.mouse_opaque = false;
- params.text_color = LLUIColorTable::instance().getColor( "ToolTipTextColor" );
+ params.text_color = p.text_color;
params.bg_visible = false;
params.font = p.font;
params.use_ellipses = true;
@@ -206,7 +208,6 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16);
icon_rect.setOriginAndSize(mPadding, mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE);
icon_params.rect = icon_rect;
- //icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM;
icon_params.image_unselected(imagep);
icon_params.image_selected(imagep);
@@ -277,15 +278,30 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
}
}
-void LLToolTip::setValue(const LLSD& value)
+void LLToolTip::initFromParams(const LLToolTip::Params& p)
{
+ LLPanel::initFromParams(p);
+
+ // do this *after* we've had our size set in LLPanel::initFromParams();
const S32 REALLY_LARGE_HEIGHT = 10000;
- reshape(mMaxWidth, REALLY_LARGE_HEIGHT);
+ mTextBox->reshape(p.max_width, REALLY_LARGE_HEIGHT);
- mTextBox->setValue(value);
+ if (p.styled_message.isProvided())
+ {
+ for (LLInitParam::ParamIterator<LLToolTip::StyledText>::const_iterator text_it = p.styled_message().begin();
+ text_it != p.styled_message().end();
+ ++text_it)
+ {
+ mTextBox->appendText(text_it->text(), false, text_it->style);
+ }
+ }
+ else
+ {
+ mTextBox->setText(p.message());
+ }
LLRect text_contents_rect = mTextBox->getContentsRect();
- S32 text_width = llmin(mMaxWidth, text_contents_rect.getWidth());
+ S32 text_width = llmin(p.max_width(), text_contents_rect.getWidth());
S32 text_height = text_contents_rect.getHeight();
mTextBox->reshape(text_width, text_height);
@@ -296,7 +312,7 @@ void LLToolTip::setValue(const LLSD& value)
tooltip_rect.mBottom = 0;
tooltip_rect.mLeft = 0;
- setRect(tooltip_rect);
+ setShape(tooltip_rect);
}
void LLToolTip::setVisible(BOOL visible)
@@ -407,9 +423,8 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params)
}
tooltip_params.rect = LLRect (0, 1, 1, 0);
-
mToolTip = LLUICtrlFactory::create<LLToolTip> (tooltip_params);
- mToolTip->setValue(params.message());
+
gToolTipView->addChild(mToolTip);
if (params.pos.isProvided())
diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h
index 30d251266c..7978b6a583 100644
--- a/indra/llui/lltooltip.h
+++ b/indra/llui/lltooltip.h
@@ -37,6 +37,7 @@
#include "llsingleton.h"
#include "llinitparam.h"
#include "llpanel.h"
+#include "llstyle.h"
//
// Classes
@@ -65,11 +66,19 @@ public:
class LLToolTip : public LLPanel
{
public:
+
+ struct StyledText : public LLInitParam::Block<StyledText>
+ {
+ Mandatory<std::string> text;
+ Optional<LLStyle::Params> style;
+ };
+
struct Params : public LLInitParam::Block<Params, LLPanel::Params>
{
typedef boost::function<void(void)> click_callback_t;
- Mandatory<std::string> message;
+ Optional<std::string> message;
+ Multiple<StyledText> styled_message;
Optional<LLCoordGL> pos;
Optional<F32> delay_time,
@@ -79,14 +88,15 @@ public:
Optional<LLRect> sticky_rect;
Optional<const LLFontGL*> font;
Optional<LLUIImage*> image;
+ Optional<LLUIColor> text_color;
Optional<bool> time_based_media,
web_based_media,
media_playing;
Optional<click_callback_t> click_callback,
click_playmedia_callback,
click_homepage_callback;
- Optional<S32> max_width;
- Optional<S32> padding;
+ Optional<S32> max_width,
+ padding;
Optional<bool> wrap;
Params();
@@ -94,7 +104,6 @@ public:
/*virtual*/ void draw();
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
- /*virtual*/ void setValue(const LLSD& value);
/*virtual*/ void setVisible(BOOL visible);
bool isFading();
@@ -102,6 +111,7 @@ public:
bool hasClickCallback();
LLToolTip(const Params& p);
+ void initFromParams(const LLToolTip::Params& params);
private:
class LLTextBox* mTextBox;
@@ -111,11 +121,16 @@ private:
LLFrameTimer mFadeTimer;
LLFrameTimer mVisibleTimer;
- S32 mMaxWidth;
bool mHasClickCallback;
S32 mPadding; // pixels
};
+// used for the inspector tooltips which need different background images etc.
+class LLInspector : public LLToolTip
+{
+public:
+ struct Params : public LLInitParam::Block<Params, LLToolTip::Params> {};
+};
class LLToolTipMgr : public LLSingleton<LLToolTipMgr>
{
diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp
index 851091f0ca..9be33483d0 100644
--- a/indra/llui/lluicolortable.cpp
+++ b/indra/llui/lluicolortable.cpp
@@ -69,7 +69,14 @@ void LLUIColorTable::insertFromParams(const Params& p)
ColorEntryParams color_entry = *it;
if(color_entry.color.value.isChosen())
{
- setColor(color_entry.name, color_entry.color.value, mLoadedColors);
+ if(mUserSetColors.find(color_entry.name)!=mUserSetColors.end())
+ {
+ setColor(color_entry.name, color_entry.color.value);
+ }
+ else
+ {
+ setColor(color_entry.name, color_entry.color.value, mLoadedColors);
+ }
}
else
{
@@ -185,19 +192,27 @@ void LLUIColorTable::clear()
LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& default_color) const
{
string_color_map_t::const_iterator iter = mUserSetColors.find(name);
+
if(iter != mUserSetColors.end())
{
return LLUIColor(&iter->second);
}
iter = mLoadedColors.find(name);
- return (iter != mLoadedColors.end() ? LLUIColor(&iter->second) : LLUIColor(default_color));
+
+ if(iter != mLoadedColors.end())
+ {
+ return LLUIColor(&iter->second);
+ }
+
+ return LLUIColor(default_color);
}
// update user color, loaded colors are parsed on initialization
void LLUIColorTable::setColor(const std::string& name, const LLColor4& color)
{
setColor(name, color, mUserSetColors);
+ setColor(name, color, mLoadedColors);
}
bool LLUIColorTable::loadFromSettings()
@@ -213,7 +228,7 @@ bool LLUIColorTable::loadFromSettings()
result |= loadFromFilename(current_filename);
}
- std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SKIN, "colors.xml");
+ std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml");
loadFromFilename(user_filename);
return result;
@@ -239,7 +254,7 @@ void LLUIColorTable::saveUserSettings() const
if(!output_node->isNull())
{
- const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SKIN, "colors.xml");
+ const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml");
LLFILE *fp = LLFile::fopen(filename, "w");
if(fp != NULL)
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 08fc8fb784..a30d5b4651 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -78,7 +78,16 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel)
mEnabledControlVariable(NULL),
mDisabledControlVariable(NULL),
mMakeVisibleControlVariable(NULL),
- mMakeInvisibleControlVariable(NULL)
+ mMakeInvisibleControlVariable(NULL),
+ mCommitSignal(NULL),
+ mValidateSignal(NULL),
+ mMouseEnterSignal(NULL),
+ mMouseLeaveSignal(NULL),
+ mMouseDownSignal(NULL),
+ mMouseUpSignal(NULL),
+ mRightMouseDownSignal(NULL),
+ mRightMouseUpSignal(NULL),
+ mDoubleClickSignal(NULL)
{
mUICtrlHandle.bind(this);
}
@@ -129,10 +138,14 @@ void LLUICtrl::initFromParams(const Params& p)
}
if (p.commit_callback.isProvided())
- initCommitCallback(p.commit_callback, mCommitSignal);
+ {
+ setCommitCallback(initCommitCallback(p.commit_callback));
+ }
if (p.validate_callback.isProvided())
- initEnableCallback(p.validate_callback, mValidateSignal);
+ {
+ setValidateCallback(initEnableCallback(p.validate_callback));
+ }
if (p.init_callback.isProvided())
{
@@ -151,10 +164,14 @@ void LLUICtrl::initFromParams(const Params& p)
}
if(p.mouseenter_callback.isProvided())
- initCommitCallback(p.mouseenter_callback, mMouseEnterSignal);
+ {
+ setMouseEnterCallback(initCommitCallback(p.mouseenter_callback));
+ }
if(p.mouseleave_callback.isProvided())
- initCommitCallback(p.mouseleave_callback, mMouseLeaveSignal);
+ {
+ setMouseLeaveCallback(initCommitCallback(p.mouseleave_callback));
+ }
}
@@ -167,16 +184,40 @@ LLUICtrl::~LLUICtrl()
llwarns << "UI Control holding top ctrl deleted: " << getName() << ". Top view removed." << llendl;
gFocusMgr.removeTopCtrlWithoutCallback( this );
}
+
+ delete mCommitSignal;
+ delete mValidateSignal;
+ delete mMouseEnterSignal;
+ delete mMouseLeaveSignal;
+ delete mMouseDownSignal;
+ delete mMouseUpSignal;
+ delete mRightMouseDownSignal;
+ delete mRightMouseUpSignal;
+ delete mDoubleClickSignal;
}
-void LLUICtrl::initCommitCallback(const CommitCallbackParam& cb, commit_signal_t& sig)
+void default_commit_handler(LLUICtrl* ctrl, const LLSD& param)
+{}
+
+bool default_enable_handler(LLUICtrl* ctrl, const LLSD& param)
+{
+ return true;
+}
+
+bool default_visible_handler(LLUICtrl* ctrl, const LLSD& param)
+{
+ return true;
+}
+
+
+LLUICtrl::commit_signal_t::slot_type LLUICtrl::initCommitCallback(const CommitCallbackParam& cb)
{
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind(cb.function(), _1, cb.parameter));
+ return boost::bind(cb.function(), _1, cb.parameter);
else
- sig.connect(cb.function());
+ return cb.function();
}
else
{
@@ -185,26 +226,27 @@ void LLUICtrl::initCommitCallback(const CommitCallbackParam& cb, commit_signal_t
if (func)
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind((*func), _1, cb.parameter));
+ return boost::bind((*func), _1, cb.parameter);
else
- sig.connect(*func);
+ return commit_signal_t::slot_type(*func);
}
else if (!function_name.empty())
{
llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl;
}
}
+ return default_commit_handler;
}
-void LLUICtrl::initEnableCallback(const EnableCallbackParam& cb, enable_signal_t& sig)
+LLUICtrl::enable_signal_t::slot_type LLUICtrl::initEnableCallback(const EnableCallbackParam& cb)
{
// Set the callback function
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind(cb.function(), this, cb.parameter));
+ return boost::bind(cb.function(), this, cb.parameter);
else
- sig.connect(cb.function());
+ return cb.function();
}
else
{
@@ -212,22 +254,23 @@ void LLUICtrl::initEnableCallback(const EnableCallbackParam& cb, enable_signal_t
if (func)
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind((*func), this, cb.parameter));
+ return boost::bind((*func), this, cb.parameter);
else
- sig.connect(*func);
+ return enable_signal_t::slot_type(*func);
}
}
+ return default_enable_handler;
}
-void LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb, visible_signal_t& sig)
+LLUICtrl::visible_signal_t::slot_type LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb)
{
// Set the callback function
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind(cb.function(), this, cb.parameter));
+ return boost::bind(cb.function(), this, cb.parameter);
else
- sig.connect(cb.function());
+ return cb.function();
}
else
{
@@ -235,30 +278,40 @@ void LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb, visible_signa
if (func)
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind((*func), this, cb.parameter));
+ return boost::bind((*func), this, cb.parameter);
else
- sig.connect(*func);
+ return visible_signal_t::slot_type(*func);
}
}
+ return default_visible_handler;
}
// virtual
void LLUICtrl::onMouseEnter(S32 x, S32 y, MASK mask)
{
- mMouseEnterSignal(this, getValue());
+ if (mMouseEnterSignal)
+ {
+ (*mMouseEnterSignal)(this, getValue());
+ }
}
// virtual
void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask)
{
- mMouseLeaveSignal(this, getValue());
+ if(mMouseLeaveSignal)
+ {
+ (*mMouseLeaveSignal)(this, getValue());
+ }
}
//virtual
BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleMouseDown(x,y,mask);
- mMouseDownSignal(this,x,y,mask);
+ if (mMouseDownSignal)
+ {
+ (*mMouseDownSignal)(this,x,y,mask);
+ }
return handled;
}
@@ -266,7 +319,10 @@ BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask)
BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleMouseUp(x,y,mask);
- mMouseUpSignal(this,x,y,mask);
+ if (mMouseUpSignal)
+ {
+ (*mMouseUpSignal)(this,x,y,mask);
+ }
return handled;
}
@@ -274,7 +330,10 @@ BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask)
BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleRightMouseDown(x,y,mask);
- mRightMouseDownSignal(this,x,y,mask);
+ if (mRightMouseDownSignal)
+ {
+ (*mRightMouseDownSignal)(this,x,y,mask);
+ }
return handled;
}
@@ -282,14 +341,20 @@ BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
BOOL LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleRightMouseUp(x,y,mask);
- mRightMouseUpSignal(this,x,y,mask);
+ if(mRightMouseUpSignal)
+ {
+ (*mRightMouseUpSignal)(this,x,y,mask);
+ }
return handled;
}
BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleDoubleClick(x, y, mask);
- mDoubleClickSignal(this, x, y, mask);
+ if (mDoubleClickSignal)
+ {
+ (*mDoubleClickSignal)(this, x, y, mask);
+ }
return handled;
}
@@ -302,7 +367,8 @@ BOOL LLUICtrl::canFocusChildren() const
void LLUICtrl::onCommit()
{
- mCommitSignal(this, getValue());
+ if (mCommitSignal)
+ (*mCommitSignal)(this, getValue());
}
//virtual
@@ -832,7 +898,8 @@ boost::signals2::connection LLUICtrl::setCommitCallback( boost::function<void (L
}
boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function<bool (const LLSD& data)> cb )
{
- return mValidateSignal.connect(boost::bind(cb, _2));
+ if (!mValidateSignal) mValidateSignal = new enable_signal_t();
+ return mValidateSignal->connect(boost::bind(cb, _2));
}
// virtual
@@ -850,3 +917,57 @@ BOOL LLUICtrl::getTentative() const
// virtual
void LLUICtrl::setColor(const LLColor4& color)
{ }
+
+boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mCommitSignal) mCommitSignal = new commit_signal_t();
+ return mCommitSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setValidateCallback( const enable_signal_t::slot_type& cb )
+{
+ if (!mValidateSignal) mValidateSignal = new enable_signal_t();
+ return mValidateSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setMouseEnterCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mMouseEnterSignal) mMouseEnterSignal = new commit_signal_t();
+ return mMouseEnterSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setMouseLeaveCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mMouseLeaveSignal) mMouseLeaveSignal = new commit_signal_t();
+ return mMouseLeaveSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setMouseDownCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mMouseDownSignal) mMouseDownSignal = new mouse_signal_t();
+ return mMouseDownSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setMouseUpCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mMouseUpSignal) mMouseUpSignal = new mouse_signal_t();
+ return mMouseUpSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setRightMouseDownCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mRightMouseDownSignal) mRightMouseDownSignal = new mouse_signal_t();
+ return mRightMouseDownSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setRightMouseUpCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mRightMouseUpSignal) mRightMouseUpSignal = new mouse_signal_t();
+ return mRightMouseUpSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t();
+ return mDoubleClickSignal->connect(cb);
+}
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index dd22851100..aef1bcd519 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -162,9 +162,9 @@ protected:
LLUICtrl(const Params& p = getDefaultParams(),
const LLViewModelPtr& viewmodel=LLViewModelPtr(new LLViewModel));
- void initCommitCallback(const CommitCallbackParam& cb, commit_signal_t& sig);
- void initEnableCallback(const EnableCallbackParam& cb, enable_signal_t& sig);
- void initVisibleCallback(const VisibleCallbackParam& cb, visible_signal_t& sig);
+ commit_signal_t::slot_type initCommitCallback(const CommitCallbackParam& cb);
+ enable_signal_t::slot_type initEnableCallback(const EnableCallbackParam& cb);
+ visible_signal_t::slot_type initVisibleCallback(const VisibleCallbackParam& cb);
// We need this virtual so we can override it with derived versions
virtual LLViewModel* getViewModel() const;
@@ -254,18 +254,18 @@ public:
// topic then put in help_topic_out
bool findHelpTopic(std::string& help_topic_out);
- boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb ) { return mCommitSignal.connect(cb); }
- boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb ) { return mValidateSignal.connect(cb); }
+ boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb );
+ boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb );
- boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mMouseEnterSignal.connect(cb); }
- boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mMouseLeaveSignal.connect(cb); }
+ boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb );
+ boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb );
- boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); }
- boost::signals2::connection setMouseUpCallback( const mouse_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(cb); }
- boost::signals2::connection setRightMouseDownCallback( const mouse_signal_t::slot_type& cb ) { return mRightMouseDownSignal.connect(cb); }
- boost::signals2::connection setRightMouseUpCallback( const mouse_signal_t::slot_type& cb ) { return mRightMouseUpSignal.connect(cb); }
+ boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb );
+ boost::signals2::connection setMouseUpCallback( const mouse_signal_t::slot_type& cb );
+ boost::signals2::connection setRightMouseDownCallback( const mouse_signal_t::slot_type& cb );
+ boost::signals2::connection setRightMouseUpCallback( const mouse_signal_t::slot_type& cb );
- boost::signals2::connection setDoubleClickCallback( const mouse_signal_t::slot_type& cb ) { return mDoubleClickSignal.connect(cb); }
+ boost::signals2::connection setDoubleClickCallback( const mouse_signal_t::slot_type& cb );
// *TODO: Deprecate; for backwards compatability only:
boost::signals2::connection setCommitCallback( boost::function<void (LLUICtrl*,void*)> cb, void* data);
@@ -293,18 +293,18 @@ protected:
static bool controlListener(const LLSD& newvalue, LLHandle<LLUICtrl> handle, std::string type);
- commit_signal_t mCommitSignal;
- enable_signal_t mValidateSignal;
+ commit_signal_t* mCommitSignal;
+ enable_signal_t* mValidateSignal;
- commit_signal_t mMouseEnterSignal;
- commit_signal_t mMouseLeaveSignal;
+ commit_signal_t* mMouseEnterSignal;
+ commit_signal_t* mMouseLeaveSignal;
- mouse_signal_t mMouseDownSignal;
- mouse_signal_t mMouseUpSignal;
- mouse_signal_t mRightMouseDownSignal;
- mouse_signal_t mRightMouseUpSignal;
+ mouse_signal_t* mMouseDownSignal;
+ mouse_signal_t* mMouseUpSignal;
+ mouse_signal_t* mRightMouseDownSignal;
+ mouse_signal_t* mRightMouseUpSignal;
- mouse_signal_t mDoubleClickSignal;
+ mouse_signal_t* mDoubleClickSignal;
LLViewModelPtr mViewModel;
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index c3c0daed0f..1c1450d7e9 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -433,8 +433,8 @@ void LLUICtrlFactory::registerWidget(const std::type_info* widget_type, const st
LLWidgetNameRegistry ::instance().defaultRegistrar().add(param_block_type, tag);
// associate widget type with factory function
LLDefaultWidgetRegistry::instance().defaultRegistrar().add(widget_type, creator_func);
- LLWidgetTypeRegistry::instance().defaultRegistrar().add(tag, widget_type);
//FIXME: comment this in when working on schema generation
+ //LLWidgetTypeRegistry::instance().defaultRegistrar().add(tag, widget_type);
//LLDefaultParamBlockRegistry::instance().defaultRegistrar().add(widget_type, &getEmptyParamBlock<T>);
}
@@ -449,3 +449,9 @@ const std::string* LLUICtrlFactory::getWidgetTag(const std::type_info* widget_ty
{
return LLWidgetNameRegistry::instance().getValue(widget_type);
}
+
+// static
+void LLUICtrlFactory::connect(LLView* parent, LLView* child)
+{
+ parent->addChild(child);
+}
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 0ccd3047f6..8a9c9e23c1 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -188,10 +188,15 @@ public:
T* widget = new T(params);
widget->initFromParams(params);
if (parent)
- parent->addChild(widget);
+ {
+ connect(parent, widget);
+ }
return widget;
}
+ // fix for gcc template instantiation annoyance
+ static void connect(LLView* parent, LLView* child);
+
LLView* createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t&, LLXMLNodePtr output_node );
template<typename T>
diff --git a/indra/llui/lluiimage.cpp b/indra/llui/lluiimage.cpp
index 6c1a32722f..a8683e55c3 100644
--- a/indra/llui/lluiimage.cpp
+++ b/indra/llui/lluiimage.cpp
@@ -142,6 +142,13 @@ namespace LLInitParam
{
LLUIImage* TypedParam<LLUIImage*>::getValueFromBlock() const
{
+ // The keyword "none" is specifically requesting a null image
+ // do not default to current value. Used to overwrite template images.
+ if (name() == "none")
+ {
+ return NULL;
+ }
+
LLUIImage* imagep = LLUI::getUIImage(name());
if (!imagep)
{
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index dae4b512d1..b51709e208 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -34,6 +34,7 @@
#include "linden_common.h"
#include "llurlentry.h"
#include "lluri.h"
+
#include "llcachename.h"
#include "lltrans.h"
#include "lluicolortable.h"
@@ -383,6 +384,38 @@ std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCa
}
}
+//
+// LLUrlEntryInventory Describes a Second Life inventory Url, e.g.,
+// secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select
+//
+LLUrlEntryInventory::LLUrlEntryInventory()
+{
+ mPattern = boost::regex("secondlife:///app/inventory/[\\da-f-]+/\\w+",
+ boost::regex::perl|boost::regex::icase);
+ mMenuName = "menu_url_inventory.xml";
+}
+
+std::string LLUrlEntryInventory::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
+{
+ return unescapeUrl(url);
+ // TODO: Figure out if we can somehow access the inventory from here to get the actual item name
+ /*
+ std::string inventory_id_string = getIDStringFromUrl(url);
+ if (inventory_id_string.empty())
+ {
+ // something went wrong, give raw url
+ return unescapeUrl(url);
+ }
+ LLUUID inventory_id(inventory_id_string);
+ LLInventoryItem* item = gInventory.getItem(inventory_id);
+ if(!item)
+ {
+ return unescapeUrl(url);
+ }
+ return item->getName(); */
+}
+
+
///
/// LLUrlEntryParcel Describes a Second Life parcel Url, e.g.,
/// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
@@ -512,50 +545,6 @@ std::string LLUrlEntryTeleport::getLocation(const std::string &url) const
return ::getStringAfterToken(url, "app/teleport/");
}
-///
-/// LLUrlEntryObjectIM Describes a Second Life object instant msg Url, e.g.,
-/// secondlife:///app/objectim/<sessionid>
-///
-LLUrlEntryObjectIM::LLUrlEntryObjectIM()
-{
- mPattern = boost::regex("secondlife:///app/objectim/[\\da-f-]+\\??\\S*",
- boost::regex::perl|boost::regex::icase);
- mMenuName = "menu_url_objectim.xml";
- mTooltip = LLTrans::getString("TooltipObjectIMUrl");
-}
-
-std::string LLUrlEntryObjectIM::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
-{
- LLURI uri(url);
- LLSD params = uri.queryMap();
- if (params.has("name"))
- {
- // look for a ?name=<obj-name> param in the url
- // and use that as the label if present.
- std::string name = params.get("name");
- LLStringUtil::trim(name);
- if (name.empty())
- {
- name = LLTrans::getString("Unnamed");
- }
- return name;
- }
-
- return unescapeUrl(url);
-}
-
-std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const
-{
- LLURI uri(url);
- LLSD params = uri.queryMap();
- if (params.has("slurl"))
- {
- return params.get("slurl");
- }
-
- return "";
-}
-
//
// LLUrlEntrySL Describes a generic SLURL, e.g., a Url that starts
// with secondlife:// (used as a catch-all for cases not matched above)
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 4507572b1e..b3fb333fdd 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -174,6 +174,19 @@ private:
};
///
+/// LLUrlEntryInventory Describes a Second Life inventory Url, e.g.,
+/// secondlife:///app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select
+///
+class LLUrlEntryInventory : public LLUrlEntryBase
+{
+public:
+ LLUrlEntryInventory();
+ /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
+private:
+};
+
+
+///
/// LLUrlEntryParcel Describes a Second Life parcel Url, e.g.,
/// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
///
@@ -209,18 +222,6 @@ public:
};
///
-/// LLUrlEntryObjectIM Describes a Second Life object instant msg Url, e.g.,
-/// secondlife:///app/objectim/<sessionid>?name=Foo
-///
-class LLUrlEntryObjectIM : public LLUrlEntryBase
-{
-public:
- LLUrlEntryObjectIM();
- /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
- /*virtual*/ std::string getLocation(const std::string &url) const;
-};
-
-///
/// LLUrlEntrySL Describes a generic SLURL, e.g., a Url that starts
/// with secondlife:// (used as a catch-all for cases not matched above)
///
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 60275b60bc..b2f084e5ac 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -52,10 +52,10 @@ LLUrlRegistry::LLUrlRegistry()
registerUrl(new LLUrlEntryParcel());
registerUrl(new LLUrlEntryTeleport());
registerUrl(new LLUrlEntryWorldMap());
- registerUrl(new LLUrlEntryObjectIM());
registerUrl(new LLUrlEntryPlace());
registerUrl(new LLUrlEntrySL());
registerUrl(new LLUrlEntrySLLabel());
+ registerUrl(new LLUrlEntryInventory());
}
LLUrlRegistry::~LLUrlRegistry()