From 860962d365ba49d063d2f934706a6e4832352b4b Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 12 Sep 2011 18:00:52 -0700 Subject: EXP-1063 FIX Destination Guide link in side panel does not open to destination guide specific search window fixed param->LLSD serialization to not introduce empty strings --- indra/llui/llsdparam.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 9ad13054cb..7deedb18b8 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -159,6 +159,11 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) it != name_stack.end(); ++it) { + if (it->first.empty()) + { + continue; + } + bool new_array_entry = false; if (prev_it == mNameStack.end()) { -- cgit v1.3 From 2809778bf1a487e2a2786301d7fd651c82290432 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 14 Sep 2011 19:45:00 -0700 Subject: EXP-1201 FIX Quit button option not present in Mode Changing and Exit viewer dialogs --- indra/llui/llnotifications.cpp | 1 - indra/llui/llsdparam.cpp | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 6085c61f9a..ffe5908a9d 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -245,7 +245,6 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica LLParamSDParser parser; parser.writeSD(mFormData, p.form_elements); - mFormData = mFormData[""]; if (!mFormData.isArray()) { // change existing contents to a one element array diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 7deedb18b8..04919e6991 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -159,11 +159,6 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) it != name_stack.end(); ++it) { - if (it->first.empty()) - { - continue; - } - bool new_array_entry = false; if (prev_it == mNameStack.end()) { @@ -188,7 +183,7 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) } } - LLSD* child_sd = &(*sd_to_write)[it->first]; + LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first]; if (child_sd->isArray()) { -- cgit v1.3 From 03e965a7324ca9ecc3d99faf27e2ea4d7b2fbc52 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 15 Sep 2011 16:16:33 -0700 Subject: EXP-974 FIX Inventory Keystroke Behavior No Longer Working --- indra/llui/llscrollcontainer.cpp | 9 +++++++++ indra/llui/llscrollcontainer.h | 1 + indra/newview/llfolderview.cpp | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index b44b4c36b6..fe3f688fc5 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -223,6 +223,15 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) return FALSE; } +BOOL LLScrollContainer::handleUnicodeCharHere(llwchar uni_char) +{ + if (mScrolledView && mScrolledView->handleUnicodeCharHere(uni_char)) + { + return TRUE; + } + return FALSE; +} + BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) { // Give event to my child views - they may have scroll bars diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index 46a71a7e30..3aa79cc255 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -103,6 +103,7 @@ public: // LLView functionality virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual BOOL handleUnicodeCharHere(llwchar uni_char); virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 8b72d83830..9ba5f827e2 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -1723,7 +1723,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) } BOOL handled = FALSE; - if (gFocusMgr.childHasKeyboardFocus(getRoot())) + if (mParentPanel->hasFocus()) { // SL-51858: Key presses are not being passed to the Popup menu. // A proper fix is non-trivial so instead just close the menu. -- cgit v1.3 From c10832bb9ade5efa2a501cb3b39f769aa3024363 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 16 Sep 2011 11:57:57 -0700 Subject: added Flag as new param type... usage: will set the bar flag on foo LLSD foo; foo["bar"]; will set the bar flag on foo converted notifications unique to use flag --- indra/llui/llnotificationtemplate.h | 4 +- indra/llui/lluictrlfactory.h | 6 +- indra/llxuixml/llinitparam.h | 115 ++++++++++++-- indra/llxuixml/llxuiparser.cpp | 3 +- .../newview/skins/default/xui/en/notifications.xml | 172 +++++++++++---------- 5 files changed, 196 insertions(+), 104 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index eff572b553..ab777d37a5 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -88,10 +88,10 @@ struct LLNotificationTemplate { private: // this idiom allows - // + // // as well as // ... - Optional dummy_val; + Flag dummy_val; public: Multiple contexts; diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index f0ba7fc7d7..d345ad4cd0 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -125,12 +125,12 @@ private: // base case for recursion, there are NO base classes of LLInitParam::BaseBlock template - class ParamDefaults : public LLSingleton > + class ParamDefaults : public LLSingleton > { public: - const LLInitParam::BaseBlock& get() { return mBaseBlock; } + const LLInitParam::BaseBlockWithFlags& get() { return mBaseBlock; } private: - LLInitParam::BaseBlock mBaseBlock; + LLInitParam::BaseBlockWithFlags mBaseBlock; }; public: diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 9d0fe781ce..fd4482f592 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -289,20 +289,20 @@ namespace LLInitParam protected: bool anyProvided() const { return mIsProvided; } - Param(class BaseBlock* enclosing_block); + Param(BaseBlock* enclosing_block); // store pointer to enclosing block as offset to reduce space and allow for quick copying - class BaseBlock& enclosingBlock() const + BaseBlock& enclosingBlock() const { const U8* my_addr = reinterpret_cast(this); // get address of enclosing BLOCK class using stored offset to enclosing BaseBlock class - return *const_cast - (reinterpret_cast + return *const_cast + (reinterpret_cast (my_addr - (ptrdiff_t)(S32)mEnclosingBlockOffset)); } private: - friend class BaseBlock; + friend BaseBlock; U32 mEnclosingBlockOffset:31; U32 mIsProvided:1; @@ -367,18 +367,16 @@ namespace LLInitParam typedef boost::unordered_map param_map_t; typedef std::vector param_list_t; - typedef std::list all_params_list_t; + typedef std::list all_params_list_t; typedef std::vector > param_validation_list_t; param_map_t mNamedParams; // parameters with associated names param_list_t mUnnamedParams; // parameters with_out_ associated names param_validation_list_t mValidationList; // parameters that must be validated all_params_list_t mAllParams; // all parameters, owns descriptors - - size_t mMaxParamOffset; - - EInitializationState mInitializationState; // whether or not static block data has been initialized - class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed + size_t mMaxParamOffset; + EInitializationState mInitializationState; // whether or not static block data has been initialized + BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed }; class BaseBlock @@ -499,6 +497,92 @@ namespace LLInitParam const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const; }; + class BaseBlockWithFlags : public BaseBlock + { + public: + class FlagBase : public Param + { + public: + typedef FlagBase self_t; + + FlagBase(const char* name, BaseBlock* enclosing_block) : Param(enclosing_block) + { + if (LL_UNLIKELY(enclosing_block->mostDerivedBlockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING)) + { + ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( + enclosing_block->getHandleFromParam(this), + &mergeWith, + &deserializeParam, + &serializeParam, + NULL, + &inspectParam, + 0, 1)); + BaseBlock::addParam(enclosing_block->mostDerivedBlockDescriptor(), param_descriptor, name); + } + } + + bool isProvided() const { return anyProvided(); } + + private: + static bool mergeWith(Param& dst, const Param& src, bool overwrite) + { + const self_t& src_typed_param = static_cast(src); + self_t& dst_typed_param = static_cast(dst); + + if (src_typed_param.isProvided() + && (overwrite || !dst_typed_param.isProvided())) + { + dst.setProvided(true); + return true; + } + return false; + } + + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + { + self_t& typed_param = static_cast(param); + + // no further names in stack, parse value now + if (name_stack.first == name_stack.second) + { + typed_param.setProvided(true); + typed_param.enclosingBlock().paramChanged(param, true); + return true; + } + + return false; + } + + static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) + { + const self_t& typed_param = static_cast(param); + const self_t* typed_diff_param = static_cast(diff_param); + + if (!typed_param.isProvided()) return; + + if (!name_stack.empty()) + { + name_stack.back().second = parser.newParseGeneration(); + } + + // then try to serialize value directly + if (!typed_diff_param || !typed_diff_param->isProvided()) + { + if (!parser.writeValue(NoParamValue(), name_stack)) + { + return; + } + } + } + + static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) + { + // tell parser about our actual type + parser.inspectValue(name_stack, min_count, max_count, NULL); + } + }; + }; + // these templates allow us to distinguish between template parameters // that derive from BaseBlock and those that don't template @@ -1424,7 +1508,7 @@ namespace LLInitParam } }; - template + template class Block : public BASE_BLOCK { @@ -1520,6 +1604,13 @@ namespace LLInitParam }; + class Flag : public FlagBase + { + public: + Flag(const char* name) : FlagBase(name, DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr) + {} + }; + template > class Multiple : public TypedParam { diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 72a7bb7af5..4af077b22c 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -440,12 +440,11 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) && nodep->mAttributes.empty() && nodep->getSanitizedValue().empty()) { - // empty node, just parse as NoValue + // empty node, just parse as flag mCurReadNode = DUMMY_NODE; return block.submitValue(mNameStack, *this, silent); } - // submit attributes for current node values_parsed |= readAttributes(nodep, block); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index a9ae4475b6..9d42a40e85 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2297,8 +2297,8 @@ Would you be my friend? icon="alertmodal.tga" label="Save Outfit" name="SaveOutfitAs" - type="alertmodal" - unique="true"> + type="alertmodal"> + Save what I'm wearing as a new Outfit: confirm
@@ -4611,8 +4611,8 @@ Go to your [http://secondlife.com/account/ Dashboard] to see your account histor + type="alertmodal"> + Are you sure you want to quit? confirm + type="alertmodal"> + [QUESTION] confirm + type="alert"> + + Use this tool to report violations of the [http://secondlife.com/corporate/tos.php Terms of Service] and [http://secondlife.com/corporate/cs.php Community Standards]. All reported abuses are investigated and resolved. @@ -5615,8 +5616,8 @@ Message from [NAME]: icon="notify.tga" name="NotSafe" persist="true" - type="notify" - unique="true"> + type="notify"> + This land has damage enabled. You can be hurt here. If you die, you will be teleported to your home location. @@ -5625,9 +5626,9 @@ You can be hurt here. If you die, you will be teleported to your home location. icon="notify.tga" name="NoFly" persist="true" - type="notify" - unique="true"> - fail + type="notify"> + + fail This area has flying disabled. You can't fly here. @@ -5636,8 +5637,8 @@ You can't fly here. icon="notify.tga" name="PushRestricted" persist="true" - type="notify" - unique="true"> + type="notify"> + This area does not allow pushing. You can't push others here unless you own the land. @@ -5645,8 +5646,8 @@ This area does not allow pushing. You can't push others here unless you own icon="notify.tga" name="NoVoice" persist="true" - type="notify" - unique="true"> + type="notify"> + This area has voice chat disabled. You won't be able to hear anyone talking. voice @@ -5655,8 +5656,8 @@ This area has voice chat disabled. You won't be able to hear anyone talking icon="notify.tga" name="NoBuild" persist="true" - type="notify" - unique="true"> + type="notify"> + This area has building disabled. You can't build or rez objects here. @@ -5664,8 +5665,8 @@ This area has building disabled. You can't build or rez objects here. icon="notify.tga" name="SeeAvatars" persist="true" - type="notify" - unique="true"> + type="notify"> + This parcel hides avatars and text chat from another parcel. You can't see other residents outside the parcel, and those outside are not able to see you. Regular text chat on channel 0 is also blocked. @@ -6535,8 +6536,8 @@ The voice call you are trying to join, [VOICE_CHANNEL_NAME], has reached maximum + type="notifytip"> + We're sorry. This area has reached maximum capacity for voice conversations. Please try to use voice in another area. fail voice @@ -6604,8 +6605,8 @@ Failed to connect to [VOICE_CHANNEL_NAME], please try again later. You will now duration="10" icon="notifytip.tga" name="VoiceLoginRetry" - type="notifytip" - unique="true"> + type="notifytip"> + We are creating a voice channel for you. This may take up to one minute. status voice @@ -6616,8 +6617,8 @@ We are creating a voice channel for you. This may take up to one minute. name="VoiceEffectsExpired" sound="UISndAlert" persist="true" - type="notify" - unique="true"> + type="notify"> + One or more of your subscribed Voice Morphs has expired. [[URL] Click here] to renew your subscription. fail @@ -6629,8 +6630,8 @@ One or more of your subscribed Voice Morphs has expired. name="VoiceEffectsExpiredInUse" sound="UISndAlert" persist="true" - type="notify" - unique="true"> + type="notify"> + The active Voice Morph has expired, your normal voice settings have been applied. [[URL] Click here] to renew your subscription. fail @@ -6642,8 +6643,8 @@ The active Voice Morph has expired, your normal voice settings have been applied name="VoiceEffectsWillExpire" sound="UISndAlert" persist="true" - type="notify" - unique="true"> + type="notify"> + One or more of your Voice Morphs will expire in less than [INTERVAL] days. [[URL] Click here] to renew your subscription. fail @@ -6655,8 +6656,8 @@ One or more of your Voice Morphs will expire in less than [INTERVAL] days. name="VoiceEffectsNew" sound="UISndAlert" persist="true" - type="notify" - unique="true"> + type="notify"> + New Voice Morphs are available! voice @@ -7057,8 +7058,9 @@ Are you sure you want to leave this call? ignoretext="Confirm before I leave call" name="okcancelignore" notext="No" - yestext="Yes" - unique="true"/> + yestext="Yes"> + + - + notext="Cancel"> + + + + type="hint"> + To join the conversation, type into the chat field below. + type="hint"> + To stand up and exit the sitting position, click the Stand button. + type="hint"> + Click the Speak button to turn your microphone on and off. Click on the up arrow to see the voice control panel. @@ -7112,32 +7114,32 @@ Hiding the Speak button will disable the voice feature. + type="hint"> + The Destination Guide contains thousands of new places to discover. Select a location and choose Teleport to start exploring. + type="hint"> + Get quick access to your inventory, outfits, profiles and more in the side panel. + type="hint"> + To walk or run, open the Move Panel and use the directional arrows to navigate. You can also use the directional keys on your keyboard. + type="hint"> + 1. Click to Walk Click anywhere on the ground to walk to that spot. @@ -7149,8 +7151,8 @@ Click and drag anywhere on the world to rotate your view + type="hint"> + Set your customizable display name here. This is in addition to your unique username, which can't be changed. You can change how you see other people's names in your preferences. @@ -7158,8 +7160,8 @@ Click and drag anywhere on the world to rotate your view + type="hint"> + To change your camera view, use the Orbit and Pan controls. Reset your view by pressing Escape or walking. custom_skin @@ -7167,16 +7169,16 @@ Click and drag anywhere on the world to rotate your view + type="hint"> + Check your inventory to find items. Newest items can be easily found in the Recent tab. + type="hint"> + Here's your current balance of L$. Click Buy L$ to purchase more Linden Dollars. funds @@ -7365,8 +7367,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + Changing modes requires you to quit and restart. confirm + type="alertmodal"> + fail confirm Creation and editing of Classifieds is only available in Advanced mode. Would you like to quit and change modes? The mode selector can be found on the login screen. @@ -7392,8 +7394,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm Creation and editing of Groups is only available in Advanced mode. Would you like to quit and change modes? The mode selector can be found on the login screen. @@ -7406,8 +7408,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm Viewing place profile is only available in Advanced mode. Would you like to quit and change modes? The mode selector can be found on the login screen. @@ -7420,8 +7422,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm Creation and editing of Picks is only available in Advanced mode. Would you like to quit and change modes? The mode selector can be found on the login screen. @@ -7434,8 +7436,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm Viewing of the world map is only available in Advanced mode. Would you like to quit and change modes? The mode selector can be found on the login screen. @@ -7448,8 +7450,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm Voice calls are only available in Advanced mode. Would you like to logout and change modes? @@ -7462,8 +7464,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm Sharing is only available in Advanced mode. Would you like to logout and change modes? @@ -7476,8 +7478,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm Paying other residents is only available in Advanced mode. Would you like to logout and change modes? @@ -7490,8 +7492,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm Viewing inventory is only available in Advanced mode. Would you like to logout and change modes? @@ -7504,8 +7506,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm The appearance editor is only available in Advanced mode. Would you like to logout and change modes? @@ -7518,8 +7520,8 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' + type="alertmodal"> + fail confirm Search is only available in Advanced mode. Would you like to logout and change modes? -- cgit v1.3 From 64f30a302dfbcaf56502676fa4b8d8a06f355b40 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 20 Sep 2011 16:37:21 -0700 Subject: EXP-1228 FIX Create toolbar widget class that displays list of buttons horizontally or vertically buttons are now centered and sized according to content created floater_test_toolbar.xml to test --- indra/llui/llbutton.cpp | 4 +- indra/llui/llbutton.h | 21 ++-- indra/llui/lllayoutstack.cpp | 14 ++- indra/llui/lllayoutstack.h | 26 +++-- indra/llui/lltoolbar.cpp | 121 +++++++++++++++++---- indra/llui/lltoolbar.h | 26 ++++- .../skins/default/xui/en/floater_test_toolbar.xml | 42 +++++++ 7 files changed, 204 insertions(+), 50 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_test_toolbar.xml (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 2459429f6e..6c08ec7431 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -314,7 +314,7 @@ boost::signals2::connection LLButton::setHeldDownCallback( const commit_signal_t } -// *TODO: Deprecate (for backwards compatability only) +// *TODO: Deprecate (for backwards compatibility only) boost::signals2::connection LLButton::setClickedCallback( button_callback_t cb, void* data ) { return setClickedCallback(boost::bind(cb, data)); @@ -919,7 +919,7 @@ void LLButton::setToggleState(BOOL b) void LLButton::setFlashing( BOOL b ) { - if (b != mFlashing) + if ((bool)b != mFlashing) { mFlashing = b; mFlashingTimer.reset(); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 5968916006..bc5e69fad5 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -327,15 +327,14 @@ private: LLUIColor mImageColor; LLUIColor mDisabledImageColor; - BOOL mIsToggle; - BOOL mScaleImage; + bool mIsToggle; + bool mScaleImage; - BOOL mDropShadowedText; - BOOL mAutoResize; - BOOL mUseEllipses; - BOOL mBorderEnabled; - - BOOL mFlashing; + bool mDropShadowedText; + bool mAutoResize; + bool mUseEllipses; + bool mBorderEnabled; + bool mFlashing; LLFontGL::HAlign mHAlign; S32 mLeftHPad; @@ -355,9 +354,9 @@ private: F32 mHoverGlowStrength; F32 mCurGlowStrength; - BOOL mNeedsHighlight; - BOOL mCommitOnReturn; - BOOL mFadeWhenDisabled; + bool mNeedsHighlight; + bool mCommitOnReturn; + bool mFadeWhenDisabled; bool mForcePressedState; LLFrameTimer mFlashingTimer; diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index a250404292..0d1f608e61 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -55,6 +55,7 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mMaxDim(p.max_dim), mAutoResize(p.auto_resize), mUserResize(p.user_resize), + mFitContent(p.fit_content), mCollapsed(FALSE), mCollapseAmt(0.f), mVisibleAmt(1.f), // default to fully visible @@ -104,6 +105,14 @@ F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientati } } +void LLLayoutPanel::fitToContent() +{ + if (mFitContent) + { + setShape(calcBoundingRect()); + } +} + // // LLLayoutStack // @@ -324,6 +333,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize) for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { LLLayoutPanel* panelp = (*panel_it); + panelp->fitToContent(); if (panelp->getVisible()) { if (mAnimate) @@ -478,7 +488,9 @@ void LLLayoutStack::updateLayout(BOOL force_resize) { // shrink proportionally to amount over minimum // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_width - relevant_min) / (F32)shrink_headroom_available)) : 0; + delta_size = (shrink_headroom_available > 0) + ? llround((F32)pixels_to_distribute * ((F32)(cur_width - relevant_min) / (F32)shrink_headroom_available)) + : 0; shrink_headroom_available -= (cur_width - relevant_min); } else diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index d8ef0aeaca..2ed32a2fa9 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -161,14 +161,16 @@ public: min_dim, max_dim; Optional user_resize, - auto_resize; + auto_resize, + fit_content; Params() : expanded_min_dim("expanded_min_dim", 0), min_dim("min_dim", 0), max_dim("max_dim", 0), user_resize("user_resize", true), - auto_resize("auto_resize", true) + auto_resize("auto_resize", true), + fit_content("fit_content", false) { addSynonym(min_dim, "min_width"); addSynonym(min_dim, "min_height"); @@ -206,18 +208,20 @@ protected: LLLayoutPanel(const Params& p); F32 getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation); + void fitToContent(); - bool mExpandedMinDimSpecified; - S32 mExpandedMinDim; + bool mExpandedMinDimSpecified; + S32 mExpandedMinDim; - S32 mMinDim; - S32 mMaxDim; - BOOL mAutoResize; - BOOL mUserResize; - BOOL mCollapsed; + S32 mMinDim; + S32 mMaxDim; + bool mAutoResize; + bool mUserResize; + bool mCollapsed; + bool mFitContent; + F32 mVisibleAmt; + F32 mCollapseAmt; class LLResizeBar* mResizeBar; - F32 mVisibleAmt; - F32 mCollapseAmt; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 0356fd5c8a..cdd3a50205 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -41,37 +41,118 @@ LLToolBar::LLToolBar(const Params& p) : LLUICtrl(p), mOrientation(p.orientation), mStack(NULL) +{} + +void LLToolBar::initFromParams(const LLToolBar::Params& p) { + LLLayoutStack::Params centering_stack_p; + centering_stack_p.rect = getLocalRect(); + centering_stack_p.follows.flags = FOLLOWS_ALL; + centering_stack_p.orientation = p.orientation; + centering_stack_p.name = "centering_stack"; -} + LLLayoutPanel::Params border_panel_p; + border_panel_p.name = "border_panel"; + border_panel_p.rect = getLocalRect(); + border_panel_p.auto_resize = true; + border_panel_p.user_resize = false; -void LLToolBar::draw() -{ - gl_rect_2d(getLocalRect(), LLColor4::blue, TRUE); -} + LLLayoutStack* centering_stack = LLUICtrlFactory::create(centering_stack_p); + addChild(centering_stack); + + LLLayoutPanel::Params center_panel_p; + center_panel_p.name = "center_panel"; + center_panel_p.rect = getLocalRect(); + center_panel_p.auto_resize = false; + center_panel_p.user_resize = false; + center_panel_p.fit_content = true; + + centering_stack->addChild(LLUICtrlFactory::create(border_panel_p)); + LLLayoutPanel* center_panel = LLUICtrlFactory::create(center_panel_p); + centering_stack->addChild(center_panel); + centering_stack->addChild(LLUICtrlFactory::create(border_panel_p)); -void LLToolBar::initFromParams(const LLToolBar::Params& p) -{ LLLayoutStack::Params stack_p; stack_p.rect = getLocalRect(); - stack_p.follows.flags = FOLLOWS_ALL; stack_p.name = "button_stack"; stack_p.orientation = p.orientation; + stack_p.follows.flags = (mOrientation == LLLayoutStack::HORIZONTAL) + ? (FOLLOWS_TOP|FOLLOWS_BOTTOM) // horizontal + : (FOLLOWS_LEFT|FOLLOWS_RIGHT); // vertical mStack = LLUICtrlFactory::create(stack_p); - addChild(mStack); + center_panel->addChild(mStack); - BOOST_FOREACH (LLButton::Params button_p, p.buttons) + BOOST_FOREACH (LLToolBarButton::Params button_p, p.buttons) { - LLLayoutPanel::Params panel_p; - panel_p.name = button_p.name() + "_panel"; - panel_p.rect = button_p.rect; - panel_p.user_resize = false; - panel_p.auto_resize= false; - - LLLayoutPanel* panel = LLUICtrlFactory::create(panel_p); - LLButton* button = LLUICtrlFactory::create(button_p); - panel->addChild(button); - mStack->addChild(panel); + // remove any offset from button + LLRect button_rect(button_p.rect); + + if (mOrientation == LLLayoutStack::HORIZONTAL) + { + button_rect.setOriginAndSize(0, 0, 0, getRect().getHeight()); + } + else // VERTICAL + { + button_rect.setOriginAndSize(0, 0, 0, button_rect.getHeight()); + } + button_p.follows.flags = FOLLOWS_NONE; + button_p.rect = button_rect; + button_p.chrome = true; + button_p.auto_resize = true; + + LLToolBarButton* button = LLUICtrlFactory::create(button_p); + + addButton(button); } + + updateLayout(); +} + +void LLToolBar::addButton(LLToolBarButton* buttonp) +{ + LLLayoutPanel::Params panel_p; + panel_p.name = buttonp->getName() + "_panel"; + panel_p.user_resize = false; + panel_p.auto_resize= false; + panel_p.fit_content = true; + + LLLayoutPanel* panel = LLUICtrlFactory::create(panel_p); + + panel->addChild(buttonp); + mStack->addChild(panel); + mButtons.push_back(buttonp); } + +void LLToolBar::updateLayout() +{ + S32 total_width = 0; + S32 total_height = 0; + S32 max_width = getRect().getWidth(); + S32 max_height = getRect().getHeight(); + + BOOST_FOREACH(LLToolBarButton* button, mButtons) + { + total_width += button->getRect().getWidth(); + total_height += button->getRect().getHeight(); + max_width = llmax(button->getRect().getWidth(), max_width); + max_height = llmax(button->getRect().getHeight(), max_height); + } + + if (mOrientation == LLLayoutStack::HORIZONTAL) + { + mStack->reshape(total_width, mStack->getParent()->getRect().getHeight()); + } + else + { + mStack->reshape(mStack->getParent()->getRect().getWidth(), total_height); + reshape(max_width, getRect().getHeight()); + } +} + + +void LLToolBar::draw() +{ + LLUICtrl::draw(); +} + diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index dd454e3f0b..fb03095c56 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -32,28 +32,44 @@ #include "lllayoutstack.h" #include "llbutton.h" +class LLToolBarButton : public LLButton +{ +public: + struct Params : public LLInitParam::Block + { + }; + + LLToolBarButton(const Params& p) : LLButton(p) {} + +}; + class LLToolBar : public LLUICtrl { public: + struct Params : public LLInitParam::Block { - Mandatory orientation; - Multiple buttons; + Mandatory orientation; + Multiple buttons; Params(); }; - void draw(); + /*virtual*/ void draw(); protected: friend class LLUICtrlFactory; LLToolBar(const Params&); void initFromParams(const Params&); + void addButton(LLToolBarButton* buttonp); + void updateLayout(); private: - LLLayoutStack::ELayoutOrientation mOrientation; - LLLayoutStack* mStack; + LLLayoutStack::ELayoutOrientation mOrientation; + LLLayoutStack* mStack; + std::list mButtons; }; diff --git a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml new file mode 100644 index 0000000000..55cfd462ac --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml @@ -0,0 +1,42 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index 4c4ff3e5c4..bb58dd500f 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -13,7 +13,7 @@ tear_off="true" name="File"> - + + + --> -