Setting through LLView::userSetShape now done through LLView::setShape. LLView::snappedTo renamed to LLView::setSnappedTo. virtual overriding of LLView::userSetShape now done through LLView::handleReshape which LLView::setShape calls.

This commit is contained in:
Shyotl
2011-07-17 19:59:30 -05:00
parent 66336e8151
commit 3e9c23e43b
15 changed files with 67 additions and 54 deletions

View File

@@ -255,7 +255,8 @@ void LLDragHandleTop::reshapeTitleBox()
getRect().getWidth() - LEFT_PAD - RIGHT_PAD, getRect().getWidth() - LEFT_PAD - RIGHT_PAD,
title_height); title_height);
getTitleBox()->setRect( title_rect ); // calls reshape on mTitleBox
getTitleBox()->setShape( title_rect );
} }
void LLDragHandleTop::reshape(S32 width, S32 height, BOOL called_from_parent) void LLDragHandleTop::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -337,14 +338,14 @@ BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask)
LLView* snap_view = getParent()->findSnapRect(new_rect, mouse_dir, SNAP_PARENT_AND_SIBLINGS, sSnapMargin); LLView* snap_view = getParent()->findSnapRect(new_rect, mouse_dir, SNAP_PARENT_AND_SIBLINGS, sSnapMargin);
getParent()->snappedTo(snap_view); getParent()->setSnappedTo(snap_view);
delta_x = new_rect.mLeft - pre_snap_x; delta_x = new_rect.mLeft - pre_snap_x;
delta_y = new_rect.mBottom - pre_snap_y; delta_y = new_rect.mBottom - pre_snap_y;
translated_rect.translate(delta_x, delta_y); translated_rect.translate(delta_x, delta_y);
// restore original rect so delta are detected, then call user reshape method to handle snapped floaters, etc // restore original rect so delta are detected, then call user reshape method to handle snapped floaters, etc
getParent()->setRect(original_rect); getParent()->setRect(original_rect);
getParent()->userSetShape(translated_rect); getParent()->setShape(translated_rect,true);
mDragLastScreenX += delta_x; mDragLastScreenX += delta_x;
mDragLastScreenY += delta_y; mDragLastScreenY += delta_y;

View File

@@ -763,7 +763,7 @@ BOOL LLFloater::canSnapTo(const LLView* other_view)
return LLPanel::canSnapTo(other_view); return LLPanel::canSnapTo(other_view);
} }
void LLFloater::snappedTo(const LLView* snap_view) void LLFloater::setSnappedTo(const LLView* snap_view)
{ {
if (!snap_view || snap_view == getParent()) if (!snap_view || snap_view == getParent())
{ {
@@ -780,10 +780,10 @@ void LLFloater::snappedTo(const LLView* snap_view)
} }
} }
void LLFloater::userSetShape(const LLRect& new_rect) void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
{ {
const LLRect old_rect = getRect(); const LLRect old_rect = getRect();
LLView::userSetShape(new_rect); LLView::handleReshape(new_rect, by_user);
// if not minimized, adjust all snapped dependents to new shape // if not minimized, adjust all snapped dependents to new shape
if (!isMinimized()) if (!isMinimized())
@@ -818,7 +818,7 @@ void LLFloater::userSetShape(const LLRect& new_rect)
delta_y += new_rect.mBottom - old_rect.mBottom; delta_y += new_rect.mBottom - old_rect.mBottom;
dependent_rect.translate(delta_x, delta_y); dependent_rect.translate(delta_x, delta_y);
floaterp->userSetShape(dependent_rect); floaterp->setShape(dependent_rect, by_user);
} }
} }
} }
@@ -2274,11 +2274,11 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
// floater is hosted elsewhere, so ignore // floater is hosted elsewhere, so ignore
return; return;
} }
S32 screen_width = getSnapRect().getWidth(); LLRect::tCoordType screen_width = getSnapRect().getWidth();
S32 screen_height = getSnapRect().getHeight(); LLRect::tCoordType screen_height = getSnapRect().getHeight();
// convert to local coordinate frame
LLRect snap_rect_local = getLocalSnapRect();
// only automatically resize non-minimized, resizable floaters
if( floater->isResizable() && !floater->isMinimized() ) if( floater->isResizable() && !floater->isMinimized() )
{ {
LLRect view_rect = floater->getRect(); LLRect view_rect = floater->getRect();
@@ -2302,7 +2302,11 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
new_width = llmax(new_width, min_width); new_width = llmax(new_width, min_width);
new_height = llmax(new_height, min_height); new_height = llmax(new_height, min_height);
floater->reshape( new_width, new_height, TRUE ); LLRect new_rect;
new_rect.setLeftTopAndSize(view_rect.mLeft,view_rect.mTop,new_width, new_height);
floater->setShape(new_rect);
if (floater->followsRight()) if (floater->followsRight())
{ {
floater->translate(old_width - new_width, 0); floater->translate(old_width - new_width, 0);
@@ -2316,7 +2320,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
} }
// move window fully onscreen // move window fully onscreen
if (floater->translateIntoRect( snap_rect_local, allow_partial_outside )) if (floater->translateIntoRect( getLocalSnapRect(), allow_partial_outside ))
{ {
floater->clearSnapTarget(); floater->clearSnapTarget();
} }

View File

@@ -128,9 +128,9 @@ public:
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
void initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open = TRUE); void initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open = TRUE);
/*virtual*/ void userSetShape(const LLRect& new_rect); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
/*virtual*/ BOOL canSnapTo(const LLView* other_view); /*virtual*/ BOOL canSnapTo(const LLView* other_view);
/*virtual*/ void snappedTo(const LLView* snap_view); /*virtual*/ void setSnappedTo(const LLView* snap_view);
/*virtual*/ void setFocus( BOOL b ); /*virtual*/ void setFocus( BOOL b );
/*virtual*/ void setIsChrome(BOOL is_chrome); /*virtual*/ void setIsChrome(BOOL is_chrome);

