From 124bc854dd7c3dffc044f306cf836a5d6c68bd2e Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 16 Aug 2010 17:44:23 -0700 Subject: moved buildFloater out of lluictrlfactory to llfloater.cpp --- indra/llui/llfloater.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 838f93d3f9..d66b3c1707 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -42,6 +42,7 @@ #include "lluictrlfactory.h" #include "llbutton.h" #include "llcheckboxctrl.h" +#include "lldir.h" #include "lldraghandle.h" #include "llfloaterreg.h" #include "llfocusmgr.h" @@ -2883,3 +2884,65 @@ bool LLFloater::isVisible(const LLFloater* floater) { return floater && floater->getVisible(); } + +static LLFastTimer::DeclareTimer FTM_BUILD_FLOATERS("Build Floaters"); + +/* static */ +bool LLFloater::buildFloater(LLFloater* floaterp, const std::string& filename, LLXMLNodePtr output_node) +{ + LLFastTimer timer(FTM_BUILD_FLOATERS); + LLXMLNodePtr root; + + //if exporting, only load the language being exported, + //instead of layering localized version on top of english + if (output_node) + { + if (!LLUICtrlFactory::getLocalizedXMLNode(filename, root)) + { + llwarns << "Couldn't parse floater from: " << LLUI::getLocalizedSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl; + return false; + } + } + else if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) + { + llwarns << "Couldn't parse floater from: " << LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl; + return false; + } + + // root must be called floater + if( !(root->hasName("floater") || root->hasName("multi_floater")) ) + { + llwarns << "Root node should be named floater in: " << filename << llendl; + return false; + } + + bool res = true; + + lldebugs << "Building floater " << filename << llendl; + LLUICtrlFactory::instance().pushFileName(filename); + { + if (!floaterp->getFactoryMap().empty()) + { + LLPanel::sFactoryStack.push_front(&floaterp->getFactoryMap()); + } + + // for local registry callbacks; define in constructor, referenced in XUI or postBuild + floaterp->getCommitCallbackRegistrar().pushScope(); + floaterp->getEnableCallbackRegistrar().pushScope(); + + res = floaterp->initFloaterXML(root, floaterp->getParent(), filename, output_node); + + floaterp->setXMLFilename(filename); + + floaterp->getCommitCallbackRegistrar().popScope(); + floaterp->getEnableCallbackRegistrar().popScope(); + + if (!floaterp->getFactoryMap().empty()) + { + LLPanel::sFactoryStack.pop_front(); + } + } + LLUICtrlFactory::instance().popFileName(); + + return res; +} -- cgit v1.2.3 From 02d8197019dcecec7aee80a104c4644ddb4807ca Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 20 Aug 2010 10:14:28 -0700 Subject: changed buildPanel/buildFloater to member functions buildFromFile streamlined LLUICtrlFactory's interface --- indra/llui/llfloater.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index d66b3c1707..0cd692b4a4 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2887,8 +2887,7 @@ bool LLFloater::isVisible(const LLFloater* floater) static LLFastTimer::DeclareTimer FTM_BUILD_FLOATERS("Build Floaters"); -/* static */ -bool LLFloater::buildFloater(LLFloater* floaterp, const std::string& filename, LLXMLNodePtr output_node) +bool LLFloater::buildFromFile(const std::string& filename, LLXMLNodePtr output_node) { LLFastTimer timer(FTM_BUILD_FLOATERS); LLXMLNodePtr root; @@ -2921,23 +2920,23 @@ bool LLFloater::buildFloater(LLFloater* floaterp, const std::string& filename, L lldebugs << "Building floater " << filename << llendl; LLUICtrlFactory::instance().pushFileName(filename); { - if (!floaterp->getFactoryMap().empty()) + if (!getFactoryMap().empty()) { - LLPanel::sFactoryStack.push_front(&floaterp->getFactoryMap()); + LLPanel::sFactoryStack.push_front(&getFactoryMap()); } // for local registry callbacks; define in constructor, referenced in XUI or postBuild - floaterp->getCommitCallbackRegistrar().pushScope(); - floaterp->getEnableCallbackRegistrar().pushScope(); + getCommitCallbackRegistrar().pushScope(); + getEnableCallbackRegistrar().pushScope(); - res = floaterp->initFloaterXML(root, floaterp->getParent(), filename, output_node); + res = initFloaterXML(root, getParent(), filename, output_node); - floaterp->setXMLFilename(filename); + setXMLFilename(filename); - floaterp->getCommitCallbackRegistrar().popScope(); - floaterp->getEnableCallbackRegistrar().popScope(); + getCommitCallbackRegistrar().popScope(); + getEnableCallbackRegistrar().popScope(); - if (!floaterp->getFactoryMap().empty()) + if (!getFactoryMap().empty()) { LLPanel::sFactoryStack.pop_front(); } -- cgit v1.2.3 From 65c9914d23022df6a39db50ce295750f08695893 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 23 Aug 2010 11:03:19 -0700 Subject: made Params parsers not act as singletons --- indra/llui/llfloater.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 0cd692b4a4..e7d0950846 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2780,7 +2780,8 @@ LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build"); bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node) { Params params(LLUICtrlFactory::getDefaultParams()); - LLXUIParser::instance().readXUI(node, params, filename); // *TODO: Error checking + LLXUIParser parser; + parser.readXUI(node, params, filename); // *TODO: Error checking if (output_node) { @@ -2788,8 +2789,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str setupParamsForExport(output_params, parent); Params default_params(LLUICtrlFactory::getDefaultParams()); output_node->setName(node->getName()->mString); - LLXUIParser::instance().writeXUI( - output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, &default_params); } // Default floater position to top-left corner of screen -- cgit v1.2.3 From baeded61a7cc281062efdecea2c8a385c619fe74 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Mon, 13 Sep 2010 20:06:48 +0300 Subject: STORM-101 FIXED Moved floater settings (rect, visibility, docked state) to account-specific XML file. The settings are now stored to settings_per_account.xml. This change affects all floaters having save_rect/save_visibility/save_dock_state params set to "true", not just detached sidebar tabs as the ticket requests. --- indra/llui/llfloater.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 8d24150e1e..c0942cf3c7 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -499,7 +499,7 @@ void LLFloater::storeRectControl() { if( mRectControl.size() > 1 ) { - LLUI::sSettingGroups["floater"]->setRect( mRectControl, getRect() ); + getControlGroup()->setRect( mRectControl, getRect() ); } } @@ -507,7 +507,7 @@ void LLFloater::storeVisibilityControl() { if( !sQuitting && mVisibilityControl.size() > 1 ) { - LLUI::sSettingGroups["floater"]->setBOOL( mVisibilityControl, getVisible() ); + getControlGroup()->setBOOL( mVisibilityControl, getVisible() ); } } @@ -515,7 +515,7 @@ void LLFloater::storeDockStateControl() { if( !sQuitting && mDocStateControl.size() > 1 ) { - LLUI::sSettingGroups["floater"]->setBOOL( mDocStateControl, isDocked() ); + getControlGroup()->setBOOL( mDocStateControl, isDocked() ); } } @@ -525,7 +525,7 @@ LLRect LLFloater::getSavedRect() const if (mRectControl.size() > 1) { - rect = LLUI::sSettingGroups["floater"]->getRect(mRectControl); + rect = getControlGroup()->getRect(mRectControl); } return rect; @@ -550,6 +550,13 @@ std::string LLFloater::getControlName(const std::string& name, const LLSD& key) return ctrl_name; } +// static +LLControlGroup* LLFloater::getControlGroup() +{ + // Floater size, position, visibility, etc are saved in per-account settings. + return LLUI::sSettingGroups["account"]; +} + void LLFloater::setVisible( BOOL visible ) { LLPanel::setVisible(visible); // calls handleVisibilityChange() @@ -805,7 +812,7 @@ void LLFloater::applyRectControl() // override center if we have saved rect control if (mRectControl.size() > 1) { - const LLRect& rect = LLUI::sSettingGroups["floater"]->getRect(mRectControl); + const LLRect& rect = getControlGroup()->getRect(mRectControl); if (rect.getWidth() > 0 && rect.getHeight() > 0) { translate( rect.mLeft - getRect().mLeft, rect.mBottom - getRect().mBottom); @@ -821,7 +828,7 @@ void LLFloater::applyDockState() { if (mDocStateControl.size() > 1) { - bool dockState = LLUI::sSettingGroups["floater"]->getBOOL(mDocStateControl); + bool dockState = getControlGroup()->getBOOL(mDocStateControl); setDocked(dockState); } -- cgit v1.2.3 From 022f9bd9a8b80481bb5ecfd651457fe6df3bae30 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Mon, 20 Sep 2010 19:08:45 +0300 Subject: STORM-192 ADDITIONAL FIX Fixed crash on pressing Ctrl+Shift+W (which closes all floaters). The crash was introduced by my previous fix of this ticket in changeset 8ceebd3612f0. The problem was that, suprisingly, even invisible (faded) toasts were destroyed when you hit Ctrl_Shift+W, however they were still referenced by the toast pool, so the references were invalidated. The easiest fix would be to remove all references to the toast being destroyed, no matter is it visible or not. However, then we'd have to search for each destroyed toast in the pool, which is slow. Besides, removing toasts from the pool compromises the whole idea of pooling (which was introduced to speed up creation of new toasts). Another possible fix is not to destroy any nearby chat toasts when user hits Ctrl+Shift+W. That would save us from any crashes at a price of changing existing behaviour (the toasts will remain visible). So I went for a third option: when closing all floaters, skip invisible ones. Then there won't be attempts to destroy invisible (pooled) toasts, so the crash won't happen, and we don't seem to change any existing behavior. However I'm not 100% sure of the latter statement, so the fix requires extensive testing. --- indra/llui/llfloater.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llui/llfloater.cpp') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c0942cf3c7..eb5d7a6b6a 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2390,7 +2390,9 @@ void LLFloaterView::closeAllChildren(bool app_quitting) // Attempt to close floater. This will cause the "do you want to save" // dialogs to appear. - if (floaterp->canClose() && !floaterp->isDead()) + // Skip invisible floaters if we're not quitting (STORM-192). + if (floaterp->canClose() && !floaterp->isDead() && + (app_quitting || floaterp->getVisible())) { floaterp->closeFloater(app_quitting); } -- cgit v1.2.3