summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Linden <none@none>2011-10-26 11:53:01 -0700
committerRichard Linden <none@none>2011-10-26 11:53:01 -0700
commitf3c0bbf1620a3a65eaa517903467a2a65681e106 (patch)
treea77f3b8254ce9030ee3d0e2395a72ebf4ff63501 /indra/llui
parent1b173ed82b65c7bb5f5d5294847a721b64f8cf35 (diff)
parentb0df4f12040152afe0813875eddfe83a078079a2 (diff)
Automated merge with http://hg.secondlife.com/viewer-development
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lldockablefloater.cpp15
-rw-r--r--indra/llui/lldockablefloater.h4
-rw-r--r--indra/llui/lldockcontrol.cpp43
-rw-r--r--indra/llui/lldockcontrol.h1
-rw-r--r--indra/llui/llfloater.cpp4
-rw-r--r--indra/llui/lltoolbar.cpp122
-rw-r--r--indra/llui/lltoolbar.h23
7 files changed, 176 insertions, 36 deletions
diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp
index aea58be12a..0fcd937361 100644
--- a/indra/llui/lldockablefloater.cpp
+++ b/indra/llui/lldockablefloater.cpp
@@ -239,8 +239,21 @@ void LLDockableFloater::setDockControl(LLDockControl* dockControl)
setDocked(isDocked());
}
-const LLUIImagePtr& LLDockableFloater::getDockTongue()
+const LLUIImagePtr& LLDockableFloater::getDockTongue(LLDockControl::DocAt dock_side)
{
+ switch(dock_side)
+ {
+ case LLDockControl::LEFT:
+ mDockTongue = LLUI::getUIImage("windows/Flyout_Left.png");
+ break;
+ case LLDockControl::RIGHT:
+ mDockTongue = LLUI::getUIImage("windows/Flyout_Right.png");
+ break;
+ default:
+ mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png");
+ break;
+ }
+
return mDockTongue;
}
diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index 8deb6c1159..89c9852f4a 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -113,6 +113,8 @@ public:
bool getUniqueDocking() { return mUniqueDocking; }
bool getUseTongue() { return mUseTongue; }
+
+ void setUseTongue(bool use_tongue) { mUseTongue = use_tongue;}
private:
/**
* Provides unique of dockable floater.
@@ -122,7 +124,7 @@ private:
protected:
void setDockControl(LLDockControl* dockControl);
- const LLUIImagePtr& getDockTongue();
+ const LLUIImagePtr& getDockTongue(LLDockControl::DocAt dock_side = LLDockControl::TOP);
// Checks if docking should be forced.
// It may be useful e.g. if floater created in mouselook mode (see EXT-5609)
diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index 6397bbd0de..8cb2e57b98 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -203,21 +203,33 @@ void LLDockControl::moveDockable()
switch (mDockAt)
{
case LEFT:
- x = dockRect.mLeft;
- y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight();
- // check is dockable inside root view rect
- if (x < rootRect.mLeft)
+
+ x = dockRect.mLeft - dockableRect.getWidth();
+ y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
+
+ if (use_tongue)
{
- x = rootRect.mLeft;
+ x -= mDockTongue->getWidth();
}
- if (x + dockableRect.getWidth() > rootRect.mRight)
+
+ mDockTongueX = dockableRect.mRight;
+ mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
+
+ break;
+
+ case RIGHT:
+
+ x = dockRect.mRight;
+ y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
+
+ if (use_tongue)
{
- x = rootRect.mRight - dockableRect.getWidth();
+ x += mDockTongue->getWidth();
}
-
- mDockTongueX = x + dockableRect.getWidth()/2 - mDockTongue->getWidth() / 2;
-
- mDockTongueY = dockRect.mTop;
+
+ mDockTongueX = dockRect.mRight;
+ mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
+
break;
case TOP:
@@ -315,13 +327,12 @@ void LLDockControl::moveDockable()
dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(),
dockableRect.getHeight());
}
+
LLRect localDocableParentRect;
- mDockableFloater->getParent()->screenRectToLocal(dockableRect,
- &localDocableParentRect);
- mDockableFloater->setRect(localDocableParentRect);
- mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY,
- &mDockTongueX, &mDockTongueY);
+ mDockableFloater->getParent()->screenRectToLocal(dockableRect, &localDocableParentRect);
+ mDockableFloater->setRect(localDocableParentRect);
+ mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY, &mDockTongueX, &mDockTongueY);
}
diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h
index 2e7359245f..463223fafd 100644
--- a/indra/llui/lldockcontrol.h
+++ b/indra/llui/lldockcontrol.h
@@ -43,6 +43,7 @@ public:
{
TOP,
LEFT,
+ RIGHT,
BOTTOM
};
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 7100ea13a7..432397d3e9 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -935,7 +935,7 @@ void LLFloater::applyPositioning(LLFloater* other)
case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP:
case LLFloaterEnums::OPEN_POSITIONING_CASCADING:
- if (other != NULL)
+ if (other != NULL && other != this)
{
stackWith(*other);
}
@@ -1070,7 +1070,7 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
const LLRect old_rect = getRect();
LLView::handleReshape(new_rect, by_user);
- if (by_user)
+ if (by_user && !isMinimized())
{
storeRectControl();
mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE;
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 515605200e..287e3e2b41 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -112,6 +112,10 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
mStartDragItemCallback(NULL),
mHandleDragItemCallback(NULL),
mHandleDropCallback(NULL),
+ mButtonAddSignal(NULL),
+ mButtonEnterSignal(NULL),
+ mButtonLeaveSignal(NULL),
+ mButtonRemoveSignal(NULL),
mDragAndDropTarget(false)
{
mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
@@ -121,6 +125,10 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
LLToolBar::~LLToolBar()
{
delete mPopupMenuHandle.get();
+ delete mButtonAddSignal;
+ delete mButtonEnterSignal;
+ delete mButtonLeaveSignal;
+ delete mButtonRemoveSignal;
}
void LLToolBar::createContextMenu()
@@ -212,7 +220,6 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
mButtonPanel->addChild(button);
mButtonMap.insert(std::make_pair(commandId.uuid(), button));
-
// Insert the command and button in the right place in their respective lists
if ((rank >= mButtonCommands.size()) || (rank == RANK_NONE))
{
@@ -238,6 +245,14 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
mNeedsLayout = true;
+ updateLayoutAsNeeded();
+
+
+ if (mButtonAddSignal)
+ {
+ (*mButtonAddSignal)(button);
+ }
+
return true;
}
@@ -264,6 +279,11 @@ int LLToolBar::removeCommand(const LLCommandId& commandId)
++rank;
}
+ if (mButtonRemoveSignal)
+ {
+ (*mButtonRemoveSignal)(*it_button);
+ }
+
// Delete the button and erase the command and button records
delete (*it_button);
mButtonCommands.erase(it_command);
@@ -352,6 +372,23 @@ bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId)
return (command_button != NULL);
}
+bool LLToolBar::flashCommand(const LLCommandId& commandId, bool flash)
+{
+ LLButton * command_button = NULL;
+
+ if (commandId != LLCommandId::null)
+ {
+ command_id_map::iterator it = mButtonMap.find(commandId.uuid());
+ if (it != mButtonMap.end())
+ {
+ command_button = it->second;
+ command_button->setFlashing(flash ? TRUE : FALSE);
+ }
+ }
+
+ return (command_button != NULL);
+}
+
BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
LLRect button_panel_rect;
@@ -790,6 +827,11 @@ void LLToolBar::createButtons()
{
BOOST_FOREACH(LLToolBarButton* button, mButtons)
{
+ if (mButtonRemoveSignal)
+ {
+ (*mButtonRemoveSignal)(button);
+ }
+
delete button;
}
mButtons.clear();
@@ -801,6 +843,11 @@ void LLToolBar::createButtons()
mButtons.push_back(button);
mButtonPanel->addChild(button);
mButtonMap.insert(std::make_pair(command_id.uuid(), button));
+
+ if (mButtonAddSignal)
+ {
+ (*mButtonAddSignal)(button);
+ }
}
mNeedsLayout = true;
}
@@ -870,8 +917,7 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
button->setCommitCallback(executeParam);
}
-
-
+ // Set up "is running" query callback
const std::string& isRunningFunction = commandp->isRunningFunctionName();
if (isRunningFunction.length() > 0)
{
@@ -898,6 +944,36 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
return button;
}
+boost::signals2::connection connectSignal(LLToolBar::button_signal_t*& signal, const LLToolBar::button_signal_t::slot_type& cb)
+{
+ if (!signal)
+ {
+ signal = new LLToolBar::button_signal_t();
+ }
+
+ return signal->connect(cb);
+}
+
+boost::signals2::connection LLToolBar::setButtonAddCallback(const button_signal_t::slot_type& cb)
+{
+ return connectSignal(mButtonAddSignal, cb);
+}
+
+boost::signals2::connection LLToolBar::setButtonEnterCallback(const button_signal_t::slot_type& cb)
+{
+ return connectSignal(mButtonEnterSignal, cb);
+}
+
+boost::signals2::connection LLToolBar::setButtonLeaveCallback(const button_signal_t::slot_type& cb)
+{
+ return connectSignal(mButtonLeaveSignal, cb);
+}
+
+boost::signals2::connection LLToolBar::setButtonRemoveCallback(const button_signal_t::slot_type& cb)
+{
+ return connectSignal(mButtonRemoveSignal, cb);
+}
+
BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
@@ -969,8 +1045,6 @@ LLToolBarButton::LLToolBarButton(const Params& p)
mOriginalImageOverlayColor(p.image_overlay_color),
mOriginalImageOverlaySelectedColor(p.image_overlay_selected_color)
{
- mButtonFlashRate = 0.0;
- mButtonFlashCount = 0;
}
LLToolBarButton::~LLToolBarButton()
@@ -1012,6 +1086,7 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask)
{
handled = LLButton::handleHover(x, y, mask);
}
+
return handled;
}
@@ -1024,6 +1099,23 @@ void LLToolBarButton::onMouseEnter(S32 x, S32 y, MASK mask)
{
mNeedsHighlight = TRUE;
}
+
+ LLToolBar* parent_toolbar = getParentByType<LLToolBar>();
+ if (parent_toolbar && parent_toolbar->mButtonEnterSignal)
+ {
+ (*(parent_toolbar->mButtonEnterSignal))(this);
+ }
+}
+
+void LLToolBarButton::onMouseLeave(S32 x, S32 y, MASK mask)
+{
+ LLButton::onMouseLeave(x, y, mask);
+
+ LLToolBar* parent_toolbar = getParentByType<LLToolBar>();
+ if (parent_toolbar && parent_toolbar->mButtonLeaveSignal)
+ {
+ (*(parent_toolbar->mButtonLeaveSignal))(this);
+ }
}
void LLToolBarButton::onMouseCaptureLost()
@@ -1072,25 +1164,25 @@ void LLToolBarButton::setEnabled(BOOL enabled)
}
}
-
const std::string LLToolBarButton::getToolTip() const
{
std::string tooltip;
+
if (labelIsTruncated() || getCurrentLabel().empty())
{
- return LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip();
+ tooltip = LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip();
}
else
{
- return LLView::getToolTip();
+ tooltip = LLView::getToolTip();
}
-}
-
-
-
-
-
-
+ LLToolBar* parent_toolbar = getParentByType<LLToolBar>();
+ if (parent_toolbar && parent_toolbar->mButtonTooltipSuffix.length() > 0)
+ {
+ tooltip = tooltip + "\n(" + parent_toolbar->mButtonTooltipSuffix + ")";
+ }
+ return tooltip;
+}
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index e634e57f93..f10f39adc3 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -71,6 +71,7 @@ public:
void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
void onMouseEnter(S32 x, S32 y, MASK mask);
+ void onMouseLeave(S32 x, S32 y, MASK mask);
void onMouseCaptureLost();
void onCommit();
@@ -120,6 +121,8 @@ namespace LLToolBarEnums
SIDE_RIGHT,
SIDE_TOP,
};
+
+ LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType);
}
// NOTE: This needs to occur before Param block declaration for proper compilation.
@@ -142,6 +145,7 @@ namespace LLInitParam
class LLToolBar
: public LLUICtrl
{
+ friend class LLToolBarButton;
public:
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
@@ -187,6 +191,7 @@ public:
bool hasCommand(const LLCommandId& commandId) const;
bool enableCommand(const LLCommandId& commandId, bool enabled);
bool stopCommandInProgress(const LLCommandId& commandId);
+ bool flashCommand(const LLCommandId& commandId, bool flash);
void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; }
void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
@@ -195,6 +200,15 @@ public:
LLToolBarButton* createButton(const LLCommandId& id);
+ typedef boost::signals2::signal<void (LLView* button)> button_signal_t;
+ boost::signals2::connection setButtonAddCallback(const button_signal_t::slot_type& cb);
+ boost::signals2::connection setButtonEnterCallback(const button_signal_t::slot_type& cb);
+ boost::signals2::connection setButtonLeaveCallback(const button_signal_t::slot_type& cb);
+ boost::signals2::connection setButtonRemoveCallback(const button_signal_t::slot_type& cb);
+
+ void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; }
+
+ LLToolBarEnums::SideType getSideType() const { return mSideType; }
bool hasButtons() const { return !mButtons.empty(); }
bool isModified() const { return mModified; }
@@ -254,7 +268,14 @@ private:
LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT];
- LLHandle<class LLContextMenu> mPopupMenuHandle;
+ LLHandle<class LLContextMenu> mPopupMenuHandle;
+
+ button_signal_t* mButtonAddSignal;
+ button_signal_t* mButtonEnterSignal;
+ button_signal_t* mButtonLeaveSignal;
+ button_signal_t* mButtonRemoveSignal;
+
+ std::string mButtonTooltipSuffix;
};