View File

@@ -506,7 +506,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
// override rectangle with embedding parameters as provided // override rectangle with embedding parameters as provided
createRect(node, new_rect, parent); createRect(node, new_rect, parent);
setOrigin(new_rect.mLeft, new_rect.mBottom); setOrigin(new_rect.mLeft, new_rect.mBottom);
reshape(new_rect.getWidth(), new_rect.getHeight()); setShape(new_rect);
// optionally override follows flags from including nodes // optionally override follows flags from including nodes
parseFollowsFlags(node); parseFollowsFlags(node);
} }

View File

@@ -185,30 +185,31 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
if (mSnappingEnabled) if (mSnappingEnabled)
{ {
static LLCachedControl<S32> snap_margin (*LLUI::sConfigGroup,"SnapMargin", 0);
switch( mSide ) switch( mSide )
{ {
case LEFT: case LEFT:
snap_view = mResizingView->findSnapEdge(scaled_rect.mLeft, mouse_dir, SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); snap_view = mResizingView->findSnapEdge(scaled_rect.mLeft, mouse_dir, SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, snap_margin);
break; break;
case TOP: case TOP:
snap_view = mResizingView->findSnapEdge(scaled_rect.mTop, mouse_dir, SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); snap_view = mResizingView->findSnapEdge(scaled_rect.mTop, mouse_dir, SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, snap_margin);
break; break;
case RIGHT: case RIGHT:
snap_view = mResizingView->findSnapEdge(scaled_rect.mRight, mouse_dir, SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); snap_view = mResizingView->findSnapEdge(scaled_rect.mRight, mouse_dir, SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, snap_margin);
break; break;
case BOTTOM: case BOTTOM:
snap_view = mResizingView->findSnapEdge(scaled_rect.mBottom, mouse_dir, SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); snap_view = mResizingView->findSnapEdge(scaled_rect.mBottom, mouse_dir, SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, snap_margin);
break; break;
} }
} }
// register "snap" behavior with snapped view // register "snap" behavior with snapped view
mResizingView->snappedTo(snap_view); mResizingView->setSnappedTo(snap_view);
// restore original rectangle so the appropriate changes are detected // restore original rectangle so the appropriate changes are detected
mResizingView->setRect(orig_rect); mResizingView->setRect(orig_rect);
// change view shape as user operation // change view shape as user operation
mResizingView->userSetShape(scaled_rect); mResizingView->setShape(scaled_rect, true);
// update last valid mouse cursor position based on resized view's actual size // update last valid mouse cursor position based on resized view's actual size
LLRect new_rect = mResizingView->getRect(); LLRect new_rect = mResizingView->getRect();
@@ -284,7 +285,7 @@ BOOL LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask)
break; break;
} }
mResizingView->userSetShape(scaled_rect); mResizingView->setShape(scaled_rect,true);
} }
return TRUE; return TRUE;

View File

