diff options
Diffstat (limited to 'linden/indra/llui/llfloater.cpp')
-rw-r--r-- | linden/indra/llui/llfloater.cpp | 73 |
1 files changed, 50 insertions, 23 deletions
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index df44a58..6ab182f 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp | |||
@@ -575,17 +575,20 @@ void LLFloater::close(bool app_quitting) | |||
575 | cleanupHandles(); | 575 | cleanupHandles(); |
576 | gFocusMgr.clearLastFocusForGroup(this); | 576 | gFocusMgr.clearLastFocusForGroup(this); |
577 | 577 | ||
578 | // Do this early, so UI controls will commit before the | 578 | if (hasFocus()) |
579 | // window is taken down. | ||
580 | releaseFocus(); | ||
581 | |||
582 | // give focus to dependee floater if it exists, and we had focus first | ||
583 | if (isDependent()) | ||
584 | { | 579 | { |
585 | LLFloater* dependee = LLFloater::getFloaterByHandle(mDependeeHandle); | 580 | // Do this early, so UI controls will commit before the |
586 | if (dependee && !dependee->isDead()) | 581 | // window is taken down. |
582 | releaseFocus(); | ||
583 | |||
584 | // give focus to dependee floater if it exists, and we had focus first | ||
585 | if (isDependent()) | ||
587 | { | 586 | { |
588 | dependee->setFocus(TRUE); | 587 | LLFloater* dependee = LLFloater::getFloaterByHandle(mDependeeHandle); |
588 | if (dependee && !dependee->isDead()) | ||
589 | { | ||
590 | dependee->setFocus(TRUE); | ||
591 | } | ||
589 | } | 592 | } |
590 | } | 593 | } |
591 | 594 | ||
@@ -1170,6 +1173,28 @@ BOOL LLFloater::getEditModeEnabled() | |||
1170 | return sEditModeEnabled; | 1173 | return sEditModeEnabled; |
1171 | } | 1174 | } |
1172 | 1175 | ||
1176 | //static | ||
1177 | void LLFloater::show(LLFloater* floaterp) | ||
1178 | { | ||
1179 | if (floaterp) floaterp->open(); | ||
1180 | } | ||
1181 | |||
1182 | //static | ||
1183 | void LLFloater::hide(LLFloater* floaterp) | ||
1184 | { | ||
1185 | if (floaterp) floaterp->close(); | ||
1186 | } | ||
1187 | |||
1188 | //static | ||
1189 | BOOL LLFloater::visible(LLFloater* floaterp) | ||
1190 | { | ||
1191 | if (floaterp) | ||
1192 | { | ||
1193 | return floaterp->isInVisibleChain(); | ||
1194 | } | ||
1195 | return FALSE; | ||
1196 | } | ||
1197 | |||
1173 | // static | 1198 | // static |
1174 | void LLFloater::onClickMinimize(void *userdata) | 1199 | void LLFloater::onClickMinimize(void *userdata) |
1175 | { | 1200 | { |
@@ -2372,7 +2397,7 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list) | |||
2372 | LLMultiFloater::LLMultiFloater() : | 2397 | LLMultiFloater::LLMultiFloater() : |
2373 | mTabContainer(NULL), | 2398 | mTabContainer(NULL), |
2374 | mTabPos(LLTabContainerCommon::TOP), | 2399 | mTabPos(LLTabContainerCommon::TOP), |
2375 | mAutoResize(FALSE) | 2400 | mAutoResize(TRUE) |
2376 | { | 2401 | { |
2377 | 2402 | ||
2378 | } | 2403 | } |
@@ -2380,7 +2405,7 @@ LLMultiFloater::LLMultiFloater() : | |||
2380 | LLMultiFloater::LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos) : | 2405 | LLMultiFloater::LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos) : |
2381 | mTabContainer(NULL), | 2406 | mTabContainer(NULL), |
2382 | mTabPos(tab_pos), | 2407 | mTabPos(tab_pos), |
2383 | mAutoResize(FALSE) | 2408 | mAutoResize(TRUE) |
2384 | { | 2409 | { |
2385 | 2410 | ||
2386 | } | 2411 | } |
@@ -2594,15 +2619,12 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, | |||
2594 | floaterp->setCanResize(FALSE); | 2619 | floaterp->setCanResize(FALSE); |
2595 | floaterp->setCanDrag(FALSE); | 2620 | floaterp->setCanDrag(FALSE); |
2596 | 2621 | ||
2597 | S32 new_width = llmax(mRect.getWidth(), floaterp->getRect().getWidth()); | ||
2598 | S32 new_height = llmax(mRect.getHeight(), floaterp->getRect().getHeight() + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); | ||
2599 | |||
2600 | reshape(new_width, new_height); | ||
2601 | |||
2602 | //add the panel, add it to proper maps | 2622 | //add the panel, add it to proper maps |
2603 | mTabContainer->addTabPanel(floaterp, floaterp->getTitle(), FALSE, onTabSelected, this, 0, FALSE, insertion_point); | 2623 | mTabContainer->addTabPanel(floaterp, floaterp->getTitle(), FALSE, onTabSelected, this, 0, FALSE, insertion_point); |
2604 | mFloaterDataMap[floaterp->getHandle()] = floater_data; | 2624 | mFloaterDataMap[floaterp->getHandle()] = floater_data; |
2605 | 2625 | ||
2626 | resizeToContents(); | ||
2627 | |||
2606 | if ( select_added_floater ) | 2628 | if ( select_added_floater ) |
2607 | { | 2629 | { |
2608 | mTabContainer->selectLastTab(); | 2630 | mTabContainer->selectLastTab(); |
@@ -2676,10 +2698,7 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp) | |||
2676 | floaterp->setBackgroundVisible(TRUE); | 2698 | floaterp->setBackgroundVisible(TRUE); |
2677 | floaterp->setHost(NULL); | 2699 | floaterp->setHost(NULL); |
2678 | 2700 | ||
2679 | if (mAutoResize) | 2701 | resizeToContents(); |
2680 | { | ||
2681 | resizeToContents(); | ||
2682 | } | ||
2683 | 2702 | ||
2684 | tabOpen((LLFloater*)mTabContainer->getCurrentPanel(), false); | 2703 | tabOpen((LLFloater*)mTabContainer->getCurrentPanel(), false); |
2685 | } | 2704 | } |
@@ -2729,7 +2748,8 @@ BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) | |||
2729 | if (key == 'W') | 2748 | if (key == 'W') |
2730 | { | 2749 | { |
2731 | LLFloater* floater = getActiveFloater(); | 2750 | LLFloater* floater = getActiveFloater(); |
2732 | if (floater && floater->canClose()) | 2751 | // is user closeable and is system closeable |
2752 | if (floater && floater->canClose() && floater->isCloseable()) | ||
2733 | { | 2753 | { |
2734 | floater->close(); | 2754 | floater->close(); |
2735 | } | 2755 | } |
@@ -2848,10 +2868,17 @@ void LLMultiFloater::resizeToContents() | |||
2848 | 2868 | ||
2849 | S32 cur_height = mRect.getHeight(); | 2869 | S32 cur_height = mRect.getHeight(); |
2850 | 2870 | ||
2851 | reshape(new_width, new_height); | 2871 | if (mAutoResize) |
2872 | { | ||
2873 | reshape(new_width, new_height); | ||
2874 | } | ||
2875 | else | ||
2876 | { | ||
2877 | reshape(llmax(new_min_width, mRect.getWidth()), llmax(new_min_height, mRect.getHeight())); | ||
2878 | } | ||
2852 | 2879 | ||
2853 | // make sure upper left corner doesn't move | 2880 | // make sure upper left corner doesn't move |
2854 | translate(0, cur_height - new_height); | 2881 | translate(0, cur_height - mRect.getHeight()); |
2855 | 2882 | ||
2856 | // Try to keep whole view onscreen, don't allow partial offscreen. | 2883 | // Try to keep whole view onscreen, don't allow partial offscreen. |
2857 | gFloaterView->adjustToFitScreen(this, FALSE); | 2884 | gFloaterView->adjustToFitScreen(this, FALSE); |