aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llfloater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/llfloater.cpp')
-rw-r--r--linden/indra/llui/llfloater.cpp56
1 files changed, 50 insertions, 6 deletions
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp
index 2f4e873..2924c29 100644
--- a/linden/indra/llui/llfloater.cpp
+++ b/linden/indra/llui/llfloater.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2002&license=viewergpl$ 5 * $LicenseInfo:firstyear=2002&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2002-2008, Linden Research, Inc. 7 * Copyright (c) 2002-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -127,6 +127,7 @@ LLFloaterView* gFloaterView = NULL;
127 127
128LLFloater::LLFloater() : 128LLFloater::LLFloater() :
129 //FIXME: we should initialize *all* member variables here 129 //FIXME: we should initialize *all* member variables here
130 LLPanel(), mAutoFocus(TRUE),
130 mResizable(FALSE), 131 mResizable(FALSE),
131 mDragOnLeft(FALSE), 132 mDragOnLeft(FALSE),
132 mMinWidth(0), 133 mMinWidth(0),
@@ -139,6 +140,11 @@ LLFloater::LLFloater() :
139 mButtonsEnabled[i] = FALSE; 140 mButtonsEnabled[i] = FALSE;
140 mButtons[i] = NULL; 141 mButtons[i] = NULL;
141 } 142 }
143 for (S32 i = 0; i < 4; i++)
144 {
145 mResizeBar[i] = NULL;
146 mResizeHandle[i] = NULL;
147 }
142 mDragHandle = NULL; 148 mDragHandle = NULL;
143 mHandle.bind(this); 149 mHandle.bind(this);
144} 150}
@@ -151,6 +157,11 @@ LLFloater::LLFloater(const std::string& name)
151 mButtonsEnabled[i] = FALSE; 157 mButtonsEnabled[i] = FALSE;
152 mButtons[i] = NULL; 158 mButtons[i] = NULL;
153 } 159 }
160 for (S32 i = 0; i < 4; i++)
161 {
162 mResizeBar[i] = NULL;
163 mResizeHandle[i] = NULL;
164 }
154 std::string title; // null string 165 std::string title; // null string
155 initFloater(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults 166 initFloater(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults
156} 167}
@@ -171,6 +182,11 @@ LLFloater::LLFloater(const std::string& name, const LLRect& rect, const std::str
171 mButtonsEnabled[i] = FALSE; 182 mButtonsEnabled[i] = FALSE;
172 mButtons[i] = NULL; 183 mButtons[i] = NULL;
173 } 184 }
185 for (S32 i = 0; i < 4; i++)
186 {
187 mResizeBar[i] = NULL;
188 mResizeHandle[i] = NULL;
189 }
174 initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); 190 initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
175} 191}
176 192
@@ -189,6 +205,11 @@ LLFloater::LLFloater(const std::string& name, const std::string& rect_control, c
189 mButtonsEnabled[i] = FALSE; 205 mButtonsEnabled[i] = FALSE;
190 mButtons[i] = NULL; 206 mButtons[i] = NULL;
191 } 207 }
208 for (S32 i = 0; i < 4; i++)
209 {
210 mResizeBar[i] = NULL;
211 mResizeHandle[i] = NULL;
212 }
192 initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); 213 initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
193} 214}
194 215
@@ -523,6 +544,7 @@ void LLFloater::close(bool app_quitting)
523 if (getHost()) 544 if (getHost())
524 { 545 {
525 ((LLMultiFloater*)getHost())->removeFloater(this); 546 ((LLMultiFloater*)getHost())->removeFloater(this);
547 gFloaterView->addChild(this);
526 } 548 }
527 549
528 if (getSoundFlags() != SILENT 550 if (getSoundFlags() != SILENT
@@ -1297,8 +1319,8 @@ void LLFloater::onClickEdit(void *userdata)
1297 self->mEditing = self->mEditing ? FALSE : TRUE; 1319 self->mEditing = self->mEditing ? FALSE : TRUE;
1298} 1320}
1299 1321
1300// static 1322// static
1301void LLFloater::closeFocusedFloater() 1323LLFloater* LLFloater::getClosableFloaterFromFocus()
1302{ 1324{
1303 LLFloater* focused_floater = NULL; 1325 LLFloater* focused_floater = NULL;
1304 1326
@@ -1315,10 +1337,32 @@ void LLFloater::closeFocusedFloater()
1315 if (iter == sFloaterMap.end()) 1337 if (iter == sFloaterMap.end())
1316 { 1338 {
1317 // nothing found, return 1339 // nothing found, return
1318 return; 1340 return NULL;
1341 }
1342
1343 // The focused floater may not be closable,
1344 // Find and close a parental floater that is closeable, if any.
1345 for(LLFloater* floater_to_close = focused_floater;
1346 NULL != floater_to_close;
1347 floater_to_close = gFloaterView->getParentFloater(floater_to_close))
1348 {
1349 if(floater_to_close->isCloseable())
1350 {
1351 return floater_to_close;
1352 }
1319 } 1353 }
1320 1354
1321 focused_floater->close(); 1355 return NULL;
1356}
1357
1358// static
1359void LLFloater::closeFocusedFloater()
1360{
1361 LLFloater* floater_to_close = LLFloater::getClosableFloaterFromFocus();
1362 if(floater_to_close)
1363 {
1364 floater_to_close->close();
1365 }
1322 1366
1323 // if nothing took focus after closing focused floater 1367 // if nothing took focus after closing focused floater
1324 // give it to next floater (to allow closing multiple windows via keyboard in rapid succession) 1368 // give it to next floater (to allow closing multiple windows via keyboard in rapid succession)
@@ -1580,7 +1624,7 @@ void LLFloater::updateButtons()
1580 S32 button_count = 0; 1624 S32 button_count = 0;
1581 for (S32 i = 0; i < BUTTON_COUNT; i++) 1625 for (S32 i = 0; i < BUTTON_COUNT; i++)
1582 { 1626 {
1583 if(!mButtons[i]) continue; 1627 if(!mButtons[i]) continue;
1584 mButtons[i]->setEnabled(mButtonsEnabled[i]); 1628 mButtons[i]->setEnabled(mButtonsEnabled[i]);
1585 1629
1586 if (mButtonsEnabled[i] 1630 if (mButtonsEnabled[i]