diff options
author | Richard Nelson <richard@lindenlab.com> | 2011-07-26 14:26:27 -0700 |
---|---|---|
committer | Richard Nelson <richard@lindenlab.com> | 2011-07-26 14:26:27 -0700 |
commit | fd9f3b9fe945cb86f677f5b0cf31302d10bcfa99 (patch) | |
tree | a16d6541e199103a069378ea3e0d695c59685719 /indra/llui | |
parent | 95da8c81f3d5afd8d888589398028883e6647333 (diff) |
EXP-1021 FIX Position of web content browser dictates position of profile panel - profile panel position changes do not persist
EXP-1030 FIX Search button toggle can get out of synch in bottom bar
made llinstancetracker::iterator do own nested level management (removing need for separate guard)
added support for filename= to floaters
can pass in arbitrary window_class to floaters
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llconsole.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 86 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 7 | ||||
-rw-r--r-- | indra/llui/llfloaterreg.cpp | 28 | ||||
-rw-r--r-- | indra/llui/llfloaterreg.h | 2 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llpanel.h | 5 |
8 files changed, 90 insertions, 53 deletions
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 04040200d0..161496b1f5 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -372,9 +372,7 @@ LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_t // static void LLConsole::updateClass() { - LLInstanceTrackerScopedGuard guard; - - for (instance_iter it = guard.beginInstances(); it != guard.endInstances(); ++it) + for (instance_iter it = beginInstances(); it != endInstances(); ++it) { it->update(); } diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index d19e33ea55..43a37d6dff 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -766,7 +766,6 @@ void LLFloater::closeFloater(bool app_quitting) void LLFloater::reshape(S32 width, S32 height, BOOL called_from_parent) { LLPanel::reshape(width, height, called_from_parent); - storeRectControl(); } void LLFloater::releaseFocus() @@ -968,6 +967,11 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) const LLRect old_rect = getRect(); LLView::handleReshape(new_rect, by_user); + if (by_user) + { + storeRectControl(); + } + // if not minimized, adjust all snapped dependents to new shape if (!isMinimized()) { @@ -2048,7 +2052,6 @@ static LLDefaultChildRegistry::Register<LLFloaterView> r("floater_view"); LLFloaterView::LLFloaterView (const Params& p) : LLUICtrl (p), - mFocusCycleMode(FALSE), mMinimizePositionVOffset(0), mSnapOffsetBottom(0), @@ -2059,12 +2062,6 @@ LLFloaterView::LLFloaterView (const Params& p) // By default, adjust vertical. void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) { - reshapeFloater(width, height, called_from_parent, ADJUST_VERTICAL_YES); -} - -// When reshaping this view, make the floaters follow their closest edge. -void LLFloaterView::reshapeFloater(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical) -{ S32 old_width = getRect().getWidth(); S32 old_height = getRect().getHeight(); @@ -2109,11 +2106,7 @@ void LLFloaterView::reshapeFloater(S32 width, S32 height, BOOL called_from_paren // "No vertical adjustment" usually means that the bottom of the view // has been pushed up or down. Hence we want the floaters to follow // the top. - if (!adjust_vertical) - { - follow_flags |= FOLLOWS_TOP; - } - else if (top_offset < bottom_offset) + if (top_offset < bottom_offset) { follow_flags |= FOLLOWS_TOP; } @@ -2847,7 +2840,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) mAutoTile = p.auto_tile; mOpenCentered = p.open_centered; - if (p.save_rect) + if (p.save_rect && mRectControl.empty()) { mRectControl = "t"; // flag to build mRectControl name once mInstanceName is set } @@ -2885,13 +2878,54 @@ boost::signals2::connection LLFloater::setCloseCallback( const commit_signal_t:: } LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build"); +static LLFastTimer::DeclareTimer FTM_EXTERNAL_FLOATER_LOAD("Load Extern Floater Reference"); bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node) { - Params params(LLUICtrlFactory::getDefaultParams<LLFloater>()); + Params default_params(LLUICtrlFactory::getDefaultParams<LLFloater>()); + Params params(default_params); + LLXUIParser parser; parser.readXUI(node, params, filename); // *TODO: Error checking + std::string xml_filename = params.filename; + + if (!xml_filename.empty()) + { + LLXMLNodePtr referenced_xml; + + if (output_node) + { + //if we are exporting, we want to export the current xml + //not the referenced xml + Params output_params; + parser.readXUI(node, output_params, LLUICtrlFactory::getInstance()->getCurFileName()); + setupParamsForExport(output_params, parent); + output_node->setName(node->getName()->mString); + parser.writeXUI(output_node, output_params, &default_params); + return TRUE; + } + + LLUICtrlFactory::instance().pushFileName(xml_filename); + + LLFastTimer _(FTM_EXTERNAL_FLOATER_LOAD); + if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml)) + { + llwarns << "Couldn't parse panel from: " << xml_filename << llendl; + + return FALSE; + } + + parser.readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName()); + + // add children using dimensions from referenced xml for consistent layout + setShape(params.rect); + LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance()); + + LLUICtrlFactory::instance().popFileName(); + } + + if (output_node) { Params output_params(params); @@ -2912,7 +2946,6 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str { params.rect.left.set(0); } - params.from_xui = true; applyXUILayout(params, parent); initFromParams(params); @@ -3054,3 +3087,24 @@ bool LLFloater::buildFromFile(const std::string& filename, LLXMLNodePtr output_n return res; } + +void LLFloater::stackWith(LLFloater& other) +{ + static LLUICachedControl<S32> floater_offset ("UIFloaterOffset", 16); + + LLRect next_rect; + if (other.getHost()) + { + next_rect = other.getHost()->getRect(); + } + else + { + next_rect = other.getRect(); + } + next_rect.translate(floater_offset, -floater_offset); + + next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, getRect().getWidth(), getRect().getHeight()); + + mRectControl.clear(); // don't save rect of stacked floaters + setShape(next_rect); +}
\ No newline at end of file diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 9aae1afc62..58c2d34253 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -265,6 +265,8 @@ public: virtual void setTornOff(bool torn_off) { mTornOff = torn_off; } + void stackWith(LLFloater& other); + // Return a closeable floater, if any, given the current focus. static LLFloater* getClosableFloaterFromFocus(); @@ -289,9 +291,6 @@ public: void updateTransparency(ETypeTransparency transparency_type); protected: - - void setRectControl(const std::string& rectname) { mRectControl = rectname; }; - virtual void applySavedVariables(); void applyRectControl(); @@ -455,8 +454,6 @@ protected: public: /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - void reshapeFloater(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical); - /*virtual*/ void draw(); /*virtual*/ LLRect getSnapRect() const; /*virtual*/ void refresh(); diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index f5e6444287..1463d0bfbb 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -57,7 +57,7 @@ void LLFloaterReg::add(const std::string& name, const std::string& filename, con } //static -LLRect LLFloaterReg::getFloaterRect(const std::string& name) +LLFloater* LLFloaterReg::getLastFloaterInGroup(const std::string& name) { LLRect rect; const std::string& groupname = sGroupMap[name]; @@ -66,20 +66,10 @@ LLRect LLFloaterReg::getFloaterRect(const std::string& name) instance_list_t& list = sInstanceMap[groupname]; if (!list.empty()) { - static LLUICachedControl<S32> floater_offset ("UIFloaterOffset", 16); - LLFloater* last_floater = list.back(); - if (last_floater->getHost()) - { - rect = last_floater->getHost()->getRect(); - } - else - { - rect = last_floater->getRect(); - } - rect.translate(floater_offset, -floater_offset); + return list.back(); } } - return rect; + return NULL; } //static @@ -137,12 +127,12 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) res->applySavedVariables(); // Can't apply rect and dock state until setting instance name if (res->mAutoTile && !res->getHost() && index > 0) { - const LLRect& cur_rect = res->getRect(); - LLRect next_rect = getFloaterRect(groupname); - next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, cur_rect.getWidth(), cur_rect.getHeight()); - res->setRect(next_rect); - res->setRectControl(LLStringUtil::null); // don't save rect of tiled floaters - gFloaterView->adjustToFitScreen(res, true); + LLFloater* last_floater = getLastFloaterInGroup(groupname); + if (last_floater) + { + res->stackWith(*last_floater); + gFloaterView->adjustToFitScreen(res, true); + } } else { diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 8414b92113..a2027a77a0 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -86,7 +86,7 @@ public: const std::string& groupname = LLStringUtil::null); // Helpers - static LLRect getFloaterRect(const std::string& name); + static LLFloater* getLastFloaterInGroup(const std::string& name); // Find / get (create) / remove / destroy static LLFloater* findInstance(const std::string& name, const LLSD& key = LLSD()); diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 6a91ec56e4..a59247ba09 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -713,10 +713,7 @@ void LLLayoutStack::createResizeBars() //static void LLLayoutStack::updateClass() { - LLInstanceTrackerScopedGuard guard; - for (LLLayoutStack::instance_iter it = guard.beginInstances(); - it != guard.endInstances(); - ++it) + for (instance_iter it = beginInstances(); it != endInstances(); ++it) { it->updateLayout(); } diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 775db6bc9d..e3193bc352 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -515,9 +515,6 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu if (!xml_filename.empty()) { - LLUICtrlFactory::instance().pushFileName(xml_filename); - - LLFastTimer timer(FTM_EXTERNAL_PANEL_LOAD); if (output_node) { //if we are exporting, we want to export the current xml @@ -530,6 +527,9 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu return TRUE; } + LLUICtrlFactory::instance().pushFileName(xml_filename); + + LLFastTimer timer(FTM_EXTERNAL_PANEL_LOAD); if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml)) { llwarns << "Couldn't parse panel from: " << xml_filename << llendl; diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 1b777ee1cb..790025cb2d 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -265,6 +265,9 @@ protected: std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer typedef std::deque<const LLCallbackMap::map_t*> factory_stack_t; static factory_stack_t sFactoryStack; + + // for setting the xml filename when building panel in context dependent cases + std::string mXMLFilename; private: BOOL mBgVisible; // any background at all? @@ -283,8 +286,6 @@ private: typedef std::map<std::string, std::string> ui_string_map_t; ui_string_map_t mUIStrings; - // for setting the xml filename when building panel in context dependent cases - std::string mXMLFilename; }; // end class LLPanel |