diff options
Diffstat (limited to 'linden/indra/llui/llfloater.cpp')
-rw-r--r-- | linden/indra/llui/llfloater.cpp | 265 |
1 files changed, 142 insertions, 123 deletions
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index 1e825d3..5142bf4 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp | |||
@@ -50,7 +50,6 @@ | |||
50 | #include "lltextbox.h" | 50 | #include "lltextbox.h" |
51 | #include "llresmgr.h" | 51 | #include "llresmgr.h" |
52 | #include "llui.h" | 52 | #include "llui.h" |
53 | #include "llviewborder.h" | ||
54 | #include "llwindow.h" | 53 | #include "llwindow.h" |
55 | #include "llstl.h" | 54 | #include "llstl.h" |
56 | #include "llcontrol.h" | 55 | #include "llcontrol.h" |
@@ -131,8 +130,9 @@ LLFloaterView* gFloaterView = NULL; | |||
131 | LLFloater::LLFloater() : | 130 | LLFloater::LLFloater() : |
132 | //FIXME: we should initialize *all* member variables here | 131 | //FIXME: we should initialize *all* member variables here |
133 | mResizable(FALSE), | 132 | mResizable(FALSE), |
134 | mDragOnLeft(FALSE) | 133 | mDragOnLeft(FALSE), |
135 | 134 | mMinWidth(0), | |
135 | mMinHeight(0) | ||
136 | { | 136 | { |
137 | // automatically take focus when opened | 137 | // automatically take focus when opened |
138 | mAutoFocus = TRUE; | 138 | mAutoFocus = TRUE; |
@@ -656,7 +656,8 @@ void LLFloater::setTitle( const LLString& title ) | |||
656 | { | 656 | { |
657 | return; | 657 | return; |
658 | } | 658 | } |
659 | mDragHandle->setTitle( title ); | 659 | if (mDragHandle) |
660 | mDragHandle->setTitle( title ); | ||
660 | } | 661 | } |
661 | 662 | ||
662 | const LLString& LLFloater::getTitle() const | 663 | const LLString& LLFloater::getTitle() const |
@@ -802,24 +803,10 @@ void LLFloater::setMinimized(BOOL minimize) | |||
802 | mButtonsEnabled[BUTTON_RESTORE] = TRUE; | 803 | mButtonsEnabled[BUTTON_RESTORE] = TRUE; |
803 | } | 804 | } |
804 | 805 | ||
805 | mMinimizedHiddenChildren.clear(); | ||
806 | // hide all children | ||
807 | for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) | ||
808 | { | ||
809 | LLView* viewp = *child_it; | ||
810 | if (!viewp->getVisible()) | ||
811 | { | ||
812 | mMinimizedHiddenChildren.push_back(viewp->getHandle()); | ||
813 | } | ||
814 | viewp->setVisible(FALSE); | ||
815 | } | ||
816 | |||
817 | // except the special controls | ||
818 | if (mDragHandle) | 806 | if (mDragHandle) |
819 | { | 807 | { |
820 | mDragHandle->setVisible(TRUE); | 808 | mDragHandle->setVisible(TRUE); |
821 | } | 809 | } |
822 | |||
823 | setBorderVisible(TRUE); | 810 | setBorderVisible(TRUE); |
824 | 811 | ||
825 | for(handle_set_iter_t dependent_it = mDependents.begin(); | 812 | for(handle_set_iter_t dependent_it = mDependents.begin(); |
@@ -843,6 +830,12 @@ void LLFloater::setMinimized(BOOL minimize) | |||
843 | // Lose keyboard focus when minimized | 830 | // Lose keyboard focus when minimized |
844 | releaseFocus(); | 831 | releaseFocus(); |
845 | 832 | ||
833 | for (S32 i = 0; i < 4; i++) | ||
834 | { | ||
835 | if (mResizeBar[i]) mResizeBar[i]->setEnabled(FALSE); | ||
836 | if (mResizeHandle[i]) mResizeHandle[i]->setEnabled(FALSE); | ||
837 | } | ||
838 | |||
846 | mMinimized = TRUE; | 839 | mMinimized = TRUE; |
847 | 840 | ||
848 | // Reshape *after* setting mMinimized | 841 | // Reshape *after* setting mMinimized |
@@ -867,24 +860,6 @@ void LLFloater::setMinimized(BOOL minimize) | |||
867 | mButtonsEnabled[BUTTON_RESTORE] = FALSE; | 860 | mButtonsEnabled[BUTTON_RESTORE] = FALSE; |
868 | } | 861 | } |
869 | 862 | ||
870 | // show all children | ||
871 | for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) | ||
872 | { | ||
873 | LLView* viewp = *child_it; | ||
874 | viewp->setVisible(TRUE); | ||
875 | } | ||
876 | |||
877 | std::vector<LLHandle<LLView> >::iterator itor = mMinimizedHiddenChildren.begin(); | ||
878 | for ( ; itor != mMinimizedHiddenChildren.end(); ++itor) | ||
879 | { | ||
880 | LLView* viewp = itor->get(); | ||
881 | if(viewp) | ||
882 | { | ||
883 | viewp->setVisible(FALSE); | ||
884 | } | ||
885 | } | ||
886 | mMinimizedHiddenChildren.clear(); | ||
887 | |||
888 | // show dependent floater | 863 | // show dependent floater |
889 | for(handle_set_iter_t dependent_it = mDependents.begin(); | 864 | for(handle_set_iter_t dependent_it = mDependents.begin(); |
890 | dependent_it != mDependents.end(); | 865 | dependent_it != mDependents.end(); |
@@ -898,6 +873,12 @@ void LLFloater::setMinimized(BOOL minimize) | |||
898 | } | 873 | } |
899 | } | 874 | } |
900 | 875 | ||
876 | for (S32 i = 0; i < 4; i++) | ||
877 | { | ||
878 | if (mResizeBar[i]) mResizeBar[i]->setEnabled(isResizable()); | ||
879 | if (mResizeHandle[i]) mResizeHandle[i]->setEnabled(isResizable()); | ||
880 | } | ||
881 | |||
901 | mMinimized = FALSE; | 882 | mMinimized = FALSE; |
902 | 883 | ||
903 | // Reshape *after* setting mMinimized | 884 | // Reshape *after* setting mMinimized |
@@ -954,7 +935,8 @@ void LLFloater::setIsChrome(BOOL is_chrome) | |||
954 | } | 935 | } |
955 | 936 | ||
956 | // no titles displayed on "chrome" floaters | 937 | // no titles displayed on "chrome" floaters |
957 | mDragHandle->setTitleVisible(!is_chrome); | 938 | if (mDragHandle) |
939 | mDragHandle->setTitleVisible(!is_chrome); | ||
958 | 940 | ||
959 | LLPanel::setIsChrome(is_chrome); | 941 | LLPanel::setIsChrome(is_chrome); |
960 | } | 942 | } |
@@ -965,7 +947,8 @@ void LLFloater::setForeground(BOOL front) | |||
965 | if (front != mForeground) | 947 | if (front != mForeground) |
966 | { | 948 | { |
967 | mForeground = front; | 949 | mForeground = front; |
968 | mDragHandle->setForeground( front ); | 950 | if (mDragHandle) |
951 | mDragHandle->setForeground( front ); | ||
969 | 952 | ||
970 | if (!front) | 953 | if (!front) |
971 | { | 954 | { |
@@ -1310,49 +1293,72 @@ void LLFloater::onClickClose( void* userdata ) | |||
1310 | // virtual | 1293 | // virtual |
1311 | void LLFloater::draw() | 1294 | void LLFloater::draw() |
1312 | { | 1295 | { |
1313 | if( getVisible() ) | 1296 | // draw background |
1297 | if( isBackgroundVisible() ) | ||
1314 | { | 1298 | { |
1315 | // draw background | 1299 | S32 left = LLPANEL_BORDER_WIDTH; |
1316 | if( isBackgroundVisible() ) | 1300 | S32 top = getRect().getHeight() - LLPANEL_BORDER_WIDTH; |
1317 | { | 1301 | S32 right = getRect().getWidth() - LLPANEL_BORDER_WIDTH; |
1318 | S32 left = LLPANEL_BORDER_WIDTH; | 1302 | S32 bottom = LLPANEL_BORDER_WIDTH; |
1319 | S32 top = getRect().getHeight() - LLPANEL_BORDER_WIDTH; | ||
1320 | S32 right = getRect().getWidth() - LLPANEL_BORDER_WIDTH; | ||
1321 | S32 bottom = LLPANEL_BORDER_WIDTH; | ||
1322 | 1303 | ||
1323 | LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow"); | 1304 | LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow"); |
1324 | F32 shadow_offset = (F32)LLUI::sConfigGroup->getS32("DropShadowFloater"); | 1305 | F32 shadow_offset = (F32)LLUI::sConfigGroup->getS32("DropShadowFloater"); |
1325 | if (!isBackgroundOpaque()) | 1306 | if (!isBackgroundOpaque()) |
1326 | { | 1307 | { |
1327 | shadow_offset *= 0.2f; | 1308 | shadow_offset *= 0.2f; |
1328 | shadow_color.mV[VALPHA] *= 0.5f; | 1309 | shadow_color.mV[VALPHA] *= 0.5f; |
1329 | } | 1310 | } |
1330 | gl_drop_shadow(left, top, right, bottom, | 1311 | gl_drop_shadow(left, top, right, bottom, |
1331 | shadow_color, | 1312 | shadow_color, |
1332 | llround(shadow_offset)); | 1313 | llround(shadow_offset)); |
1333 | 1314 | ||
1334 | // No transparent windows in simple UI | 1315 | // No transparent windows in simple UI |
1335 | if (isBackgroundOpaque()) | 1316 | if (isBackgroundOpaque()) |
1336 | { | 1317 | { |
1337 | gl_rect_2d( left, top, right, bottom, getBackgroundColor() ); | 1318 | gl_rect_2d( left, top, right, bottom, getBackgroundColor() ); |
1338 | } | 1319 | } |
1339 | else | 1320 | else |
1340 | { | 1321 | { |
1341 | gl_rect_2d( left, top, right, bottom, getTransparentColor() ); | 1322 | gl_rect_2d( left, top, right, bottom, getTransparentColor() ); |
1342 | } | 1323 | } |
1343 | 1324 | ||
1344 | if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getTitle().empty()) | 1325 | if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getTitle().empty()) |
1345 | { | 1326 | { |
1346 | // draw highlight on title bar to indicate focus. RDW | 1327 | // draw highlight on title bar to indicate focus. RDW |
1347 | const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF ); | 1328 | const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); |
1348 | LLRect r = getRect(); | 1329 | LLRect r = getRect(); |
1349 | gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1, | 1330 | gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1, |
1350 | LLUI::sColorsGroup->getColor("TitleBarFocusColor"), 0, TRUE); | 1331 | LLUI::sColorsGroup->getColor("TitleBarFocusColor"), 0, TRUE); |
1351 | } | ||
1352 | } | 1332 | } |
1333 | } | ||
1353 | 1334 | ||
1354 | LLPanel::updateDefaultBtn(); | 1335 | LLPanel::updateDefaultBtn(); |
1355 | 1336 | ||
1337 | if( getDefaultButton() ) | ||
1338 | { | ||
1339 | if (hasFocus() && getDefaultButton()->getEnabled()) | ||
1340 | { | ||
1341 | LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus(); | ||
1342 | // is this button a direct descendent and not a nested widget (e.g. checkbox)? | ||
1343 | BOOL focus_is_child_button = dynamic_cast<LLButton*>(focus_ctrl) != NULL && focus_ctrl->getParent() == this; | ||
1344 | // only enable default button when current focus is not a button | ||
1345 | getDefaultButton()->setBorderEnabled(!focus_is_child_button); | ||
1346 | } | ||
1347 | else | ||
1348 | { | ||
1349 | getDefaultButton()->setBorderEnabled(FALSE); | ||
1350 | } | ||
1351 | } | ||
1352 | if (isMinimized()) | ||
1353 | { | ||
1354 | for (S32 i = 0; i < BUTTON_COUNT; i++) | ||
1355 | { | ||
1356 | drawChild(mButtons[i]); | ||
1357 | } | ||
1358 | drawChild(mDragHandle); | ||
1359 | } | ||
1360 | else | ||
1361 | { | ||
1356 | // draw children | 1362 | // draw children |
1357 | LLView* focused_child = gFocusMgr.getKeyboardFocus(); | 1363 | LLView* focused_child = gFocusMgr.getKeyboardFocus(); |
1358 | BOOL focused_child_visible = FALSE; | 1364 | BOOL focused_child_visible = FALSE; |
@@ -1365,36 +1371,35 @@ void LLFloater::draw() | |||
1365 | // don't call LLPanel::draw() since we've implemented custom background rendering | 1371 | // don't call LLPanel::draw() since we've implemented custom background rendering |
1366 | LLView::draw(); | 1372 | LLView::draw(); |
1367 | 1373 | ||
1368 | if( isBackgroundVisible() ) | ||
1369 | { | ||
1370 | // add in a border to improve spacialized visual aclarity ;) | ||
1371 | // use lines instead of gl_rect_2d so we can round the edges as per james' recommendation | ||
1372 | LLUI::setLineWidth(1.5f); | ||
1373 | LLColor4 outlineColor = gFocusMgr.childHasKeyboardFocus(this) ? LLUI::sColorsGroup->getColor("FloaterFocusBorderColor") : LLUI::sColorsGroup->getColor("FloaterUnfocusBorderColor"); | ||
1374 | gl_rect_2d_offset_local(0, getRect().getHeight() + 1, getRect().getWidth() + 1, 0, outlineColor, -LLPANEL_BORDER_WIDTH, FALSE); | ||
1375 | LLUI::setLineWidth(1.f); | ||
1376 | } | ||
1377 | |||
1378 | if (focused_child_visible) | 1374 | if (focused_child_visible) |
1379 | { | 1375 | { |
1380 | focused_child->setVisible(TRUE); | 1376 | focused_child->setVisible(TRUE); |
1381 | } | 1377 | } |
1382 | drawChild(focused_child); | 1378 | drawChild(focused_child); |
1379 | } | ||
1383 | 1380 | ||
1384 | // update tearoff button for torn off floaters | 1381 | if( isBackgroundVisible() ) |
1385 | // when last host goes away | 1382 | { |
1386 | if (mCanTearOff && !getHost()) | 1383 | // add in a border to improve spacialized visual aclarity ;) |
1384 | // use lines instead of gl_rect_2d so we can round the edges as per james' recommendation | ||
1385 | LLUI::setLineWidth(1.5f); | ||
1386 | LLColor4 outlineColor = gFocusMgr.childHasKeyboardFocus(this) ? LLUI::sColorsGroup->getColor("FloaterFocusBorderColor") : LLUI::sColorsGroup->getColor("FloaterUnfocusBorderColor"); | ||
1387 | gl_rect_2d_offset_local(0, getRect().getHeight() + 1, getRect().getWidth() + 1, 0, outlineColor, -LLPANEL_BORDER_WIDTH, FALSE); | ||
1388 | LLUI::setLineWidth(1.f); | ||
1389 | } | ||
1390 | |||
1391 | // update tearoff button for torn off floaters | ||
1392 | // when last host goes away | ||
1393 | if (mCanTearOff && !getHost()) | ||
1394 | { | ||
1395 | LLFloater* old_host = mLastHostHandle.get(); | ||
1396 | if (!old_host) | ||
1387 | { | 1397 | { |
1388 | LLFloater* old_host = mLastHostHandle.get(); | 1398 | setCanTearOff(FALSE); |
1389 | if (!old_host) | ||
1390 | { | ||
1391 | setCanTearOff(FALSE); | ||
1392 | } | ||
1393 | } | 1399 | } |
1394 | } | 1400 | } |
1395 | } | 1401 | } |
1396 | 1402 | ||
1397 | |||
1398 | void LLFloater::setCanMinimize(BOOL can_minimize) | 1403 | void LLFloater::setCanMinimize(BOOL can_minimize) |
1399 | { | 1404 | { |
1400 | // removing minimize/restore button programmatically, | 1405 | // removing minimize/restore button programmatically, |
@@ -1540,7 +1545,13 @@ void LLFloater::updateButtons() | |||
1540 | S32 button_count = 0; | 1545 | S32 button_count = 0; |
1541 | for (S32 i = 0; i < BUTTON_COUNT; i++) | 1546 | for (S32 i = 0; i < BUTTON_COUNT; i++) |
1542 | { | 1547 | { |
1543 | if (mButtonsEnabled[i]) | 1548 | mButtons[i]->setEnabled(mButtonsEnabled[i]); |
1549 | |||
1550 | if (mButtonsEnabled[i] | ||
1551 | //*HACK: always render close button for hosted floaters | ||
1552 | // so that users don't accidentally hit the button when closing multiple windows | ||
1553 | // in the chatterbox | ||
1554 | || (i == BUTTON_CLOSE && mButtonScale != 1.f)) | ||
1544 | { | 1555 | { |
1545 | button_count++; | 1556 | button_count++; |
1546 | 1557 | ||
@@ -1564,18 +1575,16 @@ void LLFloater::updateButtons() | |||
1564 | 1575 | ||
1565 | mButtons[i]->setRect(btn_rect); | 1576 | mButtons[i]->setRect(btn_rect); |
1566 | mButtons[i]->setVisible(TRUE); | 1577 | mButtons[i]->setVisible(TRUE); |
1567 | mButtons[i]->setEnabled(TRUE); | ||
1568 | // the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater | 1578 | // the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater |
1569 | mButtons[i]->setTabStop(i == BUTTON_RESTORE); | 1579 | mButtons[i]->setTabStop(i == BUTTON_RESTORE); |
1570 | } | 1580 | } |
1571 | else if (mButtons[i]) | 1581 | else if (mButtons[i]) |
1572 | { | 1582 | { |
1573 | mButtons[i]->setVisible(FALSE); | 1583 | mButtons[i]->setVisible(FALSE); |
1574 | mButtons[i]->setEnabled(FALSE); | ||
1575 | } | 1584 | } |
1576 | } | 1585 | } |
1577 | 1586 | if (mDragHandle) | |
1578 | mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (LLFLOATER_CLOSE_BOX_SIZE + 1))); | 1587 | mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (LLFLOATER_CLOSE_BOX_SIZE + 1))); |
1579 | } | 1588 | } |
1580 | 1589 | ||
1581 | void LLFloater::buildButtons() | 1590 | void LLFloater::buildButtons() |
@@ -2076,7 +2085,7 @@ void LLFloaterView::closeAllChildren(bool app_quitting) | |||
2076 | 2085 | ||
2077 | // Attempt to close floater. This will cause the "do you want to save" | 2086 | // Attempt to close floater. This will cause the "do you want to save" |
2078 | // dialogs to appear. | 2087 | // dialogs to appear. |
2079 | if (floaterp->canClose()) | 2088 | if (floaterp->canClose() && !floaterp->isDead()) |
2080 | { | 2089 | { |
2081 | floaterp->close(app_quitting); | 2090 | floaterp->close(app_quitting); |
2082 | } | 2091 | } |
@@ -2093,7 +2102,7 @@ BOOL LLFloaterView::allChildrenClosed() | |||
2093 | LLView* viewp = *it; | 2102 | LLView* viewp = *it; |
2094 | LLFloater* floaterp = (LLFloater*)viewp; | 2103 | LLFloater* floaterp = (LLFloater*)viewp; |
2095 | 2104 | ||
2096 | if (floaterp->getVisible() && floaterp->canClose()) | 2105 | if (floaterp->getVisible() && !floaterp->isDead() && floaterp->canClose()) |
2097 | { | 2106 | { |
2098 | return false; | 2107 | return false; |
2099 | } | 2108 | } |
@@ -2332,7 +2341,9 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list) | |||
2332 | LLMultiFloater::LLMultiFloater() : | 2341 | LLMultiFloater::LLMultiFloater() : |
2333 | mTabContainer(NULL), | 2342 | mTabContainer(NULL), |
2334 | mTabPos(LLTabContainer::TOP), | 2343 | mTabPos(LLTabContainer::TOP), |
2335 | mAutoResize(TRUE) | 2344 | mAutoResize(TRUE), |
2345 | mOrigMinWidth(0), | ||
2346 | mOrigMinHeight(0) | ||
2336 | { | 2347 | { |
2337 | 2348 | ||
2338 | } | 2349 | } |
@@ -2340,7 +2351,9 @@ LLMultiFloater::LLMultiFloater() : | |||
2340 | LLMultiFloater::LLMultiFloater(LLTabContainer::TabPosition tab_pos) : | 2351 | LLMultiFloater::LLMultiFloater(LLTabContainer::TabPosition tab_pos) : |
2341 | mTabContainer(NULL), | 2352 | mTabContainer(NULL), |
2342 | mTabPos(tab_pos), | 2353 | mTabPos(tab_pos), |
2343 | mAutoResize(TRUE) | 2354 | mAutoResize(TRUE), |
2355 | mOrigMinWidth(0), | ||
2356 | mOrigMinHeight(0) | ||
2344 | { | 2357 | { |
2345 | 2358 | ||
2346 | } | 2359 | } |
@@ -2349,7 +2362,9 @@ LLMultiFloater::LLMultiFloater(const LLString &name) : | |||
2349 | LLFloater(name), | 2362 | LLFloater(name), |
2350 | mTabContainer(NULL), | 2363 | mTabContainer(NULL), |
2351 | mTabPos(LLTabContainer::TOP), | 2364 | mTabPos(LLTabContainer::TOP), |
2352 | mAutoResize(FALSE) | 2365 | mAutoResize(FALSE), |
2366 | mOrigMinWidth(0), | ||
2367 | mOrigMinHeight(0) | ||
2353 | { | 2368 | { |
2354 | } | 2369 | } |
2355 | 2370 | ||
@@ -2361,7 +2376,9 @@ LLMultiFloater::LLMultiFloater( | |||
2361 | LLFloater(name, rect, name), | 2376 | LLFloater(name, rect, name), |
2362 | mTabContainer(NULL), | 2377 | mTabContainer(NULL), |
2363 | mTabPos(LLTabContainer::TOP), | 2378 | mTabPos(LLTabContainer::TOP), |
2364 | mAutoResize(auto_resize) | 2379 | mAutoResize(auto_resize), |
2380 | mOrigMinWidth(0), | ||
2381 | mOrigMinHeight(0) | ||
2365 | { | 2382 | { |
2366 | mTabContainer = new LLTabContainer("Preview Tabs", | 2383 | mTabContainer = new LLTabContainer("Preview Tabs", |
2367 | LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), | 2384 | LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), |
@@ -2385,7 +2402,9 @@ LLMultiFloater::LLMultiFloater( | |||
2385 | LLFloater(name, rect_control, name), | 2402 | LLFloater(name, rect_control, name), |
2386 | mTabContainer(NULL), | 2403 | mTabContainer(NULL), |
2387 | mTabPos(tab_pos), | 2404 | mTabPos(tab_pos), |
2388 | mAutoResize(auto_resize) | 2405 | mAutoResize(auto_resize), |
2406 | mOrigMinWidth(0), | ||
2407 | mOrigMinHeight(0) | ||
2389 | { | 2408 | { |
2390 | mTabContainer = new LLTabContainer("Preview Tabs", | 2409 | mTabContainer = new LLTabContainer("Preview Tabs", |
2391 | LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), | 2410 | LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), |
@@ -2678,24 +2697,20 @@ void LLMultiFloater::setVisible(BOOL visible) | |||
2678 | } | 2697 | } |
2679 | } | 2698 | } |
2680 | 2699 | ||
2681 | BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) | 2700 | BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask) |
2682 | { | 2701 | { |
2683 | if (getEnabled() | 2702 | if (key == 'W' && mask == MASK_CONTROL) |
2684 | && mask == MASK_CONTROL) | ||
2685 | { | 2703 | { |
2686 | if (key == 'W') | 2704 | LLFloater* floater = getActiveFloater(); |
2705 | // is user closeable and is system closeable | ||
2706 | if (floater && floater->canClose() && floater->isCloseable()) | ||
2687 | { | 2707 | { |
2688 | LLFloater* floater = getActiveFloater(); | 2708 | floater->close(); |
2689 | // is user closeable and is system closeable | ||
2690 | if (floater && floater->canClose() && floater->isCloseable()) | ||
2691 | { | ||
2692 | floater->close(); | ||
2693 | } | ||
2694 | return TRUE; | ||
2695 | } | 2709 | } |
2710 | return TRUE; | ||
2696 | } | 2711 | } |
2697 | 2712 | ||
2698 | return LLFloater::handleKeyHere(key, mask, called_from_parent); | 2713 | return LLFloater::handleKeyHere(key, mask); |
2699 | } | 2714 | } |
2700 | 2715 | ||
2701 | LLFloater* LLMultiFloater::getActiveFloater() | 2716 | LLFloater* LLMultiFloater::getActiveFloater() |
@@ -2763,15 +2778,18 @@ void LLMultiFloater::setCanResize(BOOL can_resize) | |||
2763 | 2778 | ||
2764 | BOOL LLMultiFloater::postBuild() | 2779 | BOOL LLMultiFloater::postBuild() |
2765 | { | 2780 | { |
2781 | // remember any original xml minimum size | ||
2782 | getResizeLimits(&mOrigMinWidth, &mOrigMinHeight); | ||
2783 | |||
2766 | if (mTabContainer) | 2784 | if (mTabContainer) |
2767 | { | 2785 | { |
2768 | return TRUE; | 2786 | return TRUE; |
2769 | } | 2787 | } |
2770 | 2788 | ||
2771 | requires("Preview Tabs", WIDGET_TYPE_TAB_CONTAINER); | 2789 | requires<LLTabContainer>("Preview Tabs"); |
2772 | if (checkRequirements()) | 2790 | if (checkRequirements()) |
2773 | { | 2791 | { |
2774 | mTabContainer = LLUICtrlFactory::getTabContainerByName(this, "Preview Tabs"); | 2792 | mTabContainer = getChild<LLTabContainer>("Preview Tabs"); |
2775 | return TRUE; | 2793 | return TRUE; |
2776 | } | 2794 | } |
2777 | 2795 | ||
@@ -2780,10 +2798,11 @@ BOOL LLMultiFloater::postBuild() | |||
2780 | 2798 | ||
2781 | void LLMultiFloater::updateResizeLimits() | 2799 | void LLMultiFloater::updateResizeLimits() |
2782 | { | 2800 | { |
2783 | S32 new_min_width = 0; | 2801 | // initialize minimum size constraint to the original xml values. |
2784 | S32 new_min_height = 0; | 2802 | S32 new_min_width = mOrigMinWidth; |
2785 | S32 tab_idx; | 2803 | S32 new_min_height = mOrigMinHeight; |
2786 | for (tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) | 2804 | // possibly increase minimum size constraint due to children's minimums. |
2805 | for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) | ||
2787 | { | 2806 | { |
2788 | LLFloater* floaterp = (LLFloater*)mTabContainer->getPanelByIndex(tab_idx); | 2807 | LLFloater* floaterp = (LLFloater*)mTabContainer->getPanelByIndex(tab_idx); |
2789 | if (floaterp) | 2808 | if (floaterp) |