diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/llfloater.cpp | 286 |
1 files changed, 182 insertions, 104 deletions
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index 6ab182f..b45661f 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp | |||
@@ -312,28 +312,32 @@ void LLFloater::init(const LLString& title, | |||
312 | { | 312 | { |
313 | // Resize bars (sides) | 313 | // Resize bars (sides) |
314 | const S32 RESIZE_BAR_THICKNESS = 3; | 314 | const S32 RESIZE_BAR_THICKNESS = 3; |
315 | mResizeBar[0] = new LLResizeBar( | 315 | mResizeBar[LLResizeBar::LEFT] = new LLResizeBar( |
316 | "resizebar_left", | 316 | "resizebar_left", |
317 | this, | ||
317 | LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0), | 318 | LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0), |
318 | min_width, min_height, LLResizeBar::LEFT ); | 319 | min_width, S32_MAX, LLResizeBar::LEFT ); |
319 | addChild( mResizeBar[0] ); | 320 | addChild( mResizeBar[0] ); |
320 | 321 | ||
321 | mResizeBar[1] = new LLResizeBar( | 322 | mResizeBar[LLResizeBar::TOP] = new LLResizeBar( |
322 | "resizebar_top", | 323 | "resizebar_top", |
324 | this, | ||
323 | LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS), | 325 | LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS), |
324 | min_width, min_height, LLResizeBar::TOP ); | 326 | min_height, S32_MAX, LLResizeBar::TOP ); |
325 | addChild( mResizeBar[1] ); | 327 | addChild( mResizeBar[1] ); |
326 | 328 | ||
327 | mResizeBar[2] = new LLResizeBar( | 329 | mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar( |
328 | "resizebar_right", | 330 | "resizebar_right", |
331 | this, | ||
329 | LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0), | 332 | LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0), |
330 | min_width, min_height, LLResizeBar::RIGHT ); | 333 | min_width, S32_MAX, LLResizeBar::RIGHT ); |
331 | addChild( mResizeBar[2] ); | 334 | addChild( mResizeBar[2] ); |
332 | 335 | ||
333 | mResizeBar[3] = new LLResizeBar( | 336 | mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar( |
334 | "resizebar_bottom", | 337 | "resizebar_bottom", |
338 | this, | ||
335 | LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0), | 339 | LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0), |
336 | min_width, min_height, LLResizeBar::BOTTOM ); | 340 | min_height, S32_MAX, LLResizeBar::BOTTOM ); |
337 | addChild( mResizeBar[3] ); | 341 | addChild( mResizeBar[3] ); |
338 | 342 | ||
339 | 343 | ||
@@ -367,18 +371,6 @@ void LLFloater::init(const LLString& title, | |||
367 | LLResizeHandle::LEFT_TOP ); | 371 | LLResizeHandle::LEFT_TOP ); |
368 | addChild(mResizeHandle[3]); | 372 | addChild(mResizeHandle[3]); |
369 | } | 373 | } |
370 | else | ||
371 | { | ||
372 | mResizeBar[0] = NULL; | ||
373 | mResizeBar[1] = NULL; | ||
374 | mResizeBar[2] = NULL; | ||
375 | mResizeBar[3] = NULL; | ||
376 | |||
377 | mResizeHandle[0] = NULL; | ||
378 | mResizeHandle[1] = NULL; | ||
379 | mResizeHandle[2] = NULL; | ||
380 | mResizeHandle[3] = NULL; | ||
381 | } | ||
382 | 374 | ||
383 | // Close button. | 375 | // Close button. |
384 | if (close_btn) | 376 | if (close_btn) |
@@ -392,6 +384,13 @@ void LLFloater::init(const LLString& title, | |||
392 | mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; | 384 | mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; |
393 | } | 385 | } |
394 | 386 | ||
387 | // Keep track of whether this window has ever been dragged while it | ||
388 | // was minimized. If it has, we'll remember its position for the | ||
389 | // next time it's minimized. | ||
390 | mHasBeenDraggedWhileMinimized = FALSE; | ||
391 | mPreviousMinimizedLeft = 0; | ||
392 | mPreviousMinimizedBottom = 0; | ||
393 | |||
395 | buildButtons(); | 394 | buildButtons(); |
396 | 395 | ||
397 | // JC - Don't do this here, because many floaters first construct themselves, | 396 | // JC - Don't do this here, because many floaters first construct themselves, |
@@ -626,7 +625,14 @@ void LLFloater::setResizeLimits( S32 min_width, S32 min_height ) | |||
626 | { | 625 | { |
627 | if( mResizeBar[i] ) | 626 | if( mResizeBar[i] ) |
628 | { | 627 | { |
629 | mResizeBar[i]->setResizeLimits( min_width, min_height ); | 628 | if (i == LLResizeBar::LEFT || i == LLResizeBar::RIGHT) |
629 | { | ||
630 | mResizeBar[i]->setResizeLimits( min_width, S32_MAX ); | ||
631 | } | ||
632 | else | ||
633 | { | ||
634 | mResizeBar[i]->setResizeLimits( min_height, S32_MAX ); | ||
635 | } | ||
630 | } | 636 | } |
631 | if( mResizeHandle[i] ) | 637 | if( mResizeHandle[i] ) |
632 | { | 638 | { |
@@ -678,6 +684,25 @@ const LLString& LLFloater::getTitle() const | |||
678 | return mDragHandle ? mDragHandle->getTitle() : LLString::null; | 684 | return mDragHandle ? mDragHandle->getTitle() : LLString::null; |
679 | } | 685 | } |
680 | 686 | ||
687 | void LLFloater::setShortTitle( const LLString& short_title ) | ||
688 | { | ||
689 | mShortTitle = short_title; | ||
690 | } | ||
691 | |||
692 | LLString LLFloater::getShortTitle() | ||
693 | { | ||
694 | if (mShortTitle.empty()) | ||
695 | { | ||
696 | return mDragHandle ? mDragHandle->getTitle() : LLString::null; | ||
697 | } | ||
698 | else | ||
699 | { | ||
700 | return mShortTitle; | ||
701 | } | ||
702 | } | ||
703 | |||
704 | |||
705 | |||
681 | BOOL LLFloater::canSnapTo(LLView* other_view) | 706 | BOOL LLFloater::canSnapTo(LLView* other_view) |
682 | { | 707 | { |
683 | if (NULL == other_view) | 708 | if (NULL == other_view) |
@@ -757,6 +782,16 @@ void LLFloater::userSetShape(const LLRect& new_rect) | |||
757 | } | 782 | } |
758 | } | 783 | } |
759 | } | 784 | } |
785 | else | ||
786 | { | ||
787 | // If minimized, and origin has changed, set | ||
788 | // mHasBeenDraggedWhileMinimized to TRUE | ||
789 | if ((new_rect.mLeft != old_rect.mLeft) || | ||
790 | (new_rect.mBottom != old_rect.mBottom)) | ||
791 | { | ||
792 | mHasBeenDraggedWhileMinimized = TRUE; | ||
793 | } | ||
794 | } | ||
760 | } | 795 | } |
761 | 796 | ||
762 | void LLFloater::setMinimized(BOOL minimize) | 797 | void LLFloater::setMinimized(BOOL minimize) |
@@ -769,9 +804,19 @@ void LLFloater::setMinimized(BOOL minimize) | |||
769 | 804 | ||
770 | reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE); | 805 | reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE); |
771 | 806 | ||
772 | S32 left, bottom; | 807 | // If the floater has been dragged while minimized in the |
773 | gFloaterView->getMinimizePosition(&left, &bottom); | 808 | // past, then locate it at its previous minimized location. |
774 | setOrigin( left, bottom ); | 809 | // Otherwise, ask the view for a minimize position. |
810 | if (mHasBeenDraggedWhileMinimized) | ||
811 | { | ||
812 | setOrigin(mPreviousMinimizedLeft, mPreviousMinimizedBottom); | ||
813 | } | ||
814 | else | ||
815 | { | ||
816 | S32 left, bottom; | ||
817 | gFloaterView->getMinimizePosition(&left, &bottom); | ||
818 | setOrigin( left, bottom ); | ||
819 | } | ||
775 | 820 | ||
776 | if (mButtonsEnabled[BUTTON_MINIMIZE]) | 821 | if (mButtonsEnabled[BUTTON_MINIMIZE]) |
777 | { | 822 | { |
@@ -824,6 +869,15 @@ void LLFloater::setMinimized(BOOL minimize) | |||
824 | } | 869 | } |
825 | else | 870 | else |
826 | { | 871 | { |
872 | // If this window has been dragged while minimized (at any time), | ||
873 | // remember its position for the next time it's minimized. | ||
874 | if (mHasBeenDraggedWhileMinimized) | ||
875 | { | ||
876 | const LLRect& currentRect = getRect(); | ||
877 | mPreviousMinimizedLeft = currentRect.mLeft; | ||
878 | mPreviousMinimizedBottom = currentRect.mBottom; | ||
879 | } | ||
880 | |||
827 | reshape( mPreviousRect.getWidth(), mPreviousRect.getHeight(), TRUE ); | 881 | reshape( mPreviousRect.getWidth(), mPreviousRect.getHeight(), TRUE ); |
828 | setOrigin( mPreviousRect.mLeft, mPreviousRect.mBottom ); | 882 | setOrigin( mPreviousRect.mLeft, mPreviousRect.mBottom ); |
829 | 883 | ||
@@ -987,12 +1041,22 @@ void LLFloater::setHost(LLMultiFloater* host) | |||
987 | } | 1041 | } |
988 | } | 1042 | } |
989 | 1043 | ||
990 | void LLFloater::moveResizeHandleToFront() | 1044 | void LLFloater::moveResizeHandlesToFront() |
991 | { | 1045 | { |
992 | // 0 is the bottom right | 1046 | for( S32 i = 0; i < 4; i++ ) |
993 | if( mResizeHandle[0] ) | ||
994 | { | 1047 | { |
995 | sendChildToFront(mResizeHandle[0]); | 1048 | if( mResizeBar[i] ) |
1049 | { | ||
1050 | sendChildToFront(mResizeBar[i]); | ||
1051 | } | ||
1052 | } | ||
1053 | |||
1054 | for( S32 i = 0; i < 4; i++ ) | ||
1055 | { | ||
1056 | if( mResizeHandle[i] ) | ||
1057 | { | ||
1058 | sendChildToFront(mResizeHandle[i]); | ||
1059 | } | ||
996 | } | 1060 | } |
997 | } | 1061 | } |
998 | 1062 | ||
@@ -1040,7 +1104,6 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) | |||
1040 | if( mMinimized ) | 1104 | if( mMinimized ) |
1041 | { | 1105 | { |
1042 | // Offer the click to the close button. | 1106 | // Offer the click to the close button. |
1043 | // Any other click = restore | ||
1044 | if( mButtonsEnabled[BUTTON_CLOSE] ) | 1107 | if( mButtonsEnabled[BUTTON_CLOSE] ) |
1045 | { | 1108 | { |
1046 | S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft; | 1109 | S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft; |
@@ -1054,9 +1117,22 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) | |||
1054 | } | 1117 | } |
1055 | } | 1118 | } |
1056 | 1119 | ||
1057 | // restore | 1120 | // Offer the click to the restore button. |
1058 | bringToFront( x, y ); | 1121 | if( mButtonsEnabled[BUTTON_RESTORE] ) |
1059 | return TRUE; | 1122 | { |
1123 | S32 local_x = x - mButtons[BUTTON_RESTORE]->getRect().mLeft; | ||
1124 | S32 local_y = y - mButtons[BUTTON_RESTORE]->getRect().mBottom; | ||
1125 | |||
1126 | if (mButtons[BUTTON_RESTORE]->pointInView(local_x, local_y) | ||
1127 | && mButtons[BUTTON_RESTORE]->handleMouseDown(local_x, local_y, mask)) | ||
1128 | { | ||
1129 | // restore button handled it, return | ||
1130 | return TRUE; | ||
1131 | } | ||
1132 | } | ||
1133 | |||
1134 | // Otherwise pass to drag handle for movement | ||
1135 | return mDragHandle->handleMouseDown(x, y, mask); | ||
1060 | } | 1136 | } |
1061 | else | 1137 | else |
1062 | { | 1138 | { |
@@ -1177,6 +1253,10 @@ BOOL LLFloater::getEditModeEnabled() | |||
1177 | void LLFloater::show(LLFloater* floaterp) | 1253 | void LLFloater::show(LLFloater* floaterp) |
1178 | { | 1254 | { |
1179 | if (floaterp) floaterp->open(); | 1255 | if (floaterp) floaterp->open(); |
1256 | if (floaterp->getHost()) | ||
1257 | { | ||
1258 | floaterp->getHost()->open(); | ||
1259 | } | ||
1180 | } | 1260 | } |
1181 | 1261 | ||
1182 | //static | 1262 | //static |
@@ -1190,7 +1270,7 @@ BOOL LLFloater::visible(LLFloater* floaterp) | |||
1190 | { | 1270 | { |
1191 | if (floaterp) | 1271 | if (floaterp) |
1192 | { | 1272 | { |
1193 | return floaterp->isInVisibleChain(); | 1273 | return !floaterp->isMinimized() && floaterp->isInVisibleChain(); |
1194 | } | 1274 | } |
1195 | return FALSE; | 1275 | return FALSE; |
1196 | } | 1276 | } |
@@ -1217,12 +1297,15 @@ void LLFloater::onClickTearOff(void *userdata) | |||
1217 | // reparent to floater view | 1297 | // reparent to floater view |
1218 | gFloaterView->addChild(self); | 1298 | gFloaterView->addChild(self); |
1219 | 1299 | ||
1220 | new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->mRect.getWidth(), self->mRect.getHeight()); | ||
1221 | |||
1222 | self->open(); /* Flawfinder: ignore */ | 1300 | self->open(); /* Flawfinder: ignore */ |
1223 | self->setRect(new_rect); | 1301 | |
1302 | // only force position for floaters that don't have that data saved | ||
1303 | if (self->mRectControl.empty()) | ||
1304 | { | ||
1305 | new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->mRect.getWidth(), self->mRect.getHeight()); | ||
1306 | self->setRect(new_rect); | ||
1307 | } | ||
1224 | gFloaterView->adjustToFitScreen(self, FALSE); | 1308 | gFloaterView->adjustToFitScreen(self, FALSE); |
1225 | self->setCanDrag(TRUE); | ||
1226 | // give focus to new window to keep continuity for the user | 1309 | // give focus to new window to keep continuity for the user |
1227 | self->setFocus(TRUE); | 1310 | self->setFocus(TRUE); |
1228 | } | 1311 | } |
@@ -1232,6 +1315,8 @@ void LLFloater::onClickTearOff(void *userdata) | |||
1232 | if (new_host) | 1315 | if (new_host) |
1233 | { | 1316 | { |
1234 | new_host->showFloater(self); | 1317 | new_host->showFloater(self); |
1318 | // make sure host is visible | ||
1319 | new_host->open(); | ||
1235 | } | 1320 | } |
1236 | } | 1321 | } |
1237 | } | 1322 | } |
@@ -1468,30 +1553,14 @@ void LLFloater::setCanResize(BOOL can_resize) | |||
1468 | { | 1553 | { |
1469 | if (mResizable && !can_resize) | 1554 | if (mResizable && !can_resize) |
1470 | { | 1555 | { |
1471 | removeChild(mResizeBar[0]); | 1556 | for (S32 i = 0; i < 4; i++) |
1472 | removeChild(mResizeBar[1]); | 1557 | { |
1473 | removeChild(mResizeBar[2]); | 1558 | removeChild(mResizeBar[i], TRUE); |
1474 | removeChild(mResizeBar[3]); | 1559 | mResizeBar[i] = NULL; |
1475 | removeChild(mResizeHandle[0]); | 1560 | |
1476 | removeChild(mResizeHandle[1]); | 1561 | removeChild(mResizeHandle[i], TRUE); |
1477 | removeChild(mResizeHandle[2]); | 1562 | mResizeHandle[i] = NULL; |
1478 | removeChild(mResizeHandle[3]); | 1563 | } |
1479 | delete mResizeBar[0]; | ||
1480 | delete mResizeBar[1]; | ||
1481 | delete mResizeBar[2]; | ||
1482 | delete mResizeBar[3]; | ||
1483 | delete mResizeHandle[0]; | ||
1484 | delete mResizeHandle[1]; | ||
1485 | delete mResizeHandle[2]; | ||
1486 | mResizeHandle[3] = NULL; | ||
1487 | mResizeBar[0] = NULL; | ||
1488 | mResizeBar[1] = NULL; | ||
1489 | mResizeBar[2] = NULL; | ||
1490 | mResizeBar[3] = NULL; | ||
1491 | mResizeHandle[0] = NULL; | ||
1492 | mResizeHandle[1] = NULL; | ||
1493 | mResizeHandle[2] = NULL; | ||
1494 | mResizeHandle[3] = NULL; | ||
1495 | } | 1564 | } |
1496 | else if (!mResizable && can_resize) | 1565 | else if (!mResizable && can_resize) |
1497 | { | 1566 | { |
@@ -1499,26 +1568,30 @@ void LLFloater::setCanResize(BOOL can_resize) | |||
1499 | const S32 RESIZE_BAR_THICKNESS = 3; | 1568 | const S32 RESIZE_BAR_THICKNESS = 3; |
1500 | mResizeBar[0] = new LLResizeBar( | 1569 | mResizeBar[0] = new LLResizeBar( |
1501 | "resizebar_left", | 1570 | "resizebar_left", |
1571 | this, | ||
1502 | LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0), | 1572 | LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0), |
1503 | mMinWidth, mMinHeight, LLResizeBar::LEFT ); | 1573 | mMinWidth, S32_MAX, LLResizeBar::LEFT ); |
1504 | addChild( mResizeBar[0] ); | 1574 | addChild( mResizeBar[0] ); |
1505 | 1575 | ||
1506 | mResizeBar[1] = new LLResizeBar( | 1576 | mResizeBar[1] = new LLResizeBar( |
1507 | "resizebar_top", | 1577 | "resizebar_top", |
1578 | this, | ||
1508 | LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS), | 1579 | LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS), |
1509 | mMinWidth, mMinHeight, LLResizeBar::TOP ); | 1580 | mMinHeight, S32_MAX, LLResizeBar::TOP ); |
1510 | addChild( mResizeBar[1] ); | 1581 | addChild( mResizeBar[1] ); |
1511 | 1582 | ||
1512 | mResizeBar[2] = new LLResizeBar( | 1583 | mResizeBar[2] = new LLResizeBar( |
1513 | "resizebar_right", | 1584 | "resizebar_right", |
1585 | this, | ||
1514 | LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0), | 1586 | LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0), |
1515 | mMinWidth, mMinHeight, LLResizeBar::RIGHT ); | 1587 | mMinWidth, S32_MAX, LLResizeBar::RIGHT ); |
1516 | addChild( mResizeBar[2] ); | 1588 | addChild( mResizeBar[2] ); |
1517 | 1589 | ||
1518 | mResizeBar[3] = new LLResizeBar( | 1590 | mResizeBar[3] = new LLResizeBar( |
1519 | "resizebar_bottom", | 1591 | "resizebar_bottom", |
1592 | this, | ||
1520 | LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0), | 1593 | LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0), |
1521 | mMinWidth, mMinHeight, LLResizeBar::BOTTOM ); | 1594 | mMinHeight, S32_MAX, LLResizeBar::BOTTOM ); |
1522 | addChild( mResizeBar[3] ); | 1595 | addChild( mResizeBar[3] ); |
1523 | 1596 | ||
1524 | 1597 | ||
@@ -1855,7 +1928,7 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF | |||
1855 | sibling->getVisible() && | 1928 | sibling->getVisible() && |
1856 | expanded_base_rect.rectInRect(&sibling->getRect())) | 1929 | expanded_base_rect.rectInRect(&sibling->getRect())) |
1857 | { | 1930 | { |
1858 | base_rect |= sibling->getRect(); | 1931 | base_rect.unionWith(sibling->getRect()); |
1859 | } | 1932 | } |
1860 | } | 1933 | } |
1861 | 1934 | ||
@@ -2550,18 +2623,22 @@ BOOL LLMultiFloater::closeAllFloaters() | |||
2550 | return TRUE; //else all tabs were successfully closed... | 2623 | return TRUE; //else all tabs were successfully closed... |
2551 | } | 2624 | } |
2552 | 2625 | ||
2553 | void LLMultiFloater::growToFit(LLFloater* floaterp, S32 width, S32 height) | 2626 | void LLMultiFloater::growToFit(S32 content_width, S32 content_height) |
2554 | { | 2627 | { |
2555 | floater_data_map_t::iterator found_data_it; | 2628 | S32 new_width = llmax(mRect.getWidth(), content_width + LLPANEL_BORDER_WIDTH * 2); |
2556 | found_data_it = mFloaterDataMap.find(floaterp->getHandle()); | 2629 | S32 new_height = llmax(mRect.getHeight(), content_height + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); |
2557 | if (found_data_it != mFloaterDataMap.end()) | 2630 | |
2631 | if (isMinimized()) | ||
2558 | { | 2632 | { |
2559 | // store new width and height with this floater so that it will keep its size when detached | 2633 | mPreviousRect.setLeftTopAndSize(mPreviousRect.mLeft, mPreviousRect.mTop, new_width, new_height); |
2560 | found_data_it->second.mWidth = width; | 2634 | } |
2561 | found_data_it->second.mHeight = height; | 2635 | else |
2636 | { | ||
2637 | S32 old_height = mRect.getHeight(); | ||
2638 | reshape(new_width, new_height); | ||
2639 | // keep top left corner in same position | ||
2640 | translate(0, old_height - new_height); | ||
2562 | } | 2641 | } |
2563 | |||
2564 | resizeToContents(); | ||
2565 | } | 2642 | } |
2566 | 2643 | ||
2567 | /** | 2644 | /** |
@@ -2618,12 +2695,18 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, | |||
2618 | floaterp->setCanMinimize(FALSE); | 2695 | floaterp->setCanMinimize(FALSE); |
2619 | floaterp->setCanResize(FALSE); | 2696 | floaterp->setCanResize(FALSE); |
2620 | floaterp->setCanDrag(FALSE); | 2697 | floaterp->setCanDrag(FALSE); |
2698 | floaterp->storeRectControl(); | ||
2699 | |||
2700 | if (mAutoResize) | ||
2701 | { | ||
2702 | growToFit(floater_data.mWidth, floater_data.mHeight); | ||
2703 | } | ||
2621 | 2704 | ||
2622 | //add the panel, add it to proper maps | 2705 | //add the panel, add it to proper maps |
2623 | mTabContainer->addTabPanel(floaterp, floaterp->getTitle(), FALSE, onTabSelected, this, 0, FALSE, insertion_point); | 2706 | mTabContainer->addTabPanel(floaterp, floaterp->getShortTitle(), FALSE, onTabSelected, this, 0, FALSE, insertion_point); |
2624 | mFloaterDataMap[floaterp->getHandle()] = floater_data; | 2707 | mFloaterDataMap[floaterp->getHandle()] = floater_data; |
2625 | 2708 | ||
2626 | resizeToContents(); | 2709 | updateResizeLimits(); |
2627 | 2710 | ||
2628 | if ( select_added_floater ) | 2711 | if ( select_added_floater ) |
2629 | { | 2712 | { |
@@ -2673,7 +2756,6 @@ void LLMultiFloater::showFloater(LLFloater* floaterp) | |||
2673 | { | 2756 | { |
2674 | addFloater(floaterp, TRUE); | 2757 | addFloater(floaterp, TRUE); |
2675 | } | 2758 | } |
2676 | setVisibleAndFrontmost(); | ||
2677 | } | 2759 | } |
2678 | 2760 | ||
2679 | void LLMultiFloater::removeFloater(LLFloater* floaterp) | 2761 | void LLMultiFloater::removeFloater(LLFloater* floaterp) |
@@ -2696,9 +2778,11 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp) | |||
2696 | } | 2778 | } |
2697 | mTabContainer->removeTabPanel(floaterp); | 2779 | mTabContainer->removeTabPanel(floaterp); |
2698 | floaterp->setBackgroundVisible(TRUE); | 2780 | floaterp->setBackgroundVisible(TRUE); |
2781 | floaterp->setCanDrag(TRUE); | ||
2699 | floaterp->setHost(NULL); | 2782 | floaterp->setHost(NULL); |
2783 | floaterp->applyRectControl(); | ||
2700 | 2784 | ||
2701 | resizeToContents(); | 2785 | updateResizeLimits(); |
2702 | 2786 | ||
2703 | tabOpen((LLFloater*)mTabContainer->getCurrentPanel(), false); | 2787 | tabOpen((LLFloater*)mTabContainer->getCurrentPanel(), false); |
2704 | } | 2788 | } |
@@ -2840,18 +2924,8 @@ BOOL LLMultiFloater::postBuild() | |||
2840 | return FALSE; | 2924 | return FALSE; |
2841 | } | 2925 | } |
2842 | 2926 | ||
2843 | void LLMultiFloater::resizeToContents() | 2927 | void LLMultiFloater::updateResizeLimits() |
2844 | { | 2928 | { |
2845 | // we're already in the middle of a reshape, don't interrupt it | ||
2846 | floater_data_map_t::iterator floater_it; | ||
2847 | S32 new_width = 0; | ||
2848 | S32 new_height = 0; | ||
2849 | for (floater_it = mFloaterDataMap.begin(); floater_it != mFloaterDataMap.end(); ++floater_it) | ||
2850 | { | ||
2851 | new_width = llmax(new_width, floater_it->second.mWidth + LLPANEL_BORDER_WIDTH * 2); | ||
2852 | new_height = llmax(new_height, floater_it->second.mHeight + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); | ||
2853 | } | ||
2854 | |||
2855 | S32 new_min_width = 0; | 2929 | S32 new_min_width = 0; |
2856 | S32 new_min_height = 0; | 2930 | S32 new_min_height = 0; |
2857 | S32 tab_idx; | 2931 | S32 tab_idx; |
@@ -2867,21 +2941,23 @@ void LLMultiFloater::resizeToContents() | |||
2867 | setResizeLimits(new_min_width, new_min_height); | 2941 | setResizeLimits(new_min_width, new_min_height); |
2868 | 2942 | ||
2869 | S32 cur_height = mRect.getHeight(); | 2943 | S32 cur_height = mRect.getHeight(); |
2944 | S32 new_width = llmax(mRect.getWidth(), new_min_width); | ||
2945 | S32 new_height = llmax(mRect.getHeight(), new_min_height); | ||
2870 | 2946 | ||
2871 | if (mAutoResize) | 2947 | if (isMinimized()) |
2872 | { | 2948 | { |
2873 | reshape(new_width, new_height); | 2949 | mPreviousRect.setLeftTopAndSize(mPreviousRect.mLeft, mPreviousRect.mTop, llmax(mPreviousRect.getWidth(), new_width), llmax(mPreviousRect.getHeight(), new_height)); |
2874 | } | 2950 | } |
2875 | else | 2951 | else |
2876 | { | 2952 | { |
2877 | reshape(llmax(new_min_width, mRect.getWidth()), llmax(new_min_height, mRect.getHeight())); | 2953 | reshape(new_width, new_height); |
2878 | } | ||
2879 | 2954 | ||
2880 | // make sure upper left corner doesn't move | 2955 | // make sure upper left corner doesn't move |
2881 | translate(0, cur_height - mRect.getHeight()); | 2956 | translate(0, cur_height - mRect.getHeight()); |
2882 | 2957 | ||
2883 | // Try to keep whole view onscreen, don't allow partial offscreen. | 2958 | // Try to keep whole view onscreen, don't allow partial offscreen. |
2884 | gFloaterView->adjustToFitScreen(this, FALSE); | 2959 | gFloaterView->adjustToFitScreen(this, FALSE); |
2960 | } | ||
2885 | } | 2961 | } |
2886 | 2962 | ||
2887 | // virtual | 2963 | // virtual |
@@ -2937,6 +3013,7 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor | |||
2937 | { | 3013 | { |
2938 | LLString name(getName()); | 3014 | LLString name(getName()); |
2939 | LLString title(getTitle()); | 3015 | LLString title(getTitle()); |
3016 | LLString short_title(getShortTitle()); | ||
2940 | LLString rect_control(""); | 3017 | LLString rect_control(""); |
2941 | BOOL resizable = isResizable(); | 3018 | BOOL resizable = isResizable(); |
2942 | S32 min_width = getMinWidth(); | 3019 | S32 min_width = getMinWidth(); |
@@ -2948,6 +3025,7 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor | |||
2948 | 3025 | ||
2949 | node->getAttributeString("name", name); | 3026 | node->getAttributeString("name", name); |
2950 | node->getAttributeString("title", title); | 3027 | node->getAttributeString("title", title); |
3028 | node->getAttributeString("short_title", short_title); | ||
2951 | node->getAttributeString("rect_control", rect_control); | 3029 | node->getAttributeString("rect_control", rect_control); |
2952 | node->getAttributeBOOL("can_resize", resizable); | 3030 | node->getAttributeBOOL("can_resize", resizable); |
2953 | node->getAttributeBOOL("can_minimize", minimizable); | 3031 | node->getAttributeBOOL("can_minimize", minimizable); |
@@ -2974,6 +3052,8 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor | |||
2974 | minimizable, | 3052 | minimizable, |
2975 | close_btn); | 3053 | close_btn); |
2976 | 3054 | ||
3055 | setShortTitle(short_title); | ||
3056 | |||
2977 | BOOL can_tear_off; | 3057 | BOOL can_tear_off; |
2978 | if (node->getAttributeBOOL("can_tear_off", can_tear_off)) | 3058 | if (node->getAttributeBOOL("can_tear_off", can_tear_off)) |
2979 | { | 3059 | { |
@@ -2988,17 +3068,13 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor | |||
2988 | LLFloater::setFloaterHost((LLMultiFloater*) this); | 3068 | LLFloater::setFloaterHost((LLMultiFloater*) this); |
2989 | } | 3069 | } |
2990 | 3070 | ||
2991 | LLXMLNodePtr child; | 3071 | initChildrenXML(node, factory); |
2992 | for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) | 3072 | |
2993 | { | ||
2994 | factory->createWidget(this, child); | ||
2995 | } | ||
2996 | if (node->hasName("multi_floater")) | 3073 | if (node->hasName("multi_floater")) |
2997 | { | 3074 | { |
2998 | LLFloater::setFloaterHost(last_host); | 3075 | LLFloater::setFloaterHost(last_host); |
2999 | } | 3076 | } |
3000 | 3077 | ||
3001 | |||
3002 | BOOL result = postBuild(); | 3078 | BOOL result = postBuild(); |
3003 | 3079 | ||
3004 | if (!result) | 3080 | if (!result) |
@@ -3011,4 +3087,6 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor | |||
3011 | { | 3087 | { |
3012 | this->open(); /* Flawfinder: ignore */ | 3088 | this->open(); /* Flawfinder: ignore */ |
3013 | } | 3089 | } |
3090 | |||
3091 | moveResizeHandlesToFront(); | ||
3014 | } | 3092 | } |