From a5e4b15b7d29a64781eb32ef71e557a5bb8dc870 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 23 Feb 2012 21:02:46 +0200 Subject: Linux build fix. Moved type casts from protected base classes to derived LLCoord. --- indra/llui/llfloater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 3afa1b8e3a..2a40bbf33c 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -3306,7 +3306,7 @@ bool LLCoordFloater::operator==(const LLCoordFloater& other) const LLCoordCommon LL_COORD_FLOATER::convertToCommon() const { - const LLCoordFloater& self = static_cast(*this); + const LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); LLFloater* floaterp = mFloater.get(); @@ -3348,7 +3348,7 @@ LLCoordCommon LL_COORD_FLOATER::convertToCommon() const void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from) { - LLCoordFloater& self = static_cast(*this); + LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); LLFloater* floaterp = mFloater.get(); S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0; -- cgit v1.2.3 From 0fc6c5df969681659b1cc20bf06e9b1f8708d7a4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 24 Feb 2012 16:54:54 -0800 Subject: EXP-1181 FIX As a designer, I would like to specify default floater positions using relative coordinates floaters given specified positions will stay in that location floaters that stack will treat that as a specified position moving any floater will switch to relative positioning mode cleaned up some XUI where widgets were relying on a default height of 10 pixels --- indra/llui/llfloater.cpp | 120 +++++++++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 52 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 2a40bbf33c..992f7e1602 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -68,7 +68,7 @@ namespace LLInitParam { void TypeValues::declareValues() { - declare("none", LLFloaterEnums::OPEN_POSITIONING_NONE); + declare("relative", LLFloaterEnums::OPEN_POSITIONING_RELATIVE); declare("cascading", LLFloaterEnums::OPEN_POSITIONING_CASCADING); declare("centered", LLFloaterEnums::OPEN_POSITIONING_CENTERED); declare("specified", LLFloaterEnums::OPEN_POSITIONING_SPECIFIED); @@ -177,9 +177,7 @@ LLFloater::Params::Params() 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"), + positioning("positioning", LLFloaterEnums::OPEN_POSITIONING_RELATIVE), header_height("header_height", 0), legacy_header_height("legacy_header_height", 0), close_image("close_image"), @@ -249,9 +247,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mCanClose(p.can_close), mDragOnLeft(p.can_drag_on_left), mResizable(p.can_resize), - mOpenPositioning(p.open_positioning), - mSpecifiedLeft(p.specified_left), - mSpecifiedBottom(p.specified_bottom), + mPositioning(p.positioning), mMinWidth(p.min_width), mMinHeight(p.min_height), mHeaderHeight(p.header_height), @@ -877,7 +873,7 @@ bool LLFloater::applyRectControl() { // other floaters in our group, position ourselves relative to them and don't save the rect mRectControl.clear(); - mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP; + mPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP; } else if (mRectControl.size() > 1) { @@ -914,20 +910,14 @@ bool LLFloater::applyDockState() void LLFloater::applyPositioning(LLFloater* other) { // Otherwise position according to the positioning code - switch (mOpenPositioning) + switch (mPositioning) { case LLFloaterEnums::OPEN_POSITIONING_CENTERED: center(); break; case LLFloaterEnums::OPEN_POSITIONING_SPECIFIED: - { - // Translate relative to snap rect - setOrigin(mSpecifiedLeft, mSpecifiedBottom); - const LLRect& snap_rect = gFloaterView->getSnapRect(); - translate(snap_rect.mLeft, snap_rect.mBottom); - translateIntoRect(snap_rect); - } + //translateIntoRect(gFloaterView->getSnapRect()); break; case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP: @@ -950,11 +940,25 @@ void LLFloater::applyPositioning(LLFloater* other) setOrigin(horizontal_offset, vertical_offset - rect_height); translate(snap_rect.mLeft, snap_rect.mBottom); - translateIntoRect(snap_rect); + //translateIntoRect(snap_rect); } + mPositioning = LLFloaterEnums::OPEN_POSITIONING_SPECIFIED; + setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); + break; - case LLFloaterEnums::OPEN_POSITIONING_NONE: + case LLFloaterEnums::OPEN_POSITIONING_RELATIVE: + { + LLRect snap_rect = gFloaterView->getSnapRect(); + LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); + snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); + LLRect floater_screen_rect = calcScreenRect(); + + LLCoordGL new_center = mPosition.convert(); + LLCoordGL cur_center(floater_screen_rect.getCenterX(), floater_screen_rect.getCenterY()); + translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY); + break; + } default: // Do nothing break; @@ -1072,7 +1076,9 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) if (by_user && !isMinimized()) { storeRectControl(); - mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE; + mPositioning = LLFloaterEnums::OPEN_POSITIONING_RELATIVE; + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); } // if not minimized, adjust all snapped dependents to new shape @@ -1590,7 +1596,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) if (mDocked) { setMinimized(FALSE); - mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE; + mPositioning = LLFloaterEnums::OPEN_POSITIONING_RELATIVE; } updateTitleButtons(); @@ -2164,19 +2170,14 @@ LLFloaterView::LLFloaterView (const Params& p) mSnapOffsetBottom(0), mSnapOffsetRight(0) { + mSnapView = getHandle(); } // By default, adjust vertical. void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) { - S32 old_right = mLastSnapRect.mRight; - S32 old_top = mLastSnapRect.mTop; - LLView::reshape(width, height, called_from_parent); - S32 new_right = getSnapRect().mRight; - S32 new_top = getSnapRect().mTop; - mLastSnapRect = getSnapRect(); for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) @@ -2189,35 +2190,39 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) continue; } - if (!floaterp->isMinimized()) + if (!floaterp->isMinimized() && floaterp->getCanDrag()) { - LLRect r = floaterp->getRect(); + LLRect old_rect = floaterp->getRect(); + floaterp->applyPositioning(NULL); + LLRect new_rect = floaterp->getRect(); - // Compute absolute distance from each edge of screen - S32 left_offset = llabs(r.mLeft - 0); - S32 right_offset = llabs(old_right - r.mRight); + //LLRect r = floaterp->getRect(); - S32 top_offset = llabs(old_top - r.mTop); - S32 bottom_offset = llabs(r.mBottom - 0); + //// Compute absolute distance from each edge of screen + //S32 left_offset = llabs(r.mLeft - 0); + //S32 right_offset = llabs(old_right - r.mRight); - S32 translate_x = 0; - S32 translate_y = 0; + //S32 top_offset = llabs(old_top - r.mTop); + //S32 bottom_offset = llabs(r.mBottom - 0); - if (left_offset > right_offset) - { - translate_x = new_right - old_right; - } + S32 translate_x = new_rect.mLeft - old_rect.mLeft; + S32 translate_y = new_rect.mBottom - old_rect.mBottom; - if (top_offset < bottom_offset) - { - translate_y = new_top - old_top; - } + //if (left_offset > right_offset) + //{ + // translate_x = new_right - old_right; + //} + + //if (top_offset < bottom_offset) + //{ + // translate_y = new_top - old_top; + //} // don't reposition immovable floaters - if (floaterp->getCanDrag()) - { - floaterp->translate(translate_x, translate_y); - } + //if (floaterp->getCanDrag()) + //{ + // floaterp->translate(translate_x, translate_y); + //} BOOST_FOREACH(LLHandle dependent_floater, floaterp->mDependents) { if (dependent_floater.get()) @@ -2972,7 +2977,10 @@ void LLFloater::initFromParams(const LLFloater::Params& p) LLPanel::initFromParams(p); // override any follows flags - setFollows(FOLLOWS_NONE); + if (mPositioning != LLFloaterEnums::OPEN_POSITIONING_SPECIFIED) + { + setFollows(FOLLOWS_NONE); + } mTitle = p.title; mShortTitle = p.short_title; @@ -2991,9 +2999,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) mSingleInstance = p.single_instance; mReuseInstance = p.reuse_instance.isProvided() ? p.reuse_instance : p.single_instance; - mOpenPositioning = p.open_positioning; - mSpecifiedLeft = p.specified_left; - mSpecifiedBottom = p.specified_bottom; + mPositioning = p.positioning; if (p.save_rect && mRectControl.empty()) { @@ -3113,7 +3119,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str params.rect.left.set(0); } params.from_xui = true; - applyXUILayout(params, parent); + applyXUILayout(params, parent, parent == gFloaterView ? gFloaterView->getSnapRect() : parent->getLocalRect()); initFromParams(params); initFloater(params); @@ -3272,6 +3278,9 @@ void LLFloater::stackWith(LLFloater& other) next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, getRect().getWidth(), getRect().getHeight()); setShape(next_rect); + + other.mPositioning = LLFloaterEnums::OPEN_POSITIONING_SPECIFIED; + other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater) @@ -3309,6 +3318,9 @@ LLCoordCommon LL_COORD_FLOATER::convertToCommon() const const LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); + LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); + snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); + LLFloater* floaterp = mFloater.get(); S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0; S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0; @@ -3350,6 +3362,10 @@ void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from) { LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); + LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); + snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); + + LLFloater* floaterp = mFloater.get(); S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0; S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0; -- cgit v1.2.3 From 0c7e91205f9b2fc8fe55e5a65f4bfa908d105c37 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 24 Feb 2012 16:57:12 -0800 Subject: EXP-1181 FIX As a designer, I would like to specify default floater positions using relative coordinates fixed bug where resizing window would cause stacked floaters to move relative to each other renamed positioning enums to reflect the fact that they apply all the time now, not just when opening floaters --- indra/llui/llfloater.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 992f7e1602..65bd63a187 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -68,10 +68,10 @@ namespace LLInitParam { void TypeValues::declareValues() { - declare("relative", LLFloaterEnums::OPEN_POSITIONING_RELATIVE); - declare("cascading", LLFloaterEnums::OPEN_POSITIONING_CASCADING); - declare("centered", LLFloaterEnums::OPEN_POSITIONING_CENTERED); - declare("specified", LLFloaterEnums::OPEN_POSITIONING_SPECIFIED); + declare("relative", LLFloaterEnums::POSITIONING_RELATIVE); + declare("cascading", LLFloaterEnums::POSITIONING_CASCADING); + declare("centered", LLFloaterEnums::POSITIONING_CENTERED); + declare("specified", LLFloaterEnums::POSITIONING_SPECIFIED); } } @@ -177,7 +177,7 @@ LLFloater::Params::Params() save_visibility("save_visibility", false), can_dock("can_dock", false), show_title("show_title", true), - positioning("positioning", LLFloaterEnums::OPEN_POSITIONING_RELATIVE), + positioning("positioning", LLFloaterEnums::POSITIONING_RELATIVE), header_height("header_height", 0), legacy_header_height("legacy_header_height", 0), close_image("close_image"), @@ -873,7 +873,7 @@ bool LLFloater::applyRectControl() { // other floaters in our group, position ourselves relative to them and don't save the rect mRectControl.clear(); - mPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP; + mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; } else if (mRectControl.size() > 1) { @@ -912,16 +912,16 @@ void LLFloater::applyPositioning(LLFloater* other) // Otherwise position according to the positioning code switch (mPositioning) { - case LLFloaterEnums::OPEN_POSITIONING_CENTERED: + case LLFloaterEnums::POSITIONING_CENTERED: center(); break; - case LLFloaterEnums::OPEN_POSITIONING_SPECIFIED: + case LLFloaterEnums::POSITIONING_SPECIFIED: //translateIntoRect(gFloaterView->getSnapRect()); break; - case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP: - case LLFloaterEnums::OPEN_POSITIONING_CASCADING: + case LLFloaterEnums::POSITIONING_CASCADE_GROUP: + case LLFloaterEnums::POSITIONING_CASCADING: if (other != NULL && other != this) { stackWith(*other); @@ -942,12 +942,12 @@ void LLFloater::applyPositioning(LLFloater* other) translate(snap_rect.mLeft, snap_rect.mBottom); //translateIntoRect(snap_rect); } - mPositioning = LLFloaterEnums::OPEN_POSITIONING_SPECIFIED; + mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); break; - case LLFloaterEnums::OPEN_POSITIONING_RELATIVE: + case LLFloaterEnums::POSITIONING_RELATIVE: { LLRect snap_rect = gFloaterView->getSnapRect(); LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); @@ -1076,7 +1076,7 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) if (by_user && !isMinimized()) { storeRectControl(); - mPositioning = LLFloaterEnums::OPEN_POSITIONING_RELATIVE; + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; LLRect screen_rect = calcScreenRect(); mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); } @@ -1596,7 +1596,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) if (mDocked) { setMinimized(FALSE); - mPositioning = LLFloaterEnums::OPEN_POSITIONING_RELATIVE; + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; } updateTitleButtons(); @@ -2977,7 +2977,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) LLPanel::initFromParams(p); // override any follows flags - if (mPositioning != LLFloaterEnums::OPEN_POSITIONING_SPECIFIED) + if (mPositioning != LLFloaterEnums::POSITIONING_SPECIFIED) { setFollows(FOLLOWS_NONE); } @@ -3279,7 +3279,7 @@ void LLFloater::stackWith(LLFloater& other) setShape(next_rect); - other.mPositioning = LLFloaterEnums::OPEN_POSITIONING_SPECIFIED; + other.mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } -- cgit v1.2.3 From fbfad41587a8ba723348eb848a7366f02da87052 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 27 Feb 2012 13:06:10 -0800 Subject: EXP-1181 FIX As a designer, I would like to specify default floater positions using relative coordinates store and load floater relative positions --- indra/llui/llfloater.cpp | 96 ++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 39 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 65bd63a187..b23230bdd4 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -543,10 +543,18 @@ LLFloater::~LLFloater() void LLFloater::storeRectControl() { - if( mRectControl.size() > 1 ) + if (!mRectControl.empty()) { getControlGroup()->setRect( mRectControl, getRect() ); } + if (!mPosXControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE) + { + getControlGroup()->setF32( mPosXControl, mPosition.mX ); + } + if (!mPosYControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE) + { + getControlGroup()->setF32( mPosYControl, mPosition.mY ); + } } void LLFloater::storeVisibilityControl() @@ -565,23 +573,6 @@ void LLFloater::storeDockStateControl() } } -LLRect LLFloater::getSavedRect() const -{ - LLRect rect; - - if (mRectControl.size() > 1) - { - rect = getControlGroup()->getRect(mRectControl); - } - - return rect; -} - -bool LLFloater::hasSavedRect() const -{ - return !getSavedRect().isEmpty(); -} - // static std::string LLFloater::getControlName(const std::string& name, const LLSD& key) { @@ -875,18 +866,39 @@ bool LLFloater::applyRectControl() mRectControl.clear(); mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; } - else if (mRectControl.size() > 1) + else { - // If we have a saved rect, use it - const LLRect& rect = getControlGroup()->getRect(mRectControl); - saved_rect = rect.notEmpty(); - if (saved_rect) + if (!mRectControl.empty()) { - setOrigin(rect.mLeft, rect.mBottom); + // If we have a saved rect, use it + const LLRect& rect = getControlGroup()->getRect(mRectControl); + if (rect.notEmpty()) saved_rect = true; + if (saved_rect) + { + setOrigin(rect.mLeft, rect.mBottom); - if (mResizable) + if (mResizable) + { + reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); + } + } + } + + if (!mPosXControl.empty() && !mPosYControl.empty()) + { + LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); + LLControlVariablePtr y_control = getControlGroup()->getControl(mPosYControl); + if (x_control.notNull() + && y_control.notNull() + && !x_control->isDefault() + && !y_control->isDefault()) { - reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); + mPosition.mX = x_control->getValue().asReal(); + mPosition.mY = y_control->getValue().asReal(); + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; + applyRelativePosition(); + + saved_rect = true; } } } @@ -949,14 +961,8 @@ void LLFloater::applyPositioning(LLFloater* other) case LLFloaterEnums::POSITIONING_RELATIVE: { - LLRect snap_rect = gFloaterView->getSnapRect(); - LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); - snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); - LLRect floater_screen_rect = calcScreenRect(); + applyRelativePosition(); - LLCoordGL new_center = mPosition.convert(); - LLCoordGL cur_center(floater_screen_rect.getCenterX(), floater_screen_rect.getCenterY()); - translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY); break; } default: @@ -1630,7 +1636,7 @@ void LLFloater::onClickTearOff(LLFloater* self) self->openFloater(self->getKey()); // only force position for floaters that don't have that data saved - if (self->mRectControl.size() <= 1) + if (self->mRectControl.empty()) { new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - floater_header_size - 5, self->getRect().getWidth(), self->getRect().getHeight()); self->setRect(new_rect); @@ -2918,9 +2924,11 @@ void LLFloater::setInstanceName(const std::string& name) std::string ctrl_name = getControlName(mInstanceName, mKey); // save_rect and save_visibility only apply to registered floaters - if (!mRectControl.empty()) + if (mSaveRect) { mRectControl = LLFloaterReg::declareRectControl(ctrl_name); + mPosXControl = LLFloaterReg::declarePosXControl(ctrl_name); + mPosYControl = LLFloaterReg::declarePosYControl(ctrl_name); } if (!mVisibilityControl.empty()) { @@ -3001,10 +3009,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) mPositioning = p.positioning; - if (p.save_rect && mRectControl.empty()) - { - mRectControl = "t"; // flag to build mRectControl name once mInstanceName is set - } + mSaveRect = p.save_rect; if (p.save_visibility) { mVisibilityControl = "t"; // flag to build mVisibilityControl name once mInstanceName is set @@ -3283,6 +3288,19 @@ void LLFloater::stackWith(LLFloater& other) other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } +void LLFloater::applyRelativePosition() +{ + LLRect snap_rect = gFloaterView->getSnapRect(); + LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); + snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); + LLRect floater_screen_rect = calcScreenRect(); + + LLCoordGL new_center = mPosition.convert(); + LLCoordGL cur_center(floater_screen_rect.getCenterX(), floater_screen_rect.getCenterY()); + translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY); +} + + LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater) : coord_t(x, y) { -- cgit v1.2.3 From 80f2548371328f6fa1936ecc03a85a09f1b19508 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 28 Feb 2012 13:45:36 -0800 Subject: EXP-1918 FIX Floaters that are stacked are not offset EXP-1919 FIX Resizing viewer window with minimized floaters can result in floaters appearing off screen when un-minimized --- indra/llui/llfloater.cpp | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index b23230bdd4..f49b4edb98 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -850,7 +850,7 @@ void LLFloater::applyControlsAndPosition(LLFloater* other) { if (!applyRectControl()) { - applyPositioning(other); + applyPositioning(other, true); } } } @@ -919,7 +919,7 @@ bool LLFloater::applyDockState() return docked; } -void LLFloater::applyPositioning(LLFloater* other) +void LLFloater::applyPositioning(LLFloater* other, bool on_open) { // Otherwise position according to the positioning code switch (mPositioning) @@ -934,29 +934,30 @@ void LLFloater::applyPositioning(LLFloater* other) case LLFloaterEnums::POSITIONING_CASCADE_GROUP: case LLFloaterEnums::POSITIONING_CASCADING: - if (other != NULL && other != this) + if (on_open) { - stackWith(*other); - } - else - { - static const U32 CASCADING_FLOATER_HOFFSET = 0; - static const U32 CASCADING_FLOATER_VOFFSET = 0; + if (other != NULL && other != this) + { + stackWith(*other); + } + else + { + static const U32 CASCADING_FLOATER_HOFFSET = 0; + static const U32 CASCADING_FLOATER_VOFFSET = 0; - const LLRect& snap_rect = gFloaterView->getSnapRect(); + const LLRect& snap_rect = gFloaterView->getSnapRect(); - const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET; - const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET; + const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET; + const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET; - S32 rect_height = getRect().getHeight(); - setOrigin(horizontal_offset, vertical_offset - rect_height); + S32 rect_height = getRect().getHeight(); + setOrigin(horizontal_offset, vertical_offset - rect_height); - translate(snap_rect.mLeft, snap_rect.mBottom); - //translateIntoRect(snap_rect); + translate(snap_rect.mLeft, snap_rect.mBottom); + } + //mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; + setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); } - mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; - setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); - break; case LLFloaterEnums::POSITIONING_RELATIVE: @@ -1262,6 +1263,7 @@ void LLFloater::setMinimized(BOOL minimize) // Reshape *after* setting mMinimized reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); + applyPositioning(NULL, false); } make_ui_sound("UISndWindowClose"); @@ -2199,7 +2201,7 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) if (!floaterp->isMinimized() && floaterp->getCanDrag()) { LLRect old_rect = floaterp->getRect(); - floaterp->applyPositioning(NULL); + floaterp->applyPositioning(NULL, false); LLRect new_rect = floaterp->getRect(); //LLRect r = floaterp->getRect(); @@ -3284,7 +3286,7 @@ void LLFloater::stackWith(LLFloater& other) setShape(next_rect); - other.mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; + //other.mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } -- cgit v1.2.3 From 6b0f0a89fd6a8285f91c13699327182f513efbd5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 1 Mar 2012 13:23:01 -0800 Subject: CHUI-55 FIX Floaters that have set positions from old viewer versions can appear off screen until user repositions the floaters manually --- indra/llui/llfloater.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index f49b4edb98..d058b4ae44 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -884,22 +884,24 @@ bool LLFloater::applyRectControl() } } - if (!mPosXControl.empty() && !mPosYControl.empty()) - { - LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); - LLControlVariablePtr y_control = getControlGroup()->getControl(mPosYControl); - if (x_control.notNull() - && y_control.notNull() - && !x_control->isDefault() - && !y_control->isDefault()) - { - mPosition.mX = x_control->getValue().asReal(); - mPosition.mY = y_control->getValue().asReal(); - mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; - applyRelativePosition(); + LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); + LLControlVariablePtr y_control = getControlGroup()->getControl(mPosYControl); + if (x_control.notNull() + && y_control.notNull() + && !x_control->isDefault() + && !y_control->isDefault()) + { + mPosition.mX = x_control->getValue().asReal(); + mPosition.mY = y_control->getValue().asReal(); + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; + applyRelativePosition(); - saved_rect = true; - } + saved_rect = true; + } + else + { + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); } } @@ -929,7 +931,6 @@ void LLFloater::applyPositioning(LLFloater* other, bool on_open) break; case LLFloaterEnums::POSITIONING_SPECIFIED: - //translateIntoRect(gFloaterView->getSnapRect()); break; case LLFloaterEnums::POSITIONING_CASCADE_GROUP: @@ -955,7 +956,6 @@ void LLFloater::applyPositioning(LLFloater* other, bool on_open) translate(snap_rect.mLeft, snap_rect.mBottom); } - //mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); } break; -- cgit v1.2.3 From 6c60f214fd4959c9cd71df566edbfe0dc902496f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 5 Mar 2012 20:10:17 -0800 Subject: CHUI-55 FIX Floaters that have set positions from old viewer versions can appear off screen until user repositions the floaters manually --- indra/llui/llfloater.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index d058b4ae44..b091a4a1f7 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -933,8 +933,13 @@ void LLFloater::applyPositioning(LLFloater* other, bool on_open) case LLFloaterEnums::POSITIONING_SPECIFIED: break; - case LLFloaterEnums::POSITIONING_CASCADE_GROUP: case LLFloaterEnums::POSITIONING_CASCADING: + if (!on_open) + { + applyRelativePosition(); + } + // fall through + case LLFloaterEnums::POSITIONING_CASCADE_GROUP: if (on_open) { if (other != NULL && other != this) @@ -3286,7 +3291,7 @@ void LLFloater::stackWith(LLFloater& other) setShape(next_rect); - //other.mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; + other.mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } -- cgit v1.2.3 From 7893cc2ed9815f675b760aacc9f3bf38cec9df1a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 16 Mar 2012 17:36:05 -0700 Subject: CHUI-61 FIX Relative floater positions not written to settings file if previous settings exist from old viewer apply relative positioning to floaters that are loaded with rects specified from earlier viewer --- indra/llui/llfloater.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index b091a4a1f7..9c4bf0a5c2 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -882,6 +882,10 @@ bool LLFloater::applyRectControl() reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); } } + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); + storeRectControl(); } LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); @@ -898,11 +902,6 @@ bool LLFloater::applyRectControl() saved_rect = true; } - else - { - LLRect screen_rect = calcScreenRect(); - mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); - } } return saved_rect; -- cgit v1.2.3 From 3033ca84745f67169caf518ee97d0aab519897fe Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 20 Mar 2012 10:52:41 -0700 Subject: CHUI-61 FIX Relative floater positions not written to settings file if previous settings exist from old viewer only write back floater positioning information generated from legacy saved rect after reading any new floater positioning info --- indra/llui/llfloater.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 9c4bf0a5c2..84754d9c4d 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -885,7 +885,6 @@ bool LLFloater::applyRectControl() mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; LLRect screen_rect = calcScreenRect(); mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); - storeRectControl(); } LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); @@ -904,6 +903,13 @@ bool LLFloater::applyRectControl() } } + if (saved_rect) + { + // propagate any derived positioning data back to settings file + storeRectControl(); + } + + return saved_rect; } -- cgit v1.2.3 From 2fe364dfafe0b68fec4f664312cd943beab1d110 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 21 Mar 2012 11:08:04 -0700 Subject: CHUI-61 FIX Relative floater positions not written to settings file if previous settings exist from old viewer --- indra/llui/llfloater.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 9c4bf0a5c2..1fb10faf1e 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -885,7 +885,6 @@ bool LLFloater::applyRectControl() mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; LLRect screen_rect = calcScreenRect(); mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); - storeRectControl(); } LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); @@ -902,6 +901,12 @@ bool LLFloater::applyRectControl() saved_rect = true; } + + // remember updated position + if (mPositioning == LLFloaterEnums::POSITIONING_RELATIVE) + { + storeRectControl(); + } } return saved_rect; -- cgit v1.2.3 From 71db6d1b91cb8a62959a63ae36d3727e48439245 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 21 Mar 2012 14:01:54 -0700 Subject: CHUI-61 FIX Relative floater positions not written to settings file if previous settings exist from old viewer --- indra/llui/llfloater.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 1fb10faf1e..f6d4daba4e 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -868,6 +868,7 @@ bool LLFloater::applyRectControl() } else { + bool rect_specified = false; if (!mRectControl.empty()) { // If we have a saved rect, use it @@ -881,10 +882,11 @@ bool LLFloater::applyRectControl() { reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); } + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); + rect_specified = true; } - mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; - LLRect screen_rect = calcScreenRect(); - mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); } LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); @@ -903,7 +905,7 @@ bool LLFloater::applyRectControl() } // remember updated position - if (mPositioning == LLFloaterEnums::POSITIONING_RELATIVE) + if (rect_specified) { storeRectControl(); } -- cgit v1.2.3 From 8ff4c75637ce2b9a55a65ba1fc1db3a23e7b88ec Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 23 Mar 2012 12:03:06 -0700 Subject: CHUI-70 FIX Build floater and other floaters opened in default position become centered in viewer when object is built or viewer resized always initialize mPosition --- indra/llui/llfloater.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 3f8116d8d6..2cbc12defc 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -859,6 +859,9 @@ bool LLFloater::applyRectControl() { bool saved_rect = false; + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); + LLFloater* last_in_group = LLFloaterReg::getLastFloaterInGroup(mInstanceName); if (last_in_group && last_in_group != this) { -- cgit v1.2.3 From 93c68c7c12f2a0d19e94bae833554139f78914e9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 18 May 2012 21:03:45 -0700 Subject: MAINT-959 FIX [PUBLIC]Trouble resizing tabbed floaters don't auto position other floater when it is hosted --- indra/llui/llfloater.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a8a3a1f906..8ca1e685a9 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -3307,8 +3307,11 @@ void LLFloater::stackWith(LLFloater& other) setShape(next_rect); - other.mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; - other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); + if (!other.getHost()) + { + other.mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; + other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); + } } void LLFloater::applyRelativePosition() -- cgit v1.2.3