diff options
author | Merov Linden <merov@lindenlab.com> | 2011-10-19 14:11:34 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2011-10-19 14:11:34 -0700 |
commit | b477f3c9af39dd49fcdb88f330f60c8b166fa0e8 (patch) | |
tree | d04b72a8ce62dee897c626a3bc5374b67eb2649f /indra/llui | |
parent | b8e954f98d37cb8e045135dd6bbaab9fc4421529 (diff) | |
parent | 3e61b37258fc88916d45ee47a2a9fbb3baf934cf (diff) |
Pull from richard/viewer-experience-fui
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfloater.cpp | 23 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 4 | ||||
-rw-r--r-- | indra/llui/llfloaterreg.cpp | 8 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 17 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.h | 13 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 20 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 45 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 1 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llview.h | 2 |
10 files changed, 89 insertions, 50 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index d1d840729d..3085921e04 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -174,6 +174,7 @@ LLFloater::Params::Params() save_rect("save_rect", false), save_visibility("save_visibility", false), can_dock("can_dock", false), + show_title("show_title", true), open_positioning("open_positioning", LLFloaterEnums::OPEN_POSITIONING_NONE), specified_left("specified_left"), specified_bottom("specified_bottom"), @@ -538,7 +539,6 @@ LLFloater::~LLFloater() delete mResizeHandle[i]; } - storeRectControl(); setVisible(false); // We're not visible if we're destroyed storeVisibilityControl(); storeDockStateControl(); @@ -1142,10 +1142,6 @@ void LLFloater::setMinimized(BOOL minimize) mButtonsEnabled[BUTTON_RESTORE] = TRUE; } - if (mDragHandle) - { - mDragHandle->setVisible(TRUE); - } setBorderVisible(TRUE); for(handle_set_iter_t dependent_it = mDependents.begin(); @@ -1296,19 +1292,9 @@ void LLFloater::setIsChrome(BOOL is_chrome) mButtons[BUTTON_CLOSE]->setToolTip(LLStringExplicit(getButtonTooltip(Params(), BUTTON_CLOSE, is_chrome))); } - // no titles displayed on "chrome" floaters - if (mDragHandle) - mDragHandle->setTitleVisible(!is_chrome); - LLPanel::setIsChrome(is_chrome); } -void LLFloater::setTitleVisible(bool visible) -{ - if (mDragHandle) - mDragHandle->setTitleVisible(visible); -} - // Change the draw style to account for the foreground state. void LLFloater::setForeground(BOOL front) { @@ -1812,7 +1798,7 @@ void LLFloater::draw() { drawChild(mButtons[i]); } - drawChild(mDragHandle); + drawChild(mDragHandle, 0, 0, TRUE); } else { @@ -2991,6 +2977,11 @@ void LLFloater::initFromParams(const LLFloater::Params& p) { setCloseCallback(initCommitCallback(p.close_callback)); } + + if (mDragHandle) + { + mDragHandle->setTitleVisible(p.show_title); + } } boost::signals2::connection LLFloater::setMinimizeCallback( const commit_signal_t::slot_type& cb ) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 8beb11507e..f610b04e35 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -128,7 +128,8 @@ public: save_rect, save_visibility, save_dock_state, - can_dock; + can_dock, + show_title; Optional<LLFloaterEnums::EOpenPositioning> open_positioning; Optional<S32> specified_left; @@ -209,7 +210,6 @@ public: std::string getTitle() const; void setShortTitle( const std::string& short_title ); std::string getShortTitle() const; - void setTitleVisible(bool visible); virtual void setMinimized(BOOL b); void moveResizeHandlesToFront(); void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE); diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 0edfc8da2d..df3cff9968 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -462,16 +462,16 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& else if (instance->isMinimized()) { instance->setMinimized(FALSE); - instance->setFocus(TRUE); + instance->setVisibleAndFrontmost(); } else if (!instance->isShown()) { instance->openFloater(key); - instance->setFocus(TRUE); + instance->setVisibleAndFrontmost(); } - else if (!instance->hasFocus() && !instance->getIsChrome()) + else if (!instance->isFrontmost()) { - instance->setFocus(TRUE); + instance->setVisibleAndFrontmost(); } else { diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 4991c4afa6..0e7060e22c 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -47,6 +47,19 @@ void LLLayoutStack::OrientationNames::declareValues() // // LLLayoutPanel // +LLLayoutPanel::Params::Params() +: expanded_min_dim("expanded_min_dim", 0), + min_dim("min_dim", 0), + max_dim("max_dim", S32_MAX), + user_resize("user_resize", true), + auto_resize("auto_resize", true) +{ + addSynonym(min_dim, "min_width"); + addSynonym(min_dim, "min_height"); + addSynonym(max_dim, "max_width"); + addSynonym(max_dim, "max_height"); +} + LLLayoutPanel::LLLayoutPanel(const Params& p) : LLPanel(p), mExpandedMinDimSpecified(false), @@ -527,8 +540,8 @@ void LLLayoutStack::updateLayout(BOOL force_resize) // not enough room to fit existing contents if (force_resize == FALSE // layout did not complete by reaching target position - && ((mOrientation == VERTICAL && cur_y != -mPanelSpacing) - || (mOrientation == HORIZONTAL && cur_x != getRect().getWidth() + mPanelSpacing))) + && ((mOrientation == VERTICAL && llround(cur_y) != -mPanelSpacing) + || (mOrientation == HORIZONTAL && llround(cur_x) != getRect().getWidth() + mPanelSpacing))) { // do another layout pass with all stacked elements contributing // even those that don't usually resize diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 5d79505fc3..ede6149a80 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -161,18 +161,7 @@ public: Optional<bool> user_resize, auto_resize; - Params() - : expanded_min_dim("expanded_min_dim", 0), - min_dim("min_dim", 0), - max_dim("max_dim", 0), - user_resize("user_resize", true), - auto_resize("auto_resize", true) - { - addSynonym(min_dim, "min_width"); - addSynonym(min_dim, "min_height"); - addSynonym(max_dim, "max_width"); - addSynonym(max_dim, "max_height"); - } + Params(); }; ~LLLayoutPanel(); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 9c6a76822c..ad1f3c504d 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -548,23 +548,23 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) } S32 tab_count = getTabCount(); - if (tab_count > 0) + if (tab_count > 0 && !getTabsHidden()) { LLTabTuple* firsttuple = getTab(0); LLRect tab_rect; if (mIsVertical) { tab_rect = LLRect(firsttuple->mButton->getRect().mLeft, - has_scroll_arrows ? mPrevArrowBtn->getRect().mBottom - tabcntrv_pad : mPrevArrowBtn->getRect().mTop, - firsttuple->mButton->getRect().mRight, - has_scroll_arrows ? mNextArrowBtn->getRect().mTop + tabcntrv_pad : mNextArrowBtn->getRect().mBottom ); + has_scroll_arrows ? mPrevArrowBtn->getRect().mBottom - tabcntrv_pad : mPrevArrowBtn->getRect().mTop, + firsttuple->mButton->getRect().mRight, + has_scroll_arrows ? mNextArrowBtn->getRect().mTop + tabcntrv_pad : mNextArrowBtn->getRect().mBottom ); } else { tab_rect = LLRect(has_scroll_arrows ? mPrevArrowBtn->getRect().mRight : mJumpPrevArrowBtn->getRect().mLeft, - firsttuple->mButton->getRect().mTop, - has_scroll_arrows ? mNextArrowBtn->getRect().mLeft : mJumpNextArrowBtn->getRect().mRight, - firsttuple->mButton->getRect().mBottom ); + firsttuple->mButton->getRect().mTop, + has_scroll_arrows ? mNextArrowBtn->getRect().mLeft : mJumpNextArrowBtn->getRect().mRight, + firsttuple->mButton->getRect().mBottom ); } if( tab_rect.pointInRect( x, y ) ) { @@ -681,7 +681,7 @@ BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); BOOL handled = LLPanel::handleToolTip( x, y, mask); - if (!handled && getTabCount() > 0) + if (!handled && getTabCount() > 0 && !getTabsHidden()) { LLTabTuple* firsttuple = getTab(0); @@ -812,7 +812,9 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag { BOOL has_scroll_arrows = (getMaxScrollPos() > 0); - if( mDragAndDropDelayTimer.getStarted() && mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME ) + if( !getTabsHidden() + && mDragAndDropDelayTimer.getStarted() + && mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME ) { if (has_scroll_arrows) { diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 629c7d9bc7..c559a2bf1d 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -302,7 +302,50 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) command_id_map::iterator it = mButtonMap.find(commandId.uuid()); if (it != mButtonMap.end()) { - it->second->setEnabled(enabled); + command_button = it->second; + command_button->setEnabled(enabled); + } + } + + return (command_button != NULL); +} + +bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId) +{ + // + // Note from Leslie: + // + // This implementation was largely put in place to handle EXP-1348 which is related to + // dragging and dropping the "speak" button. The "speak" button can be in one of two + // modes, i.e., either a toggle action or a push-to-talk action. Because of this it + // responds to mouse down and mouse up in different ways, based on which behavior the + // button is currently set to obey. This was the simplest way of getting the button + // to turn off the microphone for both behaviors without risking duplicate state. + // + + LLToolBarButton * command_button = NULL; + + if (commandId != LLCommandId::null) + { + LLCommand* command = LLCommandManager::instance().getCommand(commandId); + llassert(command); + + // If this command has an explicit function for execution stop + if (command->executeStopFunctionName().length() > 0) + { + command_id_map::iterator it = mButtonMap.find(commandId.uuid()); + if (it != mButtonMap.end()) + { + command_button = it->second; + llassert(command_button->mIsRunningSignal); + + // Check to see if it is running + if ((*command_button->mIsRunningSignal)(command_button, command->isRunningParameters())) + { + // Trigger an additional button commit, which calls mouse down, mouse up and commit + command_button->onCommit(); + } + } } } diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 616710ea70..ad42d1fa35 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -185,6 +185,7 @@ public: int removeCommand(const LLCommandId& commandId); // Returns the rank the removed command was at, RANK_NONE if not found bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); + bool stopCommandInProgress(const LLCommandId& commandId); void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index fdb84f1ec5..3fd7e48428 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -721,7 +721,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m // XDATA might be MASK, or S32 clicks template <typename METHOD, typename XDATA> -LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra) +LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra, bool allow_mouse_block) { BOOST_FOREACH(LLView* viewp, mChildList) { @@ -734,7 +734,7 @@ LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDA } if ((viewp->*method)( local_x, local_y, extra ) - || viewp->blockMouseEvent( local_x, local_y )) + || (allow_mouse_block && viewp->blockMouseEvent( local_x, local_y ))) { viewp->logMouseEvent(); return viewp; @@ -1021,7 +1021,7 @@ BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) { - return childrenHandleMouseEvent(&LLView::handleScrollWheel, x, y, clicks); + return childrenHandleMouseEvent(&LLView::handleScrollWheel, x, y, clicks, false); } // Called during downward traversal diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 6d1dda90af..08828e55e6 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -565,7 +565,7 @@ protected: private: template <typename METHOD, typename XDATA> - LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra); + LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra, bool allow_mouse_block = true); template <typename METHOD, typename CHARTYPE> LLView* childrenHandleCharEvent(const std::string& desc, const METHOD& method, |