diff options
author | Steven Bennetts <steve@lindenlab.com> | 2007-03-02 19:11:06 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2007-03-02 19:11:06 +0000 |
commit | d4462963c6ba5db2088723bbedc7b60f1184c594 (patch) | |
tree | 34aaba4b31f93388b0ce3b2b36e9c49823bec2cf /indra/llui | |
parent | b53c377727d216cb277ba14ba4c73b9b9bb96b32 (diff) |
merge -r 58503:58641 maintenance -> release
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfloater.cpp | 120 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 8 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 1 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 29 | ||||
-rw-r--r-- | indra/llui/llview.h | 6 |
5 files changed, 60 insertions, 104 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index b56ae5167b..3b855a6360 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -487,17 +487,6 @@ void LLFloater::setVisible( BOOL visible ) } } -LLView* LLFloater::getRootMostFastFrameView() -{ - // trying to render a background floater in a fast frame, abort!!! - //if (!isFrontmost()) - //{ - // gViewerWindow->finishFastFrame(); - //} - - return LLView::getRootMostFastFrameView(); -} - void LLFloater::open() /* Flawfinder: ignore */ { //RN: for now, we don't allow rehosting from one multifloater to another @@ -673,7 +662,7 @@ const LLString& LLFloater::getTitle() const void LLFloater::translate(S32 x, S32 y) { - LLView::translate(x, y); + LLPanel::translate(x, y); if (x != 0 || y != 0) { @@ -703,7 +692,7 @@ BOOL LLFloater::canSnapTo(LLView* other_view) } } - return LLView::canSnapTo(other_view); + return LLPanel::canSnapTo(other_view); } void LLFloater::snappedTo(LLView* snap_view) @@ -1194,9 +1183,9 @@ void LLFloater::onClickTearOff(void *userdata) self->open(); /* Flawfinder: ignore */ self->setRect(new_rect); gFloaterView->adjustToFitScreen(self, FALSE); - self->setCanDrag(TRUE); - self->setCanResize(TRUE); - self->setCanMinimize(TRUE); + self->setCanDrag(TRUE); + // give focus to new window to keep continuity for the user + self->setFocus(TRUE); } else //Attach to parent. { @@ -1347,6 +1336,17 @@ void LLFloater::draw() focused_child->setVisible(TRUE); } drawChild(focused_child); + + // update tearoff button for torn off floaters + // when last host goes away + if (mCanTearOff && !getHost()) + { + LLFloater* old_host = gFloaterView->getFloaterByHandle(mLastHostHandle); + if (!old_host) + { + setCanTearOff(FALSE); + } + } } } @@ -2453,31 +2453,12 @@ LLString LLMultiFloater::getWidgetTag() const return LL_MULTI_FLOATER_TAG; } -void LLMultiFloater::init(const LLString& title, BOOL resizable, - S32 min_width, S32 min_height, BOOL drag_on_left, - BOOL minimizable, BOOL close_btn) -{ - LLFloater::init(title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); - - /*mTabContainer = new LLTabContainer("Preview Tabs", - LLRect(LLPANEL_BORDER_WIDTH, mRect.getHeight() - LLFLOATER_HEADER_SIZE, mRect.getWidth() - LLPANEL_BORDER_WIDTH, 0), - mTabPos, - NULL, - NULL); - mTabContainer->setFollowsAll(); - if (mResizable && mTabPos == LLTabContainerCommon::BOTTOM) - { - mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH); - } - - addChild(mTabContainer);*/ -} - void LLMultiFloater::open() /* Flawfinder: ignore */ { if (mTabContainer->getTabCount() > 0) { LLFloater::open(); /* Flawfinder: ignore */ + resizeToContents(); } else { @@ -2549,16 +2530,9 @@ void LLMultiFloater::growToFit(LLFloater* floaterp, S32 width, S32 height) // store new width and height with this floater so that it will keep its size when detached found_data_it->second.mWidth = width; found_data_it->second.mHeight = height; - - S32 cur_height = mRect.getHeight(); - reshape(llmax(mRect.getWidth(), width + LLPANEL_BORDER_WIDTH * 2), llmax(mRect.getHeight(), height + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT + (LLPANEL_BORDER_WIDTH * 2))); - - // make sure upper left corner doesn't move - translate(0, mRect.getHeight() - cur_height); - - // Try to keep whole view onscreen, don't allow partial offscreen. - gFloaterView->adjustToFitScreen(this, FALSE); } + + resizeToContents(); } /** @@ -2699,24 +2673,7 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp) if (mAutoResize) { - floater_data_map_t::iterator floater_it; - S32 new_width = 0; - S32 new_height = 0; - for (floater_it = mFloaterDataMap.begin(); floater_it != mFloaterDataMap.end(); ++floater_it) - { - new_width = llmax(new_width, floater_it->second.mWidth + LLPANEL_BORDER_WIDTH * 2); - new_height = llmax(new_height, floater_it->second.mHeight + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); - } - - S32 cur_height = mRect.getHeight(); - - reshape(new_width, new_height); - - // make sure upper left corner doesn't move - translate(0, cur_height - new_height); - - // Try to keep whole view onscreen, don't allow partial offscreen. - gFloaterView->adjustToFitScreen(this, FALSE); + resizeToContents(); } tabOpen((LLFloater*)mTabContainer->getCurrentPanel(), false); @@ -2858,6 +2815,43 @@ BOOL LLMultiFloater::postBuild() return FALSE; } +void LLMultiFloater::resizeToContents() +{ + // we're already in the middle of a reshape, don't interrupt it + floater_data_map_t::iterator floater_it; + S32 new_width = 0; + S32 new_height = 0; + for (floater_it = mFloaterDataMap.begin(); floater_it != mFloaterDataMap.end(); ++floater_it) + { + new_width = llmax(new_width, floater_it->second.mWidth + LLPANEL_BORDER_WIDTH * 2); + new_height = llmax(new_height, floater_it->second.mHeight + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); + } + + S32 new_min_width = 0; + S32 new_min_height = 0; + S32 tab_idx; + for (tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) + { + LLFloater* floaterp = (LLFloater*)mTabContainer->getPanelByIndex(tab_idx); + if (floaterp) + { + new_min_width = llmax(new_min_width, floaterp->getMinWidth() + LLPANEL_BORDER_WIDTH * 2); + new_min_height = llmax(new_min_height, floaterp->getMinHeight() + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); + } + } + setResizeLimits(new_min_width, new_min_height); + + S32 cur_height = mRect.getHeight(); + + reshape(new_width, new_height); + + // make sure upper left corner doesn't move + translate(0, cur_height - new_height); + + // Try to keep whole view onscreen, don't allow partial offscreen. + gFloaterView->adjustToFitScreen(this, FALSE); +} + // virtual LLXMLNodePtr LLFloater::getXML(bool save_children) const { diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 05e513ed1d..79483db297 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -181,8 +181,6 @@ public: void clearSnapTarget() { mSnappedTo.markDead(); } LLViewHandle getSnapTarget() { return mSnappedTo; } - /*virtual*/ LLView* getRootMostFastFrameView(); - static void closeFocusedFloater(); static void onClickClose(void *userdata); @@ -341,10 +339,6 @@ public: LLMultiFloater(const LLString& name, const LLString& rect_control, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = FALSE); virtual ~LLMultiFloater(); - virtual void init(const LLString& title, BOOL resizable, - S32 min_width, S32 min_height, BOOL drag_on_left, - BOOL minimizable, BOOL close_btn); - virtual BOOL postBuild(); /*virtual*/ void open(); /* Flawfinder: ignore */ /*virtual*/ void onClose(bool app_quitting); @@ -378,6 +372,8 @@ public: void setTabContainer(LLTabContainerCommon* tab_container) { if (!mTabContainer) mTabContainer = tab_container; } static void onTabSelected(void* userdata, bool); + virtual void resizeToContents(); + protected: struct LLFloaterData { diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 4c40d99178..a7c9cf0f92 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3044,7 +3044,6 @@ void LLMenuGL::setVisible(BOOL visible) mFadeTimer.stop(); } - //gViewerWindow->finishFastFrame(); LLView::setVisible(visible); } } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 8c3d2362c5..02a99b00cd 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -32,7 +32,6 @@ BOOL LLView::sDebugRects = FALSE; BOOL LLView::sDebugKeys = FALSE; S32 LLView::sDepth = 0; -LLView* LLView::sFastFrameView = NULL; BOOL LLView::sDebugMouseHandling = FALSE; LLString LLView::sMouseHandlerMessage; S32 LLView::sSelectID = GL_NAME_UI_RESERVED; @@ -93,7 +92,6 @@ LLView::LLView() : mSaveToXML(TRUE), mIsFocusRoot(FALSE), mLastVisible(TRUE), - mRenderInFastFrame(TRUE), mSpanChildren(FALSE), mVisible(TRUE), mHidden(FALSE), @@ -114,7 +112,6 @@ LLView::LLView(const LLString& name, BOOL mouse_opaque) : mSaveToXML(TRUE), mIsFocusRoot(FALSE), mLastVisible(TRUE), - mRenderInFastFrame(TRUE), mSpanChildren(FALSE), mVisible(TRUE), mHidden(FALSE), @@ -138,7 +135,6 @@ LLView::LLView( mSaveToXML(TRUE), mIsFocusRoot(FALSE), mLastVisible(TRUE), - mRenderInFastFrame(TRUE), mSpanChildren(FALSE), mVisible(TRUE), mHidden(FALSE), @@ -180,11 +176,6 @@ LLView::~LLView() mParentView->removeChild(this); } - if(LLView::sFastFrameView == this) - { - LLView::sFastFrameView = NULL; - } - dispatch_list_t::iterator itor; for (itor = mDispatchList.begin(); itor != mDispatchList.end(); ++itor) { @@ -1770,26 +1761,6 @@ void LLView::localRectToScreen(const LLRect& local, LLRect* screen) const } } -LLView* LLView::getRootMostFastFrameView() -{ - if (gFocusMgr.getTopView() == this) - { - return this; - } - - if (getParent()) - { - LLView* rootmost_view = getParent()->getRootMostFastFrameView(); - if (rootmost_view) - { - return rootmost_view; - } - } - - return mRenderInFastFrame ? this : NULL; -} - - LLView* LLView::getRootView() { LLView* view = this; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 839c300476..b794c087b5 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -145,7 +145,6 @@ protected: public: LLViewHandle mViewHandle; BOOL mLastVisible; - BOOL mRenderInFastFrame; BOOL mSpanChildren; private: @@ -161,7 +160,6 @@ public: static BOOL sDebugRects; // Draw debug rects behind everything. static BOOL sDebugKeys; static S32 sDepth; - static LLView* sFastFrameView; static BOOL sDebugMouseHandling; static LLString sMouseHandlerMessage; static S32 sSelectID; @@ -319,8 +317,8 @@ public: virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual void translate( S32 x, S32 y ); + virtual void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); } BOOL translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside ); - void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); } LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0); LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0); @@ -418,8 +416,6 @@ public: virtual void localRectToScreen( const LLRect& local, LLRect* screen ) const; virtual BOOL localRectToOtherView( const LLRect& local, LLRect* other, LLView* other_view ) const; - void setRenderInFastFrame(BOOL render) { mRenderInFastFrame = render; } - virtual LLView* getRootMostFastFrameView(); static LLWindow* getWindow(void); |