From b6858df0dd9fa06ec8fa56c5ba63925a790b4811 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 8 Nov 2011 13:47:08 -0800 Subject: LLHandle is now implicitly convertable to LLHandle and LLHandle can be downcast to LLHandle using the LLHandleProvider mixin --- indra/llui/llbutton.cpp | 2 +- indra/llui/llfloater.cpp | 22 +++++-------- indra/llui/llfloater.h | 11 ++----- indra/llui/llhandle.h | 67 ++++++++++++++++++++++++--------------- indra/llui/llmenugl.h | 2 +- indra/llui/llpanel.cpp | 2 -- indra/llui/llpanel.h | 3 +- indra/llui/lluictrl.cpp | 11 +++---- indra/llui/lluictrl.h | 3 +- indra/llui/llview.h | 9 +++--- indra/newview/llfloatercamera.cpp | 2 +- indra/newview/llnavigationbar.cpp | 2 +- indra/newview/lltoast.h | 4 +-- 13 files changed, 70 insertions(+), 70 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 74b8885e1f..a01dccc7ab 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -115,7 +115,7 @@ LLButton::Params::Params() LLButton::LLButton(const LLButton::Params& p) : LLUICtrl(p), - LLBadgeOwner(LLView::getHandle()), + LLBadgeOwner(getHandle()), mMouseDownFrame(0), mMouseHeldDownCount(0), mBorderEnabled( FALSE ), diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 432397d3e9..07d2e1ed5f 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -111,7 +111,6 @@ LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] = LLMultiFloater* LLFloater::sHostp = NULL; BOOL LLFloater::sQuitting = FALSE; // Flag to prevent storing visibility controls while quitting -LLFloater::handle_map_t LLFloater::sFloaterMap; LLFloaterView* gFloaterView = NULL; @@ -268,7 +267,6 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mMinimizeSignal(NULL) // mNotificationContext(NULL) { - mHandle.bind(this); // mNotificationContext = new LLFloaterNotificationContext(getHandle()); // Clicks stop here. @@ -323,9 +321,6 @@ void LLFloater::initFloater(const Params& p) // Floaters are created in the invisible state setVisible(FALSE); - // add self to handle->floater map - sFloaterMap[mHandle] = this; - if (!getParent()) { gFloaterView->addChild(this); @@ -532,8 +527,6 @@ LLFloater::~LLFloater() // correct, non-minimized positions. setMinimized( FALSE ); - sFloaterMap.erase(mHandle); - delete mDragHandle; for (S32 i = 0; i < 4; i++) { @@ -1038,7 +1031,9 @@ BOOL LLFloater::canSnapTo(const LLView* other_view) if (other_view != getParent()) { const LLFloater* other_floaterp = dynamic_cast(other_view); - if (other_floaterp && other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) + if (other_floaterp + && other_floaterp->getSnapTarget() == getHandle() + && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) { // this is a dependent that is already snapped to us, so don't snap back to it return FALSE; @@ -1677,18 +1672,17 @@ void LLFloater::onClickHelp( LLFloater* self ) LLFloater* LLFloater::getClosableFloaterFromFocus() { LLFloater* focused_floater = NULL; - - handle_map_iter_t iter; - for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter) + LLInstanceTracker::instance_iter it = beginInstances(); + LLInstanceTracker::instance_iter end_it = endInstances(); + for (; it != end_it; ++it) { - focused_floater = iter->second; - if (focused_floater->hasFocus()) + if (it->hasFocus()) { break; } } - if (iter == sFloaterMap.end()) + if (it == endInstances()) { // nothing found, return return NULL; diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 73e9c9e831..b24ae1beb9 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -83,7 +83,7 @@ namespace LLInitParam } -class LLFloater : public LLPanel +class LLFloater : public LLPanel, public LLInstanceTracker { friend class LLFloaterView; friend class LLFloaterReg; @@ -282,7 +282,7 @@ public: void clearSnapTarget() { mSnappedTo.markDead(); } LLHandle getSnapTarget() const { return mSnappedTo; } - LLHandle getHandle() const { return mHandle; } + LLHandle getHandle() const { return getDerivedHandle(); } const LLSD& getKey() { return mKey; } virtual bool matchesKey(const LLSD& key) { return mSingleInstance || KeyCompare::equate(key, mKey); } @@ -460,16 +460,9 @@ private: typedef void(*click_callback)(LLFloater*); static click_callback sButtonCallbacks[BUTTON_COUNT]; - typedef std::map, LLFloater*> handle_map_t; - typedef std::map, LLFloater*>::iterator handle_map_iter_t; - static handle_map_t sFloaterMap; - BOOL mHasBeenDraggedWhileMinimized; S32 mPreviousMinimizedBottom; S32 mPreviousMinimizedLeft; - -// LLFloaterNotificationContext* mNotificationContext; - LLRootHandle mHandle; }; diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h index 8c000eee48..c8fff72110 100644 --- a/indra/llui/llhandle.h +++ b/indra/llui/llhandle.h @@ -28,17 +28,18 @@ #define LLHANDLE_H #include "llpointer.h" +#include +#include -template class LLTombStone : public LLRefCount { public: - LLTombStone(T* target = NULL) : mTarget(target) {} + LLTombStone(void* target = NULL) : mTarget(target) {} - void setTarget(T* target) { mTarget = target; } - T* getTarget() const { return mTarget; } + void setTarget(void* target) { mTarget = target; } + void* getTarget() const { return mTarget; } private: - T* mTarget; + mutable void* mTarget; }; // LLHandles are used to refer to objects whose lifetime you do not control or influence. @@ -53,13 +54,15 @@ private: template class LLHandle { + template friend class LLHandle; + template friend class LLHandleProvider; public: LLHandle() : mTombStone(getDefaultTombStone()) {} - const LLHandle& operator =(const LLHandle& other) - { - mTombStone = other.mTombStone; - return *this; - } + + template + LLHandle(const LLHandle& other, typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) + : mTombStone(other.mTombStone) + {} bool isDead() const { @@ -73,7 +76,7 @@ public: T* get() const { - return mTombStone->getTarget(); + return reinterpret_cast(mTombStone->getTarget()); } friend bool operator== (const LLHandle& lhs, const LLHandle& rhs) @@ -94,12 +97,13 @@ public: } protected: - LLPointer > mTombStone; + LLPointer mTombStone; private: - static LLPointer >& getDefaultTombStone() + typedef T* pointer_t; + static LLPointer& getDefaultTombStone() { - static LLPointer > sDefaultTombStone = new LLTombStone; + static LLPointer sDefaultTombStone = new LLTombStone; return sDefaultTombStone; } }; @@ -108,23 +112,26 @@ template class LLRootHandle : public LLHandle { public: + typedef LLRootHandle self_t; + typedef LLHandle base_t; + LLRootHandle(T* object) { bind(object); } LLRootHandle() {}; ~LLRootHandle() { unbind(); } - // this is redundant, since a LLRootHandle *is* an LLHandle - LLHandle getHandle() { return LLHandle(*this); } + // this is redundant, since an LLRootHandle *is* an LLHandle + //LLHandle getHandle() { return LLHandle(*this); } void bind(T* object) { // unbind existing tombstone if (LLHandle::mTombStone.notNull()) { - if (LLHandle::mTombStone->getTarget() == object) return; + if (LLHandle::mTombStone->getTarget() == (void*)object) return; LLHandle::mTombStone->setTarget(NULL); } // tombstone reference counted, so no paired delete - LLHandle::mTombStone = new LLTombStone(object); + LLHandle::mTombStone = new LLTombStone((void*)object); } void unbind() @@ -142,6 +149,15 @@ private: template class LLHandleProvider { +public: + LLHandle getHandle() const + { + // perform lazy binding to avoid small tombstone allocations for handle + // providers whose handles are never referenced + mHandle.bind(static_cast(const_cast* >(this))); + return mHandle; + } + protected: typedef LLHandle handle_type_t; LLHandleProvider() @@ -149,16 +165,17 @@ protected: // provided here to enforce T deriving from LLHandleProvider } - LLHandle getHandle() - { - // perform lazy binding to avoid small tombstone allocations for handle - // providers whose handles are never referenced - mHandle.bind(static_cast(this)); - return mHandle; + template + typename LLHandle getDerivedHandle(typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) const + { + LLHandle downcast_handle; + downcast_handle.mTombStone = mHandle.mTombStone; + return downcast_handle; } + private: - LLRootHandle mHandle; + mutable LLRootHandle mHandle; }; #endif diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index bdae899933..36f3ba34b9 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -681,7 +681,7 @@ public: BOOL appendContextSubMenu(LLContextMenu *menu); - LLHandle getHandle() { mHandle.bind(this); return mHandle; } + LLHandle getHandle() { return getDerivedHandle(); } protected: BOOL mHoveredAnyItem; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index a45b617c2e..00318cec6b 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -122,8 +122,6 @@ LLPanel::LLPanel(const LLPanel::Params& p) { addBorder(p.border); } - - mPanelHandle.bind(this); } LLPanel::~LLPanel() diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index ab1c87caff..cd33938226 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -153,7 +153,7 @@ public: void setCtrlsEnabled(BOOL b); - LLHandle getHandle() const { return mPanelHandle; } + LLHandle getHandle() const { return getDerivedHandle(); } const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; } @@ -278,7 +278,6 @@ private: LLViewBorder* mBorder; LLButton* mDefaultBtn; LLUIString mLabel; - LLRootHandle mPanelHandle; typedef std::map ui_string_map_t; ui_string_map_t mUIStrings; diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 2fa260ded1..b9c843e931 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -118,7 +118,6 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel) mDoubleClickSignal(NULL), mTransparencyType(TT_DEFAULT) { - mUICtrlHandle.bind(this); } void LLUICtrl::initFromParams(const Params& p) @@ -460,7 +459,7 @@ void LLUICtrl::setControlVariable(LLControlVariable* control) if (control) { mControlVariable = control; - mControlConnection = mControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("value"))); + mControlConnection = mControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("value"))); setValue(mControlVariable->getValue()); } } @@ -491,7 +490,7 @@ void LLUICtrl::setEnabledControlVariable(LLControlVariable* control) if (control) { mEnabledControlVariable = control; - mEnabledControlConnection = mEnabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("enabled"))); + mEnabledControlConnection = mEnabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("enabled"))); setEnabled(mEnabledControlVariable->getValue().asBoolean()); } } @@ -506,7 +505,7 @@ void LLUICtrl::setDisabledControlVariable(LLControlVariable* control) if (control) { mDisabledControlVariable = control; - mDisabledControlConnection = mDisabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("disabled"))); + mDisabledControlConnection = mDisabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("disabled"))); setEnabled(!(mDisabledControlVariable->getValue().asBoolean())); } } @@ -521,7 +520,7 @@ void LLUICtrl::setMakeVisibleControlVariable(LLControlVariable* control) if (control) { mMakeVisibleControlVariable = control; - mMakeVisibleControlConnection = mMakeVisibleControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("visible"))); + mMakeVisibleControlConnection = mMakeVisibleControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("visible"))); setVisible(mMakeVisibleControlVariable->getValue().asBoolean()); } } @@ -536,7 +535,7 @@ void LLUICtrl::setMakeInvisibleControlVariable(LLControlVariable* control) if (control) { mMakeInvisibleControlVariable = control; - mMakeInvisibleControlConnection = mMakeInvisibleControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getUICtrlHandle(), std::string("invisible"))); + mMakeInvisibleControlConnection = mMakeInvisibleControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("invisible"))); setVisible(!(mMakeInvisibleControlVariable->getValue().asBoolean())); } } diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 3e055a9d06..fb2196bb16 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -223,7 +223,7 @@ public: BOOL focusLastItem(BOOL prefer_text_fields = FALSE); // Non Virtuals - LLHandle getUICtrlHandle() const { return mUICtrlHandle; } + LLHandle getHandle() const { return getDerivedHandle(); } BOOL getIsChrome() const; void setTabStop( BOOL b ); @@ -313,7 +313,6 @@ private: BOOL mRequestsFront; BOOL mTabStop; BOOL mTentative; - LLRootHandle mUICtrlHandle; ETypeTransparency mTransparencyType; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 08828e55e6..13f118abec 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -97,7 +97,11 @@ private: static std::vector sDrawContextStack; }; -class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement +class LLView +: public LLMouseHandler, // handles mouse events + public LLFocusableElement, // handles keyboard events + public LLMortician, // lazy deletion + public LLHandleProvider // passes out weak references to self { public: struct Follows : public LLInitParam::ChoiceBlock @@ -306,8 +310,6 @@ public: void popVisible() { setVisible(mLastVisible); } BOOL getLastVisible() const { return mLastVisible; } - LLHandle getHandle() { mHandle.bind(this); return mHandle; } - U32 getFollows() const { return mReshapeFlags; } BOOL followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; } BOOL followsRight() const { return mReshapeFlags & FOLLOWS_RIGHT; } @@ -606,7 +608,6 @@ private: BOOL mIsFocusRoot; BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements - LLRootHandle mHandle; BOOL mLastVisible; S32 mNextInsertionOrdinal; diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index b33dea4890..8c2dd73bd9 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -346,7 +346,7 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val) mCurrMode(CAMERA_CTRL_MODE_PAN), mPrevMode(CAMERA_CTRL_MODE_PAN) { - LLHints::registerHintTarget("view_popup", LLView::getHandle()); + LLHints::registerHintTarget("view_popup", getHandle()); mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2)); } diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index fc264db5af..12428681bd 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -318,7 +318,7 @@ BOOL LLNavigationBar::postBuild() LLTeleportHistory::getInstance()->setHistoryChangedCallback( boost::bind(&LLNavigationBar::onTeleportHistoryChanged, this)); - LLHints::registerHintTarget("nav_bar", LLView::getHandle()); + LLHints::registerHintTarget("nav_bar", getHandle()); return TRUE; } diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index 242f786bf2..380c2c391a 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -196,7 +196,7 @@ public: virtual S32 notifyParent(const LLSD& info); - LLHandle getHandle() { mHandle.bind(this); return mHandle; } + LLHandle getHandle() const { return getDerivedHandle(); } protected: void updateTransparency(); @@ -215,7 +215,7 @@ private: LLUUID mSessionID; LLNotificationPtr mNotification; - LLRootHandle mHandle; + //LLRootHandle mHandle; LLPanel* mWrapperPanel; -- cgit v1.2.3 From 7e6e3d20f334547d8cea78e8e0b37106efebe028 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 8 Nov 2011 13:48:38 -0800 Subject: added Lazy modifier to params to support recursion ChoiceBlock can now derive from another param block Params with name/value support can be assigned directly in C++ code using param = "named_value" --- indra/llxuixml/llinitparam.h | 426 +++++++++++++++++++++++++++++++---------- indra/llxuixml/llxuiparser.cpp | 258 +++++++++++++++++++------ 2 files changed, 524 insertions(+), 160 deletions(-) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 183472450d..169a724bca 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -51,7 +51,7 @@ namespace LLInitParam return a == b; } }; - + // boost function types are not comparable template struct ParamCompare @@ -74,6 +74,7 @@ namespace LLInitParam static bool equals(const Flag& a, const Flag& b) { return false; } }; + // helper functions and classes typedef ptrdiff_t param_handle_t; @@ -82,8 +83,11 @@ namespace LLInitParam template class TypeValues { + private: + struct Inaccessable{}; public: typedef std::map value_name_map_t; + typedef Inaccessable name_t; void setValueName(const std::string& key) {} std::string getValueName() const { return ""; } @@ -113,6 +117,7 @@ namespace LLInitParam { public: typedef typename std::map value_name_map_t; + typedef std::string name_t; //TODO: cache key by index to save on param block size void setValueName(const std::string& value_name) @@ -293,36 +298,7 @@ namespace LLInitParam parser_inspect_func_map_t* mParserInspectFuncs; }; - class BaseBlock; - - class Param - { - public: - // public to allow choice blocks to clear provided flag on stale choices - void setProvided(bool is_provided) { mIsProvided = is_provided; } - - protected: - bool anyProvided() const { return mIsProvided; } - - Param(BaseBlock* enclosing_block); - - // store pointer to enclosing block as offset to reduce space and allow for quick copying - BaseBlock& enclosingBlock() const - { - const U8* my_addr = reinterpret_cast(this); - // get address of enclosing BLOCK class using stored offset to enclosing BaseBlock class - return *const_cast - (reinterpret_cast - (my_addr - (ptrdiff_t)(S32)mEnclosingBlockOffset)); - } - - private: - friend class BaseBlock; - - U32 mEnclosingBlockOffset:31; - U32 mIsProvided:1; - - }; + class Param; // various callbacks and constraints associated with an individual param struct ParamDescriptor @@ -390,12 +366,91 @@ namespace LLInitParam all_params_list_t mAllParams; // all parameters, owns descriptors size_t mMaxParamOffset; EInitializationState mInitializationState; // whether or not static block data has been initialized - BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed + class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed }; class BaseBlock { public: + //TODO: implement in terms of owned_ptr + template + class Lazy + { + public: + Lazy() + : mPtr(NULL) + {} + + ~Lazy() + { + delete mPtr; + } + + Lazy(const Lazy& other) + { + if (other.mPtr) + { + mPtr = new T(*other.mPtr); + } + else + { + mPtr = NULL; + } + } + + Lazy& operator = (const Lazy& other) + { + if (other.mPtr) + { + mPtr = new T(*other.mPtr); + } + else + { + mPtr = NULL; + } + return *this; + } + + bool empty() const + { + return mPtr == NULL; + } + + void set(const T& other) + { + delete mPtr; + mPtr = new T(other); + } + + const T& get() const + { + return ensureInstance(); + } + + T& get() + { + return ensureInstance(); + } + + private: + // lazily allocate an instance of T + T* ensureInstance() const + { + if (mPtr == NULL) + { + mPtr = new T(); + } + return mPtr; + } + + private: + // if you get a compilation error with this, that means you are using a forward declared struct for T + // unfortunately, the type traits we rely on don't work with forward declared typed + //static const int dummy = sizeof(T); + + mutable T* mPtr; + }; + // "Multiple" constraint types, put here in root class to avoid ambiguity during use struct AnyAmount { @@ -511,6 +566,44 @@ namespace LLInitParam const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const; }; + template + struct ParamCompare, false > + { + static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) { return !a.empty() || !b.empty(); } + }; + + class Param + { + public: + void setProvided(bool is_provided = true) + { + mIsProvided = is_provided; + enclosingBlock().paramChanged(*this, is_provided); + } + protected: + + bool anyProvided() const { return mIsProvided; } + + Param(BaseBlock* enclosing_block); + + // store pointer to enclosing block as offset to reduce space and allow for quick copying + BaseBlock& enclosingBlock() const + { + const U8* my_addr = reinterpret_cast(this); + // get address of enclosing BLOCK class using stored offset to enclosing BaseBlock class + return *const_cast + (reinterpret_cast + (my_addr - (ptrdiff_t)(S32)mEnclosingBlockOffset)); + } + + private: + friend class BaseBlock; + + U32 mEnclosingBlockOffset:31; + U32 mIsProvided:1; + + }; + // these templates allow us to distinguish between template parameters // that derive from BaseBlock and those that don't template @@ -530,6 +623,7 @@ namespace LLInitParam { public: typedef const T& value_assignment_t; + typedef ParamValue self_t; ParamValue(): mValue() {} ParamValue(value_assignment_t other) : mValue(other) {} @@ -559,6 +653,25 @@ namespace LLInitParam return mValue; } + void operator ()(const typename NAME_VALUE_LOOKUP::name_t& name) + { + *this = name; + } + + self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name) + { + if (NAME_VALUE_LOOKUP::getValueFromName(name, mValue)) + { + setValueName(name); + } + + return *this; + } + + self_t& operator =(const self_t& other) + { + mValue = other.mValue; + } private: T mValue; @@ -571,17 +684,16 @@ namespace LLInitParam { public: typedef const T& value_assignment_t; + typedef ParamValue self_t; ParamValue() : T(), - mKeyVersion(0), mValidatedVersion(-1), mValidated(false) {} ParamValue(value_assignment_t other) : T(other), - mKeyVersion(0), mValidatedVersion(-1), mValidated(false) {} @@ -611,8 +723,25 @@ namespace LLInitParam return *this; } - S32 mKeyVersion; + void operator ()(const typename NAME_VALUE_LOOKUP::name_t& name) + { + *this = name; + } + self_t& operator =(const typename NAME_VALUE_LOOKUP::name_t& name) + { + if (NAME_VALUE_LOOKUP::getValueFromName(name, mValue)) + { + setValueName(name); + } + + return *this; + } + + self_t& operator =(const self_t& other) + { + *(static_cast(this)) = other; + } protected: mutable S32 mValidatedVersion; mutable bool mValidated; // lazy validation flag @@ -671,8 +800,7 @@ namespace LLInitParam if (parser.readValue(typed_param.getValue())) { typed_param.clearValueName(); - typed_param.setProvided(true); - typed_param.enclosingBlock().paramChanged(param, true); + typed_param.setProvided(); return true; } @@ -687,8 +815,7 @@ namespace LLInitParam if (name_value_lookup_t::getValueFromName(name, typed_param.getValue())) { typed_param.setValueName(name); - typed_param.setProvided(true); - typed_param.enclosingBlock().paramChanged(param, true); + typed_param.setProvided(); return true; } @@ -744,12 +871,22 @@ namespace LLInitParam } } + self_t& operator =(typename const name_value_lookup_t::name_t& name) + { + if (name_value_lookup_t::getValueFromName(name, getValue())) + { + setValueName(name); + setProvided(); + } + + return *this; + } + void set(value_assignment_t val, bool flag_as_provided = true) { setValue(val); param_value_t::clearValueName(); setProvided(flag_as_provided); - Param::enclosingBlock().paramChanged(*this, flag_as_provided); } protected: @@ -808,8 +945,7 @@ namespace LLInitParam if(typed_param.deserializeBlock(parser, name_stack_range, new_name)) { typed_param.clearValueName(); - typed_param.enclosingBlock().paramChanged(param, true); - typed_param.setProvided(true); + typed_param.setProvided(); return true; } @@ -822,10 +958,8 @@ namespace LLInitParam // try to parse a per type named value if (name_value_lookup_t::getValueFromName(name, typed_param.getValue())) { - typed_param.enclosingBlock().paramChanged(param, true); typed_param.setValueName(name); - typed_param.setProvided(true); - typed_param.mKeyVersion = typed_param.getLastChangeVersion(); + typed_param.setProvided(); return true; } @@ -845,7 +979,7 @@ namespace LLInitParam } std::string key = typed_param.getValueName(); - if (!key.empty() && typed_param.mKeyVersion == typed_param.getLastChangeVersion()) + if (!key.empty()) { if (!parser.writeValue(key, name_stack)) { @@ -888,19 +1022,33 @@ namespace LLInitParam // next call to isProvided() will update provision status based on validity param_value_t::mValidatedVersion = -1; setProvided(flag_as_provided); - Param::enclosingBlock().paramChanged(*this, flag_as_provided); + } + + self_t& operator =(typename const name_value_lookup_t::name_t& name) + { + if (name_value_lookup_t::getValueFromName(name, getValue())) + { + setValueName(name); + setProvided(); + } + + return *this; } // propagate changed status up to enclosing block /*virtual*/ void paramChanged(const Param& changed_param, bool user_provided) { param_value_t::paramChanged(changed_param, user_provided); - Param::enclosingBlock().paramChanged(*this, user_provided); if (user_provided) { // a child param has been explicitly changed // so *some* aspect of this block is now provided - setProvided(true); + setProvided(); + param_value_t::clearValueName(); + } + else + { + Param::enclosingBlock().paramChanged(*this, user_provided); } } @@ -917,7 +1065,6 @@ namespace LLInitParam { dst_typed_param.clearValueName(); dst_typed_param.setProvided(true); - dst_typed_param.enclosingBlock().paramChanged(dst_typed_param, true); return true; } } @@ -1004,7 +1151,7 @@ namespace LLInitParam it != end_it; ++it) { - std::string key = it->getValue(); + std::string key = it->getValueName(); name_stack.back().second = true; if(key.empty()) @@ -1013,7 +1160,7 @@ namespace LLInitParam bool value_written = parser.writeValue(*it, name_stack); if (!value_written) { - std::string calculated_key = it->calcValueName(key); + std::string calculated_key = it->calcValueName(it->getValue()); if (!parser.writeValue(calculated_key, name_stack)) { break; @@ -1043,22 +1190,31 @@ namespace LLInitParam { mValues = val; setProvided(flag_as_provided); - Param::enclosingBlock().paramChanged(*this, flag_as_provided); } - value_t& add() + param_value_t& add() { mValues.push_back(param_value_t(value_t())); - setProvided(true); - Param::enclosingBlock().paramChanged(*this, true); + Param::setProvided(); return mValues.back(); } void add(const value_t& item) { mValues.push_back(param_value_t(item)); - setProvided(true); - Param::enclosingBlock().paramChanged(*this, true); + setProvided(); + } + + void add(typename const name_value_lookup_t::name_t& name) + { + value_t value; + + // try to parse a per type named value + if (name_value_lookup_t::getValueFromName(name, value)) + { + add(value); + mValues.back().setValueName(name); + } } // implicit conversion @@ -1099,8 +1255,7 @@ namespace LLInitParam if (src_typed_param.begin() != src_typed_param.end()) { - dst_typed_param.setProvided(true); - dst_typed_param.enclosingBlock().paramChanged(dst_typed_param, true); + dst_typed_param.setProvided(); } return true; } @@ -1116,7 +1271,7 @@ namespace LLInitParam public: typedef TypedParam self_t; typedef ParamValue param_value_t; - typedef typename std::vector container_t; + typedef typename std::vector container_t; typedef const container_t& value_assignment_t; typedef VALUE_TYPE value_t; typedef NAME_VALUE_LOOKUP name_value_lookup_t; @@ -1158,8 +1313,7 @@ namespace LLInitParam // attempt to parse block... if(value.deserializeBlock(parser, name_stack_range, new_name)) { - typed_param.enclosingBlock().paramChanged(param, true); - typed_param.setProvided(true); + typed_param.setProvided(); return true; } else if(name_value_lookup_t::valueNamesExist()) @@ -1172,9 +1326,7 @@ namespace LLInitParam if (name_value_lookup_t::getValueFromName(name, value.getValue())) { typed_param.mValues.back().setValueName(name); - typed_param.mValues.back().mKeyVersion = value.getLastChangeVersion(); - typed_param.enclosingBlock().paramChanged(param, true); - typed_param.setProvided(true); + typed_param.setProvided(); return true; } @@ -1201,7 +1353,7 @@ namespace LLInitParam name_stack.back().second = true; std::string key = it->getValueName(); - if (!key.empty() && it->mKeyVersion == it->getLastChangeVersion()) + if (!key.empty()) { parser.writeValue(key, name_stack); } @@ -1224,22 +1376,31 @@ namespace LLInitParam { mValues = val; setProvided(flag_as_provided); - Param::enclosingBlock().paramChanged(*this, flag_as_provided); } - value_t& add() + param_value_t& add() { mValues.push_back(value_t()); - setProvided(true); - Param::enclosingBlock().paramChanged(*this, true); + setProvided(); return mValues.back(); } void add(const value_t& item) { mValues.push_back(item); - setProvided(true); - Param::enclosingBlock().paramChanged(*this, true); + setProvided(); + } + + void add(typename const name_value_lookup_t::name_t& name) + { + value_t value; + + // try to parse a per type named value + if (name_value_lookup_t::getValueFromName(name, value)) + { + add(value); + mValues.back().setValueName(name); + } } // implicit conversion @@ -1288,8 +1449,7 @@ namespace LLInitParam if (src_typed_param.begin() != src_typed_param.end()) { - dst_typed_param.setProvided(true); - dst_typed_param.enclosingBlock().paramChanged(dst_typed_param, true); + dst_typed_param.setProvided(); } return true; @@ -1298,24 +1458,25 @@ namespace LLInitParam container_t mValues; }; - template - class ChoiceBlock : public BaseBlock + template + class ChoiceBlock : public BASE_BLOCK { - typedef ChoiceBlock self_t; - typedef ChoiceBlock enclosing_block_t; + typedef ChoiceBlock self_t; + typedef ChoiceBlock enclosing_block_t; + typedef BASE_BLOCK base_block_t; LOG_CLASS(self_t); public: // take all provided params from other and apply to self bool overwriteFrom(const self_t& other) { - return mergeBlock(selfBlockDescriptor(), other, true); + return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, true); } // take all provided params that are not already provided, and apply to self bool fillFrom(const self_t& other) { - return mergeBlock(selfBlockDescriptor(), other, false); + return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, false); } bool mergeBlockParam(bool source_provided, bool dest_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite) @@ -1333,25 +1494,25 @@ namespace LLInitParam bool mergeBlock(BlockDescriptor& block_data, const self_t& other, bool overwrite) { mCurChoice = other.mCurChoice; - return BaseBlock::mergeBlock(selfBlockDescriptor(), other, overwrite); + return base_block_t::mergeBlock(selfBlockDescriptor(), other, overwrite); } // clear out old choice when param has changed /*virtual*/ void paramChanged(const Param& changed_param, bool user_provided) { - param_handle_t changed_param_handle = BaseBlock::getHandleFromParam(&changed_param); + param_handle_t changed_param_handle = base_block_t::getHandleFromParam(&changed_param); // if we have a new choice... if (changed_param_handle != mCurChoice) { // clear provided flag on previous choice - Param* previous_choice = BaseBlock::getParamFromHandle(mCurChoice); + Param* previous_choice = base_block_t::getParamFromHandle(mCurChoice); if (previous_choice) { previous_choice->setProvided(false); } mCurChoice = changed_param_handle; } - BaseBlock::paramChanged(changed_param, user_provided); + base_block_t::paramChanged(changed_param, user_provided); } virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); } @@ -1361,7 +1522,7 @@ namespace LLInitParam ChoiceBlock() : mCurChoice(0) { - BaseBlock::init(selfBlockDescriptor(), BaseBlock::selfBlockDescriptor(), sizeof(DERIVED_BLOCK)); + BaseBlock::init(selfBlockDescriptor(), base_block_t::selfBlockDescriptor(), sizeof(DERIVED_BLOCK)); } // Alternatives are mutually exclusive wrt other Alternatives in the same block. @@ -1447,7 +1608,7 @@ namespace LLInitParam const Param* getCurrentChoice() const { - return BaseBlock::getParamFromHandle(mCurChoice); + return base_block_t::getParamFromHandle(mCurChoice); } }; @@ -1493,6 +1654,9 @@ namespace LLInitParam typedef TypedParam >::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; + using super_t::operator(); + using super_t::operator=; + explicit Optional(const char* name = "", value_assignment_t val = defaultValue()) : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1) { @@ -1510,7 +1674,6 @@ namespace LLInitParam super_t::set(val); return static_cast(Param::enclosingBlock()); } - using super_t::operator(); }; template > @@ -1521,6 +1684,9 @@ namespace LLInitParam typedef Mandatory self_t; typedef typename super_t::value_assignment_t value_assignment_t; + using super_t::operator(); + using super_t::operator=; + // mandatory parameters require a name to be parseable explicit Mandatory(const char* name = "", value_assignment_t val = defaultValue()) : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, 1, 1) @@ -1537,7 +1703,6 @@ namespace LLInitParam super_t::set(val); return static_cast(Param::enclosingBlock()); } - using super_t::operator(); static bool validate(const Param* p) { @@ -1693,14 +1858,12 @@ namespace LLInitParam ParamValue() : block_t(), - mKeyVersion(0), mValidatedVersion(-1), mValidated(false) {} ParamValue(value_assignment_t other) : block_t(other), - mKeyVersion(0), mValidatedVersion(-1), mValidated(false) { @@ -1731,11 +1894,82 @@ namespace LLInitParam return *this; } - S32 mKeyVersion; + protected: + mutable S32 mValidatedVersion; + mutable bool mValidated; // lazy validation flag + }; + + template + class ParamValue , + TypeValues, + false> + { + public: + typedef ParamValue , TypeValues, false> self_t; + typedef const T& value_assignment_t; + + ParamValue() + : mValue(), + mValidatedVersion(-1), + mValidated(false) + {} + + ParamValue(value_assignment_t other) + : mValue(other), + mValidatedVersion(-1), + mValidated(false) + {} + + void setValue(value_assignment_t val) + { + mValue.set(val); + } + + value_assignment_t getValue() const + { + return mValue.get(); + } + + T& getValue() + { + return mValue.get(); + } + + operator value_assignment_t() const + { + return mValue.get(); + } + + value_assignment_t operator()() const + { + return mValue.get(); + } + + bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name) + { + return mValue.get().deserializeBlock(p, name_stack_range, new_name); + } + + void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const + { + if (mValue.empty()) return; + + mValue.get().serializeBlock(p, name_stack, diff_block); + } + + bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const + { + if (mValue.empty()) return false; + + return mValue.get().inspectBlock(p, name_stack, min_count, max_count); + } protected: mutable S32 mValidatedVersion; mutable bool mValidated; // lazy validation flag + + private: + BaseBlock::Lazy mValue; }; template <> @@ -1750,14 +1984,12 @@ namespace LLInitParam typedef const LLSD& value_assignment_t; ParamValue() - : mKeyVersion(0), - mValidatedVersion(-1), + : mValidatedVersion(-1), mValidated(false) {} ParamValue(value_assignment_t other) : mValue(other), - mKeyVersion(0), mValidatedVersion(-1), mValidated(false) {} @@ -1770,7 +2002,6 @@ namespace LLInitParam operator value_assignment_t() const { return mValue; } value_assignment_t operator()() const { return mValue; } - S32 mKeyVersion; // block param interface bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); @@ -1812,7 +2043,6 @@ namespace LLInitParam CustomParamValue(const T& value = T()) : mValue(value), mValueAge(VALUE_AUTHORITATIVE), - mKeyVersion(0), mValidatedVersion(-1), mValidated(false) {} @@ -1966,8 +2196,6 @@ namespace LLInitParam return getValue(); } - S32 mKeyVersion; - protected: // use this from within updateValueFromBlock() to set the value without making it authoritative diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 878f992178..cdf578113a 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -59,28 +59,26 @@ const char* NO_VALUE_MARKER = "no_value"; const S32 LINE_NUMBER_HERE = 0; -struct MaxOccur : public LLInitParam::ChoiceBlock +struct MaxOccursValues : public LLInitParam::TypeValuesHelper { - Alternative count; - Alternative unbounded; - - MaxOccur() - : unbounded("", "unbounded") - {} + using TypeValuesHelper::operator =; + typedef std::string name_t; + static void declareValues() + { + declare("unbounded", U32_MAX); + } }; struct Occurs : public LLInitParam::Block { - Optional minOccurs; - Optional maxOccurs; + Optional minOccurs; + Optional maxOccurs; + Multiple foo; Occurs() - : minOccurs("minOccurs"), - maxOccurs("maxOccurs") - { - minOccurs = 0; - maxOccurs.unbounded.choose(); - } + : minOccurs("minOccurs", 0), + maxOccurs("maxOccurs", U32_MAX) + {} }; @@ -103,18 +101,15 @@ namespace LLInitParam }; } -struct Name : public LLInitParam::Block -{ - Mandatory name; - - Name() - : name("name") - {} -}; +struct Element; +struct Group; +struct Choice; +struct Sequence; +struct Any; struct Attribute : public LLInitParam::Block { - Mandatory name; + Mandatory name; Mandatory type; Mandatory use; @@ -122,41 +117,170 @@ struct Attribute : public LLInitParam::Block : name("name"), type("type"), use("use") + {} +}; + +struct Any : public LLInitParam::Block +{ + Optional _namespace; + + Any() + : _namespace("namespace") + {} +}; + +struct All : public LLInitParam::Block +{ + Multiple> elements; + + All() + : elements("element") { + maxOccurs = 1; } }; -struct ComplexType : public LLInitParam::Block +struct Choice : public LLInitParam::ChoiceBlock +{ + Alternative> element; + Alternative> group; + Alternative> choice; + Alternative> sequence; + Alternative> any; + + Choice() + : element("element"), + group("group"), + choice("choice"), + sequence("sequence"), + any("any") + {} + +}; + +struct Sequence : public LLInitParam::ChoiceBlock +{ + Alternative> element; + Alternative> group; + Alternative> choice; + Alternative> sequence; + Alternative> any; +}; + +struct GroupContents : public LLInitParam::ChoiceBlock { - Multiple attribute; - //Multiple elements; - Optional mixed; + Alternative all; + Alternative choice; + Alternative sequence; + + GroupContents() + : all("all"), + choice("choice"), + sequence("sequence") + {} +}; + +struct Group : public LLInitParam::Block +{ + Optional name, + ref; + + Group() + : name("name"), + ref("ref") + {} +}; + +struct Restriction : public LLInitParam::Block +{ +}; + +struct Extension : public LLInitParam::Block +{ +}; + +struct SimpleContent : public LLInitParam::ChoiceBlock +{ + Alternative restriction; + Alternative extension; + + SimpleContent() + : restriction("restriction"), + extension("extension") + {} +}; + +struct SimpleType : public LLInitParam::Block +{ + // TODO +}; + +struct ComplexContent : public LLInitParam::Block +{ + Optional mixed; + + ComplexContent() + : mixed("mixed", true) + {} +}; + +struct ComplexTypeContents : public LLInitParam::ChoiceBlock +{ + Alternative simple_content; + Alternative complex_content; + Alternative group; + Alternative all; + Alternative choice; + Alternative sequence; + + ComplexTypeContents() + : simple_content("simpleContent"), + complex_content("complexContent"), + group("group"), + all("all"), + choice("choice"), + sequence("sequence") + {} +}; + +struct ComplexType : public LLInitParam::Block +{ + Optional name; + Optional mixed; + + Multiple attribute; + Multiple> elements; ComplexType() - : attribute("xs:attribute"), - //elements("xs:element"), + : name("name"), + attribute("xs:attribute"), + elements("xs:element"), mixed("mixed") { - mixed = true; } }; -struct Element : public LLInitParam::Block +struct ElementContents : public LLInitParam::ChoiceBlock { - Mandatory complexType; - Mandatory name; + Alternative simpleType; + Alternative complexType; - Element() - : complexType("xs:complexType") + ElementContents() + : simpleType("simpleType"), + complexType("complexType") {} }; -struct Elements : public LLInitParam::Block +struct Element : public LLInitParam::Block { - Multiple elements; + Optional name, + ref, + type; - Elements() - : elements("xs:element") + Element() + : name("xs:name"), + ref("xs:ref"), + type("xs:type") {} }; @@ -164,28 +288,32 @@ struct Schema : public LLInitParam::Block { private: Mandatory targetNamespace, - xmlns; + xmlns, + xs; public: Optional attributeFormDefault, - elementFormDefault, - xs; + elementFormDefault; - Optional elements; + Mandatory root_element; void setNameSpace(const std::string& ns) {targetNamespace = ns; xmlns = ns;} - Schema() + Schema(const std::string& ns = LLStringUtil::null) : attributeFormDefault("attributeFormDefault"), elementFormDefault("elementFormDefault"), xs("xmlns:xs"), targetNamespace("targetNamespace"), xmlns("xmlns"), - elements("xs:choice") + root_element("xs:element") { attributeFormDefault = "unqualified"; elementFormDefault = "qualified"; xs = "http://www.w3.org/2001/XMLSchema"; + if (!ns.empty()) + { + setNameSpace(ns); + }; } }; @@ -214,22 +342,30 @@ LLXSDWriter::LLXSDWriter() void LLXSDWriter::writeXSD(const std::string& type_name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace) { + Schema schema(xml_namespace); + + schema.root_element.name = type_name; + Choice& choice = schema.root_element.complexType.choice; + + choice.minOccurs = 0; + choice.maxOccurs = "unbounded"; + mSchemaNode = node; - node->setName("xs:schema"); - node->createChild("attributeFormDefault", true)->setStringValue("unqualified"); - node->createChild("elementFormDefault", true)->setStringValue("qualified"); - node->createChild("targetNamespace", true)->setStringValue(xml_namespace); - node->createChild("xmlns:xs", true)->setStringValue("http://www.w3.org/2001/XMLSchema"); - node->createChild("xmlns", true)->setStringValue(xml_namespace); - - node = node->createChild("xs:complexType", false); - node->createChild("name", true)->setStringValue(type_name); - node->createChild("mixed", true)->setStringValue("true"); - - mAttributeNode = node; - mElementNode = node->createChild("xs:choice", false); - mElementNode->createChild("minOccurs", true)->setStringValue("0"); - mElementNode->createChild("maxOccurs", true)->setStringValue("unbounded"); + //node->setName("xs:schema"); + //node->createChild("attributeFormDefault", true)->setStringValue("unqualified"); + //node->createChild("elementFormDefault", true)->setStringValue("qualified"); + //node->createChild("targetNamespace", true)->setStringValue(xml_namespace); + //node->createChild("xmlns:xs", true)->setStringValue("http://www.w3.org/2001/XMLSchema"); + //node->createChild("xmlns", true)->setStringValue(xml_namespace); + + //node = node->createChild("xs:complexType", false); + //node->createChild("name", true)->setStringValue(type_name); + //node->createChild("mixed", true)->setStringValue("true"); + + //mAttributeNode = node; + //mElementNode = node->createChild("xs:choice", false); + //mElementNode->createChild("minOccurs", true)->setStringValue("0"); + //mElementNode->createChild("maxOccurs", true)->setStringValue("unbounded"); block.inspectBlock(*this); // duplicate element choices -- cgit v1.2.3 From 0c9d8d917a4281e2dea7fa2044e86735caca2aa9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 10 Nov 2011 16:02:57 -0800 Subject: fixed build fixed handle downcast not initiating handle --- indra/llui/llhandle.h | 2 +- indra/llxuixml/llinitparam.h | 2 ++ indra/newview/llfloaterwebcontent.cpp | 4 ++-- indra/newview/llfloaterwebcontent.h | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h index c8fff72110..e6390ee599 100644 --- a/indra/llui/llhandle.h +++ b/indra/llui/llhandle.h @@ -169,7 +169,7 @@ protected: typename LLHandle getDerivedHandle(typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) const { LLHandle downcast_handle; - downcast_handle.mTombStone = mHandle.mTombStone; + downcast_handle.mTombStone = getHandle().mTombStone; return downcast_handle; } diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 169a724bca..f5f6876736 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -671,6 +671,7 @@ namespace LLInitParam self_t& operator =(const self_t& other) { mValue = other.mValue; + return *this; } private: @@ -741,6 +742,7 @@ namespace LLInitParam self_t& operator =(const self_t& other) { *(static_cast(this)) = other; + return *this; } protected: mutable S32 mValidatedVersion; diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index f410c31f44..d6db7aa6ad 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -167,7 +167,7 @@ LLFloater* LLFloaterWebContent::create( Params p) //static void LLFloaterWebContent::closeRequest(const std::string &uuid) { - LLFloaterWebContent* floaterp = getInstance(uuid); + LLFloaterWebContent* floaterp = instance_tracker_t::getInstance(uuid); if (floaterp) { floaterp->closeFloater(false); @@ -177,7 +177,7 @@ void LLFloaterWebContent::closeRequest(const std::string &uuid) //static void LLFloaterWebContent::geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height) { - LLFloaterWebContent* floaterp = getInstance(uuid); + LLFloaterWebContent* floaterp = instance_tracker_t::getInstance(uuid); if (floaterp) { floaterp->geometryChanged(x, y, width, height); diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index 6fc66d1ad8..9d90306a9c 100644 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -43,6 +43,7 @@ class LLFloaterWebContent : public LLInstanceTracker { public: + typedef LLInstanceTracker instance_tracker_t; LOG_CLASS(LLFloaterWebContent); struct _Params : public LLInitParam::Block<_Params> -- cgit v1.2.3 From 7d78c63c05579f72dc6998913245d793a2fbd87c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 10 Nov 2011 17:10:47 -0800 Subject: EXP-1504 : Allow opening of tab in tab containers when drag and dropping things. Added new param to LLButton to handle this (off by default). Refactor lltabcontainer code a bit while at it. --- indra/llui/llbutton.cpp | 28 +++++++++++++ indra/llui/llbutton.h | 7 ++++ indra/llui/lltabcontainer.cpp | 94 ++++++++++++++----------------------------- 3 files changed, 65 insertions(+), 64 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 74b8885e1f..be657dbb9b 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -104,6 +104,7 @@ LLButton::Params::Params() use_draw_context_alpha("use_draw_context_alpha", true), badge("badge"), handle_right_mouse("handle_right_mouse"), + click_on_drag_and_drop("click_on_drag_and_drop", false), held_down_delay("held_down_delay"), button_flash_count("button_flash_count"), button_flash_rate("button_flash_rate") @@ -171,6 +172,7 @@ LLButton::LLButton(const LLButton::Params& p) mHeldDownSignal(NULL), mUseDrawContextAlpha(p.use_draw_context_alpha), mHandleRightMouse(p.handle_right_mouse), + mClickOnDragAndDrop(p.click_on_drag_and_drop), // if true, hovering on button while dragging -> click mButtonFlashCount(p.button_flash_count), mButtonFlashRate(p.button_flash_rate) { @@ -1240,3 +1242,29 @@ BOOL LLButton::handleDoubleClick(S32 x, S32 y, MASK mask) // just treat a double click as a second click return handleMouseDown(x, y, mask); } + +// virtual +BOOL LLButton::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) +{ + const F32 CLICK_ON_DAD_DELAY_TIME = 0.5f; + if (mClickOnDragAndDrop) + { + // In that case, though the button doesn't really handles drops, it'll "click" if hovering on it + // while dragging something. That allows for instance drilling into tabbed containers. + // Note: we use the same timer as mouse down just as convenience and to avoid duplication. + if (mMouseDownTimer.getStarted()) + { + if (mMouseDownTimer.getElapsedTimeF32() > CLICK_ON_DAD_DELAY_TIME ) + { + onCommit(); + mMouseDownTimer.stop(); + } + } + else + { + mMouseDownTimer.start(); + } + } + // The true DaD effect is handled at the View level if any. + return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip); +} diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index deaa0823c6..47aa675c5e 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -132,6 +132,7 @@ public: Optional badge; Optional handle_right_mouse; + Optional click_on_drag_and_drop; Optional button_flash_count; Optional button_flash_rate; @@ -159,6 +160,11 @@ public: virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); virtual void draw(); /*virtual*/ BOOL postBuild(); @@ -376,6 +382,7 @@ protected: LLFrameTimer mFlashingTimer; bool mHandleRightMouse; + bool mClickOnDragAndDrop; }; // Build time optimization, generate once in .cpp file diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index ad1f3c504d..3b2751248b 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1025,85 +1025,51 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) } else { + LLButton::Params& p = (mCustomIconCtrlUsed ? custom_btn_params : normal_btn_params); + + p.rect(btn_rect); + p.font(mFont); + p.font_halign = mFontHalign; + p.label(trimmed_label); + p.click_callback.function(boost::bind(&LLTabContainer::onTabBtn, this, _2, child)); + if (indent) + { + p.pad_left(indent); + } + p.pad_bottom( mLabelPadBottom ); + p.scale_image(true); + p.tab_stop(false); + p.label_shadow(false); + p.follows.flags = FOLLOWS_LEFT; + p.click_on_drag_and_drop(true); + if (mIsVertical) { - LLButton::Params& p = (mCustomIconCtrlUsed)? - custom_btn_params:normal_btn_params; - p.name(std::string("vert tab button")); - p.rect(btn_rect); - p.follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT); - p.click_callback.function(boost::bind(&LLTabContainer::onTabBtn, this, _2, child)); - p.font(mFont); - p.label(trimmed_label); p.image_unselected(mMiddleTabParams.tab_left_image_unselected); p.image_selected(mMiddleTabParams.tab_left_image_selected); - p.scale_image(true); - p.font_halign = mFontHalign; - p.pad_bottom( mLabelPadBottom ); - p.tab_stop(false); - p.label_shadow(false); - if (indent) - { - p.pad_left(indent); - } - - - if(mCustomIconCtrlUsed) - { - btn = LLUICtrlFactory::create(custom_btn_params); - - } - else - { - btn = LLUICtrlFactory::create(p); - } + p.follows.flags = p.follows.flags() | FOLLOWS_TOP; } else { - LLButton::Params& p = (mCustomIconCtrlUsed)? - custom_btn_params:normal_btn_params; p.name(std::string(child->getName()) + " tab"); - p.rect(btn_rect); - p.click_callback.function(boost::bind(&LLTabContainer::onTabBtn, this, _2, child)); - p.font(mFont); - p.label(trimmed_label); p.visible(false); - p.scale_image(true); p.image_unselected(tab_img); p.image_selected(tab_selected_img); - p.tab_stop(false); - p.label_shadow(false); + p.follows.flags = p.follows.flags() | (getTabPosition() == TOP ? FOLLOWS_TOP : FOLLOWS_BOTTOM); // Try to squeeze in a bit more text p.pad_left( mLabelPadLeft ); p.pad_right(2); - p.pad_bottom( mLabelPadBottom ); - p.font_halign = mFontHalign; - p.follows.flags = FOLLOWS_LEFT; - p.follows.flags = FOLLOWS_LEFT; - - if (indent) - { - p.pad_left(indent); - } - - if( getTabPosition() == TOP ) - { - p.follows.flags = p.follows.flags() | FOLLOWS_TOP; - } - else - { - p.follows.flags = p.follows.flags() | FOLLOWS_BOTTOM; - } - - if(mCustomIconCtrlUsed) - { - btn = LLUICtrlFactory::create(custom_btn_params); - } - else - { - btn = LLUICtrlFactory::create(p); - } + } + + // *TODO : It seems wrong not to use p in both cases considering the way p is initialized + if (mCustomIconCtrlUsed) + { + btn = LLUICtrlFactory::create(custom_btn_params); + } + else + { + btn = LLUICtrlFactory::create(p); } } -- cgit v1.2.3 From 2a19aa93e9ec9a6c59a11231694b1f910cf817ea Mon Sep 17 00:00:00 2001 From: callum Date: Thu, 10 Nov 2011 19:00:03 -0800 Subject: Point to improved loading overlay and turn it on always --- autobuild.xml | 8 ++++---- indra/media_plugins/webkit/media_plugin_webkit.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 49031b9f17..1b8a61acad 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1206,9 +1206,9 @@ archive hash - 7108c2443dbcf4c032305814ce65ebb7 + c006dd7f1f7a9d4cb9e2bbf311dd1973 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244065/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20111028.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244983/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20111110.tar.bz2 name darwin @@ -1230,9 +1230,9 @@ archive hash - 24048a31d7b852774dc3117acbd4a86a + 8e7bbe2ee0a281fdd9c8af0c8f75d206 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244065/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20111028.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/244983/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20111110.tar.bz2 name windows diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 13d51099a8..47f8dcd545 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -382,9 +382,9 @@ private: //lldebugs << "data url is: " << url.str() << llendl; - // loading overlay debug screen follows media debugging flag from client for now. + // always display loading overlay now #if LLQTWEBKIT_API_VERSION >= 16 - LLQtWebKit::getInstance()->enableLoadingOverlay(mBrowserWindowId, mEnableMediaPluginDebugging); + LLQtWebKit::getInstance()->enableLoadingOverlay(mBrowserWindowId, true); #else llwarns << "Ignoring enableLoadingOverlay() call (llqtwebkit version is too old)." << llendl; #endif -- cgit v1.2.3 From 1d47d3d86380bfe2ae9d42c35843f48d3abe5155 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 11 Nov 2011 14:04:44 +0200 Subject: EXP-1489 FIXED (Cannot build notifications not being shown when chat floater closed with chat log toggled open) Reason: There is a case when the chat floater is minimized while its visibility = true as well as its chat panel visibility = true. In this case notification won't be shown to the user. It will be shown in chat history which is in minimized floater. Solution: Check for a floater minimized state. --- indra/newview/llnotificationtiphandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index aa009a76fa..fb0891c4c5 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -95,7 +95,7 @@ bool LLTipHandler::processNotification(const LLSD& notify) // don't show toast if Nearby Chat is opened LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance(); - if (nearby_chat_bar->getVisible() && nearby_chat->getVisible()) + if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible()) { return false; } -- cgit v1.2.3 From fed2e3d8a8dd310ce752e8fb3c6c012d12254350 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 11 Nov 2011 16:40:22 +0200 Subject: EXP-1509 FIXED Suppress links in resident name. Fixed in the following notificatins: Remove friend, Friend Online/Offline, Friendship Accepted/Declined. --- indra/newview/skins/default/xui/da/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/de/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/en/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/es/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/fr/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/it/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/ja/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/pl/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/pt/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/ru/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/tr/notifications.xml | 10 +++++----- indra/newview/skins/default/xui/zh/notifications.xml | 10 +++++----- 12 files changed, 60 insertions(+), 60 deletions(-) diff --git a/indra/newview/skins/default/xui/da/notifications.xml b/indra/newview/skins/default/xui/da/notifications.xml index 3ccdfc036a..cf6f1ccdd9 100644 --- a/indra/newview/skins/default/xui/da/notifications.xml +++ b/indra/newview/skins/default/xui/da/notifications.xml @@ -438,7 +438,7 @@ Tilbyd venskab til [NAME]? - Ønsker du at fjerne [NAME] fra din venneliste? + Ønsker du at fjerne <nolink>[NAME]</nolink> fra din venneliste? Mindst en af genstandene har lænkede genstande der peger på den. Hvis du sletter denne genstand, vil lænkninger ikke virke mere. Det anbefales kraftigt at fjerne lænkninger først. @@ -1023,10 +1023,10 @@ Henvis til dette fra en hjemmeside for at give andre nem adgang til denne lokati Erstattet manglende tøj/kropsdele med standard. - [NAME] er logget på + <nolink>[NAME]</nolink> er logget på - [NAME] er logget af + <nolink>[NAME]</nolink> er logget af Selvom du nok er meget sød, kan du ikke tilføje dig selv som ven. @@ -1404,10 +1404,10 @@ Prøv igen om lidt. (Som udgangspunkt, vil du være i stand til at se den andens online status) - [NAME] accepterede dit tilbud om venskab. + <nolink>[NAME]</nolink> accepterede dit tilbud om venskab. - [NAME] afviste dit tilbud om venskab. + <nolink>[NAME]</nolink> afviste dit tilbud om venskab. Tilbud om venskab accepteret. diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml index fc38608df5..72e7ec8eb4 100644 --- a/indra/newview/skins/default/xui/de/notifications.xml +++ b/indra/newview/skins/default/xui/de/notifications.xml @@ -992,7 +992,7 @@ Sie sind nicht berechtigt, Land für die aktive Gruppe zu kaufen. - Möchten Sie [NAME] aus Ihrer Freundesliste entfernen? + Möchten Sie <nolink>[NAME]</nolink> aus Ihrer Freundesliste entfernen? @@ -2134,10 +2134,10 @@ Hierzu wird Ihr Webbrowser geöffnet. Betreff: [SUBJECT], Nachricht: [MESSAGE] - [NAME] ist online + <nolink>[NAME]</nolink> ist online - [NAME] ist offline + <nolink>[NAME]</nolink> ist offline Obwohl Sie ein sehr netter Mensch sind, können Sie sich nicht selbst als Freund hinzufügen. @@ -2532,10 +2532,10 @@ Versuchen Sie es in einigen Minuten erneut. - [NAME] hat Ihr Freundschaftsangebot akzeptiert. + <nolink>[NAME]</nolink> hat Ihr Freundschaftsangebot akzeptiert. - [NAME] hat Ihr Freundschaftsangebot abgelehnt. + <nolink>[NAME]</nolink> hat Ihr Freundschaftsangebot abgelehnt. Ihr Freundschaftsangebot wurde angeommen. diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index e4458f33b1..d925bf8f96 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2369,7 +2369,7 @@ Would you be my friend? name="RemoveFromFriends" type="alertmodal"> friendship -Do you want to remove [NAME] from your Friends List? +Do you want to remove <nolink>[NAME]</nolink> from your Friends List? confirm friendship -[NAME] is Online +<nolink>[NAME]</nolink> is Online friendship -[NAME] is Offline +<nolink>[NAME]</nolink> is Offline friendship -[NAME] accepted your friendship offer. +<nolink>[NAME]</nolink> accepted your friendship offer. friendship -[NAME] declined your friendship offer. +<nolink>[NAME]</nolink> declined your friendship offer. - ¿Quieres eliminar a [NAME] de tu lista de amigos? + ¿Quieres eliminar a <nolink>[NAME]</nolink> de tu lista de amigos? @@ -2128,10 +2128,10 @@ Al hacerlo se iniciará el navegador web. Asunto: [SUBJECT], Mensaje: [MESSAGE] - [NAME] está conectado + <nolink>[NAME]</nolink> está conectado - [NAME] está desconectado + <nolink>[NAME]</nolink> está desconectado Aunque eres muy agradable, no puedes añadirte como amigo a ti mismo. @@ -2526,10 +2526,10 @@ Por favor, vuelve a intentarlo en unos momentos. - [NAME] ha aceptado tu oferta de amistad. + <nolink>[NAME]</nolink> ha aceptado tu oferta de amistad. - [NAME] ha rehusado tu oferta de amistad. + <nolink>[NAME]</nolink> ha rehusado tu oferta de amistad. Aceptado el ofrecimiento de amistad. diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml index 31c29029b5..18b9063c00 100644 --- a/indra/newview/skins/default/xui/fr/notifications.xml +++ b/indra/newview/skins/default/xui/fr/notifications.xml @@ -980,7 +980,7 @@ Proposer à [NAME] de devenir votre ami(e) ? - Voulez-vous supprimer [NAME] de votre liste d'amis ? + Voulez-vous supprimer <nolink>[NAME]</nolink> de votre liste d'amis ? @@ -2119,10 +2119,10 @@ Cette opération lancera votre navigateur Web. Sujet : [SUBJECT], Message : [MESSAGE] - [NAME] est en ligne + <nolink>[NAME]</nolink> est en ligne - [NAME] est hors ligne + <nolink>[NAME]</nolink> est hors ligne Même si vous êtes extrêmement sympathique, vous ne pouvez pas devenir ami avec vous-même. @@ -2518,10 +2518,10 @@ Veuillez réessayer dans quelques minutes. - [NAME] a accepté votre amitié. + <nolink>[NAME]</nolink> a accepté votre amitié. - [NAME] a refusé votre amitié. + <nolink>[NAME]</nolink> a refusé votre amitié. Amitié acceptée. diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml index e19b84912a..2db0892cd6 100644 --- a/indra/newview/skins/default/xui/it/notifications.xml +++ b/indra/newview/skins/default/xui/it/notifications.xml @@ -978,7 +978,7 @@ Offri l'amicizia a [NAME]? - Vuoi rimuovere [NAME] dalla lista dei tuoi amici? + Vuoi rimuovere <nolink>[NAME]</nolink> dalla lista dei tuoi amici? @@ -2125,10 +2125,10 @@ Verrà avviato il browser Web. Oggetto: [SUBJECT], Messaggio: [MESSAGE] - [NAME] è Online + <nolink>[NAME]</nolink> è Online - [NAME] è Offline + <nolink>[NAME]</nolink> è Offline Anche se sei molto simpatico, non puoi aggiungere te stesso all'elenco degli amici. @@ -2520,10 +2520,10 @@ Riprova tra qualche istante. - [NAME] ha accettato la tua offerta di amicizia. + <nolink>[NAME]</nolink> ha accettato la tua offerta di amicizia. - [NAME] ha rifiutato la tua offerta di amicizia. + <nolink>[NAME]</nolink> ha rifiutato la tua offerta di amicizia. Offerta di amicizia accettata. diff --git a/indra/newview/skins/default/xui/ja/notifications.xml b/indra/newview/skins/default/xui/ja/notifications.xml index 85f09b4500..7dfa6d2f7a 100644 --- a/indra/newview/skins/default/xui/ja/notifications.xml +++ b/indra/newview/skins/default/xui/ja/notifications.xml @@ -1010,7 +1010,7 @@ L$ は返金されません。 - フレンドリストから [NAME] を削除しますか? + フレンドリストから <nolink>[NAME]</nolink> を削除しますか? @@ -2167,10 +2167,10 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ 件名: [SUBJECT]、メッセージ: [MESSAGE] - [NAME] はオンライン中です + <nolink>[NAME]</nolink> はオンライン中です - [NAME] はオフライン中です + <nolink>[NAME]</nolink> はオフライン中です 残念ながら自分自身をフレンド登録することはできません。 @@ -2567,10 +2567,10 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ - [NAME]は、フレンド登録を受け入れました。 + <nolink>[NAME]</nolink>は、フレンド登録を受け入れました。 - [NAME]は、フレンド登録を断りました。 + <nolink>[NAME]</nolink>は、フレンド登録を断りました。 フレンドの登録依頼が承認されました。 diff --git a/indra/newview/skins/default/xui/pl/notifications.xml b/indra/newview/skins/default/xui/pl/notifications.xml index 7d3225ea31..e1fb6dd3f1 100644 --- a/indra/newview/skins/default/xui/pl/notifications.xml +++ b/indra/newview/skins/default/xui/pl/notifications.xml @@ -946,7 +946,7 @@ Zaproponować znajomość [NAME]? - Czy chcesz usunąć [NAME] z listy znajomych? + Czy chcesz usunąć <nolink>[NAME]</nolink> z listy znajomych? @@ -2078,10 +2078,10 @@ Zamieść go na stronie internetowej żeby umożliwić innym łatwy dostęp do t Temat: [SUBJECT], Treść: [MESSAGE] - [NAME] jest w Second Life + <nolink>[NAME]</nolink> jest w Second Life - [NAME] opuszcza Second Life + <nolink>[NAME]</nolink> opuszcza Second Life Nie możesz dodać siebie do listy znajomych. @@ -2458,10 +2458,10 @@ Spróbuj ponowanie za kilka minut. - Twoja propozycja znajomości została przyjęta przez [NAME]. + Twoja propozycja znajomości została przyjęta przez <nolink>[NAME]</nolink>. - Twoja propozycja znajomości została odrzucona przez [NAME]. + Twoja propozycja znajomości została odrzucona przez <nolink>[NAME]</nolink>. Propozycja znajomości została zaakceptowana. diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml index 4bd9f86e0f..d3547beeb3 100644 --- a/indra/newview/skins/default/xui/pt/notifications.xml +++ b/indra/newview/skins/default/xui/pt/notifications.xml @@ -973,7 +973,7 @@ Oferecer amizade para [NAME]? - Remover [NAME] da sua lista de amigos? + Remover <nolink>[NAME]</nolink> da sua lista de amigos? @@ -2109,10 +2109,10 @@ Isso abrirá o seu navegador. Assunto: [SUBJECT], Mensagem: [MESSAGE] - [NAME] está online + <nolink>[NAME]</nolink> está online - [NAME] está offline + <nolink>[NAME]</nolink> está offline Você é o máximo! Mesmo assim, não dá para adicionar a si mesmo(a) como amigo(a). @@ -2501,10 +2501,10 @@ Cada um pode ver o status do outro (definição padrão). - [NAME] aceitou seu convite de amizade. + <nolink>[NAME]</nolink> aceitou seu convite de amizade. - [NAME] recusou seu convite de amizade + <nolink>[NAME]</nolink> recusou seu convite de amizade Oferta de amizada aceita. diff --git a/indra/newview/skins/default/xui/ru/notifications.xml b/indra/newview/skins/default/xui/ru/notifications.xml index 87ae9d06dd..97b65a15eb 100644 --- a/indra/newview/skins/default/xui/ru/notifications.xml +++ b/indra/newview/skins/default/xui/ru/notifications.xml @@ -979,7 +979,7 @@ - Удалить жителя [NAME] из вашего списка друзей? + Удалить жителя <nolink>[NAME]</nolink> из вашего списка друзей? @@ -2119,10 +2119,10 @@ http://secondlife.com/download. Раздел: [SUBJECT], сообщение: [MESSAGE] - [NAME] в сети + <nolink>[NAME]</nolink> в сети - [NAME] не в сети + <nolink>[NAME]</nolink> не в сети Вы лучше всех, но нельзя добавить в друзья себя самого. @@ -2518,10 +2518,10 @@ http://secondlife.com/download. - [NAME] принял(а) ваше предложение дружить. + <nolink>[NAME]</nolink> принял(а) ваше предложение дружить. - [NAME] отклонил(а) ваше предложение дружить. + <nolink>[NAME]</nolink> отклонил(а) ваше предложение дружить. Предложение дружить принято. diff --git a/indra/newview/skins/default/xui/tr/notifications.xml b/indra/newview/skins/default/xui/tr/notifications.xml index a268c103a6..0d360bbf5f 100644 --- a/indra/newview/skins/default/xui/tr/notifications.xml +++ b/indra/newview/skins/default/xui/tr/notifications.xml @@ -979,7 +979,7 @@ Etkin grubunuz adına arazi satın almak için gerekli izne sahip değilsiniz. - [NAME] adlı kişiyi Arkadaş Listenizden çıkarmak istiyor musunuz? + <nolink>[NAME]</nolink> adlı kişiyi Arkadaş Listenizden çıkarmak istiyor musunuz? @@ -2119,10 +2119,10 @@ Bu adımda web tarayıcınızın başlatılacağına dikkat edin. Konu: [SUBJECT], İleti: [MESSAGE] - [NAME] Çevrimiçi + <nolink>[NAME]</nolink> Çevrimiçi - [NAME] Çevrimdışı + <nolink>[NAME]</nolink> Çevrimdışı Çok iyi biri olduğunuza eminiz fakat kendinizi arkadaş olarak ekleyemezsiniz. @@ -2518,10 +2518,10 @@ Lütfen biraz sonra tekrar deneyin. - [NAME] arkadaşlık teklifinizi kabul etti. + <nolink>[NAME]</nolink> arkadaşlık teklifinizi kabul etti. - [NAME] arkadaşlık teklifinizi reddetti. + <nolink>[NAME]</nolink> arkadaşlık teklifinizi reddetti. Arkadaşlık teklifi kabul edildi. diff --git a/indra/newview/skins/default/xui/zh/notifications.xml b/indra/newview/skins/default/xui/zh/notifications.xml index 2d309a2af0..17ff6288a5 100644 --- a/indra/newview/skins/default/xui/zh/notifications.xml +++ b/indra/newview/skins/default/xui/zh/notifications.xml @@ -966,7 +966,7 @@ Offer friendship to [NAME]? - Do you want to remove [NAME] from your Friends List? + Do you want to remove <nolink>[NAME]</nolink> from your Friends List? @@ -2109,10 +2109,10 @@ Link to this from a web page to give others easy access to this location, or try Topic: [SUBJECT], Message: [MESSAGE] - [NAME] 上線 + <nolink>[NAME]</nolink> 上線 - [NAME] 離線 + <nolink>[NAME]</nolink> 離線 Although you're very nice, you can't add yourself as a friend. @@ -2491,10 +2491,10 @@ Please try again in a few moments. - [NAME] accepted your friendship offer. + <nolink>[NAME]</nolink> accepted your friendship offer. - [NAME] 謝絕你的交友邀請。 + <nolink>[NAME]</nolink> 謝絕你的交友邀請。 交友邀請被接受。 -- cgit v1.2.3 From 4afb450225d83fef55bfee2f63290dcfbc3cfbec Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 11 Nov 2011 09:31:07 -0800 Subject: EXP-1504 : Move the tab opening stuff to lltabcontainer and out of llbutton. Added an xui param to allow drill through tabs. Set that param for build panel only. --- indra/llui/llbutton.cpp | 29 ------- indra/llui/llbutton.h | 7 -- indra/llui/lltabcontainer.cpp | 93 +++++++++++++--------- indra/llui/lltabcontainer.h | 6 ++ .../newview/skins/default/xui/en/floater_tools.xml | 1 + 5 files changed, 62 insertions(+), 74 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index be657dbb9b..f9e2ad8554 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -104,7 +104,6 @@ LLButton::Params::Params() use_draw_context_alpha("use_draw_context_alpha", true), badge("badge"), handle_right_mouse("handle_right_mouse"), - click_on_drag_and_drop("click_on_drag_and_drop", false), held_down_delay("held_down_delay"), button_flash_count("button_flash_count"), button_flash_rate("button_flash_rate") @@ -172,7 +171,6 @@ LLButton::LLButton(const LLButton::Params& p) mHeldDownSignal(NULL), mUseDrawContextAlpha(p.use_draw_context_alpha), mHandleRightMouse(p.handle_right_mouse), - mClickOnDragAndDrop(p.click_on_drag_and_drop), // if true, hovering on button while dragging -> click mButtonFlashCount(p.button_flash_count), mButtonFlashRate(p.button_flash_rate) { @@ -1236,35 +1234,8 @@ void LLButton::resetMouseDownTimer() mMouseDownTimer.reset(); } - BOOL LLButton::handleDoubleClick(S32 x, S32 y, MASK mask) { // just treat a double click as a second click return handleMouseDown(x, y, mask); } - -// virtual -BOOL LLButton::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) -{ - const F32 CLICK_ON_DAD_DELAY_TIME = 0.5f; - if (mClickOnDragAndDrop) - { - // In that case, though the button doesn't really handles drops, it'll "click" if hovering on it - // while dragging something. That allows for instance drilling into tabbed containers. - // Note: we use the same timer as mouse down just as convenience and to avoid duplication. - if (mMouseDownTimer.getStarted()) - { - if (mMouseDownTimer.getElapsedTimeF32() > CLICK_ON_DAD_DELAY_TIME ) - { - onCommit(); - mMouseDownTimer.stop(); - } - } - else - { - mMouseDownTimer.start(); - } - } - // The true DaD effect is handled at the View level if any. - return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip); -} diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 47aa675c5e..deaa0823c6 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -132,7 +132,6 @@ public: Optional badge; Optional handle_right_mouse; - Optional click_on_drag_and_drop; Optional button_flash_count; Optional button_flash_rate; @@ -160,11 +159,6 @@ public: virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); virtual void draw(); /*virtual*/ BOOL postBuild(); @@ -382,7 +376,6 @@ protected: LLFrameTimer mFlashingTimer; bool mHandleRightMouse; - bool mClickOnDragAndDrop; }; // Build time optimization, generate once in .cpp file diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 3b2751248b..d5f8707381 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -214,6 +214,7 @@ LLTabContainer::Params::Params() middle_tab("middle_tab"), last_tab("last_tab"), use_custom_icon_ctrl("use_custom_icon_ctrl", false), + open_tabs_on_drag_and_drop("open_tabs_on_drag_and_drop", false), tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), use_ellipses("use_ellipses"), font_halign("halign") @@ -250,6 +251,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) mMiddleTabParams(p.middle_tab), mLastTabParams(p.last_tab), mCustomIconCtrlUsed(p.use_custom_icon_ctrl), + mOpenTabsOnDragAndDrop(p.open_tabs_on_drag_and_drop), mTabIconCtrlPad(p.tab_icon_ctrl_pad), mUseTabEllipses(p.use_ellipses) { @@ -812,50 +814,62 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag { BOOL has_scroll_arrows = (getMaxScrollPos() > 0); - if( !getTabsHidden() - && mDragAndDropDelayTimer.getStarted() - && mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME ) + if(mOpenTabsOnDragAndDrop && !getTabsHidden()) { - if (has_scroll_arrows) + // In that case, we'll open the hovered tab while dragging and dropping items. + // This allows for drilling through tabs. + if (mDragAndDropDelayTimer.getStarted()) { - if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y)) + if (mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME) { - S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom; - mJumpPrevArrowBtn->handleHover(local_x, local_y, mask); - } - if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom; - mJumpNextArrowBtn->handleHover(local_x, local_y, mask); - } - if (mPrevArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mPrevArrowBtn->getRect().mLeft; - S32 local_y = y - mPrevArrowBtn->getRect().mBottom; - mPrevArrowBtn->handleHover(local_x, local_y, mask); - } - else if (mNextArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mNextArrowBtn->getRect().mLeft; - S32 local_y = y - mNextArrowBtn->getRect().mBottom; - mNextArrowBtn->handleHover(local_x, local_y, mask); - } - } + if (has_scroll_arrows) + { + if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft; + S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom; + mJumpPrevArrowBtn->handleHover(local_x, local_y, mask); + } + if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft; + S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom; + mJumpNextArrowBtn->handleHover(local_x, local_y, mask); + } + if (mPrevArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mPrevArrowBtn->getRect().mLeft; + S32 local_y = y - mPrevArrowBtn->getRect().mBottom; + mPrevArrowBtn->handleHover(local_x, local_y, mask); + } + else if (mNextArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mNextArrowBtn->getRect().mLeft; + S32 local_y = y - mNextArrowBtn->getRect().mBottom; + mNextArrowBtn->handleHover(local_x, local_y, mask); + } + } - for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) - { - LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); - S32 local_x = x - tuple->mButton->getRect().mLeft; - S32 local_y = y - tuple->mButton->getRect().mBottom; - if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) - { - tuple->mButton->onCommit(); + for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) + { + LLTabTuple* tuple = *iter; + tuple->mButton->setVisible( TRUE ); + S32 local_x = x - tuple->mButton->getRect().mLeft; + S32 local_y = y - tuple->mButton->getRect().mBottom; + if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) + { + tuple->mButton->onCommit(); + } + } + // Stop the timer whether successful or not. Don't let it run forever. mDragAndDropDelayTimer.stop(); } } + else + { + // Start a timer so we don't open tabs as soon as we hover on them + mDragAndDropDelayTimer.start(); + } } return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip); @@ -1041,7 +1055,6 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) p.tab_stop(false); p.label_shadow(false); p.follows.flags = FOLLOWS_LEFT; - p.click_on_drag_and_drop(true); if (mIsVertical) { @@ -1246,6 +1259,10 @@ void LLTabContainer::enableTabButton(S32 which, BOOL enable) { mTabList[which]->mButton->setEnabled(enable); } + // Stop the DaD timer as it might run forever + // enableTabButton() is typically called on refresh and draw when anything changed + // in the tab container so it's a good time to reset that. + mDragAndDropDelayTimer.stop(); } void LLTabContainer::deleteAllTabs() diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index eaa2fd54e0..cebace2ceb 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -104,6 +104,11 @@ public: */ Optional use_custom_icon_ctrl; + /** + * Open tabs on hover in drag and drop situations + */ + Optional open_tabs_on_drag_and_drop; + /** * Paddings for LLIconCtrl in case of LLCustomButtonIconCtrl usage(use_custom_icon_ctrl = true) */ @@ -300,6 +305,7 @@ private: TabParams mLastTabParams; bool mCustomIconCtrlUsed; + bool mOpenTabsOnDragAndDrop; S32 mTabIconCtrlPad; bool mUseTabEllipses; }; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 1808cab2a5..aa18c6e039 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -791,6 +791,7 @@ tab_min_width="40" tab_position="top" tab_height="25" + open_tabs_on_drag_and_drop="true" top="173" width="295"> -- cgit v1.2.3 From 4f1d146e19e3aef00c456efec5925043544f5a45 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 11 Nov 2011 19:36:43 +0200 Subject: EXP-1515 FIXED Web Preference radio button must be clicked twice to engage. Fixed the "Use external browser" radio group to work with its setting properly: * Specified valid boolean values ("true" and "") for the radio buttons. * Made default value of the setting boolean to ensure proper initialization. --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/skins/default/xui/en/panel_preferences_setup.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9c055bdc5a..c05754274e 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12277,7 +12277,7 @@ Type Boolean Value - 1 + 1 UseFreezeFrame diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index a7078ce2e1..4aeea8823e 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -122,7 +122,7 @@ layout="topleft" left_delta="0" name="external" - value="1" + value="true" top="0" tool_tip="Use the default system web browser for help, web links, etc. Not recommended if running full screen." width="480" /> -- cgit v1.2.3 From 267e75d8dc36386070ddb3ecebb31a7bbadd6d03 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 11 Nov 2011 11:17:44 -0800 Subject: support for assignment of named values to params --- indra/llxuixml/llinitparam.cpp | 1 + indra/llxuixml/llinitparam.h | 55 +++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 482064ed7b..8880072f06 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -478,6 +478,7 @@ namespace LLInitParam if (merge_func) { Param* paramp = getParamFromHandle((*it)->mParamHandle); + llassert(paramp->mEnclosingBlockOffset == (*it)->mParamHandle); some_param_changed |= merge_func(*paramp, *other_paramp, overwrite); } } diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index f5f6876736..ec14bc2fdc 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -671,10 +671,11 @@ namespace LLInitParam self_t& operator =(const self_t& other) { mValue = other.mValue; + static_cast(*this) = other; return *this; } - private: + protected: T mValue; }; @@ -741,7 +742,10 @@ namespace LLInitParam self_t& operator =(const self_t& other) { - *(static_cast(this)) = other; + static_cast(*this) = other; + static_cast(*this) = other; + mValidatedVersion = other.mValidatedVersion; + mValidated = other.mValidated; return *this; } protected: @@ -875,24 +879,17 @@ namespace LLInitParam self_t& operator =(typename const name_value_lookup_t::name_t& name) { - if (name_value_lookup_t::getValueFromName(name, getValue())) - { - setValueName(name); - setProvided(); - } - - return *this; + return static_cast(param_value_t::operator =(name)); } void set(value_assignment_t val, bool flag_as_provided = true) { - setValue(val); param_value_t::clearValueName(); + setValue(val); setProvided(flag_as_provided); } protected: - static bool mergeWith(Param& dst, const Param& src, bool overwrite) { const self_t& src_typed_param = static_cast(src); @@ -1026,17 +1023,6 @@ namespace LLInitParam setProvided(flag_as_provided); } - self_t& operator =(typename const name_value_lookup_t::name_t& name) - { - if (name_value_lookup_t::getValueFromName(name, getValue())) - { - setValueName(name); - setProvided(); - } - - return *this; - } - // propagate changed status up to enclosing block /*virtual*/ void paramChanged(const Param& changed_param, bool user_provided) { @@ -1239,6 +1225,12 @@ namespace LLInitParam } protected: + self_t& operator=(const self_t& other) + { + mValues = other.mValues; + return *this; + } + static bool mergeWith(Param& dst, const Param& src, bool overwrite) { const self_t& src_typed_param = static_cast(src); @@ -1432,6 +1424,11 @@ namespace LLInitParam } protected: + self_t& operator=(const self_t& other) + { + mValues = other.mValues; + return *this; + } static bool mergeWith(Param& dst, const Param& src, bool overwrite) { @@ -1540,6 +1537,8 @@ namespace LLInitParam typedef TypedParam >::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; + using super_t::param_value_t::operator =; + explicit Alternative(const char* name = "", value_assignment_t val = defaultValue()) : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1), mOriginalValue(val) @@ -1565,7 +1564,7 @@ namespace LLInitParam super_t::set(val); } - void operator=(value_assignment_t val) + void operator =(value_assignment_t val) { super_t::set(val); } @@ -1657,7 +1656,7 @@ namespace LLInitParam typedef typename super_t::value_assignment_t value_assignment_t; using super_t::operator(); - using super_t::operator=; + using super_t::param_value_t::operator =; explicit Optional(const char* name = "", value_assignment_t val = defaultValue()) : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1) @@ -1665,7 +1664,7 @@ namespace LLInitParam //#pragma message("Parsing LLInitParam::Block::Optional") } - Optional& operator=(value_assignment_t val) + Optional& operator =(value_assignment_t val) { set(val); return *this; @@ -1687,14 +1686,14 @@ namespace LLInitParam typedef typename super_t::value_assignment_t value_assignment_t; using super_t::operator(); - using super_t::operator=; + using super_t::param_value_t::operator =; // mandatory parameters require a name to be parseable explicit Mandatory(const char* name = "", value_assignment_t val = defaultValue()) : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, 1, 1) {} - Mandatory& operator=(value_assignment_t val) + Mandatory& operator =(value_assignment_t val) { set(val); return *this; @@ -1729,7 +1728,7 @@ namespace LLInitParam : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, container_t(), &validate, RANGE::minCount, RANGE::maxCount) {} - Multiple& operator=(value_assignment_t val) + Multiple& operator =(value_assignment_t val) { set(val); return *this; -- cgit v1.2.3 From e4e4977f5eab5aac24c32b569c5273c4be926cb2 Mon Sep 17 00:00:00 2001 From: callum Date: Fri, 11 Nov 2011 12:29:04 -0800 Subject: EXP-1527 FIX Debug values for windowwidth and windowheight can be set below minimum required values and EXP-1528 Launching viewer with a settings.xml file with windowwidth and windowheight set below minimum values, launches to those values not minimum window size --- indra/llwindow/llwindow.cpp | 9 ++ indra/llwindow/llwindow.h | 3 + indra/llwindow/llwindowmacosx.cpp | 206 ++++++++++++++++---------------- indra/llwindow/llwindowwin32.cpp | 4 +- indra/newview/app_settings/settings.xml | 26 +++- indra/newview/llappviewer.cpp | 14 ++- indra/newview/llviewerwindow.cpp | 14 ++- 7 files changed, 166 insertions(+), 110 deletions(-) diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index dc3a1099b1..a313885ca3 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -111,6 +111,8 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) mCursorHidden(FALSE), mBusyCount(0), mIsMouseClipping(FALSE), + mMinWindowWidth(1024), // just a sanity check - actual minimum size is stored in settings.xml + mMinWindowHeight(768), mSwapMethod(SWAP_METHOD_UNDEFINED), mHideCursorPermanent(FALSE), mFlags(flags), @@ -179,6 +181,13 @@ void *LLWindow::getMediaWindow() return getPlatformWindow(); } +// virtual +void LLWindow::setMinSize(U32 min_width, U32 min_height) +{ + mMinWindowWidth = min_width; + mMinWindowHeight = min_height; +} + //virtual void LLWindow::processMiscNativeEvents() { diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index e8a86a1880..b2c2628ec4 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -73,6 +73,7 @@ public: virtual BOOL getSize(LLCoordWindow *size) = 0; virtual BOOL setPosition(LLCoordScreen position) = 0; virtual BOOL setSize(LLCoordScreen size) = 0; + virtual void setMinSize(U32 min_width, U32 min_height); virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0; virtual BOOL setCursorPosition(LLCoordWindow position) = 0; virtual BOOL getCursorPosition(LLCoordWindow *position) = 0; @@ -188,6 +189,8 @@ protected: BOOL mHideCursorPermanent; U32 mFlags; U16 mHighSurrogate; + U32 mMinWindowWidth; + U32 mMinWindowHeight; // Handle a UTF-16 encoding unit received from keyboard. // Converting the series of UTF-16 encoding units to UTF-32 data, diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 8057506736..c48c3564b2 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llwindowmacosx.cpp * @brief Platform-dependent implementation of llwindow * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -220,10 +220,10 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, // Route them to a dummy callback structure until the end of constructor. LLWindowCallbacks null_callbacks; mCallbacks = &null_callbacks; - + // Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm). setupCocoa(); - + // Initialize the keyboard gKeyboard = new LLKeyboardMacOSX(); gKeyboard->setCallbacks(callbacks); @@ -254,10 +254,10 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, mRawKeyEvent = NULL; mFSAASamples = fsaa_samples; mForceRebuild = FALSE; - + // For reasons that aren't clear to me, LLTimers seem to be created in the "started" state. // Since the started state of this one is used to track whether the NMRec has been installed, it wants to start out in the "stopped" state. - mBounceTimer.stop(); + mBounceTimer.stop(); // Get the original aspect ratio of the main device. mOriginalAspectRatio = (double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay); @@ -270,7 +270,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, mMoveEventCampartorUPP = NewEventComparatorUPP(staticMoveEventComparator); mGlobalHandlerRef = NULL; mWindowHandlerRef = NULL; - + mDragOverrideCursor = -1; // We're not clipping yet @@ -445,7 +445,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits mFullscreenBits = -1; mFullscreenRefresh = -1; - std::string error= llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); + std::string error= llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); OSMessageBox(error, "Error", OSMB_OK); } } @@ -477,7 +477,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits kFirstWindowOfClass, true, (long)this); - + if (!mWindow) { setupFailure("Window creation error", "Error", OSMB_OK); @@ -493,7 +493,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits InstallStandardEventHandler(GetWindowEventTarget(mWindow)); InstallWindowEventHandler(mWindow, mEventHandlerUPP, GetEventTypeCount (WindowHandlerEventList), WindowHandlerEventList, (void*)this, &mWindowHandlerRef); // add event handler #if LL_OS_DRAGDROP_ENABLED - InstallTrackingHandler( dragTrackingHandler, mWindow, (void*)this ); + InstallTrackingHandler( dragTrackingHandler, mWindow, (void*)this ); InstallReceiveHandler( dragReceiveHandler, mWindow, (void*)this ); #endif // LL_OS_DRAGDROP_ENABLED } @@ -790,7 +790,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits LL_DEBUGS("GLinit") << "Keeping vertical sync" << LL_ENDL; frames_per_swap = 1; } - aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap); + aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap); //enable multi-threaded OpenGL if (sUseMultGL) @@ -803,7 +803,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits if (cgl_err != kCGLNoError ) { LL_DEBUGS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL; - } + } else { LL_DEBUGS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL; @@ -1109,7 +1109,7 @@ BOOL LLWindowMacOSX::maximize() { ZoomWindow(mWindow, inContent, true); } - + return mMaximized; } @@ -1433,7 +1433,7 @@ static void fixOrigin(void) GrafPtr port; Rect portrect; - ::GetPort(&port); + ::GetPort(&port); ::GetPortBounds(port, &portrect); if((portrect.left != 0) || (portrect.top != 0)) { @@ -1447,17 +1447,17 @@ BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) Point cursor_point; LLCoordScreen screen_pos; GrafPtr save; - + if(mWindow == NULL) return FALSE; - + ::GetPort(&save); ::SetPort(GetWindowPort(mWindow)); fixOrigin(); // gets the mouse location in local coordinates ::GetMouse(&cursor_point); - + // lldebugs << "getCursorPosition(): cursor is at " << cursor_point.h << ", " << cursor_point.v << " port origin: " << portrect.left << ", " << portrect.top << llendl; ::SetPort(save); @@ -1522,7 +1522,7 @@ F32 LLWindowMacOSX::getNativeAspectRatio() { // The constructor for this class grabs the aspect ratio of the monitor before doing any resolution // switching, and stashes it in mOriginalAspectRatio. Here, we just return it. - + if (mOverrideAspectRatio > 0.f) { return mOverrideAspectRatio; @@ -1997,7 +1997,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e if (mPreeditor && (result = GetEventParameter(event, kEventParamTextInputSendFixLen, typeLongInteger, ¶m_type, sizeof(fix_len), NULL, &fix_len)) == noErr - && typeLongInteger == param_type + && typeLongInteger == param_type && (result = GetEventParameter(event, kEventParamTextInputSendText, typeUnicodeText, ¶m_type, 0, &text_len, NULL)) == noErr && typeUnicodeText == param_type) @@ -2017,7 +2017,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e mPreeditor->markAsPreedit(location, length); } mPreeditor->resetPreedit(); - + // Receive the text from input method. U16 *const text = new U16[text_len / sizeof(U16)]; GetEventParameter(event, kEventParamTextInputSendText, typeUnicodeText, NULL, text_len, NULL, text); @@ -2056,11 +2056,11 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e GetEventParameter(event, kEventParamTextInputSendHiliteRng, typeTextRangeArray, NULL, text_range_array_size, NULL, text_range_array); - // WARNING: We assume ranges are in ascending order, + // WARNING: We assume ranges are in ascending order, // although the condition is undocumented. It seems // OK to assume this. I also assumed // the ranges are contiguous in previous versions, but I - // have heard a rumore that older versions os ATOK may + // have heard a rumore that older versions os ATOK may // return ranges with some _gap_. I don't know whether // it is true, but I'm preparing my code for the case. @@ -2124,7 +2124,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e } } break; - + case kEventTextInputUnicodeForKeyEvent: { UInt32 modifiers = 0; @@ -2133,7 +2133,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e // First, process the raw event. { EventRef rawEvent = NULL; - + // Get the original event and extract the modifier keys, so we can ignore command-key events. if (GetEventParameter(event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent) == noErr) { @@ -2142,7 +2142,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e // and call this function recursively to handle the raw key event. eventHandler (myHandler, rawEvent); - + // save the raw event until we're done processing the unicode input as well. mRawKeyEvent = rawEvent; } @@ -2173,7 +2173,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e else { MASK mask = LLWindowMacOSX::modifiersToMask(modifiers); - + llassert( actualType == typeUnicodeText ); // The result is a UTF16 buffer. Pass the characters in turn to handleUnicodeChar. @@ -2199,7 +2199,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e result = err; } break; - + case kEventTextInputOffsetToPos: { EventParamType param_type; @@ -2212,7 +2212,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e S32 preedit, preedit_length; mPreeditor->getPreeditRange(&preedit, &preedit_length); const LLWString & text = mPreeditor->getPreeditString(); - + LLCoordGL caret_coord; LLRect preedit_bounds; if (0 <= offset @@ -2226,10 +2226,10 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e qd_point.h = caret_base_coord_screen.mX; qd_point.v = caret_base_coord_screen.mY; SetEventParameter(event, kEventParamTextInputReplyPoint, typeQDPoint, sizeof(qd_point), &qd_point); - + short line_height = (short) preedit_bounds.getHeight(); SetEventParameter(event, kEventParamTextInputReplyLineHeight, typeShortInteger, sizeof(line_height), &line_height); - + result = noErr; } else @@ -2282,7 +2282,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e case kEventRawKeyRepeat: if (gDebugWindowProc) { - printf("key down, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", + printf("key down, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", (unsigned int)keyCode, charCode, (char)charCode, (unsigned int)modifiers); fflush(stdout); } @@ -2293,7 +2293,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e case kEventRawKeyUp: if (gDebugWindowProc) { - printf("key up, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", + printf("key up, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", (unsigned int)keyCode, charCode, (char)charCode, (unsigned int)modifiers); fflush(stdout); } @@ -2351,7 +2351,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e } // When the state of the 'Fn' key (the one that changes some of the mappings on a powerbook/macbook keyboard - // to an embedded keypad) changes, it may subsequently cause a key up event to be lost, which may lead to + // to an embedded keypad) changes, it may subsequently cause a key up event to be lost, which may lead to // a movement key getting "stuck" down. This is bad. // This is an OS bug -- even the GetKeys() API doesn't tell you the key has been released. // This workaround causes all held-down keys to be reset whenever the state of the Fn key changes. This isn't @@ -2361,14 +2361,14 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e if (gDebugWindowProc) printf("Fn key state change event\n"); gKeyboard->resetKeys(); } - + if (gDebugWindowProc) fflush(stdout); mLastModifiers = modifiers; result = eventNotHandledErr; break; } - + mRawKeyEvent = NULL; } break; @@ -2463,7 +2463,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e case kEventMouseButtonSecondary: mCallbacks->handleRightMouseDown(this, outCoords, mask); break; - + case kEventMouseButtonTertiary: mCallbacks->handleMiddleMouseDown(this, outCoords, mask); break; @@ -2525,7 +2525,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e case kEventClassWindow: switch(evtKind) - { + { case kEventWindowActivated: if (mTSMDocument) { @@ -2540,20 +2540,20 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e } mCallbacks->handleFocusLost(this); break; - + case kEventWindowBoundsChanging: { // This is where we would constrain move/resize to a particular screen - const S32 MIN_WIDTH = 1024; - const S32 MIN_HEIGHT = 768; - + const S32 MIN_WIDTH = mMinWindowWidth; + const S32 MIN_HEIGHT = mMinWindowHeight; + Rect currentBounds; Rect previousBounds; GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, ¤tBounds); GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &previousBounds); - + // Put an offset into window un-maximize operation since the kEventWindowGetIdealSize // event only allows the specification of size and not position. if (mMaximized) @@ -2561,7 +2561,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e short leftOffset = mPreviousWindowRect.left - currentBounds.left; currentBounds.left += leftOffset; currentBounds.right += leftOffset; - + short topOffset = mPreviousWindowRect.top - currentBounds.top; currentBounds.top += topOffset; currentBounds.bottom += topOffset; @@ -2581,7 +2581,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e { currentBounds.bottom = currentBounds.top + MIN_HEIGHT; } - + SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), ¤tBounds); result = noErr; } @@ -2592,38 +2592,38 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e // Get new window bounds Rect newBounds; GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &newBounds); - + // Get previous window bounds Rect oldBounds; GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &oldBounds); - + // Determine if the new size is larger than the old bool newBoundsLarger = ((newBounds.right - newBounds.left) >= (oldBounds.right - oldBounds.left)); newBoundsLarger &= ((newBounds.bottom - newBounds.top) >= (oldBounds.bottom - oldBounds.top)); - + // Check to see if this is a zoom event (+ button on window pane) unsigned int eventParams; GetEventParameter(event, kEventParamAttributes, typeUInt32, NULL, sizeof(int), NULL, &eventParams); bool isZoomEvent = ((eventParams & kWindowBoundsChangeZoom) != 0); - + // Maximized flag is if zoom event and increasing window size mMaximized = (isZoomEvent && newBoundsLarger); - + aglUpdateContext(mContext); - + mCallbacks->handleResize(this, newBounds.right - newBounds.left, newBounds.bottom - newBounds.top); } break; - + case kEventWindowGetIdealSize: // Only recommend a new ideal size when un-maximizing if (mMaximized == TRUE) { Point nonMaximizedSize; - + nonMaximizedSize.v = mPreviousWindowRect.bottom - mPreviousWindowRect.top; nonMaximizedSize.h = mPreviousWindowRect.right - mPreviousWindowRect.left; - + SetEventParameter(event, kEventParamDimensions, typeQDPoint, sizeof(Point), &nonMaximizedSize); result = noErr; } @@ -2678,7 +2678,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e if (mPreeditor) { switch(evtKind) - { + { case kEventTSMDocumentAccessGetLength: { @@ -2697,14 +2697,14 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e { // Return the selected range, excluding preedit. // In our preeditor, preedit and selection are exclusive, so, - // when it has a preedit, there is no selection and the + // when it has a preedit, there is no selection and the // insertion point is on the preedit that corrupses into the // beginning of the preedit when the preedit was removed. S32 preedit, preedit_length; mPreeditor->getPreeditRange(&preedit, &preedit_length); const LLWString & text = mPreeditor->getPreeditString(); - + CFRange range; if (preedit_length) { @@ -2768,7 +2768,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e memcpy(target_pointer, text_utf16.c_str() + range.location, range.length * sizeof(UniChar)); // Note that result has already been set above. - } + } } break; @@ -2815,14 +2815,14 @@ const char* cursorIDToName(int id) case UI_CURSOR_TOOLPLAY: return "UI_CURSOR_TOOLPLAY"; case UI_CURSOR_TOOLPAUSE: return "UI_CURSOR_TOOLPAUSE"; case UI_CURSOR_TOOLMEDIAOPEN: return "UI_CURSOR_TOOLMEDIAOPEN"; - case UI_CURSOR_PIPETTE: return "UI_CURSOR_PIPETTE"; + case UI_CURSOR_PIPETTE: return "UI_CURSOR_PIPETTE"; case UI_CURSOR_TOOLSIT: return "UI_CURSOR_TOOLSIT"; case UI_CURSOR_TOOLBUY: return "UI_CURSOR_TOOLBUY"; case UI_CURSOR_TOOLOPEN: return "UI_CURSOR_TOOLOPEN"; } llerrs << "cursorIDToName: unknown cursor id" << id << llendl; - + return "UI_CURSOR_ARROW"; } @@ -2838,7 +2838,7 @@ static void initPixmapCursor(int cursorid, int hotspotX, int hotspotY) fullpath += gDirUtilp->getDirDelimiter(); fullpath += cursorIDToName(cursorid); fullpath += ".tif"; - + gCursors[cursorid] = createImageCursor(fullpath.c_str(), hotspotX, hotspotY); } @@ -2846,20 +2846,20 @@ void LLWindowMacOSX::setCursor(ECursorType cursor) { OSStatus result = noErr; - if (mDragOverrideCursor != -1) + if (mDragOverrideCursor != -1) { // A drag is in progress...remember the requested cursor and we'll // restore it when it is done mCurrentCursor = cursor; return; } - + if (cursor == UI_CURSOR_ARROW && mBusyCount > 0) { cursor = UI_CURSOR_WORKING; } - + if(mCurrentCursor == cursor) return; @@ -3269,14 +3269,14 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) LLSD LLWindowMacOSX::getNativeKeyData() { LLSD result = LLSD::emptyMap(); - + if(mRawKeyEvent) { char char_code = 0; UInt32 key_code = 0; UInt32 modifiers = 0; UInt32 keyboard_type = 0; - + GetEventParameter (mRawKeyEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &char_code); GetEventParameter (mRawKeyEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code); GetEventParameter (mRawKeyEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers); @@ -3286,7 +3286,7 @@ LLSD LLWindowMacOSX::getNativeKeyData() result["key_code"] = (S32)key_code; result["modifiers"] = (S32)modifiers; result["keyboard_type"] = (S32)keyboard_type; - + #if 0 // This causes trouble for control characters -- apparently character codes less than 32 (escape, control-A, etc) // cause llsd serialization to create XML that the llsd deserializer won't parse! @@ -3295,7 +3295,7 @@ LLSD LLWindowMacOSX::getNativeKeyData() EventParamType actualType = typeUTF8Text; UInt32 actualSize = 0; char *buffer = NULL; - + err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, 0, &actualSize, NULL); if(err == noErr) { @@ -3308,7 +3308,7 @@ LLSD LLWindowMacOSX::getNativeKeyData() } delete[] buffer; } - + result["unicode"] = unicode; #endif @@ -3316,7 +3316,7 @@ LLSD LLWindowMacOSX::getNativeKeyData() lldebugs << "native key data is: " << result << llendl; - + return result; } @@ -3363,17 +3363,17 @@ void *LLWindowMacOSX::getPlatformWindow() void *LLWindowMacOSX::getMediaWindow() { - /* - Mozilla needs to be initialized with a WindowRef to function properly. + /* + Mozilla needs to be initialized with a WindowRef to function properly. (There's no good reason for this, since it shouldn't be interacting with our window in any way, but that's another issue.) - If we're in windowed mode, we _could_ hand it our actual window pointer, but a subsequent switch to fullscreen will destroy that window, + If we're in windowed mode, we _could_ hand it our actual window pointer, but a subsequent switch to fullscreen will destroy that window, which trips up Mozilla. Instead of using our actual window, we create an invisible window which will persist for the lifetime of the application and pass that to Mozilla. This satisfies its deep-seated need to latch onto a WindowRef and solves the issue with switching between fullscreen and windowed modes. Note that we will never destroy this window (by design!), but since only one will ever be created per run of the application, that's okay. */ - + if(sMediaWindow == NULL) { Rect window_rect = {100, 100, 200, 200}; @@ -3382,13 +3382,13 @@ void *LLWindowMacOSX::getMediaWindow() NULL, &window_rect, (ConstStr255Param) "\p", - false, // Create the window invisible. + false, // Create the window invisible. zoomDocProc, // Window with a grow box and a zoom box kLastWindowOfClass, // create it behind other windows false, // no close box 0); } - + return (void*)sMediaWindow; } @@ -3438,7 +3438,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) } UseInputWindow(mTSMDocument, !b); - + // Take care of old and new preeditors. if (preeditor != mPreeditor || !b) { @@ -3457,7 +3457,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) return; } mLanguageTextInputAllowed = b; - + if (b) { if (mTSMScriptCode != smRoman) @@ -3506,7 +3506,7 @@ MASK LLWindowMacOSX::modifiersToMask(SInt16 modifiers) if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; } if(modifiers & optionKey) { mask |= MASK_ALT; } return mask; -} +} #if LL_OS_DRAGDROP_ENABLED @@ -3517,53 +3517,53 @@ OSErr LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon; lldebugs << "drag tracking handler, message = " << message << llendl; - + switch(message) { case kDragTrackingInWindow: result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_TRACK); break; - + case kDragTrackingEnterHandler: result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_START_TRACKING); break; - + case kDragTrackingLeaveHandler: result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_STOP_TRACKING); break; - + default: break; } - + return result; } -OSErr LLWindowMacOSX::dragReceiveHandler(WindowRef theWindow, void * handlerRefCon, +OSErr LLWindowMacOSX::dragReceiveHandler(WindowRef theWindow, void * handlerRefCon, DragRef drag) -{ +{ LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon; return self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_DROPPED); } OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDropAction action) -{ +{ OSErr result = dragNotAcceptedErr; // overall function result OSErr err = noErr; // for local error handling - + // Get the mouse position and modifiers of this drag. SInt16 modifiers, mouseDownModifiers, mouseUpModifiers; ::GetDragModifiers(drag, &modifiers, &mouseDownModifiers, &mouseUpModifiers); MASK mask = LLWindowMacOSX::modifiersToMask(modifiers); - + Point mouse_point; // This will return the mouse point in global screen coords ::GetDragMouse(drag, &mouse_point, NULL); LLCoordScreen screen_coords(mouse_point.h, mouse_point.v); LLCoordGL gl_pos; convertCoords(screen_coords, &gl_pos); - + // Look at the pasteboard and try to extract an URL from it PasteboardRef pasteboard; if(GetDragPasteboard(drag, &pasteboard) == noErr) @@ -3571,22 +3571,22 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop ItemCount num_items = 0; // Treat an error here as an item count of 0 (void)PasteboardGetItemCount(pasteboard, &num_items); - + // Only deal with single-item drags. if(num_items == 1) { PasteboardItemID item_id = NULL; CFArrayRef flavors = NULL; CFDataRef data = NULL; - + err = PasteboardGetItemIdentifier(pasteboard, 1, &item_id); // Yes, this really is 1-based. - + // Try to extract an URL from the pasteboard if(err == noErr) { err = PasteboardCopyItemFlavors( pasteboard, item_id, &flavors); } - + if(err == noErr) { if(CFArrayContainsValue(flavors, CFRangeMake(0, CFArrayGetCount(flavors)), kUTTypeURL)) @@ -3599,9 +3599,9 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop // This is a string that might be an URL. err = PasteboardCopyItemFlavorData(pasteboard, item_id, kUTTypeUTF8PlainText, &data); } - + } - + if(flavors != NULL) { CFRelease(flavors); @@ -3612,12 +3612,12 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop std::string url; url.assign((char*)CFDataGetBytePtr(data), CFDataGetLength(data)); CFRelease(data); - + if(!url.empty()) { - LLWindowCallbacks::DragNDropResult res = + LLWindowCallbacks::DragNDropResult res = mCallbacks->handleDragNDrop(this, gl_pos, mask, action, url); - + switch (res) { case LLWindowCallbacks::DND_NONE: // No drop allowed if (action == LLWindowCallbacks::DNDA_TRACK) @@ -3652,7 +3652,7 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop // Restore the cursor ECursorType temp_cursor = mCurrentCursor; // get around the "setting the same cursor" code in setCursor() - mCurrentCursor = UI_CURSOR_COUNT; + mCurrentCursor = UI_CURSOR_COUNT; setCursor(temp_cursor); } else { @@ -3664,7 +3664,7 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop } } } - + return result; } diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index a84bd5fb08..06360d261f 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2363,8 +2363,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_GETMINMAXINFO: { LPMINMAXINFO min_max = (LPMINMAXINFO)l_param; - min_max->ptMinTrackSize.x = 1024; - min_max->ptMinTrackSize.y = 768; + min_max->ptMinTrackSize.x = window_imp->mMinWindowWidth; + min_max->ptMinTrackSize.y = window_imp->mMinWindowHeight; return 0; } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9c055bdc5a..bc6c63985f 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12927,6 +12927,17 @@ Value 0 + MinWindowHeight + + Comment + SL viewer minimum window height in pixels + Persist + 1 + Type + U32 + Value + 768 + WindowHeight Comment @@ -12934,7 +12945,7 @@ Persist 1 Type - S32 + U32 Value 738 @@ -12949,6 +12960,17 @@ Value 0 + MinWindowWidth + + Comment + SL viewer minimum window width in pixels + Persist + 1 + Type + U32 + Value + 1024 + WindowWidth Comment @@ -12956,7 +12978,7 @@ Persist 1 Type - S32 + U32 Value 1024 diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8bf4d94059..9b8f5c5961 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2860,10 +2860,22 @@ bool LLAppViewer::initWindow() // always start windowed BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth"); + + // clamp to minimum window size + U32 min_window_width=gSavedSettings.getU32("MinWindowWidth"); + U32 window_width=gSavedSettings.getU32("WindowWidth"); + if ( window_width < min_window_width ) + window_width=min_window_width; + + U32 min_window_height=gSavedSettings.getU32("MinWindowHeight"); + U32 window_height=gSavedSettings.getU32("WindowHeight"); + if ( window_height < min_window_height ) + window_height=min_window_height; + gViewerWindow = new LLViewerWindow(gWindowTitle, VIEWER_WINDOW_CLASSNAME, gSavedSettings.getS32("WindowX"), gSavedSettings.getS32("WindowY"), - gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"), + window_width, window_height, gSavedSettings.getBOOL("WindowFullScreen"), ignorePixelDepth); LL_INFOS("AppInit") << "gViewerwindow created." << LL_ENDL; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index cf21ac4e5d..140cbb4e04 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2161,8 +2161,18 @@ void LLViewerWindow::reshape(S32 width, S32 height) if (!maximized && mWindow->getSize(&window_size)) { - gSavedSettings.setS32("WindowWidth", window_size.mX); - gSavedSettings.setS32("WindowHeight", window_size.mY); + U32 min_window_width=gSavedSettings.getU32("MinWindowWidth"); + if ( window_size.mX < min_window_width ) + window_size.mX=min_window_width; + gSavedSettings.setU32("WindowWidth", window_size.mX); + + U32 min_window_height=gSavedSettings.getU32("MinWindowHeight"); + if ( window_size.mY < min_window_height ) + window_size.mY=min_window_height; + gSavedSettings.setU32("WindowHeight", window_size.mY); + + // tell the OS specific window code about min windoow size + mWindow->setMinSize(min_window_width, min_window_height); } LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width); -- cgit v1.2.3 From e926b33567f4bb27fb1ec6cb6a422b20f8d8a487 Mon Sep 17 00:00:00 2001 From: callum Date: Fri, 11 Nov 2011 16:12:33 -0800 Subject: EXP-1544 FIX Remove 'Edit Terrain' from About Land floater --- indra/newview/llfloaterland.cpp | 14 +-- indra/newview/llfloaterland.h | 1 - .../skins/default/xui/en/floater_about_land.xml | 99 ++++++++++------------ 3 files changed, 48 insertions(+), 66 deletions(-) diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 2bb1075ec4..b13a9aab88 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1806,7 +1806,6 @@ LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel) mCheckEditGroupObjects(NULL), mCheckAllObjectEntry(NULL), mCheckGroupObjectEntry(NULL), - mCheckEditLand(NULL), mCheckSafe(NULL), mCheckFly(NULL), mCheckGroupScripts(NULL), @@ -1840,10 +1839,6 @@ BOOL LLPanelLandOptions::postBuild() mCheckGroupObjectEntry = getChild( "group object entry check"); childSetCommitCallback("group object entry check", onCommitAny, this); - mCheckEditLand = getChild( "edit land check"); - childSetCommitCallback("edit land check", onCommitAny, this); - - mCheckGroupScripts = getChild( "check group scripts"); childSetCommitCallback("check group scripts", onCommitAny, this); @@ -1956,9 +1951,6 @@ void LLPanelLandOptions::refresh() mCheckGroupObjectEntry ->set(FALSE); mCheckGroupObjectEntry ->setEnabled(FALSE); - mCheckEditLand ->set(FALSE); - mCheckEditLand ->setEnabled(FALSE); - mCheckSafe ->set(FALSE); mCheckSafe ->setEnabled(FALSE); @@ -2006,10 +1998,6 @@ void LLPanelLandOptions::refresh() mCheckGroupObjectEntry ->set( parcel->getAllowGroupObjectEntry() || parcel->getAllowAllObjectEntry()); mCheckGroupObjectEntry ->setEnabled( can_change_options && !parcel->getAllowAllObjectEntry() ); - - BOOL can_change_terraform = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_EDIT); - mCheckEditLand ->set( parcel->getAllowTerraform() ); - mCheckEditLand ->setEnabled( can_change_terraform ); mCheckSafe ->set( !parcel->getAllowDamage() ); mCheckSafe ->setEnabled( can_change_options ); @@ -2235,7 +2223,7 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata) BOOL create_group_objects = self->mCheckEditGroupObjects->get() || self->mCheckEditObjects->get(); BOOL all_object_entry = self->mCheckAllObjectEntry->get(); BOOL group_object_entry = self->mCheckGroupObjectEntry->get() || self->mCheckAllObjectEntry->get(); - BOOL allow_terraform = self->mCheckEditLand->get(); + BOOL allow_terraform = false; // removed from UI so always off now - self->mCheckEditLand->get(); BOOL allow_damage = !self->mCheckSafe->get(); BOOL allow_fly = self->mCheckFly->get(); BOOL allow_landmark = TRUE; // cannot restrict landmark creation diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 6fceca1acd..4f1c10274a 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -330,7 +330,6 @@ private: LLCheckBoxCtrl* mCheckEditGroupObjects; LLCheckBoxCtrl* mCheckAllObjectEntry; LLCheckBoxCtrl* mCheckGroupObjectEntry; - LLCheckBoxCtrl* mCheckEditLand; LLCheckBoxCtrl* mCheckSafe; LLCheckBoxCtrl* mCheckFly; LLCheckBoxCtrl* mCheckGroupScripts; diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index 1c7b354221..db1856b9e7 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -1208,7 +1208,7 @@ Only large parcels can be listed in search. - See and chat with residents on this parcel + Avatars on other parcels can see Allow other Residents to: - - + Fly: + + + + left_pad="2" + width="130" /> Build: @@ -1271,7 +1274,7 @@ Only large parcels can be listed in search. follows="left|top" height="16" layout="topleft" - left="14" + left="20" name="allow_label3" width="150"> Object Entry: @@ -1298,7 +1301,7 @@ Only large parcels can be listed in search. follows="left|top" height="16" layout="topleft" - left="14" + left="20" name="allow_label4" width="150"> Run Scripts: @@ -1319,32 +1322,21 @@ Only large parcels can be listed in search. name="check group scripts" top_delta="0" width="70" /> - - Land Options: - + @@ -1361,7 +1353,7 @@ Only large parcels can be listed in search. enabled="false" height="23" layout="topleft" - left="30" + left="20" name="land category with adult" visible="false" width="140"> @@ -1426,7 +1418,7 @@ Only large parcels can be listed in search. enabled="false" height="23" layout="topleft" - left="30" + left="20" name="land category" visible="false" width="140"> @@ -1487,11 +1479,11 @@ Only large parcels can be listed in search. height="16" label="Moderate Content" layout="topleft" - left="14" + left="18" name="MatureCheck" - top="177" + top="167" label_text.valign="center" - label_text.v_pad="-5" + label_text.v_pad="-1" tool_tip=" " width="200" /> Snapshot: - Allow Residents on other parcels to: + and chat with avatars on this parcel