@@ -205,36 +205,37 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
LLView* snap_view = NULL; LLView* snap_view = NULL;
LLView* test_view = NULL; LLView* test_view = NULL;
static LLCachedControl<S32> snap_margin (*LLUI::sConfigGroup,"SnapMargin", 0);
// now do snapping // now do snapping
switch(mCorner) switch(mCorner)
{ {
case LEFT_TOP: case LEFT_TOP:
snap_view = resizing_view->findSnapEdge(scaled_rect.mLeft, mouse_dir, SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); snap_view = resizing_view->findSnapEdge(scaled_rect.mLeft, mouse_dir, SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, snap_margin);
test_view = resizing_view->findSnapEdge(scaled_rect.mTop, mouse_dir, SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); test_view = resizing_view->findSnapEdge(scaled_rect.mTop, mouse_dir, SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, snap_margin);
if (!snap_view) if (!snap_view)
{ {
snap_view = test_view; snap_view = test_view;
} }
break; break;
case LEFT_BOTTOM: case LEFT_BOTTOM:
snap_view = resizing_view->findSnapEdge(scaled_rect.mLeft, mouse_dir, SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); snap_view = resizing_view->findSnapEdge(scaled_rect.mLeft, mouse_dir, SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, snap_margin);
test_view = resizing_view->findSnapEdge(scaled_rect.mBottom, mouse_dir, SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); test_view = resizing_view->findSnapEdge(scaled_rect.mBottom, mouse_dir, SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, snap_margin);
if (!snap_view) if (!snap_view)
{ {
snap_view = test_view; snap_view = test_view;
} }
break; break;
case RIGHT_TOP: case RIGHT_TOP:
snap_view = resizing_view->findSnapEdge(scaled_rect.mRight, mouse_dir, SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); snap_view = resizing_view->findSnapEdge(scaled_rect.mRight, mouse_dir, SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, snap_margin);
test_view = resizing_view->findSnapEdge(scaled_rect.mTop, mouse_dir, SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); test_view = resizing_view->findSnapEdge(scaled_rect.mTop, mouse_dir, SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, snap_margin);
if (!snap_view) if (!snap_view)
{ {
snap_view = test_view; snap_view = test_view;
} }
break; break;
case RIGHT_BOTTOM: case RIGHT_BOTTOM:
snap_view = resizing_view->findSnapEdge(scaled_rect.mRight, mouse_dir, SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); snap_view = resizing_view->findSnapEdge(scaled_rect.mRight, mouse_dir, SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, snap_margin);
test_view = resizing_view->findSnapEdge(scaled_rect.mBottom, mouse_dir, SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, LLUI::sConfigGroup->getS32("SnapMargin")); test_view = resizing_view->findSnapEdge(scaled_rect.mBottom, mouse_dir, SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, snap_margin);
if (!snap_view) if (!snap_view)
{ {
snap_view = test_view; snap_view = test_view;
@@ -243,13 +244,13 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
} }
// register "snap" behavior with snapped view // register "snap" behavior with snapped view
resizing_view->snappedTo(snap_view); resizing_view->setSnappedTo(snap_view);
// reset parent rect // reset parent rect
resizing_view->setRect(orig_rect); resizing_view->setRect(orig_rect);
// translate and scale to new shape // translate and scale to new shape
resizing_view->userSetShape(scaled_rect); resizing_view->setShape(scaled_rect,true);
// update last valid mouse cursor position based on resized view's actual size // update last valid mouse cursor position based on resized view's actual size
LLRect new_rect = resizing_view->getRect(); LLRect new_rect = resizing_view->getRect();

View File

@@ -3833,7 +3833,7 @@ BOOL LLColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask)
// reshape column to max content width // reshape column to max content width
LLRect column_rect = getRect(); LLRect column_rect = getRect();
column_rect.mRight = column_rect.mLeft + mColumn->mMaxContentWidth; column_rect.mRight = column_rect.mLeft + mColumn->mMaxContentWidth;
userSetShape(column_rect); setShape(column_rect,true);
} }
else else
{ {
@@ -4045,7 +4045,7 @@ LLView* LLColumnHeader::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_d
return this; return this;
} }
void LLColumnHeader::userSetShape(const LLRect& new_rect) void LLColumnHeader::handleReshape(const LLRect& new_rect, bool by_user)
{ {
S32 new_width = new_rect.getWidth(); S32 new_width = new_rect.getWidth();
S32 delta_width = new_width - (getRect().getWidth() /*+ mColumn->mParentCtrl->getColumnPadding()*/); S32 delta_width = new_width - (getRect().getWidth() /*+ mColumn->mParentCtrl->getColumnPadding()*/);

View File

@@ -271,7 +271,7 @@ public:
/*virtual*/ void showList(); /*virtual*/ void showList();
/*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding); /*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding);
/*virtual*/ void userSetShape(const LLRect& new_rect); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
void setImage(const std::string &image_name); void setImage(const std::string &image_name);
void setImageOverlay(const std::string &overlay_image, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); void setImageOverlay(const std::string &overlay_image, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);

View File

@@ -678,7 +678,7 @@ BOOL LLView::canSnapTo(const LLView* other_view)
} }
// virtual // virtual
void LLView::snappedTo(const LLView* snap_view) void LLView::setSnappedTo(const LLView* snap_view)
{ {
} }
@@ -2135,7 +2135,12 @@ const LLCtrlQuery & LLView::getFocusRootsQuery()
} }
void LLView::userSetShape(const LLRect& new_rect) void LLView::setShape(const LLRect& new_rect, bool by_user)
{
handleReshape(new_rect, by_user);
}
void LLView::handleReshape(const LLRect& new_rect, bool by_user)
{ {
reshape(new_rect.getWidth(), new_rect.getHeight()); reshape(new_rect.getWidth(), new_rect.getHeight());
translate(new_rect.mLeft - getRect().mLeft, new_rect.mBottom - getRect().mBottom); translate(new_rect.mLeft - getRect().mLeft, new_rect.mBottom - getRect().mBottom);

View File

@@ -104,14 +104,14 @@ virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
LLUICtrl, et. al. LLUICtrl, et. al.
virtual void translate( S32 x, S32 y ); virtual void translate( S32 x, S32 y );
LLMenuGL LLMenuGL
virtual void userSetShape(const LLRect& new_rect); virtual void handleReshape(const LLRect& new_rect, bool by_user = false);
LLFloater, LLScrollLIstVtrl LLFloater, LLScrollLIstVtrl
virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0); virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0);
virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0); virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0);
LLScrollListCtrl LLScrollListCtrl
virtual BOOL canSnapTo(const LLView* other_view) { return other_view != this && other_view->getVisible(); } virtual BOOL canSnapTo(const LLView* other_view) { return other_view != this && other_view->getVisible(); }
LLFloater LLFloater
virtual void snappedTo(const LLView* snap_view) {} virtual void setSnappedTo(const LLView* snap_view) {}
LLFloater LLFloater
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
* *
@@ -389,13 +389,13 @@ public:
BOOL translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside ); BOOL translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside );
void centerWithin(const LLRect& bounds); void centerWithin(const LLRect& bounds);
virtual void userSetShape(const LLRect& new_rect); void setShape(const LLRect& new_rect, bool by_user = false);
virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0); virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0);
virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0); virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0);
virtual BOOL canSnapTo(const LLView* other_view); virtual BOOL canSnapTo(const LLView* other_view);
virtual void snappedTo(const LLView* snap_view); virtual void setSnappedTo(const LLView* snap_view);
// inherited from LLFocusableElement // inherited from LLFocusableElement
/* virtual */ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); /* virtual */ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
@@ -586,7 +586,7 @@ public:
static BOOL deleteViewByHandle(LLHandle<LLView> handle); static BOOL deleteViewByHandle(LLHandle<LLView> handle);
static LLWindow* getWindow(void) { return LLUI::sWindow; } static LLWindow* getWindow(void) { return LLUI::sWindow; }
virtual void handleReshape(const LLRect& rect, bool by_user);
protected: protected:
virtual BOOL handleKeyHere(KEY key, MASK mask); virtual BOOL handleKeyHere(KEY key, MASK mask);
virtual BOOL handleUnicodeCharHere(llwchar uni_char); virtual BOOL handleUnicodeCharHere(llwchar uni_char);

