diff options
-rw-r--r-- | indra/llui/lldraghandle.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lldraghandle.h | 3 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 40 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 3 | ||||
-rw-r--r-- | indra/newview/llpreviewnotecard.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llpreviewnotecard.h | 1 |
6 files changed, 50 insertions, 19 deletions
diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 832f148902..9d4e2fa495 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -248,15 +248,14 @@ void LLDragHandleTop::reshapeTitleBox() return; } const LLFontGL* font = LLFontGL::getFontSansSerif(); - S32 title_width = font->getWidth( mTitleBox->getText() ) + TITLE_HPAD; - if (getMaxTitleWidth() > 0) - title_width = llmin(title_width, getMaxTitleWidth()); + S32 title_width = getRect().getWidth(); + title_width -= 2 * LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth(); S32 title_height = llround(font->getLineHeight()); LLRect title_rect; title_rect.setLeftTopAndSize( LEFT_PAD, getRect().getHeight() - title_vpad, - getRect().getWidth() - LEFT_PAD - RIGHT_PAD, + title_width, title_height); // calls reshape on mTitleBox diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index dc5410787b..825bc9303e 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -71,6 +71,8 @@ public: BOOL getForeground() const { return mForeground; } void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); } S32 getMaxTitleWidth() const { return mMaxTitleWidth; } + void setButtonsRect(const LLRect& rect){ mButtonsRect = rect; } + LLRect getButtonsRect() { return mButtonsRect; } void setTitleVisible(BOOL visible); virtual void setTitle( const std::string& title ) = 0; @@ -88,6 +90,7 @@ protected: LLTextBox* mTitleBox; private: + LLRect mButtonsRect; S32 mDragLastScreenX; S32 mDragLastScreenY; S32 mLastMouseScreenX; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 104ae19eda..e672252a50 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -346,7 +346,7 @@ void LLFloater::layoutDragHandle() rect = getLocalRect(); } mDragHandle->setRect(rect); - updateButtons(); + updateTitleButtons(); applyTitle(); } @@ -1061,11 +1061,10 @@ void LLFloater::setMinimized(BOOL minimize) // Reshape *after* setting mMinimized reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); } - - applyTitle (); make_ui_sound("UISndWindowClose"); - updateButtons(); + updateTitleButtons(); + applyTitle (); } void LLFloater::setFocus( BOOL b ) @@ -1191,7 +1190,7 @@ void LLFloater::setHost(LLMultiFloater* host) mButtonScale = 1.f; //mButtonsEnabled[BUTTON_TEAR_OFF] = FALSE; } - updateButtons(); + updateTitleButtons(); if (host) { mHostHandle = host->getHandle(); @@ -1390,7 +1389,7 @@ void LLFloater::setCanDock(bool b) mButtonsEnabled[BUTTON_DOCK] = FALSE; } } - updateButtons(); + updateTitleButtons(); } void LLFloater::setDocked(bool docked, bool pop_on_undock) @@ -1399,7 +1398,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) { mDocked = docked; mButtonsEnabled[BUTTON_DOCK] = !mDocked; - updateButtons(); + updateTitleButtons(); storeDockStateControl(); } @@ -1452,7 +1451,7 @@ void LLFloater::onClickTearOff(LLFloater* self) } self->setTornOff(false); } - self->updateButtons(); + self->updateTitleButtons(); } // static @@ -1692,7 +1691,7 @@ void LLFloater::setCanMinimize(BOOL can_minimize) mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized(); mButtonsEnabled[BUTTON_RESTORE] = can_minimize && isMinimized(); - updateButtons(); + updateTitleButtons(); } void LLFloater::setCanClose(BOOL can_close) @@ -1700,7 +1699,7 @@ void LLFloater::setCanClose(BOOL can_close) mCanClose = can_close; mButtonsEnabled[BUTTON_CLOSE] = can_close; - updateButtons(); + updateTitleButtons(); } void LLFloater::setCanTearOff(BOOL can_tear_off) @@ -1708,7 +1707,7 @@ void LLFloater::setCanTearOff(BOOL can_tear_off) mCanTearOff = can_tear_off; mButtonsEnabled[BUTTON_TEAR_OFF] = mCanTearOff && !mHostHandle.isDead(); - updateButtons(); + updateTitleButtons(); } @@ -1732,10 +1731,11 @@ void LLFloater::setCanDrag(BOOL can_drag) } } -void LLFloater::updateButtons() +void LLFloater::updateTitleButtons() { static LLUICachedControl<S32> floater_close_box_size ("UIFloaterCloseBoxSize", 0); static LLUICachedControl<S32> close_box_from_top ("UICloseBoxFromTop", 0); + LLRect buttons_rect; S32 button_count = 0; for (S32 i = 0; i < BUTTON_COUNT; i++) { @@ -1786,6 +1786,15 @@ void LLFloater::updateButtons() llround((F32)floater_close_box_size * mButtonScale)); } + if(!buttons_rect.isValid()) + { + buttons_rect = btn_rect; + } + else + { + mDragOnLeft ? buttons_rect.mRight + btn_rect.mRight : + buttons_rect.mLeft = btn_rect.mLeft; + } mButtons[i]->setRect(btn_rect); mButtons[i]->setVisible(TRUE); // the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater @@ -1797,7 +1806,10 @@ void LLFloater::updateButtons() } } if (mDragHandle) - mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (floater_close_box_size + 1))); + { + localRectToOtherView(buttons_rect, &buttons_rect, mDragHandle); + mDragHandle->setButtonsRect(buttons_rect); + } } void LLFloater::buildButtons(const Params& floater_params) @@ -1854,7 +1866,7 @@ void LLFloater::buildButtons(const Params& floater_params) mButtons[i] = buttonp; } - updateButtons(); + updateTitleButtons(); } // static diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index d8c77370f6..403723d9d8 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -311,11 +311,12 @@ protected: virtual void onClickCloseBtn(); + virtual void updateTitleButtons(); + private: void setForeground(BOOL b); // called only by floaterview void cleanupHandles(); // remove handles to dead floaters void createMinimizeButton(); - void updateButtons(); void buildButtons(const Params& p); // Images and tooltips are named in the XML, but we want to look them diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index ee8e3f1db6..bfd9a840f2 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -38,6 +38,7 @@ #include "llagent.h" #include "llassetuploadresponders.h" +#include "lldraghandle.h" #include "llviewerwindow.h" #include "llbutton.h" #include "llfloaterreg.h" @@ -188,6 +189,20 @@ void LLPreviewNotecard::refreshFromInventory(const LLUUID& new_item_id) loadAsset(); } +void LLPreviewNotecard::updateTitleButtons() +{ + LLPreview::updateTitleButtons(); + + LLUICtrl* lock_btn = getChild<LLUICtrl>("lock"); + if(lock_btn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized. + { + LLRect lock_rc = lock_btn->getRect(); + LLRect buttons_rect = getDragHandle()->getButtonsRect(); + buttons_rect.mLeft = lock_rc.mLeft; + getDragHandle()->setButtonsRect(buttons_rect); + } +} + void LLPreviewNotecard::loadAsset() { // request the asset. diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index 5b8cf1c2f6..e0363eef54 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -79,6 +79,7 @@ public: protected: + void updateTitleButtons(); virtual void loadAsset(); bool saveIfNeeded(LLInventoryItem* copyitem = NULL); |