diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-06-21 17:16:27 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-06-21 17:16:27 +0000 |
commit | ade6bbb06c6a842f39a3fe32decf7c66682df092 (patch) | |
tree | 8fa1e4ba680f916bb4c77c70f2464f295a3bd3f3 /indra | |
parent | 9ec432034dc3c45d7ce763eb02dae4cc7f6b8da8 (diff) |
merge -r 124105-124625 skinning-13 -> viewer-2.0.0-3
Diffstat (limited to 'indra')
78 files changed, 1058 insertions, 368 deletions
diff --git a/indra/llmath/llrect.h b/indra/llmath/llrect.h index 98aceb0597..16bfdde658 100644 --- a/indra/llmath/llrect.h +++ b/indra/llmath/llrect.h @@ -64,17 +64,11 @@ public: mLeft(left), mTop(top), mRight(right), mBottom(bottom) {} - LLRectBase(const LLSD& sd) + explicit LLRectBase(const LLSD& sd) { setValue(sd); } - const LLRectBase& operator=(const LLSD& sd) - { - setValue(sd); - return *this; - } - void setValue(const LLSD& sd) { mLeft = sd[0].asInteger(); diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h index a99bf5b4a6..6ab31e8a41 100644 --- a/indra/llmath/v3dmath.h +++ b/indra/llmath/v3dmath.h @@ -53,7 +53,7 @@ class LLVector3d inline LLVector3d(const F64 x, const F64 y, const F64 z); // Initializes LLVector3d to (x. y, z) inline explicit LLVector3d(const F64 *vec); // Initializes LLVector3d to (vec[0]. vec[1], vec[2]) inline explicit LLVector3d(const LLVector3 &vec); - LLVector3d(const LLSD& sd) + explicit LLVector3d(const LLSD& sd) { setValue(sd); } @@ -65,12 +65,6 @@ class LLVector3d mdV[2] = sd[2].asReal(); } - const LLVector3d& operator=(const LLSD& sd) - { - setValue(sd); - return *this; - } - LLSD getValue() const { LLSD ret; diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp index 101e9d075a..f392ac448b 100644 --- a/indra/llmath/v3math.cpp +++ b/indra/llmath/v3math.cpp @@ -314,12 +314,6 @@ void LLVector3::setValue(const LLSD& sd) mV[2] = (F32) sd[2].asReal(); } -const LLVector3& LLVector3::operator=(const LLSD& sd) -{ - setValue(sd); - return *this; -} - const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &rot) { const F32 rw = - rot.mQ[VX] * a.mV[VX] - rot.mQ[VY] * a.mV[VY] - rot.mQ[VZ] * a.mV[VZ]; diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index 7f96800e21..805d7e6384 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -67,14 +67,12 @@ class LLVector3 explicit LLVector3(const LLVector2 &vec); // Initializes LLVector3 to (vec[0]. vec[1], 0) explicit LLVector3(const LLVector3d &vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2]) explicit LLVector3(const LLVector4 &vec); // Initializes LLVector4 to (vec[0]. vec[1], vec[2]) - LLVector3(const LLSD& sd); + explicit LLVector3(const LLSD& sd); LLSD getValue() const; void setValue(const LLSD& sd); - const LLVector3& operator=(const LLSD& sd); - inline BOOL isFinite() const; // checks to see if all values of LLVector3 are finite BOOL clamp(F32 min, F32 max); // Clamps all values to (min,max), returns TRUE if data changed BOOL clampLength( F32 length_limit ); // Scales vector to limit length to a value diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index 7414c38847..d6fbdec61e 100644 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -58,7 +58,7 @@ class LLColor4 LLColor4(U32 clr); // Initializes LLColor4 to (r=clr>>24, etc)) LLColor4(const F32 *vec); // Initializes LLColor4 to (vec[0]. vec[1], vec[2], 1) LLColor4(const LLColor3 &vec, F32 a = 1.f); // Initializes LLColor4 to (vec, a) - LLColor4(const LLSD& sd); + explicit LLColor4(const LLSD& sd); explicit LLColor4(const LLColor4U& color4u); // "explicit" to avoid automatic conversion explicit LLColor4(const LLVector4& vector4); // "explicit" to avoid automatic conversion @@ -113,7 +113,6 @@ class LLColor4 F32 &operator[](int idx) { return mV[idx]; } const LLColor4& operator=(const LLColor3 &a); // Assigns vec3 to vec4 and returns vec4 - const LLColor4& operator=(const LLSD& sd); friend std::ostream& operator<<(std::ostream& s, const LLColor4 &a); // Print a friend LLColor4 operator+(const LLColor4 &a, const LLColor4 &b); // Return vector a + b @@ -634,12 +633,5 @@ void LLColor4::clamp() } } -inline const LLColor4& LLColor4::operator=(const LLSD& sd) -{ - setValue(sd); - - return *this; -} - #endif diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index c0390fa0b2..4ec5a345eb 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -66,7 +66,7 @@ public: LLColor4U(U8 r, U8 g, U8 b); // Initializes LLColor4U to (r, g, b, 1) LLColor4U(U8 r, U8 g, U8 b, U8 a); // Initializes LLColor4U to (r. g, b, a) LLColor4U(const U8 *vec); // Initializes LLColor4U to (vec[0]. vec[1], vec[2], 1) - LLColor4U(const LLSD& sd) + explicit LLColor4U(const LLSD& sd) { setValue(sd); } @@ -79,12 +79,6 @@ public: mV[3] = sd[3].asInteger(); } - const LLColor4U& operator=(const LLSD& sd) - { - setValue(sd); - return *this; - } - LLSD getValue() const { LLSD ret; diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 110ad82763..4d340b3ddd 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -146,7 +146,7 @@ LLButton::LLButton(const LLButton::Params& p) mFadeWhenDisabled(FALSE) { static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0); - static LLButton::Params default_params(LLUICtrlFactory::getDefaultParams<LLButton::Params>()); + static Params default_params(LLUICtrlFactory::getDefaultParams<Params>()); //if we aren't a picture_style button set label as name if not provided if (!p.picture_style.isProvided() || !p.picture_style) diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index fe719e3b6a..2f8f088a3e 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -65,7 +65,7 @@ public: Optional<LLTextBox::Params> label_text; Optional<LLButton::Params> check_button; - Deprecated radio_style; + Ignored radio_style; Params(); }; diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 2197d5432b..51ab3326fe 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -640,15 +640,17 @@ void LLComboBox::onButtonDown() { if (!mList->getVisible()) { + // this might change selection, so do it first + prearrangeList(); + + // highlight the last selected item from the original selection before potentially selecting a new item + // as visual cue to original value of combo box LLScrollListItem* last_selected_item = mList->getLastSelectedItem(); if (last_selected_item) { - // highlight the original selection before potentially selecting a new item mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item)); } - prearrangeList(); - if (mList->getItemCount() != 0) { showList(); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a14b99eeb7..8932a7ccf2 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -188,6 +188,13 @@ bool LLFloater::KeyCompare::equate(const LLSD& a, const LLSD& b) //************************************ +//static +const LLFloater::Params& LLFloater::getDefaultParams() +{ + return LLUICtrlFactory::getDefaultParams<LLFloater::Params>(); +} + + LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) : LLPanel(), mDragHandle(NULL), diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 421b7f3ec1..3e80f1b284 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -141,7 +141,10 @@ public: } }; - LLFloater(const LLSD& key = LLSD(), const LLFloater::Params& params = LLFloater::Params()); + // use this to avoid creating your own default LLFloater::Param instance + static const Params& getDefaultParams(); + + LLFloater(const LLSD& key = LLSD(), const Params& params = getDefaultParams()); virtual ~LLFloater(); diff --git a/indra/llui/llflyoutbutton.cpp b/indra/llui/llflyoutbutton.cpp index 62a321dc02..8846f2a8c4 100644 --- a/indra/llui/llflyoutbutton.cpp +++ b/indra/llui/llflyoutbutton.cpp @@ -35,7 +35,7 @@ // file includes #include "llflyoutbutton.h" -static LLDefaultWidgetRegistry::Register<LLFlyoutButton> r2("flyout_button"); +//static LLDefaultWidgetRegistry::Register<LLFlyoutButton> r2("flyout_button"); const S32 FLYOUT_BUTTON_ARROW_WIDTH = 24; diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index ad0f6f563f..a6cab0e9ee 100644 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -55,7 +55,7 @@ public: { Optional<LLUIImage*> image; Optional<LLUIColor> color; - Deprecated scale_image; + Ignored scale_image; Params(); }; protected: diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 78df791334..eb021bace9 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -103,7 +103,7 @@ public: Optional<S32> text_pad_left, text_pad_right; - Deprecated is_unicode, + Ignored is_unicode, drop_shadow_visible, border_drop_shadow_visible, bg_visible; diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 7d889c291c..0d7d1ae746 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -63,7 +63,7 @@ public: Optional<KEY> jump_key; Optional<bool> use_mac_ctrl; - Deprecated rect, + Ignored rect, left, top, right, diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index ea8a9841e3..7f4c1c040a 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -44,7 +44,7 @@ class LLMultiFloater : public LLFloater { public: - LLMultiFloater(const LLFloater::Params& params = LLFloater::Params()); + LLMultiFloater(const LLFloater::Params& params = LLFloater::getDefaultParams()); virtual ~LLMultiFloater() {}; void buildTabContainer(); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 5c8d146e0c..b749724b4e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -299,8 +299,8 @@ public: struct Functor : public LLInitParam::Choice<Functor> { - Option<std::string> name; - Option<LLNotificationFunctorRegistry::ResponseFunctor> function; + Alternative<std::string> name; + Alternative<LLNotificationFunctorRegistry::ResponseFunctor> function; Functor() : name("functor_name"), diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index ad5cdca5cc..0136a41d61 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -58,6 +58,11 @@ static LLDefaultWidgetRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML); +const LLPanel::Params& LLPanel::getDefaultParams() +{ + return LLUICtrlFactory::getDefaultParams<LLPanel::Params>(); +} + LLPanel::Params::Params() : has_border("border", false), bg_opaque_color("bg_opaque_color"), @@ -114,6 +119,14 @@ void LLPanel::addBorder(LLViewBorder::Params p) addChild( mBorder ); } +void LLPanel::addBorder() +{ + LLViewBorder::Params p; + p.border_thickness(LLPANEL_BORDER_WIDTH); + addBorder(p); +} + + void LLPanel::removeBorder() { if (mBorder) @@ -885,10 +898,11 @@ LLView* LLPanel::getChildView(const std::string& name, BOOL recurse, BOOL create } if (!view && create_if_missing) { - view = getDummyWidget<LLView>(name); + view = getDefaultWidget<LLView>(name); if (!view) { - view = LLUICtrlFactory::createDummyWidget<LLView>(name); + // create LLViews explicitly, as they are not registered widget types + view = LLUICtrlFactory::createDefaultWidget<LLView>(name); } } return view; diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index b3ccdd0f00..fc40cd77eb 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -96,10 +96,10 @@ public: protected: friend class LLUICtrlFactory; // RN: for some reason you can't just use LLUICtrlFactory::getDefaultParams as a default argument in VC8 - static const Params& defaultParams() { return LLUICtrlFactory::getDefaultParams<LLPanel::Params>(); } + static const LLPanel::Params& getDefaultParams(); // Panels can get constructed directly - LLPanel(const Params& params = defaultParams()); + LLPanel(const LLPanel::Params& params = getDefaultParams()); public: // LLPanel(const std::string& name, const LLRect& rect = LLRect(), BOOL bordered = TRUE); @@ -122,7 +122,7 @@ public: // Border controls void addBorder( LLViewBorder::Params p); - void addBorder() { LLViewBorder::Params p; p.border_thickness(LLPANEL_BORDER_WIDTH); addBorder(p); } + void addBorder(); void removeBorder(); BOOL hasBorder() const { return mBorder != NULL; } void setBorderVisible( BOOL b ); diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h index d3cb8a628e..850d896e29 100644 --- a/indra/llui/llradiogroup.h +++ b/indra/llui/llradiogroup.h @@ -48,8 +48,8 @@ class LLRadioCtrl : public LLCheckBoxCtrl public: struct Params : public LLInitParam::Block<Params, LLCheckBoxCtrl::Params> { - Deprecated length; - Deprecated type; + Ignored length; + Ignored type; Params() : length("length"), diff --git a/indra/llui/llscrolllistcolumn.cpp b/indra/llui/llscrolllistcolumn.cpp index 48fddbfb71..02f09bd9b4 100644 --- a/indra/llui/llscrolllistcolumn.cpp +++ b/indra/llui/llscrolllistcolumn.cpp @@ -285,6 +285,16 @@ void LLScrollListColumn::SortNames::declareValues() declare("descending", LLScrollListColumn::DESCENDING); } +// +// LLScrollListColumn +// +//static +const LLScrollListColumn::Params& LLScrollListColumn::getDefaultParams() +{ + return LLUICtrlFactory::getDefaultParams<LLScrollListColumn::Params>(); +} + + LLScrollListColumn::LLScrollListColumn(const Params& p, LLScrollListCtrl* parent) : mWidth(0), mIndex (-1), diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h index c1bb86577f..712ea56454 100644 --- a/indra/llui/llscrolllistcolumn.h +++ b/indra/llui/llscrolllistcolumn.h @@ -116,9 +116,9 @@ public: struct Width : public LLInitParam::Choice<Width> { - Option<bool> dynamic_width; - Option<S32> pixel_width; - Option<F32> relative_width; + Alternative<bool> dynamic_width; + Alternative<S32> pixel_width; + Alternative<F32> relative_width; Width() : dynamic_width("dynamicwidth", false), @@ -133,8 +133,8 @@ public: // either an image or label is used in column header struct Header : public LLInitParam::Choice<Header> { - Option<std::string> label; - Option<LLUIImage*> image; + Alternative<std::string> label; + Alternative<LLUIImage*> image; Header() : label("label"), @@ -160,8 +160,10 @@ public: } }; + static const Params& getDefaultParams(); + //NOTE: this is default constructible so we can store it in a map. - LLScrollListColumn(const Params& p = Params(), LLScrollListCtrl* = NULL); + LLScrollListColumn(const Params& p = getDefaultParams(), LLScrollListCtrl* = NULL); void setWidth(S32 width); S32 getWidth() const { return mWidth; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 42c7c892c8..6d91c784f7 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1246,14 +1246,14 @@ const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which // has an associated, unique UUID, and only one of which can be selected at a time. -LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos, BOOL enabled, S32 column_width) +LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos, BOOL enabled) { if (getItemCount() < mMaxItemCount) { LLScrollListItem::Params item_p; item_p.enabled(enabled); item_p.value(id); - item_p.cells.add().value(item_text).width(column_width).type("text"); + item_p.cells.add().value(item_text).type("text"); return addRow( item_p, pos ); } diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 461df6760f..8d200fb73f 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -222,7 +222,7 @@ public: // DEPRECATED: Use LLSD versions of setCommentText() and getSelectedValue(). // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which // has an associated, unique UUID, and only one of which can be selected at a time. - LLScrollListItem* addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, S32 column_width = 0); + LLScrollListItem* addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); LLUUID getStringUUIDSelectedItem() const; LLScrollListItem* getFirstSelected() const; diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h index 8d87137c3a..4237d5b304 100644 --- a/indra/llui/llscrolllistitem.h +++ b/indra/llui/llscrolllistitem.h @@ -64,9 +64,9 @@ public: Optional<void*> userdata; Optional<LLSD> value; - Deprecated name; // use for localization tools - Deprecated type; - Deprecated length; + Ignored name; // use for localization tools + Ignored type; + Ignored length; Multiple<LLScrollListCell::Params> cells; diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 3171f96fcf..9522d32a8b 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -36,7 +36,7 @@ #include "llsearcheditor.h" -static LLDefaultWidgetRegistry::Register<LLSearchEditor> r2("search_editor"); +//static LLDefaultWidgetRegistry::Register<LLSearchEditor> r2("search_editor"); LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) : LLUICtrl(p) diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index aae538a221..dca906decc 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -60,7 +60,7 @@ public: Optional<LLFontGL::ShadowType> font_shadow; - Deprecated drop_shadow_visible, + Ignored drop_shadow_visible, type, length; diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index efedb30f47..f64353555e 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -82,7 +82,7 @@ public: Optional<LLViewBorder::Params> border; - Deprecated type, + Ignored type, length, is_unicode; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 3c9759695d..1d3e5d7a15 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -58,6 +58,10 @@ #include "llmenugl.h" #include "llwindow.h" +// for registration +#include "llsearcheditor.h" +#include "llflyoutbutton.h" + // for XUIParse #include "llquaternion.h" #include <boost/tokenizer.hpp> @@ -85,6 +89,10 @@ std::list<std::string> gUntranslated; /*static*/ std::vector<std::string> LLUI::sXUIPaths; +// register searcheditor here +static LLDefaultWidgetRegistry::Register<LLSearchEditor> register_search_editor("search_editor"); +static LLDefaultWidgetRegistry::Register<LLFlyoutButton> register_flyout_button("flyout_button"); + // // Functions diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 35c0bb478e..dbd295d4e8 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -665,8 +665,8 @@ template <typename T> LLRegisterWith<LLDestroyClassList> LLDestroyClass<T>::sReg // useful parameter blocks struct TimeIntervalParam : public LLInitParam::Choice<TimeIntervalParam> { - Option<F32> seconds; - Option<S32> frames; + Alternative<F32> seconds; + Alternative<S32> frames; TimeIntervalParam() : seconds("seconds"), frames("frames") diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index 8900875813..dcbb1ee5cb 100644 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h @@ -22,8 +22,8 @@ class LLUIColorTable : public LLSingleton<LLUIColorTable> public: struct ColorParams : LLInitParam::Choice<ColorParams> { - Option<LLColor4> value; - Option<std::string> reference; + Alternative<LLColor4> value; + Alternative<std::string> reference; ColorParams(); }; diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 80ef7ebdf1..8aba122e39 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -111,6 +111,13 @@ void LLFocusableElement::setFocus(BOOL b) { } +//static +const LLUICtrl::Params& LLUICtrl::getDefaultParams() +{ + return LLUICtrlFactory::getDefaultParams<LLUICtrl::Params>(); +} + + LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel) : LLView(p), mTentative(FALSE), diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 71f0a47f45..686f1e966d 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -87,7 +87,7 @@ public: struct CallbackParam : public LLInitParam::Block<CallbackParam> { - Deprecated name; + Ignored name; Optional<std::string> function_name; Optional<LLSD> parameter; @@ -116,8 +116,8 @@ public: struct EnableControls : public LLInitParam::Choice<EnableControls> { - Option<std::string> enabled; - Option<std::string> disabled; + Alternative<std::string> enabled; + Alternative<std::string> disabled; EnableControls() : enabled("enabled_control"), @@ -126,8 +126,8 @@ public: }; struct ControlVisibility : public LLInitParam::Choice<ControlVisibility> { - Option<std::string> visible; - Option<std::string> invisible; + Alternative<std::string> visible; + Alternative<std::string> invisible; ControlVisibility() : visible("make_visible_control"), @@ -160,7 +160,8 @@ public: void initFromParams(const Params& p); protected: friend class LLUICtrlFactory; - LLUICtrl(const Params& p = LLUICtrl::Params(), + static const Params& getDefaultParams(); + LLUICtrl(const Params& p = getDefaultParams(), const LLViewModelPtr& viewmodel=LLViewModelPtr(new LLViewModel)); void initCommitCallback(const CommitCallbackParam& cb, commit_signal_t& sig); diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 4045022c8e..b9c61b1fed 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -154,9 +154,15 @@ struct LLCompareTypeID class LLWidgetTemplateRegistry : public LLRegistrySingleton<const std::type_info*, std::string, LLWidgetTemplateRegistry, LLCompareTypeID> -{ +{}; -}; +// function used to create new default widgets via LLView::getChild<T> +typedef LLView* (*dummy_widget_creator_func_t)(const std::string&); + +// used to register factory functions for default widget instances +class LLDummyWidgetRegistry +: public LLRegistrySingleton<const std::type_info*, dummy_widget_creator_func_t, LLDummyWidgetRegistry, LLCompareTypeID> +{}; extern LLFastTimer::DeclareTimer FTM_WIDGET_SETUP; extern LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION; @@ -295,10 +301,16 @@ fail: return widget; } + template<class T> + static T* getDefaultWidget(const std::string& name) + { + dummy_widget_creator_func_t* dummy_func = LLDummyWidgetRegistry::instance().getValue(&typeid(T)); + return dynamic_cast<T*>((*dummy_func)(name)); + } + template <class T> - static T* createDummyWidget(const std::string& name) + static LLView* createDefaultWidget(const std::string& name) { - //#pragma message("Generating LLUICtrlFactory::createDummyWidget") typename T::Params params; params.name(name); @@ -389,8 +401,10 @@ template<typename T, typename PARAM_BLOCK> LLWidgetRegistry<DERIVED>::Register<T, PARAM_BLOCK>::Register(const char* tag, LLWidgetCreatorFunc func) : LLWidgetRegistry<DERIVED>::StaticRegistrar(tag, func.empty() ? (LLWidgetCreatorFunc)&LLUICtrlFactory::defaultBuilder<T, PARAM_BLOCK> : func) { - //FIXME: inventory_panel will register itself with LLPanel::Params but it does have its own params...:( + // associate parameter block type with template .xml file LLWidgetTemplateRegistry::instance().defaultRegistrar().add(&typeid(PARAM_BLOCK), tag); + // associate widget type with factory function + LLDummyWidgetRegistry::instance().defaultRegistrar().add(&typeid(T), &LLUICtrlFactory::createDefaultWidget<T>); } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 2e2ef4d79f..d225ad2767 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -124,7 +124,7 @@ LLView::LLView(const LLView::Params& p) mDefaultTabGroup(p.default_tab_group), mLastTabGroup(0), mToolTipMsg((LLStringExplicit)p.tool_tip()), - mDummyWidgets(NULL) + mDefaultWidgets(NULL) { // create rect first, as this will supply initial follows flags setShape(p.rect); @@ -157,12 +157,12 @@ LLView::~LLView() mParentView->removeChild(this); } - if (mDummyWidgets) + if (mDefaultWidgets) { - std::for_each(mDummyWidgets->begin(), mDummyWidgets->end(), + std::for_each(mDefaultWidgets->begin(), mDefaultWidgets->end(), DeletePairedPointer()); - delete mDummyWidgets; - mDummyWidgets = NULL; + delete mDefaultWidgets; + mDefaultWidgets = NULL; } } @@ -1710,10 +1710,10 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_ if (create_if_missing) { - LLView* view = getDummyWidget<LLView>(name); + LLView* view = getDefaultWidget<LLView>(name); if (!view) { - view = LLUICtrlFactory::createDummyWidget<LLView>(name); + view = LLUICtrlFactory::createDefaultWidget<LLView>(name); } return view; } @@ -2750,11 +2750,11 @@ LLView::tree_iterator_t LLView::endTree() // only create maps on demand, as they incur heap allocation/deallocation cost // when a view is constructed/deconstructed -LLView::dummy_widget_map_t& LLView::getDummyWidgetMap() const +LLView::default_widget_map_t& LLView::getDefaultWidgetMap() const { - if (!mDummyWidgets) + if (!mDefaultWidgets) { - mDummyWidgets = new dummy_widget_map_t(); + mDefaultWidgets = new default_widget_map_t(); } - return *mDummyWidgets; + return *mDefaultWidgets; } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 458d02d001..422f62f602 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -143,8 +143,8 @@ class LLView : public LLMouseHandler, public LLMortician public: struct Follows : public LLInitParam::Choice<Follows> { - Option<std::string> string; - Option<U32> flags; + Alternative<std::string> string; + Alternative<U32> flags; Follows() : string(""), @@ -190,7 +190,7 @@ public: // these are nested attributes for LLLayoutPanel //FIXME: get parent context involved in parsing traversal - Deprecated user_resize, + Ignored user_resize, auto_resize, needs_translate; @@ -486,10 +486,10 @@ public: virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; - template <class T> T* getDummyWidget(const std::string& name) const + template <class T> T* getDefaultWidget(const std::string& name) const { - dummy_widget_map_t::const_iterator found_it = getDummyWidgetMap().find(name); - if (found_it == getDummyWidgetMap().end()) + default_widget_map_t::const_iterator found_it = getDefaultWidgetMap().find(name); + if (found_it == getDefaultWidgetMap().end()) { return NULL; } @@ -592,11 +592,11 @@ private: static LLWindow* sWindow; // All root views must know about their window. - typedef std::map<std::string, LLView*> dummy_widget_map_t; + typedef std::map<std::string, LLView*> default_widget_map_t; // allocate this map no demand, as it is rarely needed - mutable dummy_widget_map_t* mDummyWidgets; + mutable default_widget_map_t* mDefaultWidgets; - dummy_widget_map_t& getDummyWidgetMap() const; + default_widget_map_t& getDefaultWidgetMap() const; public: static BOOL sDebugRects; // Draw debug rects behind everything. @@ -640,10 +640,10 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse, BO } if (create_if_missing) { - result = getDummyWidget<T>(name); + result = getDefaultWidget<T>(name); if (!result) { - result = LLUICtrlFactory::createDummyWidget<T>(name); + result = LLUICtrlFactory::getDefaultWidget<T>(name); if (result) { @@ -655,7 +655,7 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse, BO return NULL; } - getDummyWidgetMap()[name] = result; + getDefaultWidgetMap()[name] = result; } } } diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 2271c02cd0..9d0cdacb1d 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -1176,7 +1176,7 @@ template<> LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const std::string& control_name) { if (type == TYPE_VEC3) - return sd; + return (LLVector3)sd; else { CONTROL_ERRS << "Invalid LLVector3 value" << llendl; @@ -1188,7 +1188,7 @@ template<> LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, const std::string& control_name) { if (type == TYPE_VEC3D) - return sd; + return (LLVector3d)sd; else { CONTROL_ERRS << "Invalid LLVector3d value" << llendl; @@ -1200,7 +1200,7 @@ template<> LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::string& control_name) { if (type == TYPE_RECT) - return sd; + return LLRect(sd); else { CONTROL_ERRS << "Invalid rect value" << llendl; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 0cbacd5b2e..f96c8fdca0 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -278,7 +278,6 @@ set(viewer_SOURCE_FILES llpaneldirland.cpp llpaneldirpeople.cpp llpaneldirplaces.cpp - llpaneldisplay.cpp llpanelevent.cpp llpanelface.cpp llpanelgroup.cpp @@ -694,7 +693,6 @@ set(viewer_HEADER_FILES llpaneldirland.h llpaneldirpeople.h llpaneldirplaces.h - llpaneldisplay.h llpanelevent.h llpanelface.h llpanelgroup.h diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ce66bb6180..d0d6a118b3 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1715,7 +1715,7 @@ void LLAppViewer::loadColorSettings() if(control->isType(TYPE_COL4)) { LLUIColorTable::ColorParams color; - color.value = control->getValue(); + color.value = (LLColor4)control->getValue(); LLUIColorTable::ColorEntryParams color_entry; color_entry.name = name; diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 7719af2bd7..0e5b943dd3 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -367,7 +367,7 @@ BOOL LLFavoritesBarCtrl::postBuild() LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_favorites.xml", gMenuHolder); if (!menu) { - menu = LLUICtrlFactory::createDummyWidget<LLMenuGL>("inventory_menu"); + menu = LLUICtrlFactory::getDefaultWidget<LLMenuGL>("inventory_menu"); } menu->setBackgroundColor(gSavedSkinSettings.getColor("MenuPopupBgColor")); mInventoryItemsPopupMenuHandle = menu->getHandle(); diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index e1974bba84..8ad5a19d02 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -75,7 +75,9 @@ LLFloaterAuction::LLFloaterAuction(const LLSD& key) : LLFloater(), mParcelID(-1) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_auction.xml"); +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_auction.xml"); + mCommitCallbackRegistrar.add("ClickSnapshot", boost::bind(&LLFloaterAuction::onClickSnapshot, this)); + mCommitCallbackRegistrar.add("ClickOK", boost::bind(&LLFloaterAuction::onClickOK, this)); } // Destroys the object @@ -85,11 +87,6 @@ LLFloaterAuction::~LLFloaterAuction() BOOL LLFloaterAuction::postBuild() { - childSetValue("fence_check", LLSD( gSavedSettings.getBOOL("AuctionShowFence") ) ); - getChild<LLUICtrl>("fence_check")->setCommitCallback(boost::bind(LLSavedSettingsGlue::setBOOL, _1, "AuctionShowFence")); - - childSetAction("snapshot_btn", onClickSnapshot, this); - childSetAction("ok_btn", onClickOK, this); return TRUE; } diff --git a/indra/newview/llfloaterauction.h b/indra/newview/llfloaterauction.h index d71fd3c653..b018316c64 100644 --- a/indra/newview/llfloaterauction.h +++ b/indra/newview/llfloaterauction.h @@ -55,9 +55,9 @@ public: /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void draw(); -private: LLFloaterAuction(const LLSD& key); ~LLFloaterAuction(); +private: void initialize(); static void onClickSnapshot(void* data); diff --git a/indra/newview/llfloaterbuildoptions.cpp b/indra/newview/llfloaterbuildoptions.cpp index 2507a72caa..9dbd1db38e 100644 --- a/indra/newview/llfloaterbuildoptions.cpp +++ b/indra/newview/llfloaterbuildoptions.cpp @@ -46,7 +46,7 @@ LLFloaterBuildOptions::LLFloaterBuildOptions(const LLSD& key) : LLFloater() { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_build_options.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_build_options.xml"); } LLFloaterBuildOptions::~LLFloaterBuildOptions() diff --git a/indra/newview/llfloaterbuildoptions.h b/indra/newview/llfloaterbuildoptions.h index da72520486..61db303ba2 100644 --- a/indra/newview/llfloaterbuildoptions.h +++ b/indra/newview/llfloaterbuildoptions.h @@ -45,7 +45,7 @@ class LLFloaterBuildOptions : public LLFloater, public LLFloaterSingleton<LLFloaterBuildOptions> { friend class LLUISingleton<LLFloaterBuildOptions, VisibilityPolicy<LLFloater> >; -protected: +public: LLFloaterBuildOptions(const LLSD& key); ~LLFloaterBuildOptions(); }; diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index 5cf4d90ece..e4e1c7efa2 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -50,7 +50,7 @@ LLFloaterBump::LLFloaterBump(const LLSD& key) : LLFloater() { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_bumps.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_bumps.xml"); } diff --git a/indra/newview/llfloaterbump.h b/indra/newview/llfloaterbump.h index f55a9e6bc5..b56817436c 100644 --- a/indra/newview/llfloaterbump.h +++ b/indra/newview/llfloaterbump.h @@ -44,13 +44,12 @@ class LLFloaterBump { friend class LLUISingleton<LLFloaterBump, VisibilityPolicy<LLFloater> >; protected: - LLFloaterBump(const LLSD& key); - virtual ~LLFloaterBump(); - void add(LLScrollListCtrl* list, LLMeanCollisionData *mcd); public: /*virtual*/ void onOpen(const LLSD& key); + LLFloaterBump(const LLSD& key); + virtual ~LLFloaterBump(); }; #endif diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 6ca8944a19..e79142513b 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -47,20 +47,24 @@ const F32 CAMERA_BUTTON_DELAY = 0.0f; // // Member functions // - - LLFloaterCamera::LLFloaterCamera(const LLSD& val) : LLFloater() { - setIsChrome(TRUE); - // For now, only used for size and tooltip strings const BOOL DONT_OPEN = FALSE; LLUICtrlFactory::getInstance()->buildFloater(this, "floater_camera.xml", DONT_OPEN); - +} + +// virtual +BOOL LLFloaterCamera::postBuild() +{ + setIsChrome(TRUE); + mRotate = getChild<LLJoystickCameraRotate>("cam_rotate_stick"); mZoom = getChild<LLJoystickCameraZoom>("zoom"); mTrack = getChild<LLJoystickCameraTrack>("cam_track_stick"); + + return TRUE; } // virtual @@ -79,3 +83,4 @@ void LLFloaterCamera::onClose(bool app_quitting) gSavedSettings.setBOOL("ShowCameraControls", FALSE); } } + diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 871e5c8ed1..f954e329eb 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -51,7 +51,7 @@ private: /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); - + /*virtual*/ BOOL postBuild(); public: LLJoystickCameraRotate* mRotate; LLJoystickCameraZoom* mZoom; diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp index a97b270c44..82deaef4a9 100644 --- a/indra/newview/llfloaterlagmeter.cpp +++ b/indra/newview/llfloaterlagmeter.cpp @@ -53,21 +53,22 @@ const std::string LAG_GOOD_IMAGE_NAME = "lag_status_good.tga"; LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) : LLFloater() { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_lagmeter.xml"); +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_lagmeter.xml"); + mCommitCallbackRegistrar.add("LagMeter.ClickShrink", boost::bind(&LLFloaterLagMeter::onClickShrink, this)); +} +BOOL LLFloaterLagMeter::postBuild() +{ // Don't let this window take keyboard focus -- it's confusing to // lose arrow-key driving when testing lag. setIsChrome(TRUE); - + // were we shrunk last time? if (gSavedSettings.getBOOL("LagMeterShrunk")) { - onClickShrink(this); + onClickShrink(); } -} - -BOOL LLFloaterLagMeter::postBuild() -{ + mClientButton = getChild<LLButton>("client_lagmeter"); mClientText = getChild<LLTextBox>("client_text"); mClientCause = getChild<LLTextBox>("client_lag_cause"); @@ -102,7 +103,7 @@ BOOL LLFloaterLagMeter::postBuild() config_string = getString("server_single_process_max_time_ms", mStringArgs); mServerSingleProcessMaxTime = (float)atof( config_string.c_str() ); - mShrunk = false; +// mShrunk = false; config_string = getString("max_width_px", mStringArgs); mMaxWidth = atoi( config_string.c_str() ); config_string = getString("min_width_px", mStringArgs); @@ -120,18 +121,18 @@ BOOL LLFloaterLagMeter::postBuild() mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps"); mStringArgs["[SERVER_FRAME_RATE_WARNING]"] = getString("server_frame_rate_warning_fps"); - childSetAction("minimize", onClickShrink, this); +// childSetAction("minimize", onClickShrink, this); return TRUE; } LLFloaterLagMeter::~LLFloaterLagMeter() { // save shrunk status for next time - gSavedSettings.setBOOL("LagMeterShrunk", mShrunk); +// gSavedSettings.setBOOL("LagMeterShrunk", mShrunk); // expand so we save the large window rectangle - if (mShrunk) + if (gSavedSettings.getBOOL("LagMeterShrunk")) { - onClickShrink(this); + onClickShrink(); } } @@ -311,58 +312,61 @@ void LLFloaterLagMeter::determineServer() } } -//static -void LLFloaterLagMeter::onClickShrink(void * data) + +void LLFloaterLagMeter::onClickShrink() // toggle "LagMeterShrunk" { - LLFloaterLagMeter * self = (LLFloaterLagMeter*)data; +// LLFloaterLagMeter * self = (LLFloaterLagMeter*)data; + + LLButton * button = getChild<LLButton>("minimize"); + S32 delta_width = mMaxWidth -mMinWidth; + LLRect r = getRect(); + bool shrunk = gSavedSettings.getBOOL("LagMeterShrunk"); - LLButton * button = self->getChild<LLButton>("minimize"); - S32 delta_width = self->mMaxWidth - self->mMinWidth; - LLRect r = self->getRect(); - if(self->mShrunk) + if(shrunk) { - self->setTitle( self->getString("max_title_msg", self->mStringArgs) ); + setTitle(getString("max_title_msg", mStringArgs) ); // make left edge appear to expand r.translate(-delta_width, 0); - self->setRect(r); - self->reshape(self->mMaxWidth, self->getRect().getHeight()); + setRect(r); + reshape(mMaxWidth, getRect().getHeight()); - self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) + ":"); - self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) + ":"); - self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) + ":"); + childSetText("client", getString("client_text_msg", mStringArgs) + ":"); + childSetText("network", getString("network_text_msg",mStringArgs) + ":"); + childSetText("server", getString("server_text_msg", mStringArgs) + ":"); // usually "<<" - button->setLabel( self->getString("smaller_label", self->mStringArgs) ); + button->setLabel( getString("smaller_label", mStringArgs) ); } else { - self->setTitle( self->getString("min_title_msg", self->mStringArgs) ); + setTitle( getString("min_title_msg", mStringArgs) ); // make left edge appear to collapse r.translate(delta_width, 0); - self->setRect(r); - self->reshape(self->mMinWidth, self->getRect().getHeight()); + setRect(r); + reshape(mMinWidth, getRect().getHeight()); - self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) ); - self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) ); - self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) ); + childSetText("client", getString("client_text_msg", mStringArgs) ); + childSetText("network",getString("network_text_msg",mStringArgs) ); + childSetText("server", getString("server_text_msg", mStringArgs) ); // usually ">>" - button->setLabel( self->getString("bigger_label", self->mStringArgs) ); + button->setLabel( getString("bigger_label", mStringArgs) ); } // Don't put keyboard focus on the button button->setFocus(FALSE); - self->mClientText->setVisible(self->mShrunk); - self->mClientCause->setVisible(self->mShrunk); - self->childSetVisible("client_help", self->mShrunk); +// self->mClientText->setVisible(self->mShrunk); +// self->mClientCause->setVisible(self->mShrunk); +// self->childSetVisible("client_help", self->mShrunk); - self->mNetworkText->setVisible(self->mShrunk); - self->mNetworkCause->setVisible(self->mShrunk); - self->childSetVisible("network_help", self->mShrunk); +// self->mNetworkText->setVisible(self->mShrunk); +// self->mNetworkCause->setVisible(self->mShrunk); +// self->childSetVisible("network_help", self->mShrunk); - self->mServerText->setVisible(self->mShrunk); - self->mServerCause->setVisible(self->mShrunk); - self->childSetVisible("server_help", self->mShrunk); +// self->mServerText->setVisible(self->mShrunk); +// self->mServerCause->setVisible(self->mShrunk); +// self->childSetVisible("server_help", self->mShrunk); - self->mShrunk = !self->mShrunk; +// self->mShrunk = !self->mShrunk; + gSavedSettings.setBOOL("LagMeterShrunk", !gSavedSettings.getBOOL("LagMeterShrunk")); } diff --git a/indra/newview/llfloaterlagmeter.h b/indra/newview/llfloaterlagmeter.h index e8af68ac7a..6d2086839e 100644 --- a/indra/newview/llfloaterlagmeter.h +++ b/indra/newview/llfloaterlagmeter.h @@ -42,17 +42,18 @@ class LLFloaterLagMeter : public LLFloater, public LLFloaterSingleton<LLFloaterL friend class LLUISingleton<LLFloaterLagMeter, VisibilityPolicy<LLFloater> >; public: + LLFloaterLagMeter(const LLSD& key); + /*virtual*/ ~LLFloaterLagMeter(); + /*virtual*/ void draw(); /*virtual*/ BOOL postBuild(); private: - LLFloaterLagMeter(const LLSD& key); - /*virtual*/ ~LLFloaterLagMeter(); void determineClient(); void determineNetwork(); void determineServer(); - static void onClickShrink(void * data); + void onClickShrink(); bool mShrunk; S32 mMaxWidth, mMinWidth; diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 6f5bd5f27b..f3275913e4 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -44,11 +44,11 @@ #include "lluserauth.h" #include "llagent.h" -#include "llfloateravatarpicker.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llradiogroup.h" #include "llcombobox.h" +#include "llfloaterreg.h" +#include "llfloateravatarpicker.h" #include "llfloaterauction.h" #include "llfloatergroups.h" #include "llfloatergroupinfo.h" @@ -889,7 +889,8 @@ void LLPanelLandGeneral::onClickStartAuction(void* data) } else { - LLFloaterAuction::showInstance(); + //LLFloaterAuction::showInstance(); + LLFloaterReg::showInstance("auction"); } } } diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp index 11842b8b0e..3d5d2b733f 100644 --- a/indra/newview/llfloaternotificationsconsole.cpp +++ b/indra/newview/llfloaternotificationsconsole.cpp @@ -163,7 +163,9 @@ bool LLNotificationChannelPanel::update(const LLSD& payload, bool passed_filter) LLFloaterNotificationConsole::LLFloaterNotificationConsole(const LLSD& key) : LLFloater() { - LLUICtrlFactory::instance().buildFloater(this, "floater_notifications_console.xml"); + mCommitCallbackRegistrar.add("ClickAdd", boost::bind(&LLFloaterNotificationConsole::onClickAdd, this)); + + //LLUICtrlFactory::instance().buildFloater(this, "floater_notifications_console.xml"); } void LLFloaterNotificationConsole::onClose(bool app_quitting) @@ -187,7 +189,7 @@ BOOL LLFloaterNotificationConsole::postBuild() addChannel("Notifications"); addChannel("NotificationTips"); - getChild<LLButton>("add_notification")->setClickedCallback(onClickAdd, this); +// getChild<LLButton>("add_notification")->setClickedCallback(onClickAdd, this); LLComboBox* notifications = getChild<LLComboBox>("notification_types"); LLNotifications::TemplateNames names = LLNotifications::instance().getTemplateNames(); @@ -236,11 +238,9 @@ void LLFloaterNotificationConsole::updateResizeLimits() setResizeLimits(getMinWidth(), floater_header_size + HEADER_PADDING + ((NOTIFICATION_PANEL_HEADER_HEIGHT + 3) * stack.getNumPanels())); } -void LLFloaterNotificationConsole::onClickAdd(void* user_data) +void LLFloaterNotificationConsole::onClickAdd() { - LLFloaterNotificationConsole* floater = (LLFloaterNotificationConsole*)user_data; - - std::string message_name = floater->getChild<LLComboBox>("notification_types")->getValue().asString(); + std::string message_name = getChild<LLComboBox>("notification_types")->getValue().asString(); if (!message_name.empty()) { LLNotifications::instance().add(message_name, LLSD()); diff --git a/indra/newview/llfloaternotificationsconsole.h b/indra/newview/llfloaternotificationsconsole.h index 0372553182..b85437c3c5 100644 --- a/indra/newview/llfloaternotificationsconsole.h +++ b/indra/newview/llfloaternotificationsconsole.h @@ -55,7 +55,7 @@ public: void updateResizeLimits(); private: - static void onClickAdd(void* user_data); + void onClickAdd(); }; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d0df2617b3..15d57ebbcc 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -57,18 +57,61 @@ #include "llfloatervoicedevicesettings.h" #include "llkeyboard.h" #include "llmodaldialog.h" -#include "llpaneldisplay.h" #include "llpanellogin.h" #include "llradiogroup.h" +#include "llsky.h" #include "llstylemap.h" #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llsliderctrl.h" #include "lltabcontainer.h" +#include "lltrans.h" #include "lltexteditor.h" #include "llviewercontrol.h" #include "llviewercamera.h" #include "llviewerwindow.h" +#include "llviewermessage.h" +#include "llviewershadermgr.h" +#include "llvotree.h" +#include "llvosky.h" + +// linden library includes +#include "llerror.h" +#include "llfontgl.h" +#include "llrect.h" +#include "llstring.h" + +// project includes + +#include "llbutton.h" +#include "llflexibleobject.h" +#include "lllineeditor.h" +#include "llresmgr.h" +#include "llspinctrl.h" +#include "llstartup.h" +#include "lltextbox.h" + +#include "llui.h" + +#include "llviewerimage.h" +#include "llviewerimagelist.h" +#include "llviewerobjectlist.h" + +#include "llvoavatar.h" +#include "llvovolume.h" +#include "llwindow.h" +#include "llworld.h" +#include "pipeline.h" +#include "lluictrlfactory.h" +#include "llboost.h" + + +//RN temporary includes for resolution switching +#include "llglheaders.h" +const F32 MAX_USER_FAR_CLIP = 512.f; +const F32 MIN_USER_FAR_CLIP = 64.f; + +const S32 ASPECT_RATIO_STR_LEN = 100; class LLVoiceSetKeyDialog : public LLModalDialog { @@ -136,6 +179,9 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); +bool extractWindowSizeFromString(const std::string& instr, U32 &width, U32 &height); +void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator); + LLMediaBase *get_web_media() { LLMediaBase *media_source; @@ -223,8 +269,41 @@ bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFl return false; } + +// Extract from strings of the form "<width> x <height>", e.g. "640 x 480". +bool extractWindowSizeFromString(const std::string& instr, U32 &width, U32 &height) +{ + using namespace boost; + cmatch what; + const regex expression("([0-9]+) x ([0-9]+)"); + if (regex_match(instr.c_str(), what, expression)) + { + width = atoi(what[1].first); + height = atoi(what[2].first); + return true; + } + + width = height = 0; + return false; +} + +void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator) +{ + numerator = 0; + denominator = 0; + for (F32 test_denominator = 1.f; test_denominator < 30.f; test_denominator += 1.f) + { + if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f) + { + numerator = llround(decimal_val * test_denominator); + denominator = llround(test_denominator); + break; + } + } +} // static std::string LLFloaterPreference::sSkin = ""; +F32 LLFloaterPreference::sAspectRatio = 0.0; ////////////////////////////////////////////// // LLFloaterPreference @@ -235,9 +314,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) { //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); - mFactoryMap["display"] = LLCallbackMap((LLCallbackMap::callback_t)LLCallbackMap::buildPanel<LLPanelDisplay>); /// done fixing the callbacks - - mCommitCallbackRegistrar.add("Pref.Apply", boost::bind(&LLFloaterPreference::onBtnApply, this)); mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this)); mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this)); @@ -261,9 +337,14 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.HardwareSettings", boost::bind(&LLFloaterPreference::onOpenHardwareSettings, this)); mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); - gSavedSkinSettings.getControl("HTMLLinkColor")->getCommitSignal()->connect(boost::bind(&handleHTMLLinkColorChanged, _2)); - //gSavedSettings.getControl("UseExternalBrowser")->getCommitSignal()->connect(boost::bind(&LLPanelPreference::handleUseExternalBrowserChanged, this)); + mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); + mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::onUpdateSliderText,this, _1,_2)); + mCommitCallbackRegistrar.add("Pref.AutoDetectAspect", boost::bind(&LLFloaterPreference::onCommitAutoDetectAspect, this)); + mCommitCallbackRegistrar.add("Pref.onSelectAspectRatio", boost::bind(&LLFloaterPreference::onKeystrokeAspectRatio, this)); + mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); + gSavedSkinSettings.getControl("HTMLLinkColor")->getCommitSignal()->connect(boost::bind(&handleHTMLLinkColorChanged, _2)); + } BOOL LLFloaterPreference::postBuild() @@ -271,20 +352,27 @@ BOOL LLFloaterPreference::postBuild() LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core"); if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) tabcontainer->selectFirstTab(); - - return TRUE; } LLFloaterPreference::~LLFloaterPreference() { + // clean up user data + LLComboBox* ctrl_aspect_ratio = getChild<LLComboBox>( "aspect_ratio"); + LLComboBox* ctrl_window_size = getChild<LLComboBox>("windowsize combo"); + for (S32 i = 0; i < ctrl_aspect_ratio->getItemCount(); i++) + { + ctrl_aspect_ratio->setCurrentByIndex(i); + } + for (S32 i = 0; i < ctrl_window_size->getItemCount(); i++) + { + ctrl_window_size->setCurrentByIndex(i); + } } void LLFloaterPreference::draw() { BOOL has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL); gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); - - LLFloater::draw(); } @@ -368,6 +456,14 @@ void LLFloaterPreference::apply() } } + applyResolution(); + + // Only set window size if we're not in fullscreen mode + if(gSavedSettings.getBOOL("NotFullScreen")) + { + applyWindowSize(); + } + } void LLFloaterPreference::cancel() @@ -396,7 +492,11 @@ void LLFloaterPreference::cancel() { voice_device_settings ->cancel(); } + LLFloaterReg::hideInstance("pref_voicedevicesettings"); + + gSavedSettings.setF32("FullScreenAspectRatio", sAspectRatio); + } void LLFloaterPreference::onOpen(const LLSD& key) @@ -517,32 +617,17 @@ void LLFloaterPreference::onChangeCustom() refreshEnabledGraphics(); } -////////////////////////////////////////////////////////////////////////// -// static Note:(angela) NOT touching LLPanelDisplay for this milestone (skinning-11) + void LLFloaterPreference::refreshEnabledGraphics() { LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences"); if(instance) { LLFloaterHardwareSettings::instance()->refreshEnabledState(); - - LLTabContainer* tabcontainer = instance->getChild<LLTabContainer>("pref core"); - for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); - iter != tabcontainer->getChildList()->end(); ++iter) - { - LLView* view = *iter; - if(!view) - return; - if(view->getName()=="display") - { - LLPanelDisplay* display_panel = dynamic_cast<LLPanelDisplay*>(view); - if(!display_panel) - return; - display_panel->refreshEnabledState(); - } - } + instance->refreshEnabledState(); } } + void LLFloaterPreference::updateMeterText(LLUICtrl* ctrl) { // get our UI widgets @@ -693,6 +778,208 @@ void LLFloaterPreference::buildLists(void* data) } } +void LLFloaterPreference::refreshEnabledState() +{ + + // disable graphics settings and exit if it's not set to custom + if(!gSavedSettings.getBOOL("RenderCustomSettings")) + { + return; + } + + LLCheckBoxCtrl* ctrl_reflections = getChild<LLCheckBoxCtrl>("Reflections"); + LLRadioGroup* radio_reflection_detail = getChild<LLRadioGroup>("ReflectionDetailRadio"); + + // Reflections + BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable") + && gGLManager.mHasCubeMap + && LLCubeMap::sUseCubeMaps; + ctrl_reflections->setEnabled(reflections); + + // Bump & Shiny + bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); + getChild<LLCheckBoxCtrl>("BumpShiny")->setEnabled(bumpshiny ? TRUE : FALSE); + + for (S32 i = 0; i < radio_reflection_detail->getItemCount(); ++i) + { + radio_reflection_detail->setIndexEnabled(i, ctrl_reflections->get() && reflections); + } + + // Avatar Mode + // Enable Avatar Shaders + LLCheckBoxCtrl* ctrl_avatar_vp = getChild<LLCheckBoxCtrl>("AvatarVertexProgram"); + // Avatar Render Mode + LLCheckBoxCtrl* ctrl_avatar_cloth = getChild<LLCheckBoxCtrl>("AvatarCloth"); + + S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel; + ctrl_avatar_vp->setEnabled((max_avatar_shader > 0) ? TRUE : FALSE); + + if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE || + gSavedSettings.getBOOL("RenderAvatarVP") == FALSE) + { + ctrl_avatar_cloth->setEnabled(false); + } + else + { + ctrl_avatar_cloth->setEnabled(true); + } + + // Vertex Shaders + // Global Shader Enable + LLCheckBoxCtrl* ctrl_shader_enable = getChild<LLCheckBoxCtrl>("BasicShaders"); + // radio set for terrain detail mode + LLRadioGroup* mRadioTerrainDetail = getChild<LLRadioGroup>("TerrainDetailRadio"); // can be linked with control var + + ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); + + BOOL shaders = ctrl_shader_enable->get(); + if (shaders) + { + mRadioTerrainDetail->setValue(1); + mRadioTerrainDetail->setEnabled(FALSE); + } + else + { + mRadioTerrainDetail->setEnabled(TRUE); + } + + // WindLight + LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders"); + + // *HACK just checks to see if we can use shaders... + // maybe some cards that use shaders, but don't support windlight + ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders); + // now turn off any features that are unavailable + disableUnavailableSettings(); +} + +void LLFloaterPreference::disableUnavailableSettings() +{ + LLCheckBoxCtrl* ctrl_reflections = getChild<LLCheckBoxCtrl>("Reflections"); + LLCheckBoxCtrl* ctrl_avatar_vp = getChild<LLCheckBoxCtrl>("AvatarVertexProgram"); + LLCheckBoxCtrl* ctrl_avatar_cloth = getChild<LLCheckBoxCtrl>("AvatarCloth"); + LLCheckBoxCtrl* ctrl_shader_enable = getChild<LLCheckBoxCtrl>("BasicShaders"); + LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders"); + LLCheckBoxCtrl* ctrl_avatar_impostors = getChild<LLCheckBoxCtrl>("AvatarImpostors"); + + // if vertex shaders off, disable all shader related products + if(!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")) + { + ctrl_shader_enable->setEnabled(FALSE); + ctrl_shader_enable->setValue(FALSE); + + ctrl_wind_light->setEnabled(FALSE); + ctrl_wind_light->setValue(FALSE); + + ctrl_reflections->setEnabled(FALSE); + ctrl_reflections->setValue(FALSE); + + ctrl_avatar_vp->setEnabled(FALSE); + ctrl_avatar_vp->setValue(FALSE); + + ctrl_avatar_cloth->setEnabled(FALSE); + ctrl_avatar_cloth->setValue(FALSE); + } + + // disabled windlight + if(!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")) + { + ctrl_wind_light->setEnabled(FALSE); + ctrl_wind_light->setValue(FALSE); + } + + // disabled reflections + if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderWaterReflections")) + { + ctrl_reflections->setEnabled(FALSE); + ctrl_reflections->setValue(FALSE); + } + + // disabled av + if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP")) + { + ctrl_avatar_vp->setEnabled(FALSE); + ctrl_avatar_vp->setValue(FALSE); + + ctrl_avatar_cloth->setEnabled(FALSE); + ctrl_avatar_cloth->setValue(FALSE); + } + // disabled cloth + if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarCloth")) + { + ctrl_avatar_cloth->setEnabled(FALSE); + ctrl_avatar_cloth->setValue(FALSE); + } + // disabled impostors + if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseImpostors")) + { + ctrl_avatar_impostors->setEnabled(FALSE); + ctrl_avatar_impostors->setValue(FALSE); + } +} + +void LLFloaterPreference::onCommitAutoDetectAspect() +{ + BOOL auto_detect = getChild<LLCheckBoxCtrl>("aspect_auto_detect")->get(); + F32 ratio; + + if (auto_detect) + { + S32 numerator = 0; + S32 denominator = 0; + + // clear any aspect ratio override + gViewerWindow->mWindow->setNativeAspectRatio(0.f); + fractionFromDecimal(gViewerWindow->mWindow->getNativeAspectRatio(), numerator, denominator); + + std::string aspect; + if (numerator != 0) + { + aspect = llformat("%d:%d", numerator, denominator); + } + else + { + aspect = llformat("%.3f", gViewerWindow->mWindow->getNativeAspectRatio()); + } + + getChild<LLComboBox>( "aspect_ratio")->setLabel(aspect); + + ratio = gViewerWindow->mWindow->getNativeAspectRatio(); + gSavedSettings.setF32("FullScreenAspectRatio", ratio); + } +} + +void LLFloaterPreference::refresh() +{ + LLPanel::refresh(); + + // sliders and their text boxes + // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); + // slider text boxes + updateSliderText(getChild<LLSliderCtrl>("ObjectMeshDetail"), getChild<LLTextBox>("ObjectMeshDetailText")); + updateSliderText(getChild<LLSliderCtrl>("FlexibleMeshDetail"), getChild<LLTextBox>("FlexibleMeshDetailText")); + updateSliderText(getChild<LLSliderCtrl>("TreeMeshDetail"), getChild<LLTextBox>("TreeMeshDetailText")); + updateSliderText(getChild<LLSliderCtrl>("AvatarMeshDetail"), getChild<LLTextBox>("AvatarMeshDetailText")); + updateSliderText(getChild<LLSliderCtrl>("TerrainMeshDetail"), getChild<LLTextBox>("TerrainMeshDetailText")); + updateSliderText(getChild<LLSliderCtrl>("RenderPostProcess"), getChild<LLTextBox>("PostProcessText")); + updateSliderText(getChild<LLSliderCtrl>("SkyMeshDetail"), getChild<LLTextBox>("SkyMeshDetailText")); + + refreshEnabledState(); +} + +void LLFloaterPreference::onCommitWindowedMode() +{ + refresh(); +} + +void LLFloaterPreference::onChangeQuality(const LLSD& data) +{ + U32 level = (U32)(data.asReal()); + LLFeatureManager::getInstance()->setGraphicsLevel(level, true); + refreshEnabledGraphics(); + refresh(); +} + // static // DEV-24146 - needs to be removed at a later date. jan-2009 void LLFloaterPreference::cleanupBadSetting() @@ -790,9 +1077,9 @@ void LLFloaterPreference::onCommitLogging() { enableHistory(); } + void LLFloaterPreference::enableHistory() { - if (childGetValue("log_instant_messages").asBoolean() || childGetValue("log_chat").asBoolean()) { childEnable("log_show_history"); @@ -850,6 +1137,158 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im } +void LLFloaterPreference::onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name) +{ + if(name.asString() =="" || !hasChild("name")) + return; + + LLTextBox* text_box = getChild<LLTextBox>(name.asString()); + LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(ctrl); + updateSliderText(slider, text_box); +} + +void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) +{ + if(text_box == NULL || ctrl== NULL) + return; + + // get range and points when text should change + F32 value = (F32)ctrl->getValue().asReal(); + F32 min = ctrl->getMinValue(); + F32 max = ctrl->getMaxValue(); + F32 range = max - min; + llassert(range > 0); + F32 midPoint = min + range / 3.0f; + F32 highPoint = min + (2.0f * range / 3.0f); + + // choose the right text + if(value < midPoint) + { + text_box->setText(LLTrans::getString("GraphicsQualityLow")); + } + else if (value < highPoint) + { + text_box->setText(LLTrans::getString("GraphicsQualityMid")); + } + else + { + text_box->setText(LLTrans::getString("GraphicsQualityHigh")); + } +} + +void LLFloaterPreference::onKeystrokeAspectRatio() +{ + getChild<LLCheckBoxCtrl>("aspect_auto_detect")->set(FALSE); +} + +void LLFloaterPreference::applyWindowSize() +{ + LLComboBox* ctrl_windowSize = getChild<LLComboBox>("windowsize combo"); + if (ctrl_windowSize->getVisible() && (ctrl_windowSize->getCurrentIndex() != -1)) + { + U32 width = 0; + U32 height = 0; + if (extractWindowSizeFromString(ctrl_windowSize->getValue().asString().c_str(), width,height)) + { + LLViewerWindow::movieSize(width, height); + } + } +} + +void LLFloaterPreference::applyResolution() +{ + LLComboBox* ctrl_aspect_ratio = getChild<LLComboBox>( "aspect_ratio"); + gGL.flush(); + char aspect_ratio_text[ASPECT_RATIO_STR_LEN]; /*Flawfinder: ignore*/ + if (ctrl_aspect_ratio->getCurrentIndex() == -1) + { + // *Can't pass const char* from c_str() into strtok + strncpy(aspect_ratio_text, ctrl_aspect_ratio->getSimple().c_str(), sizeof(aspect_ratio_text) -1); /*Flawfinder: ignore*/ + aspect_ratio_text[sizeof(aspect_ratio_text) -1] = '\0'; + char *element = strtok(aspect_ratio_text, ":/\\"); + if (!element) + { + sAspectRatio = 0.f; // will be clamped later + } + else + { + LLLocale locale(LLLocale::USER_LOCALE); + sAspectRatio = (F32)atof(element); + } + + // look for denominator + element = strtok(NULL, ":/\\"); + if (element) + { + LLLocale locale(LLLocale::USER_LOCALE); + + F32 denominator = (F32)atof(element); + if (denominator != 0.f) + { + sAspectRatio /= denominator; + } + } + } + else + { + sAspectRatio = (F32)ctrl_aspect_ratio->getValue().asReal(); + } + + // presumably, user entered a non-numeric value if aspect_ratio == 0.f + if (sAspectRatio != 0.f) + { + sAspectRatio = llclamp(sAspectRatio, 0.2f, 5.f); + gSavedSettings.setF32("FullScreenAspectRatio", sAspectRatio); + } + + // Screen resolution + S32 num_resolutions; + LLWindow::LLWindowResolution* supported_resolutions = + gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions); + U32 resIndex = getChild<LLComboBox>("fullscreen combo")->getCurrentIndex(); + gSavedSettings.setS32("FullScreenWidth", supported_resolutions[resIndex].mWidth); + gSavedSettings.setS32("FullScreenHeight", supported_resolutions[resIndex].mHeight); + + gViewerWindow->requestResolutionUpdate(!gSavedSettings.getBOOL("NotFullScreen")); + + send_agent_update(TRUE); + + // Update enable/disable + refresh(); +} + +void LLFloaterPreference::initWindowSizeControls(LLPanel* panelp) +{ + // Window size + // mWindowSizeLabel = getChild<LLTextBox>("WindowSizeLabel"); + LLComboBox* ctrl_window_size = panelp->getChild<LLComboBox>("windowsize combo"); + + // Look to see if current window size matches existing window sizes, if so then + // just set the selection value... + const U32 height = gViewerWindow->getWindowDisplayHeight(); + const U32 width = gViewerWindow->getWindowDisplayWidth(); + for (S32 i=0; i < ctrl_window_size->getItemCount(); i++) + { + U32 height_test = 0; + U32 width_test = 0; + ctrl_window_size->setCurrentByIndex(i); + if (extractWindowSizeFromString(ctrl_window_size->getValue().asString(), width_test, height_test)) + { + if ((height_test == height) && (width_test == width)) + { + return; + } + } + } + // ...otherwise, add a new entry with the current window height/width. + LLUIString resolution_label = panelp->getString("resolution_format"); + resolution_label.setArg("[RES_X]", llformat("%d", width)); + resolution_label.setArg("[RES_Y]", llformat("%d", height)); + ctrl_window_size->add(resolution_label, ADD_TOP); + ctrl_window_size->setCurrentByIndex(0); +} + + //---------------------------------------------------------------------------- static LLRegisterPanelClassWrapper<LLPanelPreference> t_places("panel_preference"); @@ -858,14 +1297,12 @@ LLPanelPreference::LLPanelPreference() { // mCommitCallbackRegistrar.add("setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2)); - } //virtual BOOL LLPanelPreference::postBuild() { if (hasChild("maturity_desired_combobox")) { - /////////////////////////// From LLPanelGeneral ////////////////////////// // if we have no agent, we can't let them choose anything // if we have an agent, then we only let them choose if they have a choice @@ -935,6 +1372,94 @@ BOOL LLPanelPreference::postBuild() childSetText("busy_response", getString("log_in_to_change")); } + + + if(hasChild("fullscreen combo")) + { + //============================================================================ + // Resolution + + S32 num_resolutions = 0; + LLWindow::LLWindowResolution* supported_resolutions = gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions); + + S32 fullscreen_mode = num_resolutions - 1; + + LLComboBox*ctrl_full_screen = getChild<LLComboBox>( "fullscreen combo"); + LLUIString resolution_label = getString("resolution_format"); + + for (S32 i = 0; i < num_resolutions; i++) + { + resolution_label.setArg("[RES_X]", llformat("%d", supported_resolutions[i].mWidth)); + resolution_label.setArg("[RES_Y]", llformat("%d", supported_resolutions[i].mHeight)); + ctrl_full_screen->add( resolution_label, ADD_BOTTOM ); + } + + { + BOOL targetFullscreen; + S32 targetWidth; + S32 targetHeight; + + gViewerWindow->getTargetWindow(targetFullscreen, targetWidth, targetHeight); + + if (targetFullscreen) + { + fullscreen_mode = 0; // default to 800x600 + for (S32 i = 0; i < num_resolutions; i++) + { + if (targetWidth == supported_resolutions[i].mWidth + && targetHeight == supported_resolutions[i].mHeight) + { + fullscreen_mode = i; + } + } + ctrl_full_screen->setCurrentByIndex(fullscreen_mode); + } + else + { + // set to windowed mode + //fullscreen_mode = mCtrlFullScreen->getItemCount() - 1; + ctrl_full_screen->setCurrentByIndex(0); + } + } + + LLFloaterPreference::initWindowSizeControls(this); + + if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio")) + { + LLFloaterPreference::sAspectRatio = gViewerWindow->getDisplayAspectRatio(); + } + else + { + LLFloaterPreference::sAspectRatio = gSavedSettings.getF32("FullScreenAspectRatio"); + } + + getChild<LLComboBox>("aspect_ratio")->setTextEntryCallback(boost::bind(&LLPanelPreference::setControlFalse, this, LLSD("FullScreenAutoDetectAspectRatio") )); + + + S32 numerator = 0; + S32 denominator = 0; + fractionFromDecimal(LLFloaterPreference::sAspectRatio, numerator, denominator); + + LLUIString aspect_ratio_text = getString("aspect_ratio_text"); + if (numerator != 0) + { + aspect_ratio_text.setArg("[NUM]", llformat("%d", numerator)); + aspect_ratio_text.setArg("[DEN]", llformat("%d", denominator)); + } + else + { + aspect_ratio_text = llformat("%.3f", LLFloaterPreference::sAspectRatio); + } + + LLComboBox* ctrl_aspect_ratio = getChild<LLComboBox>( "aspect_ratio"); + //mCtrlAspectRatio->setCommitCallback(onSelectAspectRatio, this); + // add default aspect ratios + ctrl_aspect_ratio->add(aspect_ratio_text, &LLFloaterPreference::sAspectRatio, ADD_TOP); + ctrl_aspect_ratio->setCurrentByIndex(0); + + refresh(); + } + apply(); return true; } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 000bff4dea..afff610c69 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -43,12 +43,22 @@ class LLPanelPreference; class LLPanelLCD; -class LLPanelDisplay; class LLPanelDebug; class LLMessageSystem; class LLScrollListCtrl; - +class LLSliderCtrl; class LLSD; +class LLTextBox; + +typedef enum + { + GS_LOW_GRAPHICS, + GS_MID_GRAPHICS, + GS_HIGH_GRAPHICS, + GS_ULTRA_GRAPHICS + + } EGraphicsSettings; + // Floater to control preferences (display, audio, bandwidth, general. class LLFloaterPreference : public LLFloater @@ -88,6 +98,8 @@ protected: void setHardwareDefaults(); // callback for when client turns on shaders void onVertexShaderEnable(); + + public: void onClickSetCache(); @@ -106,11 +118,29 @@ public: void enableHistory(); void onCommitLogging(); void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); + void refreshEnabledState(); + void disableUnavailableSettings(); + void onCommitWindowedMode(); + void refresh(); // Refresh enable/disable + // if the quality radio buttons are changed + void onChangeQuality(const LLSD& data); + + void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name); + void onKeystrokeAspectRatio(); +// void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator); +// bool extractWindowSizeFromString(const std::string& instr, U32 &width, U32 &height); + + void onCommitAutoDetectAspect(); + void applyResolution(); + void applyWindowSize(); + + static void initWindowSizeControls(LLPanel* panelp); static void buildLists(void* data); static void refreshSkin(void* data); static void cleanupBadSetting(); - + static F32 sAspectRatio; private: static std::string sSkin; bool mGotPersonalInfo; diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 8ddc929019..4b175cdc27 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -188,7 +188,7 @@ BOOL LLFloaterReporter::postBuild() LLLineEditor* le = getChild<LLLineEditor>("abuser_name_edit"); le->setEnabled( FALSE ); - setPosBox(mPosition.getValue()); + setPosBox((LLVector3d)mPosition.getValue()); LLButton* pick_btn = getChild<LLButton>("pick_btn"); pick_btn->setImages(std::string("tool_face.tga"), std::string("tool_face_active.tga") ); diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 339b90a0f5..8b6102c67f 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -44,7 +44,11 @@ LLFloaterSettingsDebug::LLFloaterSettingsDebug(const LLSD& key) : LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_settings_debug.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_settings_debug.xml"); + mCommitCallbackRegistrar.add("SettingSelect", boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this,_1)); + mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); + mCommitCallbackRegistrar.add("ClickDefault", boost::bind(&LLFloaterSettingsDebug::onClickDefault, this)); + } LLFloaterSettingsDebug::~LLFloaterSettingsDebug() @@ -82,17 +86,7 @@ BOOL LLFloaterSettingsDebug::postBuild() } settings_combo->sortByName(); - settings_combo->setCommitCallback(onSettingSelect, this); settings_combo->updateSelection(); - - childSetCommitCallback("val_spinner_1", onCommitSettings, this); - childSetCommitCallback("val_spinner_2", onCommitSettings, this); - childSetCommitCallback("val_spinner_3", onCommitSettings, this); - childSetCommitCallback("val_spinner_4", onCommitSettings, this); - childSetCommitCallback("val_text", onCommitSettings, this); - childSetCommitCallback("boolean_combo", onCommitSettings, this); - childSetCommitCallback("color_swatch", onCommitSettings, this); - childSetAction("default_btn", onClickDefault, this); mComment = getChild<LLTextEditor>("comment_text"); return TRUE; } @@ -107,21 +101,17 @@ void LLFloaterSettingsDebug::draw() } //static -void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl, void* user_data) +void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl) { - LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; LLComboBox* combo_box = (LLComboBox*)ctrl; LLControlVariable* controlp = (LLControlVariable*)combo_box->getCurrentUserdata(); - floaterp->updateControl(controlp); + updateControl(controlp); } -//static -void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) +void LLFloaterSettingsDebug::onCommitSettings() { - LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; - - LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo"); + LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); LLVector3 vector; @@ -135,46 +125,46 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) switch(controlp->type()) { case TYPE_U32: - controlp->set(floaterp->childGetValue("val_spinner_1")); + controlp->set(childGetValue("val_spinner_1")); break; case TYPE_S32: - controlp->set(floaterp->childGetValue("val_spinner_1")); + controlp->set(childGetValue("val_spinner_1")); break; case TYPE_F32: - controlp->set(LLSD(floaterp->childGetValue("val_spinner_1").asReal())); + controlp->set(LLSD(childGetValue("val_spinner_1").asReal())); break; case TYPE_BOOLEAN: - controlp->set(floaterp->childGetValue("boolean_combo")); + controlp->set(childGetValue("boolean_combo")); break; case TYPE_STRING: - controlp->set(LLSD(floaterp->childGetValue("val_text").asString())); + controlp->set(LLSD(childGetValue("val_text").asString())); break; case TYPE_VEC3: - vector.mV[VX] = (F32)floaterp->childGetValue("val_spinner_1").asReal(); - vector.mV[VY] = (F32)floaterp->childGetValue("val_spinner_2").asReal(); - vector.mV[VZ] = (F32)floaterp->childGetValue("val_spinner_3").asReal(); + vector.mV[VX] = (F32)childGetValue("val_spinner_1").asReal(); + vector.mV[VY] = (F32)childGetValue("val_spinner_2").asReal(); + vector.mV[VZ] = (F32)childGetValue("val_spinner_3").asReal(); controlp->set(vector.getValue()); break; case TYPE_VEC3D: - vectord.mdV[VX] = floaterp->childGetValue("val_spinner_1").asReal(); - vectord.mdV[VY] = floaterp->childGetValue("val_spinner_2").asReal(); - vectord.mdV[VZ] = floaterp->childGetValue("val_spinner_3").asReal(); + vectord.mdV[VX] = childGetValue("val_spinner_1").asReal(); + vectord.mdV[VY] = childGetValue("val_spinner_2").asReal(); + vectord.mdV[VZ] = childGetValue("val_spinner_3").asReal(); controlp->set(vectord.getValue()); break; case TYPE_RECT: - rect.mLeft = floaterp->childGetValue("val_spinner_1").asInteger(); - rect.mRight = floaterp->childGetValue("val_spinner_2").asInteger(); - rect.mBottom = floaterp->childGetValue("val_spinner_3").asInteger(); - rect.mTop = floaterp->childGetValue("val_spinner_4").asInteger(); + rect.mLeft = childGetValue("val_spinner_1").asInteger(); + rect.mRight = childGetValue("val_spinner_2").asInteger(); + rect.mBottom = childGetValue("val_spinner_3").asInteger(); + rect.mTop = childGetValue("val_spinner_4").asInteger(); controlp->set(rect.getValue()); break; case TYPE_COL4: - col3.setValue(floaterp->childGetValue("color_swatch")); - col4 = LLColor4(col3, (F32)floaterp->childGetValue("val_spinner_4").asReal()); + col3.setValue(childGetValue("val_color_swatch")); + col4 = LLColor4(col3, (F32)childGetValue("val_spinner_4").asReal()); controlp->set(col4.getValue()); break; case TYPE_COL3: - controlp->set(floaterp->childGetValue("color_swatch")); + controlp->set(childGetValue("val_color_swatch")); //col3.mV[VRED] = (F32)floaterp->childGetValue("val_spinner_1").asC(); //col3.mV[VGREEN] = (F32)floaterp->childGetValue("val_spinner_2").asReal(); //col3.mV[VBLUE] = (F32)floaterp->childGetValue("val_spinner_3").asReal(); @@ -186,16 +176,15 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) } // static -void LLFloaterSettingsDebug::onClickDefault(void* user_data) +void LLFloaterSettingsDebug::onClickDefault() { - LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; - LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo"); + LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); if (controlp) { controlp->resetToDefault(); - floaterp->updateControl(controlp); + updateControl(controlp); } } @@ -206,7 +195,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2"); LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3"); LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4"); - LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch"); + LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("val_color_swatch"); if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) { diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index 0a98021c79..87833793af 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -52,9 +52,9 @@ public: void updateControl(LLControlVariable* control); - static void onSettingSelect(LLUICtrl* ctrl, void* user_data); - static void onCommitSettings(LLUICtrl* ctrl, void* user_data); - static void onClickDefault(void* user_data); + void onSettingSelect(LLUICtrl* ctrl); + void onCommitSettings(); + void onClickDefault(); protected: LLTextEditor* mComment; diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 62a8c0d27e..4bcf470317 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -45,6 +45,7 @@ #include "lldraghandle.h" #include "llfloaterbuildoptions.h" #include "llfloateropenobject.h" +#include "llfloaterreg.h" #include "llfocusmgr.h" #include "llmenugl.h" #include "llpanelcontents.h" @@ -952,7 +953,7 @@ void LLFloaterTools::setObjectType( LLPCode pcode ) void LLFloaterTools::onClickGridOptions(void* data) { //LLFloaterTools* floaterp = (LLFloaterTools*)data; - LLFloaterBuildOptions::showInstance(); + LLFloaterReg::showInstance("build_options"); // RN: this makes grid options dependent on build tools window //floaterp->addDependentFloater(LLFloaterBuildOptions::getInstance(), FALSE); } diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 5b17c98ef0..fd8c22b8e5 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -82,7 +82,7 @@ const S32 ICON_WIDTH = 16; const S32 TEXT_PAD = 1; const S32 ARROW_SIZE = 12; const S32 RENAME_WIDTH_PAD = 4; -const S32 RENAME_HEIGHT_PAD = 6; +const S32 RENAME_HEIGHT_PAD = 2; const S32 AUTO_OPEN_STACK_DEPTH = 16; const S32 MIN_ITEM_WIDTH_VISIBLE = ICON_WIDTH + ICON_PAD + ARROW_SIZE + TEXT_PAD + /*first few characters*/ 40; const S32 MINIMUM_RENAMER_WIDTH = 80; @@ -2560,7 +2560,7 @@ LLFolderView::LLFolderView(const Params& p) LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory.xml", gMenuHolder); if (!menu) { - menu = LLUICtrlFactory::createDummyWidget<LLMenuGL>("inventory_menu"); + menu = LLUICtrlFactory::getDefaultWidget<LLMenuGL>("inventory_menu"); } menu->setBackgroundColor(gSavedSkinSettings.getColor("MenuPopupBgColor")); mPopupMenuHandle = menu->getHandle(); @@ -2772,6 +2772,9 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen reshape( llmax(min_width, total_width), running_height ); } + // move item renamer text field to item's new position + updateRenamerPosition(); + mTargetHeight = (F32)target_height; return llround(mTargetHeight); } @@ -3620,23 +3623,8 @@ void LLFolderView::startRenamingSelectedItem( void ) { mRenameItem = item; - S32 x = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD - 1 + item->getIndentation(); - S32 y = llfloor(item->getRect().getHeight()-sFont->getLineHeight()-2); - item->localPointToScreen( x, y, &x, &y ); - screenPointToLocal( x, y, &x, &y ); - mRenamer->setOrigin( x, y ); - - S32 scroller_height = 0; - S32 scroller_width = gViewerWindow->getWindowWidth(); - BOOL dummy_bool; - if (mScrollContainer) - { - mScrollContainer->calcVisibleSize( &scroller_width, &scroller_height, &dummy_bool, &dummy_bool); - } + updateRenamerPosition(); - S32 width = llmax(llmin(item->getRect().getWidth() - x, scroller_width - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH); - S32 height = llfloor(sFont->getLineHeight() + RENAME_HEIGHT_PAD); - mRenamer->reshape( width, height, TRUE ); mRenamer->setText(item->getName()); mRenamer->selectAll(); @@ -4386,6 +4374,31 @@ void LLFolderView::dumpSelectionInformation() llinfos << "****************************************" << llendl; } +void LLFolderView::updateRenamerPosition() +{ + if(mRenameItem) + { + S32 x = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD - 1 + mRenameItem->getIndentation(); + S32 y = llfloor(mRenameItem->getRect().getHeight()-sFont->getLineHeight()-2); + mRenameItem->localPointToScreen( x, y, &x, &y ); + screenPointToLocal( x, y, &x, &y ); + mRenamer->setOrigin( x, y ); + + S32 scroller_height = 0; + S32 scroller_width = gViewerWindow->getWindowWidth(); + BOOL dummy_bool; + if (mScrollContainer) + { + mScrollContainer->calcVisibleSize( &scroller_width, &scroller_height, &dummy_bool, &dummy_bool); + } + + S32 width = llmax(llmin(mRenameItem->getRect().getWidth() - x, scroller_width - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH); + S32 height = llfloor(sFont->getLineHeight() + RENAME_HEIGHT_PAD); + mRenamer->reshape( width, height, TRUE ); + } +} + + ///---------------------------------------------------------------------------- /// Local function definitions ///---------------------------------------------------------------------------- diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 2393aa627c..848d289bb9 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -915,6 +915,9 @@ public: // DEBUG only void dumpSelectionInformation(); +private: + void updateRenamerPosition(); + protected: LLScrollContainer* mScrollContainer; // NULL if this is not a child of a scroll container. diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 4aaa7ca6cb..fac0de0f33 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -426,7 +426,9 @@ void LLLocationInputCtrl::rebuildLocationHistory(std::string filter) LLLocationHistory* lh = LLLocationHistory::getInstance(); if (filter.empty()) + { itemsp = &lh->getItems(); + } else { lh->getMatchingItems(filter, filtered_items); @@ -435,7 +437,9 @@ void LLLocationInputCtrl::rebuildLocationHistory(std::string filter) removeall(); for (LLLocationHistory::location_list_t::const_reverse_iterator it = itemsp->rbegin(); it != itemsp->rend(); it++) + { add(*it); + } } void LLLocationInputCtrl::focusTextEntry() diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 379cd48a6a..6f64aa68ad 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -68,8 +68,8 @@ public: struct NameColumn : public LLInitParam::Choice<NameColumn> { - Option<S32> column_index; - Option<std::string> column_name; + Alternative<S32> column_index; + Alternative<std::string> column_name; NameColumn() : column_name("name_column"), column_index("name_column_index", 0) diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp index 457397a379..0d25272f88 100644 --- a/indra/newview/llpanelprofileview.cpp +++ b/indra/newview/llpanelprofileview.cpp @@ -45,8 +45,8 @@ static std::string PANEL_PROFILE = "panel_profile"; static std::string PANEL_PICKS = "panel_picks"; static std::string PANEL_NOTES = "panel_notes"; -LLPanelProfileView::LLPanelProfileView(const LLPanel::Params& p) -: LLPanel(p) +LLPanelProfileView::LLPanelProfileView() +: LLPanel() { } diff --git a/indra/newview/llpanelprofileview.h b/indra/newview/llpanelprofileview.h index 4d81704522..2d89f15fe4 100644 --- a/indra/newview/llpanelprofileview.h +++ b/indra/newview/llpanelprofileview.h @@ -44,7 +44,7 @@ class LLPanelProfileView : public LLPanel friend class LLUICtrlFactory; public: - LLPanelProfileView(const LLPanel::Params& p = defaultParams()); + LLPanelProfileView(); ~LLPanelProfileView(void); diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 22e8ada2ea..eb35834dc0 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -92,15 +92,8 @@ void LLTeleportHistoryPanel::onShowOnMap() S32 index = itemp->getColumn(LIST_INDEX)->getValue().asInteger(); - const LLTeleportHistory::slurl_list_t& hist_items = mTeleportHistory->getItems(); - - LLVector3d global_pos = hist_items[index].mGlobalPos; - - if (!global_pos.isExactlyZero()) - { - LLFloaterWorldMap::getInstance()->trackLocation(global_pos); - LLFloaterReg::showInstance("world_map", "center"); - } + // teleport to existing item in history, so we don't add it again + mTeleportHistory->goToItem(index); } // virtual diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 981a843d94..8c2372ee74 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -732,7 +732,7 @@ void LLStatusBar::onClickSearch(void* data) // static void LLStatusBar::onClickStatGraph(void* data) { - LLFloaterLagMeter::showInstance(); + LLFloaterReg::showInstance("lagmeter"); } BOOL can_afford_transaction(S32 cost) diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 950d5ba20c..03c4915e66 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -39,20 +39,26 @@ #include "llcompilequeue.h" #include "llfloaterabout.h" +#include "llfloaterauction.h" #include "llfloateraddlandmark.h" #include "llfloateravatarinfo.h" +#include "llfloaterbuildoptions.h" +#include "llfloaterbump.h" #include "llfloaterchat.h" #include "llfloaterchatterbox.h" #include "llfloaterdirectory.h" #include "llfloaterjoystick.h" -#include "llfloatervoicedevicesettings.h" +#include "llfloaternotificationsconsole.h" +#include "llfloaterlagmeter.h" #include "llfloatermap.h" #include "llfloatermemleak.h" #include "llfloatermute.h" #include "llfloaterpreference.h" #include "llfloatersnapshot.h" +#include "llfloatersettingsdebug.h" #include "llfloatertools.h" #include "llfloateruipreview.h" +#include "llfloatervoicedevicesettings.h" #include "llfloaterworldmap.h" #include "llinventoryview.h" #include "llnearbychathistory.h" @@ -80,6 +86,13 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("add_landmark", "floater_add_landmark.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAddLandmark>); LLFloaterReg::add("mute", "floater_mute.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMute>); + LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>); + LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuildOptions>); + LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBump>); + LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotificationConsole>); + LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>); + LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLagMeter>); + LLFloaterReg::add("ui_preview", "floater_ui_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterUIPreview>); LLFloaterReg::add("test_widgets", "floater_test_widgets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index bdc86a3a69..826aca5e64 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -121,6 +121,7 @@ #include "llfloaterperms.h" #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" +#include "llfloaterreg.h" #include "llfloaterregioninfo.h" #include "llfloaterreporter.h" #include "llfloaterscriptdebug.h" @@ -613,7 +614,8 @@ class LLAdvancedToggleConsole : public view_listener_t #endif else if ("notifications" == console_type) { - LLFloaterNotificationConsole::showInstance(); + //LLFloaterNotificationConsole::showInstance(); + LLFloaterReg::showInstance("notifications_console"); } return true; } @@ -2145,7 +2147,8 @@ class LLAdvancedShowDebugSettings : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLFloaterSettingsDebug::showInstance(userdata); + // LLFloaterSettingsDebug::showInstance(userdata); + LLFloaterReg::showInstance("settings_debug",userdata); return true; } }; @@ -5649,7 +5652,7 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "grid options") { - LLFloaterBuildOptions::showInstance(); + LLFloaterReg::showInstance("build_options"); } else if (floater_name == "script errors") { @@ -5673,12 +5676,13 @@ class LLShowFloater : public view_listener_t { if (!gNoRender) { - LLFloaterBump::showInstance(); + //LLFloaterBump::showInstance(); + LLFloaterReg::showInstance("bumps"); } } else if (floater_name == "lag meter") { - LLFloaterLagMeter::showInstance(); + LLFloaterReg::showInstance("lagmeter"); } else if (floater_name == "buy currency") { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a62e59bc10..a05bd30600 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4395,8 +4395,8 @@ void handle_show_mean_events(void *) { return; } - - LLFloaterBump::showInstance(); + LLFloaterReg::showInstance("bumps"); + //LLFloaterBump::showInstance(); } void mean_name_callback(const LLUUID &id, const std::string& first, const std::string& last, BOOL always_false) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index cb2a8771fa..46aa284258 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2131,7 +2131,8 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) && (MASK_CONTROL & mask) && ('5' == key)) { - LLFloaterNotificationConsole::showInstance(); + //LLFloaterNotificationConsole::showInstance(); + LLFloaterReg::showInstance("notifications_console"); return TRUE; } @@ -2428,51 +2429,59 @@ void LLViewerWindow::updateUI() root_view = mRootView; } - // walk UI tree in depth-first order - LLView::tree_iterator_t end_it; - for (LLView::tree_iterator_t it = root_view->beginTree(); - it != end_it; - ++it) - { - LLView* viewp = *it; - // calculating the screen rect involves traversing the parent, so this is less than optimal - if (!viewp->getVisible() - || !viewp->calcScreenBoundingRect().pointInRect(x, y)) - { - // skip this view and all of its children - it.skipDescendants(); - continue; - } + // aggregate visible views that contain mouse cursor in display order - // if this view is mouse opaque, nothing behind it should be in mouse_hover_set - if (viewp->getMouseOpaque()) + // while the top_ctrl contains the mouse cursor, only it and its descendants will receive onMouseEnter events + if (top_ctrl && top_ctrl->calcScreenBoundingRect().pointInRect(x, y)) + { + // iterator over contents of top_ctrl, and throw into mouse_hover_set + for (LLView::tree_iterator_t it = top_ctrl->beginTree(); + it != top_ctrl->endTree(); + ++it) { - // constrain further iteration to children of this widget - it = viewp->beginTree(); + LLView* viewp = *it; + if (viewp->getVisible() + && viewp->calcScreenBoundingRect().pointInRect(x, y)) + { + // we have a view that contains the mouse, add it to the set + mouse_hover_set.insert(viewp->getHandle()); + } + else + { + // skip this view and all of its children + it.skipDescendants(); + } } - - // we have a view that contains the mouse, add it to the set - mouse_hover_set.insert(viewp->getHandle()); } - - // now do the same aggregation for the "top" ctrl, whose parent does not necessarily contain the mouse - if (top_ctrl) + else { - for (LLView::tree_iterator_t it = top_ctrl->beginTree(); - it != root_view->endTree(); + // walk UI tree in depth-first order + LLView::tree_iterator_t end_it; + for (LLView::tree_iterator_t it = root_view->beginTree(); + it != end_it; ++it) { LLView* viewp = *it; - if (!viewp->getVisible() - || !viewp->calcScreenBoundingRect().pointInRect(x, y)) + // calculating the screen rect involves traversing the parent, so this is less than optimal + if (viewp->getVisible() + && viewp->calcScreenBoundingRect().pointInRect(x, y)) + { + + // if this view is mouse opaque, nothing behind it should be in mouse_hover_set + if (viewp->getMouseOpaque()) + { + // constrain further iteration to children of this widget + it = viewp->beginTree(); + } + + // we have a view that contains the mouse, add it to the set + mouse_hover_set.insert(viewp->getHandle()); + } + else { // skip this view and all of its children it.skipDescendants(); - continue; } - - // we have a view that contains the mouse, add it to the set - mouse_hover_set.insert(viewp->getHandle()); } } @@ -2898,11 +2907,25 @@ void LLViewerWindow::updateWorldViewRect() if (!LLSideTray::instanceCreated()) return; LLRect new_world_rect = mWindowRect; + + // pull in right side of world view based on sidetray LLSideTray* sidetray = LLSideTray::getInstance(); if (sidetray->getVisible()) { new_world_rect.mRight -= llround((F32)sidetray->getTrayWidth() * mDisplayScale.mV[VX]); } + + // push top of world view below nav bar + if (LLNavigationBar::getInstance()->getVisible()) + { + LLNavigationBar* barp = LLNavigationBar::getInstance(); + LLRect nav_bar_rect; + if(barp->localRectToOtherView(barp->getLocalRect(), &nav_bar_rect, mRootView)) + { + new_world_rect.mTop = llround((F32)LLNavigationBar::getInstance()->getRect().mBottom * mDisplayScale.mV[VY]); + } + } + if (mWorldViewRect != new_world_rect) { mWorldViewRect = new_world_rect; diff --git a/indra/newview/skins/default/xui/en/floater_auction.xml b/indra/newview/skins/default/xui/en/floater_auction.xml index 21d060fdda..076332e062 100644 --- a/indra/newview/skins/default/xui/en/floater_auction.xml +++ b/indra/newview/skins/default/xui/en/floater_auction.xml @@ -29,6 +29,7 @@ top_pad="12" width="400" /> <check_box + control_name="AuctionShowFence" follows="left|bottom" height="16" initial_value="true" @@ -47,7 +48,10 @@ left_delta="0" name="snapshot_btn" top_pad="4" - width="96" /> + width="96" > + <button.commit_callback + function="ClickSnapshot" /> + </button> <button follows="left|bottom" height="20" @@ -57,5 +61,8 @@ left_pad="4" name="ok_btn" top_delta="0" - width="48" /> + width="48"> + <button.commit_callback + function="ClickOK" /> + </button> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml index 0e29046500..0012294160 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml @@ -64,17 +64,17 @@ left_delta="0" name="Edit" top_pad="4" - width="132" /> + width="50" /> <button follows="top|right" height="20" label="Find" label_selected="Find" layout="topleft" - left_pad="30" + left_pad="5" name="Find" top_delta="-1" - width="95" /> + width="62" /> <scroll_list follows="left|top|right|bottom" height="90" @@ -196,12 +196,12 @@ top="324" width="95" /> <button - follows="left|bottom" + follows="right|bottom" height="20" label="Cancel" label_selected="Cancel" layout="topleft" - left_pad="70" + right="-10" name="Cancel" top_delta="0" width="95" /> diff --git a/indra/newview/skins/default/xui/en/floater_lagmeter.xml b/indra/newview/skins/default/xui/en/floater_lagmeter.xml index ebe8df9f5e..8af4f74aa3 100644 --- a/indra/newview/skins/default/xui/en/floater_lagmeter.xml +++ b/indra/newview/skins/default/xui/en/floater_lagmeter.xml @@ -201,6 +201,7 @@ Client: </text> <text + make_visible_control="LagMeterShrunk" type="string" length="1" bottom="40" @@ -214,6 +215,7 @@ Normal </text> <text + make_visible_control="LagMeterShrunk" bottom="56" follows="left|top" height="16" @@ -248,6 +250,7 @@ Network: </text> <text + make_visible_control="LagMeterShrunk" type="string" length="1" bottom="80" @@ -261,6 +264,7 @@ Normal </text> <text + make_visible_control="LagMeterShrunk" bottom="96" follows="left|top" height="16" @@ -295,6 +299,7 @@ Server: </text> <text + make_visible_control="LagMeterShrunk" type="string" length="1" bottom="120" @@ -308,6 +313,7 @@ Normal </text> <text + make_visible_control="LagMeterShrunk" bottom="136" follows="left|top" height="16" @@ -333,5 +339,8 @@ left_delta="-317" name="minimize" top_delta="-2" - width="25" /> + width="25"> + <button.commit_callback + function="LagMeter.ClickShrink" /> + </button> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_notifications_console.xml b/indra/newview/skins/default/xui/en/floater_notifications_console.xml index 92ecb5908e..14aa12aed7 100644 --- a/indra/newview/skins/default/xui/en/floater_notifications_console.xml +++ b/indra/newview/skins/default/xui/en/floater_notifications_console.xml @@ -24,7 +24,10 @@ left_pad="3" name="add_notification" top_delta="0" - width="50" /> + width="50" > + <button.commit_callback + function="ClickAdd" /> + </button> <layout_stack bottom="495" follows="left|right|top|bottom" diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index ba28016d8e..1760d5b818 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -109,6 +109,7 @@ layout="topleft" name="web" /> <panel + class="panel_preference" filename="panel_preferences_graphics1.xml" label="Graphics" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_settings_debug.xml b/indra/newview/skins/default/xui/en/floater_settings_debug.xml index 108d0b97e8..9a73ffb1a2 100644 --- a/indra/newview/skins/default/xui/en/floater_settings_debug.xml +++ b/indra/newview/skins/default/xui/en/floater_settings_debug.xml @@ -15,7 +15,10 @@ max_chars="255" name="settings_combo" top="30" - width="200" /> + width="200"> + <combo_box.commit_callback + function="SettingSelect" /> + </combo_box> <text_editor enabled="false" height="60" @@ -41,6 +44,8 @@ <combo_box.item label="FALSE" value="" /> + <combo_box.commit_callback + function="CommitSettings" /> </combo_box> <line_editor height="20" @@ -49,14 +54,21 @@ name="val_text" top_delta="0" visible="false" - width="300" /> + width="300" > + <line_editor.commit_callback + function="CommitSettings" /> + </line_editor> <color_swatch bottom="185" can_apply_immediately="true" height="55" + name="val_color_swatch" label="Color" layout="topleft" - width="37" /> + width="37" > + <color_swatch.commit_callback + function="CommitSettings" /> + </color_swatch> <spinner height="20" label="x" @@ -66,7 +78,10 @@ name="val_spinner_1" top_delta="10" visible="false" - width="120" /> + width="120" > + <spinner.commit_callback + function="CommitSettings" /> + </spinner> <spinner height="20" label="x" @@ -76,7 +91,10 @@ name="val_spinner_2" top_delta="0" visible="false" - width="120" /> + width="120"> + <spinner.commit_callback + function="CommitSettings" /> + </spinner> <spinner height="20" label="x" @@ -86,7 +104,10 @@ name="val_spinner_3" top="160" visible="false" - width="120" /> + width="120"> + <spinner.commit_callback + function="CommitSettings" /> + </spinner> <spinner height="20" label="x" @@ -96,7 +117,10 @@ name="val_spinner_4" top_delta="0" visible="false" - width="120" /> + width="120" > + <spinner.commit_callback + function="CommitSettings" /> + </spinner> <button height="20" label="Reset to default" @@ -104,5 +128,8 @@ left="15" name="default_btn" top="190" - width="150" /> + width="150" > + <button.commit_callback + function="ClickDefault" /> + </button> </floater> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 929f857e90..8db8c8f31d 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -165,6 +165,9 @@ enabled="true" label="16:9 (Widescreen)" value="1.7777777" /> + <combo_box.commit_callback + function="setControlFalse" + parameter="FullScreenAutoDetectAspectRatio" /> </combo_box> <check_box make_invisible_control="NotFullScreen" @@ -336,7 +339,10 @@ name="QualityPerformanceSelection" show_text="false" top_delta="-1" - width="150" /> + width="150"> + <slider.commit_callback + function="Pref.QualityPerformance"/> + </slider> <check_box control_name="RenderCustomSettings" height="16" |