View File

@@ -59,7 +59,7 @@ const S32 HUD_ARROW_SIZE = 32;
LLHUDView::LLHUDView(const LLRect& r) LLHUDView::LLHUDView(const LLRect& r)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_hud.xml"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_hud.xml");
userSetShape(r); setShape(r,true);
} }
LLHUDView::~LLHUDView() LLHUDView::~LLHUDView()

View File

@@ -368,7 +368,7 @@ void LLPanelMediaHUD::updateShape()
media_hud_rect.setCenterAndSize(media_hud_rect.getCenterX(), media_hud_rect.getCenterY(), media_hud_rect.setCenterAndSize(media_hud_rect.getCenterX(), media_hud_rect.getCenterY(),
llmax(MIN_HUD_WIDTH, media_hud_rect.getWidth()), llmax(MIN_HUD_HEIGHT, media_hud_rect.getHeight())); llmax(MIN_HUD_WIDTH, media_hud_rect.getWidth()), llmax(MIN_HUD_HEIGHT, media_hud_rect.getHeight()));
userSetShape(media_hud_rect); setShape(media_hud_rect);
// Test mouse position to see if the cursor is stationary // Test mouse position to see if the cursor is stationary
LLCoordWindow cursor_pos_window; LLCoordWindow cursor_pos_window;

