diff options
author | Richard Linden <none@none> | 2010-05-18 16:26:18 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2010-05-18 16:26:18 -0700 |
commit | 5921f2c14b57bbc4c5c327713a521e270b250f52 (patch) | |
tree | 46b3e42c721f7402026cade6456877bec5594a41 | |
parent | 3e0c0b86c0fb1a1c26d020ca44a30365487edf3b (diff) |
EXT-7398 FIXED negative top/bottom coordinates do the wrong thing with topleft layout
reviewed by Leyla
-rw-r--r-- | indra/llui/llfloater.cpp | 9 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 58 | ||||
-rw-r--r-- | indra/llui/llview.h | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_camera.xml | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_moveview.xml | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preferences.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preview_gesture.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_test_widgets.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_tools.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_world_map.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_bottomtray.xml | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_notifications_channel.xml | 4 |
13 files changed, 28 insertions, 69 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 79c47a1136..6babaf936b 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -169,6 +169,7 @@ LLFloater::Params::Params() save_rect("save_rect", false), save_visibility("save_visibility", false), can_dock("can_dock", false), + open_centered("open_centered", false), header_height("header_height", 0), legacy_header_height("legacy_header_height", 0), close_image("close_image"), @@ -763,6 +764,13 @@ void LLFloater::applySavedVariables() void LLFloater::applyRectControl() { + // first, center on screen if requested + if (mOpenCentered) + { + center(); + } + + // override center if we have saved rect control if (mRectControl.size() > 1) { const LLRect& rect = LLUI::sSettingGroups["floater"]->getRect(mRectControl); @@ -2711,6 +2719,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) mLegacyHeaderHeight = p.legacy_header_height; mSingleInstance = p.single_instance; mAutoTile = p.auto_tile; + mOpenCentered = p.open_centered; if (p.save_rect) { diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 444711de81..654164ddc0 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -110,7 +110,8 @@ public: save_rect, save_visibility, save_dock_state, - can_dock; + can_dock, + open_centered; Optional<S32> header_height, legacy_header_height; // HACK see initFromXML() @@ -373,6 +374,7 @@ private: BOOL mCanClose; BOOL mDragOnLeft; BOOL mResizable; + bool mOpenCentered; S32 mMinWidth; S32 mMinHeight; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index e67f0ec3fc..c091686ffb 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -107,8 +107,6 @@ LLView::Params::Params() top_delta("top_delta", S32_MAX), left_pad("left_pad"), left_delta("left_delta", S32_MAX), - center_horiz("center_horiz", false), - center_vert("center_vert", false), from_xui("from_xui", false), user_resize("user_resize"), auto_resize("auto_resize"), @@ -2501,7 +2499,6 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) p.layout = parent->getLayout(); } - if (parent) { LLRect parent_rect = parent->getLocalRect(); @@ -2509,60 +2506,21 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) LLRect last_rect = parent->getLocalRect(); bool layout_topleft = (p.layout() == "topleft"); - if (layout_topleft) - { - //invert top to bottom - if (p.rect.top.isProvided()) p.rect.top = parent_rect.getHeight() - p.rect.top; - if (p.rect.bottom.isProvided()) p.rect.bottom = parent_rect.getHeight() - p.rect.bottom; - } // convert negative or centered coordinates to parent relative values // Note: some of this logic matches the logic in TypedParam<LLRect>::setValueFromBlock() + if (p.rect.left.isProvided() && p.rect.left < 0) p.rect.left = p.rect.left + parent_rect.getWidth(); + if (p.rect.right.isProvided() && p.rect.right < 0) p.rect.right = p.rect.right + parent_rect.getWidth(); + if (p.rect.bottom.isProvided() && p.rect.bottom < 0) p.rect.bottom = p.rect.bottom + parent_rect.getHeight(); + if (p.rect.top.isProvided() && p.rect.top < 0) p.rect.top = p.rect.top + parent_rect.getHeight(); - if (p.center_horiz) - { - if (p.rect.left.isProvided() && p.rect.right.isProvided()) - { - S32 width = p.rect.right - p.rect.left; - width = llmax(width, 0); - S32 offset = parent_rect.getWidth()/2 - width/2; - p.rect.left = p.rect.left + offset; - p.rect.right = p.rect.right + offset; - } - else - { - p.rect.left = p.rect.left + parent_rect.getWidth()/2 - p.rect.width/2; - p.rect.right.setProvided(false); // recalculate the right - } - } - else - { - if (p.rect.left.isProvided() && p.rect.left < 0) p.rect.left = p.rect.left + parent_rect.getWidth(); - if (p.rect.right.isProvided() && p.rect.right < 0) p.rect.right = p.rect.right + parent_rect.getWidth(); - } - if (p.center_vert) - { - if (p.rect.bottom.isProvided() && p.rect.top.isProvided()) - { - S32 height = p.rect.top - p.rect.bottom; - height = llmax(height, 0); - S32 offset = parent_rect.getHeight()/2 - height/2; - p.rect.bottom = p.rect.bottom + offset; - p.rect.top = p.rect.top + offset; - } - else - { - p.rect.bottom = p.rect.bottom + parent_rect.getHeight()/2 - p.rect.height/2; - p.rect.top.setProvided(false); // recalculate the top - } - } - else + if (layout_topleft) { - if (p.rect.bottom.isProvided() && p.rect.bottom < 0) p.rect.bottom = p.rect.bottom + parent_rect.getHeight(); - if (p.rect.top.isProvided() && p.rect.top < 0) p.rect.top = p.rect.top + parent_rect.getHeight(); + //invert top to bottom + if (p.rect.top.isProvided()) p.rect.top = parent_rect.getHeight() - p.rect.top; + if (p.rect.bottom.isProvided()) p.rect.bottom = parent_rect.getHeight() - p.rect.bottom; } - // DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0) { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index efae00f0e5..3779fedf34 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -143,9 +143,6 @@ public: left_pad, // from last right to my left left_delta; // from last left to my left - Optional<bool> center_horiz, - center_vert; - // these are nested attributes for LLLayoutPanel //FIXME: get parent context involved in parsing traversal Ignored user_resize, diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index b45e39a111..999cb9ed97 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -4,7 +4,6 @@ can_dock="true" can_minimize="true" can_close="false" - center_horiz="true" follows="bottom" height="152" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_moveview.xml b/indra/newview/skins/default/xui/en/floater_moveview.xml index a685094190..7d9a17548e 100644 --- a/indra/newview/skins/default/xui/en/floater_moveview.xml +++ b/indra/newview/skins/default/xui/en/floater_moveview.xml @@ -4,7 +4,6 @@ can_dock="true" can_minimize="true" can_close="false" - center_horiz="true" follows="bottom" height="110" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index 6e82bb09ee..50d0011338 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater legacy_header_height="18" - center_horiz="true" - center_vert="true" + open_centered="true" default_tab_group="1" height="460" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_preview_gesture.xml b/indra/newview/skins/default/xui/en/floater_preview_gesture.xml index 3dc546aee3..f766fe5a5d 100644 --- a/indra/newview/skins/default/xui/en/floater_preview_gesture.xml +++ b/indra/newview/skins/default/xui/en/floater_preview_gesture.xml @@ -298,7 +298,7 @@ layout="topleft" left="3" name="start" - top="-11" + top="-51" width="80" /> <radio_item height="16" diff --git a/indra/newview/skins/default/xui/en/floater_test_widgets.xml b/indra/newview/skins/default/xui/en/floater_test_widgets.xml index 80cb2723a0..fb583114c0 100644 --- a/indra/newview/skins/default/xui/en/floater_test_widgets.xml +++ b/indra/newview/skins/default/xui/en/floater_test_widgets.xml @@ -49,13 +49,10 @@ name="test_menu_bar" top="16"> <menu - height="16" label="Menu" layout="topleft" tear_off="true" - left="0" name="Menu" - top="-32" width="128"> <!-- menu_item_call will trigger a function call in the C++ code --> <menu_item_call diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index cc9e72cfb5..0c7ef3619d 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -580,7 +580,7 @@ layout="topleft" left="0" name="radio select land" - top="-1" + top="-106" width="134" /> <radio_item height="19" diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index 233ab2c1b2..a53774a492 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -2,8 +2,7 @@ <floater legacy_header_height="18" can_resize="true" - center_horiz="true" - center_vert="true" + open_centered="true" height="600" layout="topleft" min_height="520" diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index 620aabeeb8..2cb91fe1f0 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -375,7 +375,7 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. layout="topleft" name="chicklet_left_scroll_button" tab_stop="false" - top="-4" + top="-28" visible="false" width="7" /> <button @@ -392,7 +392,7 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. layout="topleft" name="chicklet_right_scroll_button" tab_stop="false" - top="-4" + top="-28" visible="false" width="7" /> </chiclet_panel> diff --git a/indra/newview/skins/default/xui/en/panel_notifications_channel.xml b/indra/newview/skins/default/xui/en/panel_notifications_channel.xml index 16593751f7..3143b0a40c 100644 --- a/indra/newview/skins/default/xui/en/panel_notifications_channel.xml +++ b/indra/newview/skins/default/xui/en/panel_notifications_channel.xml @@ -23,7 +23,7 @@ name="notifications_list" sort_ascending="false" sort_column="2" - top="-78" + top="0" user_resize="true" width="100"> <scroll_list.columns @@ -48,7 +48,7 @@ name="notification_rejects_list" sort_ascending="false" sort_column="2" - top="-78" + top="0" user_resize="true" width="100"> <scroll_list.columns |