diff options
author | Richard Nelson <richard@lindenlab.com> | 2011-09-30 16:57:08 -0700 |
---|---|---|
committer | Richard Nelson <richard@lindenlab.com> | 2011-09-30 16:57:08 -0700 |
commit | 09e179b2381a4db03309839babae664feb9b0886 (patch) | |
tree | 415517eb2195cc2e9d624273fd65836045420a8d /indra/llui | |
parent | 788c5cdf978e6844663c1d3734fc5d604de5e7cb (diff) |
param block cleanup
added Flag as value type
moved Batch to BatchBlock
renamed Choice to ChoiceBlock
made merging of parameters for ValueParams consistent (fillFrom and overwriteFrom are inverses of each other now)
made iteration over Multiple<T> type params easier
initial schema param blocks
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/lllineeditor.h | 2 | ||||
-rw-r--r-- | indra/llui/llloadingindicator.cpp | 7 | ||||
-rw-r--r-- | indra/llui/llloadingindicator.h | 4 | ||||
-rw-r--r-- | indra/llui/llnotifications.h | 4 | ||||
-rw-r--r-- | indra/llui/llnotificationtemplate.h | 4 | ||||
-rw-r--r-- | indra/llui/llnotificationvisibilityrule.h | 2 | ||||
-rw-r--r-- | indra/llui/llscrolllistcolumn.h | 4 | ||||
-rw-r--r-- | indra/llui/llsdparam.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llsdparam.h | 4 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 2 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lltoolbarview.h | 4 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llui.h | 2 | ||||
-rw-r--r-- | indra/llui/lluicolortable.h | 2 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 4 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.h | 6 | ||||
-rw-r--r-- | indra/llui/llview.h | 2 |
18 files changed, 33 insertions, 36 deletions
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 583bde360a..2518dbe3c7 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -60,7 +60,7 @@ public: typedef boost::function<void (LLLineEditor* caller)> keystroke_callback_t; - struct MaxLength : public LLInitParam::Choice<MaxLength> + struct MaxLength : public LLInitParam::ChoiceBlock<MaxLength> { Alternative<S32> bytes, chars; diff --git a/indra/llui/llloadingindicator.cpp b/indra/llui/llloadingindicator.cpp index c4eec1835c..6ac38f5ad4 100644 --- a/indra/llui/llloadingindicator.cpp +++ b/indra/llui/llloadingindicator.cpp @@ -34,6 +34,7 @@ // Project includes #include "lluictrlfactory.h" #include "lluiimage.h" +#include "boost/foreach.hpp" // registered in llui.cpp to avoid being left out by MS linker //static LLDefaultChildRegistry::Register<LLLoadingIndicator> r("loading_indicator"); @@ -51,11 +52,9 @@ LLLoadingIndicator::LLLoadingIndicator(const Params& p) void LLLoadingIndicator::initFromParams(const Params& p) { - for (LLInitParam::ParamIterator<LLUIImage*>::const_iterator it = p.images().image.begin(), end_it = p.images().image.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLUIImage* image, p.images.image) { - mImages.push_back(it->getValue()); + mImages.push_back(image); } // Start timer for switching images. diff --git a/indra/llui/llloadingindicator.h b/indra/llui/llloadingindicator.h index 7c44478848..c1f979c111 100644 --- a/indra/llui/llloadingindicator.h +++ b/indra/llui/llloadingindicator.h @@ -51,7 +51,7 @@ class LLLoadingIndicator LOG_CLASS(LLLoadingIndicator); public: - struct Images : public LLInitParam::Block<Images> + struct Images : public LLInitParam::BatchBlock<Images> { Multiple<LLUIImage*> image; @@ -63,7 +63,7 @@ public: struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { Optional<F32> images_per_sec; - Batch<Images> images; + Optional<Images> images; Params() : images_per_sec("images_per_sec", 1.0f), diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 0c4d4fc897..462d69be2e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -201,7 +201,7 @@ public: FormInput(); }; - struct FormElement : public LLInitParam::Choice<FormElement> + struct FormElement : public LLInitParam::ChoiceBlock<FormElement> { Alternative<FormButton> button; Alternative<FormInput> input; @@ -312,7 +312,7 @@ public: Optional<LLNotificationContext*> context; Optional<void*> responder; - struct Functor : public LLInitParam::Choice<Functor> + struct Functor : public LLInitParam::ChoiceBlock<Functor> { Alternative<std::string> name; Alternative<LLNotificationFunctorRegistry::ResponseFunctor> function; diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index ab777d37a5..fb50c9c123 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -91,7 +91,7 @@ struct LLNotificationTemplate // <notification> <unique/> </notification> // as well as // <notification> <unique> <context></context> </unique>... - Flag dummy_val; + Optional<LLInitParam::Flag> dummy_val; public: Multiple<UniquenessContext> contexts; @@ -147,7 +147,7 @@ struct LLNotificationTemplate {} }; - struct FormRef : public LLInitParam::Choice<FormRef> + struct FormRef : public LLInitParam::ChoiceBlock<FormRef> { Alternative<LLNotificationForm::Params> form; Alternative<TemplateRef> form_template; diff --git a/indra/llui/llnotificationvisibilityrule.h b/indra/llui/llnotificationvisibilityrule.h index 78bdec2a8f..78788a275c 100644 --- a/indra/llui/llnotificationvisibilityrule.h +++ b/indra/llui/llnotificationvisibilityrule.h @@ -59,7 +59,7 @@ struct LLNotificationVisibilityRule {} }; - struct Rule : public LLInitParam::Choice<Rule> + struct Rule : public LLInitParam::ChoiceBlock<Rule> { Alternative<Filter> show; Alternative<Filter> hide; diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h index 12baea8e0c..b4d4a6d05e 100644 --- a/indra/llui/llscrolllistcolumn.h +++ b/indra/llui/llscrolllistcolumn.h @@ -95,7 +95,7 @@ public: Optional<ESortDirection, SortNames> sort_direction; Optional<bool> sort_ascending; - struct Width : public LLInitParam::Choice<Width> + struct Width : public LLInitParam::ChoiceBlock<Width> { Alternative<bool> dynamic_width; Alternative<S32> pixel_width; @@ -112,7 +112,7 @@ public: Optional<Width> width; // either an image or label is used in column header - struct Header : public LLInitParam::Choice<Header> + struct Header : public LLInitParam::ChoiceBlock<Header> { Alternative<std::string> label; Alternative<LLUIImage*> image; diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 04919e6991..4b69360e33 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -45,7 +45,7 @@ LLParamSDParser::LLParamSDParser() if (sReadFuncs.empty()) { - registerParserFuncs<LLInitParam::NoParamValue>(readNoValue, &LLParamSDParser::writeNoValue); + registerParserFuncs<LLInitParam::Flag>(readFlag, &LLParamSDParser::writeFlag); registerParserFuncs<S32>(readS32, &LLParamSDParser::writeTypedValue<S32>); registerParserFuncs<U32>(readU32, &LLParamSDParser::writeU32Param); registerParserFuncs<F32>(readF32, &LLParamSDParser::writeTypedValue<F32>); @@ -72,7 +72,7 @@ bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const voi return true; } -bool LLParamSDParser::writeNoValue(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) +bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) { LLParamSDParser& sdparser = static_cast<LLParamSDParser&>(parser); if (!sdparser.mWriteRootSD) return false; @@ -226,7 +226,7 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) return sd_to_write; } -bool LLParamSDParser::readNoValue(Parser& parser, void* val_ptr) +bool LLParamSDParser::readFlag(Parser& parser, void* val_ptr) { LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); return self.mCurReadSD == &NO_VALUE_MARKER; diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index f776c781b3..a371c28f68 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -63,9 +63,9 @@ private: LLSD* getSDWriteNode(const parser_t::name_stack_t& name_stack); static bool writeU32Param(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); - static bool writeNoValue(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); + static bool writeFlag(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); - static bool readNoValue(Parser& parser, void* val_ptr); + static bool readFlag(Parser& parser, void* val_ptr); static bool readS32(Parser& parser, void* val_ptr); static bool readU32(Parser& parser, void* val_ptr); static bool readF32(Parser& parser, void* val_ptr); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 7d545a1ba6..384d9116fc 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -237,7 +237,7 @@ public: friend class LLNormalTextSegment; friend class LLUICtrlFactory; - struct LineSpacingParams : public LLInitParam::Choice<LineSpacingParams> + struct LineSpacingParams : public LLInitParam::ChoiceBlock<LineSpacingParams> { Alternative<F32> multiple; Alternative<S32> pixels; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index caad896a06..d940bed905 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -185,7 +185,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) LLPanel::Params button_panel_p(p.button_panel); button_panel_p.rect = center_panel->getLocalRect(); - button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; + button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; mButtonPanel = LLUICtrlFactory::create<LLPanel>(button_panel_p); center_panel->addChild(mButtonPanel); @@ -558,8 +558,8 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) LLToolBar* bar = getParentByType<LLToolBar>(); if (view) { - view->startDrag(bar->createButton(mId)); - setVisible(FALSE); + //view->startDrag(bar->createButton(mId)); + //setVisible(FALSE); } } } diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index ea3422f04e..dd2bbf0e49 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -65,10 +65,6 @@ public: virtual ~LLToolBarView(); virtual BOOL postBuild(); virtual void draw(); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual void onMouseCaptureLost(); - void startDrag(LLToolBarButton*); // Toolbar view interface with the rest of the world // Checks if the commandId is being used somewhere in one of the toolbars bool hasCommand(const LLCommandId& commandId) const; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 4f129ccfba..76a12e649b 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -2107,7 +2107,7 @@ namespace LLInitParam void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateValueFromBlock() { - if (control.isProvided()) + if (control.isProvided() && !control().empty()) { updateValue(LLUIColorTable::instance().getColor(control)); } @@ -2264,9 +2264,11 @@ namespace LLInitParam // in this case, that is left+width and bottom+height LLRect& value = getValue(); + right.set(value.mRight, false); left.set(value.mLeft, make_block_authoritative); width.set(value.getWidth(), make_block_authoritative); + top.set(value.mTop, false); bottom.set(value.mBottom, make_block_authoritative); height.set(value.getHeight(), make_block_authoritative); } diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 7801a01ace..3afb7c65a9 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -365,7 +365,7 @@ template <typename T> LLRegisterWith<LLInitClassList> LLInitClass<T>::sRegister( template <typename T> LLRegisterWith<LLDestroyClassList> LLDestroyClass<T>::sRegister(&T::destroyClass); // useful parameter blocks -struct TimeIntervalParam : public LLInitParam::Choice<TimeIntervalParam> +struct TimeIntervalParam : public LLInitParam::ChoiceBlock<TimeIntervalParam> { Alternative<F32> seconds; Alternative<S32> frames; diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index 76518789ec..6a7a681d57 100644 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h @@ -44,7 +44,7 @@ LOG_CLASS(LLUIColorTable); typedef std::map<std::string, LLUIColor> string_color_map_t; public: - struct ColorParams : LLInitParam::Choice<ColorParams> + struct ColorParams : LLInitParam::ChoiceBlock<ColorParams> { Alternative<LLColor4> value; Alternative<std::string> reference; diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index fc56e5fc35..a8a4e3191d 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -76,14 +76,14 @@ public: Optional<enable_callback_t> function; }; - struct EnableControls : public LLInitParam::Choice<EnableControls> + struct EnableControls : public LLInitParam::ChoiceBlock<EnableControls> { Alternative<std::string> enabled; Alternative<std::string> disabled; EnableControls(); }; - struct ControlVisibility : public LLInitParam::Choice<ControlVisibility> + struct ControlVisibility : public LLInitParam::ChoiceBlock<ControlVisibility> { Alternative<std::string> visible; Alternative<std::string> invisible; diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 71c38237c1..d612ad5005 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<int DUMMY> - class ParamDefaults<LLInitParam::BaseBlockWithFlags, DUMMY> : public LLSingleton<ParamDefaults<LLInitParam::BaseBlockWithFlags, DUMMY> > + class ParamDefaults<LLInitParam::BaseBlock, DUMMY> : public LLSingleton<ParamDefaults<LLInitParam::BaseBlock, DUMMY> > { public: - const LLInitParam::BaseBlockWithFlags& get() { return mBaseBlock; } + const LLInitParam::BaseBlock& get() { return mBaseBlock; } private: - LLInitParam::BaseBlockWithFlags mBaseBlock; + LLInitParam::BaseBlock mBaseBlock; }; public: diff --git a/indra/llui/llview.h b/indra/llui/llview.h index f4e31b109a..a1c46f3bf3 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -98,7 +98,7 @@ private: class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement { public: - struct Follows : public LLInitParam::Choice<Follows> + struct Follows : public LLInitParam::ChoiceBlock<Follows> { Alternative<std::string> string; Alternative<U32> flags; |