aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llfloater.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llfloater.cpp488
1 files changed, 161 insertions, 327 deletions
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp
index 6d86652..493e68f 100644
--- a/linden/indra/llui/llfloater.cpp
+++ b/linden/indra/llui/llfloater.cpp
@@ -142,20 +142,18 @@ LLFloater::LLFloater() :
142 mButtons[i] = NULL; 142 mButtons[i] = NULL;
143 } 143 }
144 mDragHandle = NULL; 144 mDragHandle = NULL;
145 mHandle.bind(this);
145} 146}
146 147
147LLFloater::LLFloater(const LLString& name) 148LLFloater::LLFloater(const LLString& name)
148: LLPanel(name) 149: LLPanel(name), mAutoFocus(TRUE) // automatically take focus when opened
149{ 150{
150 for (S32 i = 0; i < BUTTON_COUNT; i++) 151 for (S32 i = 0; i < BUTTON_COUNT; i++)
151 { 152 {
152 mButtonsEnabled[i] = FALSE; 153 mButtonsEnabled[i] = FALSE;
153 mButtons[i] = NULL; 154 mButtons[i] = NULL;
154 } 155 }
155
156 LLString title; // null string 156 LLString title; // null string
157 // automatically take focus when opened
158 mAutoFocus = TRUE;
159 init(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults 157 init(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults
160} 158}
161 159
@@ -168,15 +166,13 @@ LLFloater::LLFloater(const LLString& name, const LLRect& rect, const LLString& t
168 BOOL minimizable, 166 BOOL minimizable,
169 BOOL close_btn, 167 BOOL close_btn,
170 BOOL bordered) 168 BOOL bordered)
171: LLPanel(name, rect, bordered) 169: LLPanel(name, rect, bordered), mAutoFocus(TRUE) // automatically take focus when opened
172{ 170{
173 for (S32 i = 0; i < BUTTON_COUNT; i++) 171 for (S32 i = 0; i < BUTTON_COUNT; i++)
174 { 172 {
175 mButtonsEnabled[i] = FALSE; 173 mButtonsEnabled[i] = FALSE;
176 mButtons[i] = NULL; 174 mButtons[i] = NULL;
177 } 175 }
178 // automatically take focus when opened
179 mAutoFocus = TRUE;
180 init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); 176 init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
181} 177}
182 178
@@ -188,15 +184,13 @@ LLFloater::LLFloater(const LLString& name, const LLString& rect_control, const L
188 BOOL minimizable, 184 BOOL minimizable,
189 BOOL close_btn, 185 BOOL close_btn,
190 BOOL bordered) 186 BOOL bordered)
191: LLPanel(name, rect_control, bordered) 187: LLPanel(name, rect_control, bordered), mAutoFocus(TRUE) // automatically take focus when opened
192{ 188{
193 for (S32 i = 0; i < BUTTON_COUNT; i++) 189 for (S32 i = 0; i < BUTTON_COUNT; i++)
194 { 190 {
195 mButtonsEnabled[i] = FALSE; 191 mButtonsEnabled[i] = FALSE;
196 mButtons[i] = NULL; 192 mButtons[i] = NULL;
197 } 193 }
198 // automatically take focus when opened
199 mAutoFocus = TRUE;
200 init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); 194 init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
201} 195}
202 196
@@ -206,6 +200,8 @@ void LLFloater::init(const LLString& title,
206 BOOL resizable, S32 min_width, S32 min_height, 200 BOOL resizable, S32 min_width, S32 min_height,
207 BOOL drag_on_left, BOOL minimizable, BOOL close_btn) 201 BOOL drag_on_left, BOOL minimizable, BOOL close_btn)
208{ 202{
203 mHandle.bind(this);
204
209 // Init function can be called more than once, so clear out old data. 205 // Init function can be called more than once, so clear out old data.
210 for (S32 i = 0; i < BUTTON_COUNT; i++) 206 for (S32 i = 0; i < BUTTON_COUNT; i++)
211 { 207 {
@@ -219,20 +215,20 @@ void LLFloater::init(const LLString& title,
219 } 215 }
220 mButtonScale = 1.f; 216 mButtonScale = 1.f;
221 217
222 BOOL need_border = mBorder != NULL; 218 //sjb: Thia is a bit of a hack:
223 219 BOOL need_border = hasBorder();
220 // remove the border since deleteAllChildren() will also delete the border (but not clear mBorder)
221 removeBorder();
224 // this will delete mBorder too 222 // this will delete mBorder too
225 deleteAllChildren(); 223 deleteAllChildren();
226 // make sure we don't have a pointer to an old, deleted border 224 // add the border back if we want it
227 mBorder = NULL;
228 //sjb: HACK! we had a border which was just deleted, so re-create it
229 if (need_border) 225 if (need_border)
230 { 226 {
231 addBorder(); 227 addBorder();
232 } 228 }
233 229
234 // chrome floaters don't take focus at all 230 // chrome floaters don't take focus at all
235 mIsFocusRoot = !getIsChrome(); 231 setFocusRoot(!getIsChrome());
236 232
237 // Reset cached pointers 233 // Reset cached pointers
238 mDragHandle = NULL; 234 mDragHandle = NULL;
@@ -257,7 +253,7 @@ void LLFloater::init(const LLString& title,
257 // Floaters start not minimized. When minimized, they save their 253 // Floaters start not minimized. When minimized, they save their
258 // prior rectangle to be used on restore. 254 // prior rectangle to be used on restore.
259 mMinimized = FALSE; 255 mMinimized = FALSE;
260 mPreviousRect.set(0,0,0,0); 256 mExpandedRect.set(0,0,0,0);
261 257
262 S32 close_pad; // space to the right of close box 258 S32 close_pad; // space to the right of close box
263 S32 close_box_size; // For layout purposes, how big is the close box? 259 S32 close_box_size; // For layout purposes, how big is the close box?
@@ -288,31 +284,20 @@ void LLFloater::init(const LLString& title,
288 // Drag Handle 284 // Drag Handle
289 // Add first so it's in the background. 285 // Add first so it's in the background.
290// const S32 drag_pad = 2; 286// const S32 drag_pad = 2;
291 LLRect drag_handle_rect; 287 if (drag_on_left)
292 if (!drag_on_left)
293 {
294 drag_handle_rect.set( 0, mRect.getHeight(), mRect.getWidth(), 0 );
295
296 /*
297 drag_handle_rect.setLeftTopAndSize(
298 0, mRect.getHeight(),
299 mRect.getWidth()
300 - LLPANEL_BORDER_WIDTH
301 - drag_pad
302 - minimize_box_size - minimize_pad
303 - close_box_size - close_pad,
304 DRAG_HANDLE_HEIGHT);
305 */
306 mDragHandle = new LLDragHandleTop( "Drag Handle", drag_handle_rect, title );
307 }
308 else
309 { 288 {
289 LLRect drag_handle_rect;
310 drag_handle_rect.setOriginAndSize( 290 drag_handle_rect.setOriginAndSize(
311 0, 0, 291 0, 0,
312 DRAG_HANDLE_WIDTH, 292 DRAG_HANDLE_WIDTH,
313 mRect.getHeight() - LLPANEL_BORDER_WIDTH - close_box_size); 293 getRect().getHeight() - LLPANEL_BORDER_WIDTH - close_box_size);
314 mDragHandle = new LLDragHandleLeft("drag", drag_handle_rect, title ); 294 mDragHandle = new LLDragHandleLeft("drag", drag_handle_rect, title );
315 } 295 }
296 else // drag on top
297 {
298 LLRect drag_handle_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
299 mDragHandle = new LLDragHandleTop( "Drag Handle", drag_handle_rect, title );
300 }
316 addChild(mDragHandle); 301 addChild(mDragHandle);
317 302
318 // Resize Handle 303 // Resize Handle
@@ -327,28 +312,28 @@ void LLFloater::init(const LLString& title,
327 mResizeBar[LLResizeBar::LEFT] = new LLResizeBar( 312 mResizeBar[LLResizeBar::LEFT] = new LLResizeBar(
328 "resizebar_left", 313 "resizebar_left",
329 this, 314 this,
330 LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0), 315 LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0),
331 min_width, S32_MAX, LLResizeBar::LEFT ); 316 min_width, S32_MAX, LLResizeBar::LEFT );
332 addChild( mResizeBar[0] ); 317 addChild( mResizeBar[0] );
333 318
334 mResizeBar[LLResizeBar::TOP] = new LLResizeBar( 319 mResizeBar[LLResizeBar::TOP] = new LLResizeBar(
335 "resizebar_top", 320 "resizebar_top",
336 this, 321 this,
337 LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS), 322 LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS),
338 min_height, S32_MAX, LLResizeBar::TOP ); 323 min_height, S32_MAX, LLResizeBar::TOP );
339 addChild( mResizeBar[1] ); 324 addChild( mResizeBar[1] );
340 325
341 mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar( 326 mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar(
342 "resizebar_right", 327 "resizebar_right",
343 this, 328 this,
344 LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0), 329 LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0),
345 min_width, S32_MAX, LLResizeBar::RIGHT ); 330 min_width, S32_MAX, LLResizeBar::RIGHT );
346 addChild( mResizeBar[2] ); 331 addChild( mResizeBar[2] );
347 332
348 mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar( 333 mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar(
349 "resizebar_bottom", 334 "resizebar_bottom",
350 this, 335 this,
351 LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0), 336 LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0),
352 min_height, S32_MAX, LLResizeBar::BOTTOM ); 337 min_height, S32_MAX, LLResizeBar::BOTTOM );
353 addChild( mResizeBar[3] ); 338 addChild( mResizeBar[3] );
354 339
@@ -356,14 +341,14 @@ void LLFloater::init(const LLString& title,
356 // Resize handles (corners) 341 // Resize handles (corners)
357 mResizeHandle[0] = new LLResizeHandle( 342 mResizeHandle[0] = new LLResizeHandle(
358 "Resize Handle", 343 "Resize Handle",
359 LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, mRect.getWidth(), 0), 344 LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0),
360 min_width, 345 min_width,
361 min_height, 346 min_height,
362 LLResizeHandle::RIGHT_BOTTOM); 347 LLResizeHandle::RIGHT_BOTTOM);
363 addChild(mResizeHandle[0]); 348 addChild(mResizeHandle[0]);
364 349
365 mResizeHandle[1] = new LLResizeHandle( "resize", 350 mResizeHandle[1] = new LLResizeHandle( "resize",
366 LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_HANDLE_HEIGHT), 351 LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT),
367 min_width, 352 min_width,
368 min_height, 353 min_height,
369 LLResizeHandle::RIGHT_TOP ); 354 LLResizeHandle::RIGHT_TOP );
@@ -377,7 +362,7 @@ void LLFloater::init(const LLString& title,
377 addChild(mResizeHandle[2]); 362 addChild(mResizeHandle[2]);
378 363
379 mResizeHandle[3] = new LLResizeHandle( "resize", 364 mResizeHandle[3] = new LLResizeHandle( "resize",
380 LLRect( 0, mRect.getHeight(), RESIZE_HANDLE_WIDTH, mRect.getHeight() - RESIZE_HANDLE_HEIGHT ), 365 LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ),
381 min_width, 366 min_width,
382 min_height, 367 min_height,
383 LLResizeHandle::LEFT_TOP ); 368 LLResizeHandle::LEFT_TOP );
@@ -413,7 +398,7 @@ void LLFloater::init(const LLString& title,
413 setVisible(FALSE); 398 setVisible(FALSE);
414 399
415 // add self to handle->floater map 400 // add self to handle->floater map
416 sFloaterMap[mViewHandle] = this; 401 sFloaterMap[mHandle] = this;
417 402
418 if (!getParent()) 403 if (!getParent())
419 { 404 {
@@ -450,7 +435,7 @@ LLFloater::~LLFloater()
450 // correct, non-minimized positions. 435 // correct, non-minimized positions.
451 setMinimized( FALSE ); 436 setMinimized( FALSE );
452 437
453 sFloaterMap.erase(mViewHandle); 438 sFloaterMap.erase(mHandle);
454 439
455 delete mDragHandle; 440 delete mDragHandle;
456 for (S32 i = 0; i < 4; i++) 441 for (S32 i = 0; i < 4; i++)
@@ -460,22 +445,6 @@ LLFloater::~LLFloater()
460 } 445 }
461} 446}
462 447
463// virtual
464EWidgetType LLFloater::getWidgetType() const
465{
466 return WIDGET_TYPE_FLOATER;
467}
468
469// virtual
470LLString LLFloater::getWidgetTag() const
471{
472 return LL_FLOATER_TAG;
473}
474
475void LLFloater::destroy()
476{
477 die();
478}
479 448
480void LLFloater::setVisible( BOOL visible ) 449void LLFloater::setVisible( BOOL visible )
481{ 450{
@@ -501,7 +470,7 @@ void LLFloater::setVisible( BOOL visible )
501 for(handle_set_iter_t dependent_it = mDependents.begin(); 470 for(handle_set_iter_t dependent_it = mDependents.begin();
502 dependent_it != mDependents.end(); ) 471 dependent_it != mDependents.end(); )
503 { 472 {
504 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 473 LLFloater* floaterp = dependent_it->get();
505 474
506 if (floaterp) 475 if (floaterp)
507 { 476 {
@@ -513,10 +482,10 @@ void LLFloater::setVisible( BOOL visible )
513 482
514void LLFloater::open() /* Flawfinder: ignore */ 483void LLFloater::open() /* Flawfinder: ignore */
515{ 484{
516 if (mSoundFlags != SILENT 485 if (getSoundFlags() != SILENT
517 // don't play open sound for hosted (tabbed) windows 486 // don't play open sound for hosted (tabbed) windows
518 && !getHost() 487 && !getHost()
519 && !sHostp 488 && !getFloaterHost()
520 && (!getVisible() || isMinimized())) 489 && (!getVisible() || isMinimized()))
521 { 490 {
522 make_ui_sound("UISndWindowOpen"); 491 make_ui_sound("UISndWindowOpen");
@@ -524,17 +493,16 @@ void LLFloater::open() /* Flawfinder: ignore */
524 493
525 //RN: for now, we don't allow rehosting from one multifloater to another 494 //RN: for now, we don't allow rehosting from one multifloater to another
526 // just need to fix the bugs 495 // just need to fix the bugs
527 LLMultiFloater* hostp = getHost(); 496 if (getFloaterHost() != NULL && getHost() == NULL)
528 if (sHostp != NULL && hostp == NULL)
529 { 497 {
530 // needs a host 498 // needs a host
531 // only select tabs if window they are hosted in is visible 499 // only select tabs if window they are hosted in is visible
532 sHostp->addFloater(this, sHostp->getVisible()); 500 getFloaterHost()->addFloater(this, getFloaterHost()->getVisible());
533 } 501 }
534 else if (hostp != NULL) 502 else if (getHost() != NULL)
535 { 503 {
536 // already hosted 504 // already hosted
537 hostp->showFloater(this); 505 getHost()->showFloater(this);
538 } 506 }
539 else 507 else
540 { 508 {
@@ -558,7 +526,7 @@ void LLFloater::close(bool app_quitting)
558 ((LLMultiFloater*)getHost())->removeFloater(this); 526 ((LLMultiFloater*)getHost())->removeFloater(this);
559 } 527 }
560 528
561 if (mSoundFlags != SILENT 529 if (getSoundFlags() != SILENT
562 && getVisible() 530 && getVisible()
563 && !getHost() 531 && !getHost()
564 && !app_quitting) 532 && !app_quitting)
@@ -571,7 +539,7 @@ void LLFloater::close(bool app_quitting)
571 dependent_it != mDependents.end(); ) 539 dependent_it != mDependents.end(); )
572 { 540 {
573 541
574 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 542 LLFloater* floaterp = dependent_it->get();
575 if (floaterp) 543 if (floaterp)
576 { 544 {
577 ++dependent_it; 545 ++dependent_it;
@@ -595,7 +563,7 @@ void LLFloater::close(bool app_quitting)
595 // give focus to dependee floater if it exists, and we had focus first 563 // give focus to dependee floater if it exists, and we had focus first
596 if (isDependent()) 564 if (isDependent())
597 { 565 {
598 LLFloater* dependee = LLFloater::getFloaterByHandle(mDependeeHandle); 566 LLFloater* dependee = mDependeeHandle.get();
599 if (dependee && !dependee->isDead()) 567 if (dependee && !dependee->isDead())
600 { 568 {
601 dependee->setFocus(TRUE); 569 dependee->setFocus(TRUE);
@@ -661,20 +629,15 @@ void LLFloater::center()
661 // hosted floaters can't move 629 // hosted floaters can't move
662 return; 630 return;
663 } 631 }
664 const LLRect &window = gFloaterView->getRect(); 632 centerWithin(gFloaterView->getRect());
665
666 S32 left = window.mLeft + (window.getWidth() - mRect.getWidth()) / 2;
667 S32 bottom = window.mBottom + (window.getHeight() - mRect.getHeight()) / 2;
668
669 translate( left - mRect.mLeft, bottom - mRect.mBottom );
670} 633}
671 634
672void LLFloater::applyRectControl() 635void LLFloater::applyRectControl()
673{ 636{
674 if (!mRectControl.empty()) 637 if (!getRectControl().empty())
675 { 638 {
676 const LLRect& rect = LLUI::sConfigGroup->getRect(mRectControl); 639 const LLRect& rect = LLUI::sConfigGroup->getRect(getRectControl());
677 translate( rect.mLeft - mRect.mLeft, rect.mBottom - mRect.mBottom); 640 translate( rect.mLeft - getRect().mLeft, rect.mBottom - getRect().mBottom);
678 if (mResizable) 641 if (mResizable)
679 { 642 {
680 reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); 643 reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight()));
@@ -715,7 +678,7 @@ LLString LLFloater::getShortTitle()
715 678
716 679
717 680
718BOOL LLFloater::canSnapTo(LLView* other_view) 681BOOL LLFloater::canSnapTo(const LLView* other_view)
719{ 682{
720 if (NULL == other_view) 683 if (NULL == other_view)
721 { 684 {
@@ -727,7 +690,7 @@ BOOL LLFloater::canSnapTo(LLView* other_view)
727 { 690 {
728 LLFloater* other_floaterp = (LLFloater*)other_view; 691 LLFloater* other_floaterp = (LLFloater*)other_view;
729 692
730 if (other_floaterp->getSnapTarget() == mViewHandle && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) 693 if (other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end())
731 { 694 {
732 // this is a dependent that is already snapped to us, so don't snap back to it 695 // this is a dependent that is already snapped to us, so don't snap back to it
733 return FALSE; 696 return FALSE;
@@ -737,7 +700,7 @@ BOOL LLFloater::canSnapTo(LLView* other_view)
737 return LLPanel::canSnapTo(other_view); 700 return LLPanel::canSnapTo(other_view);
738} 701}
739 702
740void LLFloater::snappedTo(LLView* snap_view) 703void LLFloater::snappedTo(const LLView* snap_view)
741{ 704{
742 if (!snap_view || snap_view == getParent()) 705 if (!snap_view || snap_view == getParent())
743 { 706 {
@@ -754,7 +717,7 @@ void LLFloater::snappedTo(LLView* snap_view)
754 717
755void LLFloater::userSetShape(const LLRect& new_rect) 718void LLFloater::userSetShape(const LLRect& new_rect)
756{ 719{
757 LLRect old_rect = mRect; 720 const LLRect& old_rect = getRect();
758 LLView::userSetShape(new_rect); 721 LLView::userSetShape(new_rect);
759 722
760 // if not minimized, adjust all snapped dependents to new shape 723 // if not minimized, adjust all snapped dependents to new shape
@@ -764,22 +727,22 @@ void LLFloater::userSetShape(const LLRect& new_rect)
764 for(handle_set_iter_t dependent_it = mDependents.begin(); 727 for(handle_set_iter_t dependent_it = mDependents.begin();
765 dependent_it != mDependents.end(); ++dependent_it) 728 dependent_it != mDependents.end(); ++dependent_it)
766 { 729 {
767 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 730 LLFloater* floaterp = dependent_it->get();
768 // is a dependent snapped to us? 731 // is a dependent snapped to us?
769 if (floaterp && floaterp->getSnapTarget() == mViewHandle) 732 if (floaterp && floaterp->getSnapTarget() == getHandle())
770 { 733 {
771 S32 delta_x = 0; 734 S32 delta_x = 0;
772 S32 delta_y = 0; 735 S32 delta_y = 0;
773 // check to see if it snapped to right or top, and move if dependee floater is resizing 736 // check to see if it snapped to right or top, and move if dependee floater is resizing
774 LLRect dependent_rect = floaterp->getRect(); 737 LLRect dependent_rect = floaterp->getRect();
775 if (dependent_rect.mLeft - mRect.mLeft >= old_rect.getWidth() || // dependent on my right? 738 if (dependent_rect.mLeft - getRect().mLeft >= old_rect.getWidth() || // dependent on my right?
776 dependent_rect.mRight == mRect.mLeft + old_rect.getWidth()) // dependent aligned with my right 739 dependent_rect.mRight == getRect().mLeft + old_rect.getWidth()) // dependent aligned with my right
777 { 740 {
778 // was snapped directly onto right side or aligned with it 741 // was snapped directly onto right side or aligned with it
779 delta_x += new_rect.getWidth() - old_rect.getWidth(); 742 delta_x += new_rect.getWidth() - old_rect.getWidth();
780 } 743 }
781 if (dependent_rect.mBottom - mRect.mBottom >= old_rect.getHeight() || 744 if (dependent_rect.mBottom - getRect().mBottom >= old_rect.getHeight() ||
782 dependent_rect.mTop == mRect.mBottom + old_rect.getHeight()) 745 dependent_rect.mTop == getRect().mBottom + old_rect.getHeight())
783 { 746 {
784 // was snapped directly onto top side or aligned with it 747 // was snapped directly onto top side or aligned with it
785 delta_y += new_rect.getHeight() - old_rect.getHeight(); 748 delta_y += new_rect.getHeight() - old_rect.getHeight();
@@ -812,7 +775,7 @@ void LLFloater::setMinimized(BOOL minimize)
812 775
813 if (minimize) 776 if (minimize)
814 { 777 {
815 mPreviousRect = mRect; 778 mExpandedRect = getRect();
816 779
817 reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE); 780 reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE);
818 781
@@ -843,7 +806,7 @@ void LLFloater::setMinimized(BOOL minimize)
843 LLView* viewp = *child_it; 806 LLView* viewp = *child_it;
844 if (!viewp->getVisible()) 807 if (!viewp->getVisible())
845 { 808 {
846 mMinimizedHiddenChildren.push_back(viewp->mViewHandle); 809 mMinimizedHiddenChildren.push_back(viewp->getHandle());
847 } 810 }
848 viewp->setVisible(FALSE); 811 viewp->setVisible(FALSE);
849 } 812 }
@@ -860,7 +823,7 @@ void LLFloater::setMinimized(BOOL minimize)
860 dependent_it != mDependents.end(); 823 dependent_it != mDependents.end();
861 ++dependent_it) 824 ++dependent_it)
862 { 825 {
863 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 826 LLFloater* floaterp = dependent_it->get();
864 if (floaterp) 827 if (floaterp)
865 { 828 {
866 if (floaterp->isMinimizeable()) 829 if (floaterp->isMinimizeable())
@@ -890,8 +853,8 @@ void LLFloater::setMinimized(BOOL minimize)
890 mPreviousMinimizedBottom = currentRect.mBottom; 853 mPreviousMinimizedBottom = currentRect.mBottom;
891 } 854 }
892 855
893 reshape( mPreviousRect.getWidth(), mPreviousRect.getHeight(), TRUE ); 856 reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE );
894 setOrigin( mPreviousRect.mLeft, mPreviousRect.mBottom ); 857 setOrigin( mExpandedRect.mLeft, mExpandedRect.mBottom );
895 858
896 if (mButtonsEnabled[BUTTON_RESTORE]) 859 if (mButtonsEnabled[BUTTON_RESTORE])
897 { 860 {
@@ -906,10 +869,10 @@ void LLFloater::setMinimized(BOOL minimize)
906 viewp->setVisible(TRUE); 869 viewp->setVisible(TRUE);
907 } 870 }
908 871
909 std::vector<LLViewHandle>::iterator itor = mMinimizedHiddenChildren.begin(); 872 std::vector<LLHandle<LLView> >::iterator itor = mMinimizedHiddenChildren.begin();
910 for ( ; itor != mMinimizedHiddenChildren.end(); ++itor) 873 for ( ; itor != mMinimizedHiddenChildren.end(); ++itor)
911 { 874 {
912 LLView* viewp = LLView::getViewByHandle(*itor); 875 LLView* viewp = itor->get();
913 if(viewp) 876 if(viewp)
914 { 877 {
915 viewp->setVisible(FALSE); 878 viewp->setVisible(FALSE);
@@ -922,7 +885,7 @@ void LLFloater::setMinimized(BOOL minimize)
922 dependent_it != mDependents.end(); 885 dependent_it != mDependents.end();
923 ++dependent_it) 886 ++dependent_it)
924 { 887 {
925 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 888 LLFloater* floaterp = dependent_it->get();
926 if (floaterp) 889 if (floaterp)
927 { 890 {
928 floaterp->setMinimized(FALSE); 891 floaterp->setMinimized(FALSE);
@@ -979,7 +942,7 @@ void LLFloater::setIsChrome(BOOL is_chrome)
979 // remove focus if we're changing to chrome 942 // remove focus if we're changing to chrome
980 setFocus(FALSE); 943 setFocus(FALSE);
981 // can't Ctrl-Tab to "chrome" floaters 944 // can't Ctrl-Tab to "chrome" floaters
982 mIsFocusRoot = FALSE; 945 setFocusRoot(FALSE);
983 } 946 }
984 947
985 // no titles displayed on "chrome" floaters 948 // no titles displayed on "chrome" floaters
@@ -1011,7 +974,7 @@ void LLFloater::cleanupHandles()
1011 for(handle_set_iter_t dependent_it = mDependents.begin(); 974 for(handle_set_iter_t dependent_it = mDependents.begin();
1012 dependent_it != mDependents.end(); ) 975 dependent_it != mDependents.end(); )
1013 { 976 {
1014 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 977 LLFloater* floaterp = dependent_it->get();
1015 if (!floaterp) 978 if (!floaterp)
1016 { 979 {
1017 mDependents.erase(dependent_it++); 980 mDependents.erase(dependent_it++);
@@ -1085,7 +1048,7 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition)
1085 if (reposition) 1048 if (reposition)
1086 { 1049 {
1087 floaterp->setRect(gFloaterView->findNeighboringPosition(this, floaterp)); 1050 floaterp->setRect(gFloaterView->findNeighboringPosition(this, floaterp));
1088 floaterp->setSnapTarget(mViewHandle); 1051 floaterp->setSnapTarget(getHandle());
1089 } 1052 }
1090 gFloaterView->adjustToFitScreen(floaterp, FALSE); 1053 gFloaterView->adjustToFitScreen(floaterp, FALSE);
1091 if (floaterp->isFrontmost()) 1054 if (floaterp->isFrontmost())
@@ -1095,9 +1058,9 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition)
1095 } 1058 }
1096} 1059}
1097 1060
1098void LLFloater::addDependentFloater(LLViewHandle dependent, BOOL reposition) 1061void LLFloater::addDependentFloater(LLHandle<LLFloater> dependent, BOOL reposition)
1099{ 1062{
1100 LLFloater* dependent_floaterp = LLFloater::getFloaterByHandle(dependent); 1063 LLFloater* dependent_floaterp = dependent.get();
1101 if(dependent_floaterp) 1064 if(dependent_floaterp)
1102 { 1065 {
1103 addDependentFloater(dependent_floaterp, reposition); 1066 addDependentFloater(dependent_floaterp, reposition);
@@ -1107,7 +1070,7 @@ void LLFloater::addDependentFloater(LLViewHandle dependent, BOOL reposition)
1107void LLFloater::removeDependentFloater(LLFloater* floaterp) 1070void LLFloater::removeDependentFloater(LLFloater* floaterp)
1108{ 1071{
1109 mDependents.erase(floaterp->getHandle()); 1072 mDependents.erase(floaterp->getHandle());
1110 floaterp->mDependeeHandle = LLViewHandle::sDeadHandle; 1073 floaterp->mDependeeHandle = LLHandle<LLFloater>();
1111} 1074}
1112 1075
1113// virtual 1076// virtual
@@ -1215,32 +1178,13 @@ void LLFloater::setFrontmost(BOOL take_focus)
1215 } 1178 }
1216} 1179}
1217 1180
1218// static
1219LLFloater* LLFloater::getFloaterByHandle(LLViewHandle handle)
1220{
1221 LLFloater* floater = NULL;
1222 if (sFloaterMap.count(handle))
1223 {
1224 floater = sFloaterMap[handle];
1225 }
1226 if (floater && !floater->isDead())
1227 {
1228 return floater;
1229 }
1230 else
1231 {
1232 return NULL;
1233 }
1234}
1235
1236//static 1181//static
1237void LLFloater::setEditModeEnabled(BOOL enable) 1182void LLFloater::setEditModeEnabled(BOOL enable)
1238{ 1183{
1239 if (enable != sEditModeEnabled) 1184 if (enable != sEditModeEnabled)
1240 { 1185 {
1241 S32 count = 0; 1186 S32 count = 0;
1242 std::map<LLViewHandle, LLFloater*>::iterator iter; 1187 for(handle_map_iter_t iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
1243 for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
1244 { 1188 {
1245 LLFloater* floater = iter->second; 1189 LLFloater* floater = iter->second;
1246 if (!floater->isDead()) 1190 if (!floater->isDead())
@@ -1255,41 +1199,6 @@ void LLFloater::setEditModeEnabled(BOOL enable)
1255 sEditModeEnabled = enable; 1199 sEditModeEnabled = enable;
1256} 1200}
1257 1201
1258//static
1259BOOL LLFloater::getEditModeEnabled()
1260{
1261 return sEditModeEnabled;
1262}
1263
1264//static
1265void LLFloater::show(LLFloater* floaterp)
1266{
1267 if (floaterp)
1268 {
1269 gFocusMgr.triggerFocusFlash();
1270 floaterp->open();
1271 if (floaterp->getHost())
1272 {
1273 floaterp->getHost()->open();
1274 }
1275 }
1276}
1277
1278//static
1279void LLFloater::hide(LLFloater* floaterp)
1280{
1281 if (floaterp) floaterp->close();
1282}
1283
1284//static
1285BOOL LLFloater::visible(LLFloater* floaterp)
1286{
1287 if (floaterp)
1288 {
1289 return !floaterp->isMinimized() && floaterp->isInVisibleChain();
1290 }
1291 return FALSE;
1292}
1293 1202
1294// static 1203// static
1295void LLFloater::onClickMinimize(void *userdata) 1204void LLFloater::onClickMinimize(void *userdata)
@@ -1316,9 +1225,9 @@ void LLFloater::onClickTearOff(void *userdata)
1316 self->open(); /* Flawfinder: ignore */ 1225 self->open(); /* Flawfinder: ignore */
1317 1226
1318 // only force position for floaters that don't have that data saved 1227 // only force position for floaters that don't have that data saved
1319 if (self->mRectControl.empty()) 1228 if (self->getRectControl().empty())
1320 { 1229 {
1321 new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->mRect.getWidth(), self->mRect.getHeight()); 1230 new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->getRect().getWidth(), self->getRect().getHeight());
1322 self->setRect(new_rect); 1231 self->setRect(new_rect);
1323 } 1232 }
1324 gFloaterView->adjustToFitScreen(self, FALSE); 1233 gFloaterView->adjustToFitScreen(self, FALSE);
@@ -1327,7 +1236,7 @@ void LLFloater::onClickTearOff(void *userdata)
1327 } 1236 }
1328 else //Attach to parent. 1237 else //Attach to parent.
1329 { 1238 {
1330 LLMultiFloater* new_host = (LLMultiFloater*)LLFloater::getFloaterByHandle(self->mLastHostHandle); 1239 LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get();
1331 if (new_host) 1240 if (new_host)
1332 { 1241 {
1333 new_host->showFloater(self); 1242 new_host->showFloater(self);
@@ -1351,7 +1260,7 @@ void LLFloater::closeFocusedFloater()
1351{ 1260{
1352 LLFloater* focused_floater = NULL; 1261 LLFloater* focused_floater = NULL;
1353 1262
1354 std::map<LLViewHandle, LLFloater*>::iterator iter; 1263 handle_map_iter_t iter;
1355 for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter) 1264 for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
1356 { 1265 {
1357 focused_floater = iter->second; 1266 focused_floater = iter->second;
@@ -1396,16 +1305,16 @@ void LLFloater::draw()
1396 if( getVisible() ) 1305 if( getVisible() )
1397 { 1306 {
1398 // draw background 1307 // draw background
1399 if( mBgVisible ) 1308 if( isBackgroundVisible() )
1400 { 1309 {
1401 S32 left = LLPANEL_BORDER_WIDTH; 1310 S32 left = LLPANEL_BORDER_WIDTH;
1402 S32 top = mRect.getHeight() - LLPANEL_BORDER_WIDTH; 1311 S32 top = getRect().getHeight() - LLPANEL_BORDER_WIDTH;
1403 S32 right = mRect.getWidth() - LLPANEL_BORDER_WIDTH; 1312 S32 right = getRect().getWidth() - LLPANEL_BORDER_WIDTH;
1404 S32 bottom = LLPANEL_BORDER_WIDTH; 1313 S32 bottom = LLPANEL_BORDER_WIDTH;
1405 1314
1406 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow"); 1315 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow");
1407 F32 shadow_offset = (F32)LLUI::sConfigGroup->getS32("DropShadowFloater"); 1316 F32 shadow_offset = (F32)LLUI::sConfigGroup->getS32("DropShadowFloater");
1408 if (!mBgOpaque) 1317 if (!isBackgroundOpaque())
1409 { 1318 {
1410 shadow_offset *= 0.2f; 1319 shadow_offset *= 0.2f;
1411 shadow_color.mV[VALPHA] *= 0.5f; 1320 shadow_color.mV[VALPHA] *= 0.5f;
@@ -1415,13 +1324,13 @@ void LLFloater::draw()
1415 llround(shadow_offset)); 1324 llround(shadow_offset));
1416 1325
1417 // No transparent windows in simple UI 1326 // No transparent windows in simple UI
1418 if (mBgOpaque) 1327 if (isBackgroundOpaque())
1419 { 1328 {
1420 gl_rect_2d( left, top, right, bottom, mBgColorOpaque ); 1329 gl_rect_2d( left, top, right, bottom, getBackgroundColor() );
1421 } 1330 }
1422 else 1331 else
1423 { 1332 {
1424 gl_rect_2d( left, top, right, bottom, mBgColorAlpha ); 1333 gl_rect_2d( left, top, right, bottom, getTransparentColor() );
1425 } 1334 }
1426 1335
1427 if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getTitle().empty()) 1336 if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getTitle().empty())
@@ -1448,13 +1357,13 @@ void LLFloater::draw()
1448 // don't call LLPanel::draw() since we've implemented custom background rendering 1357 // don't call LLPanel::draw() since we've implemented custom background rendering
1449 LLView::draw(); 1358 LLView::draw();
1450 1359
1451 if( mBgVisible ) 1360 if( isBackgroundVisible() )
1452 { 1361 {
1453 // add in a border to improve spacialized visual aclarity ;) 1362 // add in a border to improve spacialized visual aclarity ;)
1454 // use lines instead of gl_rect_2d so we can round the edges as per james' recommendation 1363 // use lines instead of gl_rect_2d so we can round the edges as per james' recommendation
1455 LLUI::setLineWidth(1.5f); 1364 LLUI::setLineWidth(1.5f);
1456 LLColor4 outlineColor = gFocusMgr.childHasKeyboardFocus(this) ? LLUI::sColorsGroup->getColor("FloaterFocusBorderColor") : LLUI::sColorsGroup->getColor("FloaterUnfocusBorderColor"); 1365 LLColor4 outlineColor = gFocusMgr.childHasKeyboardFocus(this) ? LLUI::sColorsGroup->getColor("FloaterFocusBorderColor") : LLUI::sColorsGroup->getColor("FloaterUnfocusBorderColor");
1457 gl_rect_2d_offset_local(0, mRect.getHeight() + 1, mRect.getWidth() + 1, 0, outlineColor, -LLPANEL_BORDER_WIDTH, FALSE); 1366 gl_rect_2d_offset_local(0, getRect().getHeight() + 1, getRect().getWidth() + 1, 0, outlineColor, -LLPANEL_BORDER_WIDTH, FALSE);
1458 LLUI::setLineWidth(1.f); 1367 LLUI::setLineWidth(1.f);
1459 } 1368 }
1460 1369
@@ -1468,7 +1377,7 @@ void LLFloater::draw()
1468 // when last host goes away 1377 // when last host goes away
1469 if (mCanTearOff && !getHost()) 1378 if (mCanTearOff && !getHost())
1470 { 1379 {
1471 LLFloater* old_host = gFloaterView->getFloaterByHandle(mLastHostHandle); 1380 LLFloater* old_host = mLastHostHandle.get();
1472 if (!old_host) 1381 if (!old_host)
1473 { 1382 {
1474 setCanTearOff(FALSE); 1383 setCanTearOff(FALSE);
@@ -1477,33 +1386,6 @@ void LLFloater::draw()
1477 } 1386 }
1478} 1387}
1479 1388
1480// virtual
1481void LLFloater::onOpen()
1482{
1483}
1484
1485// virtual
1486void LLFloater::onClose(bool app_quitting)
1487{
1488 destroy();
1489}
1490
1491// virtual
1492BOOL LLFloater::canClose()
1493{
1494 return TRUE;
1495}
1496
1497// virtual
1498BOOL LLFloater::canSaveAs()
1499{
1500 return FALSE;
1501}
1502
1503// virtual
1504void LLFloater::saveAs()
1505{
1506}
1507 1389
1508void LLFloater::setCanMinimize(BOOL can_minimize) 1390void LLFloater::setCanMinimize(BOOL can_minimize)
1509{ 1391{
@@ -1572,28 +1454,28 @@ void LLFloater::setCanResize(BOOL can_resize)
1572 mResizeBar[0] = new LLResizeBar( 1454 mResizeBar[0] = new LLResizeBar(
1573 "resizebar_left", 1455 "resizebar_left",
1574 this, 1456 this,
1575 LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0), 1457 LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0),
1576 mMinWidth, S32_MAX, LLResizeBar::LEFT ); 1458 mMinWidth, S32_MAX, LLResizeBar::LEFT );
1577 addChild( mResizeBar[0] ); 1459 addChild( mResizeBar[0] );
1578 1460
1579 mResizeBar[1] = new LLResizeBar( 1461 mResizeBar[1] = new LLResizeBar(
1580 "resizebar_top", 1462 "resizebar_top",
1581 this, 1463 this,
1582 LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS), 1464 LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS),
1583 mMinHeight, S32_MAX, LLResizeBar::TOP ); 1465 mMinHeight, S32_MAX, LLResizeBar::TOP );
1584 addChild( mResizeBar[1] ); 1466 addChild( mResizeBar[1] );
1585 1467
1586 mResizeBar[2] = new LLResizeBar( 1468 mResizeBar[2] = new LLResizeBar(
1587 "resizebar_right", 1469 "resizebar_right",
1588 this, 1470 this,
1589 LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0), 1471 LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0),
1590 mMinWidth, S32_MAX, LLResizeBar::RIGHT ); 1472 mMinWidth, S32_MAX, LLResizeBar::RIGHT );
1591 addChild( mResizeBar[2] ); 1473 addChild( mResizeBar[2] );
1592 1474
1593 mResizeBar[3] = new LLResizeBar( 1475 mResizeBar[3] = new LLResizeBar(
1594 "resizebar_bottom", 1476 "resizebar_bottom",
1595 this, 1477 this,
1596 LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0), 1478 LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0),
1597 mMinHeight, S32_MAX, LLResizeBar::BOTTOM ); 1479 mMinHeight, S32_MAX, LLResizeBar::BOTTOM );
1598 addChild( mResizeBar[3] ); 1480 addChild( mResizeBar[3] );
1599 1481
@@ -1601,14 +1483,14 @@ void LLFloater::setCanResize(BOOL can_resize)
1601 // Resize handles (corners) 1483 // Resize handles (corners)
1602 mResizeHandle[0] = new LLResizeHandle( 1484 mResizeHandle[0] = new LLResizeHandle(
1603 "Resize Handle", 1485 "Resize Handle",
1604 LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, mRect.getWidth(), 0), 1486 LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0),
1605 mMinWidth, 1487 mMinWidth,
1606 mMinHeight, 1488 mMinHeight,
1607 LLResizeHandle::RIGHT_BOTTOM); 1489 LLResizeHandle::RIGHT_BOTTOM);
1608 addChild(mResizeHandle[0]); 1490 addChild(mResizeHandle[0]);
1609 1491
1610 mResizeHandle[1] = new LLResizeHandle( "resize", 1492 mResizeHandle[1] = new LLResizeHandle( "resize",
1611 LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_HANDLE_HEIGHT), 1493 LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT),
1612 mMinWidth, 1494 mMinWidth,
1613 mMinHeight, 1495 mMinHeight,
1614 LLResizeHandle::RIGHT_TOP ); 1496 LLResizeHandle::RIGHT_TOP );
@@ -1622,7 +1504,7 @@ void LLFloater::setCanResize(BOOL can_resize)
1622 addChild(mResizeHandle[2]); 1504 addChild(mResizeHandle[2]);
1623 1505
1624 mResizeHandle[3] = new LLResizeHandle( "resize", 1506 mResizeHandle[3] = new LLResizeHandle( "resize",
1625 LLRect( 0, mRect.getHeight(), RESIZE_HANDLE_WIDTH, mRect.getHeight() - RESIZE_HANDLE_HEIGHT ), 1507 LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ),
1626 mMinWidth, 1508 mMinWidth,
1627 mMinHeight, 1509 mMinHeight,
1628 LLResizeHandle::LEFT_TOP ); 1510 LLResizeHandle::LEFT_TOP );
@@ -1659,15 +1541,15 @@ void LLFloater::updateButtons()
1659 { 1541 {
1660 btn_rect.setLeftTopAndSize( 1542 btn_rect.setLeftTopAndSize(
1661 LLPANEL_BORDER_WIDTH, 1543 LLPANEL_BORDER_WIDTH,
1662 mRect.getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count, 1544 getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
1663 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), 1545 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
1664 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); 1546 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
1665 } 1547 }
1666 else 1548 else
1667 { 1549 {
1668 btn_rect.setLeftTopAndSize( 1550 btn_rect.setLeftTopAndSize(
1669 mRect.getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count, 1551 getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
1670 mRect.getHeight() - CLOSE_BOX_FROM_TOP, 1552 getRect().getHeight() - CLOSE_BOX_FROM_TOP,
1671 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), 1553 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
1672 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); 1554 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
1673 } 1555 }
@@ -1685,7 +1567,7 @@ void LLFloater::updateButtons()
1685 } 1567 }
1686 } 1568 }
1687 1569
1688 mDragHandle->setMaxTitleWidth(mRect.getWidth() - (button_count * (LLFLOATER_CLOSE_BOX_SIZE + 1))); 1570 mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (LLFLOATER_CLOSE_BOX_SIZE + 1)));
1689} 1571}
1690 1572
1691void LLFloater::buildButtons() 1573void LLFloater::buildButtons()
@@ -1697,15 +1579,15 @@ void LLFloater::buildButtons()
1697 { 1579 {
1698 btn_rect.setLeftTopAndSize( 1580 btn_rect.setLeftTopAndSize(
1699 LLPANEL_BORDER_WIDTH, 1581 LLPANEL_BORDER_WIDTH,
1700 mRect.getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1), 1582 getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
1701 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), 1583 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
1702 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); 1584 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
1703 } 1585 }
1704 else 1586 else
1705 { 1587 {
1706 btn_rect.setLeftTopAndSize( 1588 btn_rect.setLeftTopAndSize(
1707 mRect.getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1), 1589 getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
1708 mRect.getHeight() - CLOSE_BOX_FROM_TOP, 1590 getRect().getHeight() - CLOSE_BOX_FROM_TOP,
1709 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), 1591 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
1710 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); 1592 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
1711 } 1593 }
@@ -1748,16 +1630,6 @@ LLFloaterView::LLFloaterView( const LLString& name, const LLRect& rect )
1748 resetStartingFloaterPosition(); 1630 resetStartingFloaterPosition();
1749} 1631}
1750 1632
1751EWidgetType LLFloaterView::getWidgetType() const
1752{
1753 return WIDGET_TYPE_FLOATER_VIEW;
1754}
1755
1756LLString LLFloaterView::getWidgetTag() const
1757{
1758 return LL_FLOATER_VIEW_TAG;
1759}
1760
1761// By default, adjust vertical. 1633// By default, adjust vertical.
1762void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) 1634void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
1763{ 1635{
@@ -1767,8 +1639,8 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
1767// When reshaping this view, make the floaters follow their closest edge. 1639// When reshaping this view, make the floaters follow their closest edge.
1768void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical) 1640void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical)
1769{ 1641{
1770 S32 old_width = mRect.getWidth(); 1642 S32 old_width = getRect().getWidth();
1771 S32 old_height = mRect.getHeight(); 1643 S32 old_height = getRect().getHeight();
1772 1644
1773 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) 1645 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
1774 { 1646 {
@@ -1822,7 +1694,7 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent, BOOL
1822 for(LLFloater::handle_set_iter_t dependent_it = floaterp->mDependents.begin(); 1694 for(LLFloater::handle_set_iter_t dependent_it = floaterp->mDependents.begin();
1823 dependent_it != floaterp->mDependents.end(); ++dependent_it) 1695 dependent_it != floaterp->mDependents.end(); ++dependent_it)
1824 { 1696 {
1825 LLFloater* dependent_floaterp = getFloaterByHandle(*dependent_it); 1697 LLFloater* dependent_floaterp = dependent_it->get();
1826 if (dependent_floaterp) 1698 if (dependent_floaterp)
1827 { 1699 {
1828 dependent_floaterp->setFollows(follow_flags); 1700 dependent_floaterp->setFollows(follow_flags);
@@ -1924,7 +1796,7 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
1924 for(LLFloater::handle_set_iter_t dependent_it = reference_floater->mDependents.begin(); 1796 for(LLFloater::handle_set_iter_t dependent_it = reference_floater->mDependents.begin();
1925 dependent_it != reference_floater->mDependents.end(); ++dependent_it) 1797 dependent_it != reference_floater->mDependents.end(); ++dependent_it)
1926 { 1798 {
1927 LLFloater* sibling = LLFloater::getFloaterByHandle(*dependent_it); 1799 LLFloater* sibling = dependent_it->get();
1928 // check for dependents within 10 pixels of base floater 1800 // check for dependents within 10 pixels of base floater
1929 if (sibling && 1801 if (sibling &&
1930 sibling != neighbor && 1802 sibling != neighbor &&
@@ -1936,8 +1808,8 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
1936 } 1808 }
1937 1809
1938 S32 left_margin = llmax(0, base_rect.mLeft); 1810 S32 left_margin = llmax(0, base_rect.mLeft);
1939 S32 right_margin = llmax(0, mRect.getWidth() - base_rect.mRight); 1811 S32 right_margin = llmax(0, getRect().getWidth() - base_rect.mRight);
1940 S32 top_margin = llmax(0, mRect.getHeight() - base_rect.mTop); 1812 S32 top_margin = llmax(0, getRect().getHeight() - base_rect.mTop);
1941 S32 bottom_margin = llmax(0, base_rect.mBottom); 1813 S32 bottom_margin = llmax(0, base_rect.mBottom);
1942 1814
1943 // find position for floater in following order 1815 // find position for floater in following order
@@ -1946,22 +1818,22 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
1946 { 1818 {
1947 if (right_margin > width) 1819 if (right_margin > width)
1948 { 1820 {
1949 new_rect.translate(base_rect.mRight - neighbor->mRect.mLeft, base_rect.mTop - neighbor->mRect.mTop); 1821 new_rect.translate(base_rect.mRight - neighbor->getRect().mLeft, base_rect.mTop - neighbor->getRect().mTop);
1950 return new_rect; 1822 return new_rect;
1951 } 1823 }
1952 else if (left_margin > width) 1824 else if (left_margin > width)
1953 { 1825 {
1954 new_rect.translate(base_rect.mLeft - neighbor->mRect.mRight, base_rect.mTop - neighbor->mRect.mTop); 1826 new_rect.translate(base_rect.mLeft - neighbor->getRect().mRight, base_rect.mTop - neighbor->getRect().mTop);
1955 return new_rect; 1827 return new_rect;
1956 } 1828 }
1957 else if (bottom_margin > height) 1829 else if (bottom_margin > height)
1958 { 1830 {
1959 new_rect.translate(base_rect.mLeft - neighbor->mRect.mLeft, base_rect.mBottom - neighbor->mRect.mTop); 1831 new_rect.translate(base_rect.mLeft - neighbor->getRect().mLeft, base_rect.mBottom - neighbor->getRect().mTop);
1960 return new_rect; 1832 return new_rect;
1961 } 1833 }
1962 else if (top_margin > height) 1834 else if (top_margin > height)
1963 { 1835 {
1964 new_rect.translate(base_rect.mLeft - neighbor->mRect.mLeft, base_rect.mTop - neighbor->mRect.mBottom); 1836 new_rect.translate(base_rect.mLeft - neighbor->getRect().mLeft, base_rect.mTop - neighbor->getRect().mBottom);
1965 return new_rect; 1837 return new_rect;
1966 } 1838 }
1967 1839
@@ -1976,15 +1848,6 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
1976 return new_rect; 1848 return new_rect;
1977} 1849}
1978 1850
1979void LLFloaterView::setCycleMode(BOOL mode)
1980{
1981 mFocusCycleMode = mode;
1982}
1983
1984BOOL LLFloaterView::getCycleMode()
1985{
1986 return mFocusCycleMode;
1987}
1988 1851
1989void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus) 1852void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
1990{ 1853{
@@ -2014,7 +1877,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
2014 for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin(); 1877 for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin();
2015 dependent_it != floater->mDependents.end(); ) 1878 dependent_it != floater->mDependents.end(); )
2016 { 1879 {
2017 LLFloater* sibling = LLFloater::getFloaterByHandle(*dependent_it); 1880 LLFloater* sibling = dependent_it->get();
2018 if (sibling) 1881 if (sibling)
2019 { 1882 {
2020 floaters_to_move.push_back(sibling); 1883 floaters_to_move.push_back(sibling);
@@ -2045,7 +1908,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
2045 for(LLFloater::handle_set_iter_t dependent_it = child->mDependents.begin(); 1908 for(LLFloater::handle_set_iter_t dependent_it = child->mDependents.begin();
2046 dependent_it != child->mDependents.end(); ) 1909 dependent_it != child->mDependents.end(); )
2047 { 1910 {
2048 LLFloater* dependent = getFloaterByHandle(*dependent_it); 1911 LLFloater* dependent = dependent_it->get();
2049 if (dependent) 1912 if (dependent)
2050 { 1913 {
2051 sendChildToFront(dependent); 1914 sendChildToFront(dependent);
@@ -2086,7 +1949,7 @@ void LLFloaterView::highlightFocusedFloater()
2086 dependent_it != floater->mDependents.end(); 1949 dependent_it != floater->mDependents.end();
2087 ++dependent_it) 1950 ++dependent_it)
2088 { 1951 {
2089 LLFloater* dependent_floaterp = getFloaterByHandle(*dependent_it); 1952 LLFloater* dependent_floaterp = dependent_it->get();
2090 if (dependent_floaterp && gFocusMgr.childHasKeyboardFocus(dependent_floaterp)) 1953 if (dependent_floaterp && gFocusMgr.childHasKeyboardFocus(dependent_floaterp))
2091 { 1954 {
2092 floater_or_dependent_has_focus = TRUE; 1955 floater_or_dependent_has_focus = TRUE;
@@ -2099,7 +1962,7 @@ void LLFloaterView::highlightFocusedFloater()
2099 for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin(); 1962 for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin();
2100 dependent_it != floater->mDependents.end(); ) 1963 dependent_it != floater->mDependents.end(); )
2101 { 1964 {
2102 LLFloater* dependent_floaterp = getFloaterByHandle(*dependent_it); 1965 LLFloater* dependent_floaterp = dependent_it->get();
2103 if (dependent_floaterp) 1966 if (dependent_floaterp)
2104 { 1967 {
2105 dependent_floaterp->setForeground(floater_or_dependent_has_focus); 1968 dependent_floaterp->setForeground(floater_or_dependent_has_focus);
@@ -2260,42 +2123,40 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
2260 if( floater->isResizable() ) 2123 if( floater->isResizable() )
2261 { 2124 {
2262 LLRect view_rect = floater->getRect(); 2125 LLRect view_rect = floater->getRect();
2263 S32 view_width = view_rect.getWidth(); 2126 S32 old_width = view_rect.getWidth();
2264 S32 view_height = view_rect.getHeight(); 2127 S32 old_height = view_rect.getHeight();
2265 S32 min_width; 2128 S32 min_width;
2266 S32 min_height; 2129 S32 min_height;
2267 floater->getResizeLimits( &min_width, &min_height ); 2130 floater->getResizeLimits( &min_width, &min_height );
2268 2131
2269 // Make sure floater isn't already smaller than its min height/width? 2132 // Make sure floater isn't already smaller than its min height/width?
2270 S32 new_width = llmax( min_width, view_width ); 2133 S32 new_width = llmax( min_width, old_width );
2271 S32 new_height = llmax( min_height, view_height ); 2134 S32 new_height = llmax( min_height, old_height);
2272 2135
2273 if( !allow_partial_outside 2136 if((new_width > screen_width) || (new_height > screen_height))
2274 && ( (new_width > screen_width)
2275 || (new_height > screen_height) ) )
2276 { 2137 {
2277 // We have to force this window to be inside the screen. 2138 // We have to make this window able to fit on screen
2278 new_width = llmin(new_width, screen_width); 2139 new_width = llmin(new_width, screen_width);
2279 new_height = llmin(new_height, screen_height); 2140 new_height = llmin(new_height, screen_height);
2280 2141
2281 // Still respect minimum width/height 2142 // ...while respecting minimum width/height
2282 new_width = llmax(new_width, min_width); 2143 new_width = llmax(new_width, min_width);
2283 new_height = llmax(new_height, min_height); 2144 new_height = llmax(new_height, min_height);
2284 2145
2285 floater->reshape( new_width, new_height, TRUE ); 2146 floater->reshape( new_width, new_height, TRUE );
2147 if (floater->followsRight())
2148 {
2149 floater->translate(old_width - new_width, 0);
2150 }
2286 2151
2287 // Make sure the damn thing is actually onscreen. 2152 if (floater->followsTop())
2288 if (floater->translateIntoRect(snap_rect_local, FALSE))
2289 { 2153 {
2290 floater->clearSnapTarget(); 2154 floater->translate(0, old_height - new_height);
2291 } 2155 }
2292 } 2156 }
2293 else if (!floater->isMinimized())
2294 {
2295 floater->reshape(new_width, new_height, TRUE);
2296 }
2297 } 2157 }
2298 2158
2159 // move window fully onscreen
2299 if (floater->translateIntoRect( snap_rect_local, allow_partial_outside )) 2160 if (floater->translateIntoRect( snap_rect_local, allow_partial_outside ))
2300 { 2161 {
2301 floater->clearSnapTarget(); 2162 floater->clearSnapTarget();
@@ -2328,9 +2189,9 @@ void LLFloaterView::draw()
2328 } 2189 }
2329} 2190}
2330 2191
2331const LLRect LLFloaterView::getSnapRect() const 2192LLRect LLFloaterView::getSnapRect() const
2332{ 2193{
2333 LLRect snap_rect = mRect; 2194 LLRect snap_rect = getRect();
2334 snap_rect.mBottom += mSnapOffsetBottom; 2195 snap_rect.mBottom += mSnapOffsetBottom;
2335 2196
2336 return snap_rect; 2197 return snap_rect;
@@ -2397,23 +2258,6 @@ void LLFloaterView::syncFloaterTabOrder()
2397 } 2258 }
2398} 2259}
2399 2260
2400LLFloater* LLFloaterView::getFloaterByHandle(LLViewHandle handle)
2401{
2402 if (handle == LLViewHandle::sDeadHandle)
2403 {
2404 return NULL;
2405 }
2406 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
2407 {
2408 LLView* viewp = *child_it;
2409 if (((LLFloater*)viewp)->getHandle() == handle)
2410 {
2411 return (LLFloater*)viewp;
2412 }
2413 }
2414 return NULL;
2415}
2416
2417LLFloater* LLFloaterView::getParentFloater(LLView* viewp) 2261LLFloater* LLFloaterView::getParentFloater(LLView* viewp)
2418{ 2262{
2419 LLView* parentp = viewp->getParent(); 2263 LLView* parentp = viewp->getParent();
@@ -2479,13 +2323,13 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list)
2479 2323
2480LLMultiFloater::LLMultiFloater() : 2324LLMultiFloater::LLMultiFloater() :
2481 mTabContainer(NULL), 2325 mTabContainer(NULL),
2482 mTabPos(LLTabContainerCommon::TOP), 2326 mTabPos(LLTabContainer::TOP),
2483 mAutoResize(TRUE) 2327 mAutoResize(TRUE)
2484{ 2328{
2485 2329
2486} 2330}
2487 2331
2488LLMultiFloater::LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos) : 2332LLMultiFloater::LLMultiFloater(LLTabContainer::TabPosition tab_pos) :
2489 mTabContainer(NULL), 2333 mTabContainer(NULL),
2490 mTabPos(tab_pos), 2334 mTabPos(tab_pos),
2491 mAutoResize(TRUE) 2335 mAutoResize(TRUE)
@@ -2496,7 +2340,7 @@ LLMultiFloater::LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos) :
2496LLMultiFloater::LLMultiFloater(const LLString &name) : 2340LLMultiFloater::LLMultiFloater(const LLString &name) :
2497 LLFloater(name), 2341 LLFloater(name),
2498 mTabContainer(NULL), 2342 mTabContainer(NULL),
2499 mTabPos(LLTabContainerCommon::TOP), 2343 mTabPos(LLTabContainer::TOP),
2500 mAutoResize(FALSE) 2344 mAutoResize(FALSE)
2501{ 2345{
2502} 2346}
@@ -2508,16 +2352,16 @@ LLMultiFloater::LLMultiFloater(
2508 BOOL auto_resize) : 2352 BOOL auto_resize) :
2509 LLFloater(name, rect, name), 2353 LLFloater(name, rect, name),
2510 mTabContainer(NULL), 2354 mTabContainer(NULL),
2511 mTabPos(LLTabContainerCommon::TOP), 2355 mTabPos(LLTabContainer::TOP),
2512 mAutoResize(auto_resize) 2356 mAutoResize(auto_resize)
2513{ 2357{
2514 mTabContainer = new LLTabContainer("Preview Tabs", 2358 mTabContainer = new LLTabContainer("Preview Tabs",
2515 LLRect(LLPANEL_BORDER_WIDTH, mRect.getHeight() - LLFLOATER_HEADER_SIZE, mRect.getWidth() - LLPANEL_BORDER_WIDTH, 0), 2359 LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0),
2516 mTabPos, 2360 mTabPos,
2517 NULL, 2361 FALSE,
2518 NULL); 2362 FALSE);
2519 mTabContainer->setFollowsAll(); 2363 mTabContainer->setFollowsAll();
2520 if (mResizable) 2364 if (isResizable())
2521 { 2365 {
2522 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH); 2366 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
2523 } 2367 }
@@ -2536,12 +2380,12 @@ LLMultiFloater::LLMultiFloater(
2536 mAutoResize(auto_resize) 2380 mAutoResize(auto_resize)
2537{ 2381{
2538 mTabContainer = new LLTabContainer("Preview Tabs", 2382 mTabContainer = new LLTabContainer("Preview Tabs",
2539 LLRect(LLPANEL_BORDER_WIDTH, mRect.getHeight() - LLFLOATER_HEADER_SIZE, mRect.getWidth() - LLPANEL_BORDER_WIDTH, 0), 2383 LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0),
2540 mTabPos, 2384 mTabPos,
2541 NULL, 2385 FALSE,
2542 NULL); 2386 FALSE);
2543 mTabContainer->setFollowsAll(); 2387 mTabContainer->setFollowsAll();
2544 if (mResizable && mTabPos == LLTabContainerCommon::BOTTOM) 2388 if (isResizable() && mTabPos == LLTabContainer::BOTTOM)
2545 { 2389 {
2546 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH); 2390 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
2547 } 2391 }
@@ -2550,21 +2394,6 @@ LLMultiFloater::LLMultiFloater(
2550 2394
2551} 2395}
2552 2396
2553LLMultiFloater::~LLMultiFloater()
2554{
2555}
2556
2557// virtual
2558EWidgetType LLMultiFloater::getWidgetType() const
2559{
2560 return WIDGET_TYPE_MULTI_FLOATER;
2561}
2562
2563// virtual
2564LLString LLMultiFloater::getWidgetTag() const
2565{
2566 return LL_MULTI_FLOATER_TAG;
2567}
2568 2397
2569void LLMultiFloater::open() /* Flawfinder: ignore */ 2398void LLMultiFloater::open() /* Flawfinder: ignore */
2570{ 2399{
@@ -2584,7 +2413,7 @@ void LLMultiFloater::onClose(bool app_quitting)
2584{ 2413{
2585 if(closeAllFloaters() == TRUE) 2414 if(closeAllFloaters() == TRUE)
2586 { 2415 {
2587 LLFloater::onClose(app_quitting ? true : false); 2416 LLFloater::onClose(app_quitting);
2588 }//else not all tabs could be closed... 2417 }//else not all tabs could be closed...
2589} 2418}
2590 2419
@@ -2635,16 +2464,18 @@ BOOL LLMultiFloater::closeAllFloaters()
2635 2464
2636void LLMultiFloater::growToFit(S32 content_width, S32 content_height) 2465void LLMultiFloater::growToFit(S32 content_width, S32 content_height)
2637{ 2466{
2638 S32 new_width = llmax(mRect.getWidth(), content_width + LLPANEL_BORDER_WIDTH * 2); 2467 S32 new_width = llmax(getRect().getWidth(), content_width + LLPANEL_BORDER_WIDTH * 2);
2639 S32 new_height = llmax(mRect.getHeight(), content_height + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); 2468 S32 new_height = llmax(getRect().getHeight(), content_height + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT);
2640 2469
2641 if (isMinimized()) 2470 if (isMinimized())
2642 { 2471 {
2643 mPreviousRect.setLeftTopAndSize(mPreviousRect.mLeft, mPreviousRect.mTop, new_width, new_height); 2472 LLRect newrect;
2644 } 2473 newrect.setLeftTopAndSize(getExpandedRect().mLeft, getExpandedRect().mTop, new_width, new_height);
2474 setExpandedRect(newrect);
2475 }
2645 else 2476 else
2646 { 2477 {
2647 S32 old_height = mRect.getHeight(); 2478 S32 old_height = getRect().getHeight();
2648 reshape(new_width, new_height); 2479 reshape(new_width, new_height);
2649 // keep top left corner in same position 2480 // keep top left corner in same position
2650 translate(0, old_height - new_height); 2481 translate(0, old_height - new_height);
@@ -2729,7 +2560,7 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater,
2729 } 2560 }
2730 2561
2731 floaterp->setHost(this); 2562 floaterp->setHost(this);
2732 if (mMinimized) 2563 if (isMinimized())
2733 { 2564 {
2734 floaterp->setVisible(FALSE); 2565 floaterp->setVisible(FALSE);
2735 } 2566 }
@@ -2912,7 +2743,7 @@ void LLMultiFloater::onTabSelected(void* userdata, bool from_click)
2912void LLMultiFloater::setCanResize(BOOL can_resize) 2743void LLMultiFloater::setCanResize(BOOL can_resize)
2913{ 2744{
2914 LLFloater::setCanResize(can_resize); 2745 LLFloater::setCanResize(can_resize);
2915 if (mResizable && mTabContainer->getTabPosition() == LLTabContainer::BOTTOM) 2746 if (isResizable() && mTabContainer->getTabPosition() == LLTabContainer::BOTTOM)
2916 { 2747 {
2917 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH); 2748 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
2918 } 2749 }
@@ -2955,20 +2786,23 @@ void LLMultiFloater::updateResizeLimits()
2955 } 2786 }
2956 setResizeLimits(new_min_width, new_min_height); 2787 setResizeLimits(new_min_width, new_min_height);
2957 2788
2958 S32 cur_height = mRect.getHeight(); 2789 S32 cur_height = getRect().getHeight();
2959 S32 new_width = llmax(mRect.getWidth(), new_min_width); 2790 S32 new_width = llmax(getRect().getWidth(), new_min_width);
2960 S32 new_height = llmax(mRect.getHeight(), new_min_height); 2791 S32 new_height = llmax(getRect().getHeight(), new_min_height);
2961 2792
2962 if (isMinimized()) 2793 if (isMinimized())
2963 { 2794 {
2964 mPreviousRect.setLeftTopAndSize(mPreviousRect.mLeft, mPreviousRect.mTop, llmax(mPreviousRect.getWidth(), new_width), llmax(mPreviousRect.getHeight(), new_height)); 2795 const LLRect& expanded = getExpandedRect();
2796 LLRect newrect;
2797 newrect.setLeftTopAndSize(expanded.mLeft, expanded.mTop, llmax(expanded.getWidth(), new_width), llmax(expanded.getHeight(), new_height));
2798 setExpandedRect(newrect);
2965 } 2799 }
2966 else 2800 else
2967 { 2801 {
2968 reshape(new_width, new_height); 2802 reshape(new_width, new_height);
2969 2803
2970 // make sure upper left corner doesn't move 2804 // make sure upper left corner doesn't move
2971 translate(0, cur_height - mRect.getHeight()); 2805 translate(0, cur_height - getRect().getHeight());
2972 2806
2973 // make sure this window is visible on screen when it has been modified 2807 // make sure this window is visible on screen when it has been modified
2974 // (tab added, etc) 2808 // (tab added, etc)