View File

@@ -530,13 +530,14 @@ LLPreview* LLPreview::getFirstPreviewForSource(const LLUUID& source_id)
return NULL; return NULL;
} }
void LLPreview::userSetShape(const LLRect& new_rect) void LLPreview::handleReshape(const LLRect& new_rect, bool by_user)
{ {
if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()) if(by_user
&& (new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()))
{ {
userResized(); userResized();
} }
LLFloater::userSetShape(new_rect); LLFloater::handleReshape(new_rect, by_user);
} }
// //
@@ -559,14 +560,14 @@ void LLMultiPreview::open() /*Flawfinder: ignore*/
} }
void LLMultiPreview::userSetShape(const LLRect& new_rect) void LLMultiPreview::handleReshape(const LLRect& new_rect, bool by_user)
{ {
if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()) if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight())
{ {
LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel(); LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel();
if (frontmost_preview) frontmost_preview->userResized(); if (frontmost_preview) frontmost_preview->userResized();
} }
LLFloater::userSetShape(new_rect); LLFloater::handleReshape(new_rect, by_user);
} }

View File

@@ -53,7 +53,7 @@ public:
/*virtual*/void open(); /*Flawfinder: ignore*/ /*virtual*/void open(); /*Flawfinder: ignore*/
/*virtual*/void tabOpen(LLFloater* opened_floater, bool from_click); /*virtual*/void tabOpen(LLFloater* opened_floater, bool from_click);
/*virtual*/ void userSetShape(const LLRect& new_rect); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
static LLMultiPreview* getAutoOpenInstance(const LLUUID& id); static LLMultiPreview* getAutoOpenInstance(const LLUUID& id);
static void setAutoOpenInstance(LLMultiPreview* previewp, const LLUUID& id); static void setAutoOpenInstance(LLMultiPreview* previewp, const LLUUID& id);
@@ -110,7 +110,7 @@ public:
void addKeepDiscardButtons(); void addKeepDiscardButtons();
static void onKeepBtn(void* data); static void onKeepBtn(void* data);
static void onDiscardBtn(void* data); static void onDiscardBtn(void* data);
/*virtual*/ void userSetShape(const LLRect& new_rect); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
void userResized() { mUserResized = TRUE; }; void userResized() { mUserResized = TRUE; };

View File

@@ -3069,7 +3069,7 @@ BOOL LLViewerWindow::handlePerFrameHover()
LLRect notify_box_rect = gNotifyBoxView->getRect(); LLRect notify_box_rect = gNotifyBoxView->getRect();
notify_box_rect.mBottom = bar_rect.mBottom; notify_box_rect.mBottom = bar_rect.mBottom;
gNotifyBoxView->reshape(notify_box_rect.getWidth(), notify_box_rect.getHeight()); gNotifyBoxView->reshape(notify_box_rect.getWidth(), notify_box_rect.getHeight());
gNotifyBoxView->setRect(notify_box_rect); gNotifyBoxView->setShape(notify_box_rect);
// make sure floaters snap to visible rect by adjusting floater view rect // make sure floaters snap to visible rect by adjusting floater view rect
LLRect floater_rect = gFloaterView->getRect(); LLRect floater_rect = gFloaterView->getRect();
@@ -3079,7 +3079,7 @@ BOOL LLViewerWindow::handlePerFrameHover()
// Don't bounce the floaters up and down. // Don't bounce the floaters up and down.
gFloaterView->reshapeFloater(floater_rect.getWidth(), floater_rect.getHeight(), gFloaterView->reshapeFloater(floater_rect.getWidth(), floater_rect.getHeight(),
TRUE, ADJUST_VERTICAL_NO); TRUE, ADJUST_VERTICAL_NO);
gFloaterView->setRect(floater_rect); gFloaterView->setShape(floater_rect);
} }
// snap floaters to top of chat bar/button strip // snap floaters to top of chat bar/button strip