From 7c95af74f195c9ec4ebc0fc0264d98cd4a85be49 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 14 Sep 2011 16:30:45 -0500 Subject: SH-2243 work in progress -- application side matrix stack management --- indra/llui/llaccordionctrltab.cpp | 2 +- indra/llui/llui.cpp | 10 +++++----- indra/llui/llview.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 6afe276379..e832b6bbeb 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -973,7 +973,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child) if ( root_rect.overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect)) { - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); { LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f); diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 58ba9e05f5..b7894f5bf7 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -150,11 +150,11 @@ void gl_state_for_2d(S32 width, S32 height) F32 window_width = (F32) width;//gViewerWindow->getWindowWidth(); F32 window_height = (F32) height;//gViewerWindow->getWindowHeight(); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadIdentity(); + gGL.ortho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.loadIdentity(); stop_glerror(); } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 659a54cc6e..c16481c1c8 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1433,7 +1433,7 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr if ((childp->getVisible() && childp->getRect().isValid()) || force_draw) { - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); { LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset, 0.f); -- cgit v1.2.3 From 9ea41c8094695365bc7ea10165ffd54cda204e88 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 20 Sep 2011 00:54:37 -0500 Subject: SH-2243 No deprecated calls for the whole session. --- indra/llui/llui.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index b7894f5bf7..212672b809 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -992,10 +992,18 @@ void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha) // ...gray squares gGL.color4f( .7f, .7f, .7f, alpha ); gGL.flush(); - glPolygonStipple( checkerboard ); - LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); - gl_rect_2d(rect); + if (!LLGLSLShader::sNoFixedFunction) + { //polygon stipple is deprecated + glPolygonStipple( checkerboard ); + + LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); + gl_rect_2d(rect); + } + else + { + gl_rect_2d(rect); + } gGL.flush(); } -- cgit v1.2.3 From f49e7014ca9693d77ff265d3fc668a8b05ddf085 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 24 Sep 2011 23:29:38 -0500 Subject: SH-2244 Fix for crash when transparent water disabled (silently ignore setting when basic shaders enabled) --- indra/llui/llui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 212672b809..36f87fc597 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -534,7 +534,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex } } - gGL.getTexUnit(0)->bind(image); + gGL.getTexUnit(0)->bind(image, true); gGL.color4fv(color.mV); @@ -732,7 +732,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre LLGLSUIDefault gls_ui; - gGL.getTexUnit(0)->bind(image); + gGL.getTexUnit(0)->bind(image, true); gGL.color4fv(color.mV); @@ -785,7 +785,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); - gGL.getTexUnit(0)->bind(image); + gGL.getTexUnit(0)->bind(image, true); gGL.color4fv(color.mV); -- cgit v1.2.3 From f657f5a428e47fc9963cc4eb943062216443673f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2011 15:54:02 -0500 Subject: SH-2276 Remove some log spam to alleviate stalls on login. --- indra/llui/llnotifications.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index ffe5908a9d..3fa13d7bb0 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1640,7 +1640,7 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid) LLNotificationSet::iterator it=mItems.find(target); if (it == mItems.end()) { - llwarns << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl; + LL_DEBUGS("Notifications") << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl; return LLNotificationPtr((LLNotification*)NULL); } else -- cgit v1.2.3 From 8a8e9ccdb67e7e8a492a4fe1505407ebe128ee18 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 4 Nov 2011 16:15:05 -0500 Subject: SH-2652 Don't allocate 6000+ strings every frame --- indra/llui/lltextbase.cpp | 6 +++++- indra/llui/lltextbase.h | 2 +- indra/llui/llview.cpp | 6 ++++-- indra/llui/llview.h | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 919364be63..3b768166f1 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2518,7 +2518,11 @@ BOOL LLTextSegment::handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; } BOOL LLTextSegment::handleHover(S32 x, S32 y, MASK mask) { return FALSE; } BOOL LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; } BOOL LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; } -std::string LLTextSegment::getName() const { return ""; } +const std::string& LLTextSegment::getName() const +{ + static std::string empty_string(""); + return empty_string; +} void LLTextSegment::onMouseCaptureLost() {} void LLTextSegment::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {} void LLTextSegment::localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {} diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 384d9116fc..b699601908 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -84,7 +84,7 @@ public: /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ std::string getName() const; + /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 1644f53978..486babb0ab 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -225,9 +225,11 @@ BOOL LLView::getUseBoundingRect() const } // virtual -std::string LLView::getName() const +const std::string& LLView::getName() const { - return mName.empty() ? std::string("(no name)") : mName; + static std::string no_name("(no name)"); + + return mName.empty() ? no_name : mName; } void LLView::sendChildToFront(LLView* child) diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 08828e55e6..ec7f8e385d 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -431,7 +431,7 @@ public: /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ std::string getName() const; + /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); /*virtual*/ BOOL hasMouseCapture(); /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; -- cgit v1.2.3 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 ++++--- 10 files changed, 66 insertions(+), 66 deletions(-) (limited to 'indra/llui') 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; -- 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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') 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; } -- 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(-) (limited to 'indra/llui') 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 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 +++ 4 files changed, 61 insertions(+), 74 deletions(-) (limited to 'indra/llui') 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; }; -- cgit v1.2.3 From 98755a62bb414f23919e003101153c20d3ab3f72 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 14 Nov 2011 15:39:32 -0800 Subject: EXP-1588 WIP Floaters do not snap to edge --- indra/llui/llfloater.cpp | 66 +++++++++++++++++++++++------------------------- indra/llui/llfloater.h | 1 + 2 files changed, 32 insertions(+), 35 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 432397d3e9..05bd7fb67f 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -58,6 +58,8 @@ #include "llhelp.h" #include "llmultifloater.h" #include "llsdutil.h" +#include + // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; @@ -2163,8 +2165,15 @@ LLFloaterView::LLFloaterView (const Params& p) // By default, adjust vertical. void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) { - S32 old_width = getRect().getWidth(); - S32 old_height = getRect().getHeight(); + S32 old_right = mLastSnapRect.mRight; + S32 old_top = mLastSnapRect.mTop; + + LLView::reshape(width, height, called_from_parent); + + S32 new_right = getSnapRect().mRight; + S32 new_top = getSnapRect().mTop; + + mLastSnapRect = getSnapRect(); for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { @@ -2179,59 +2188,40 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) // Make if follow the edge it is closest to U32 follow_flags = 0x0; - if (floaterp->isMinimized()) - { - follow_flags |= (FOLLOWS_LEFT | FOLLOWS_TOP); - } - else + if (!floaterp->isMinimized()) { LLRect r = floaterp->getRect(); // Compute absolute distance from each edge of screen S32 left_offset = llabs(r.mLeft - 0); - S32 right_offset = llabs(old_width - r.mRight); + S32 right_offset = llabs(old_right - r.mRight); - S32 top_offset = llabs(old_height - r.mTop); + S32 top_offset = llabs(old_top - r.mTop); S32 bottom_offset = llabs(r.mBottom - 0); + S32 translate_x = 0; + S32 translate_y = 0; - if (left_offset < right_offset) - { - follow_flags |= FOLLOWS_LEFT; - } - else + if (left_offset > right_offset) { - follow_flags |= FOLLOWS_RIGHT; + translate_x = new_right - old_right; } - // "No vertical adjustment" usually means that the bottom of the view - // has been pushed up or down. Hence we want the floaters to follow - // the top. if (top_offset < bottom_offset) { - follow_flags |= FOLLOWS_TOP; - } - else - { - follow_flags |= FOLLOWS_BOTTOM; + translate_y = new_top - old_top; } - } - floaterp->setFollows(follow_flags); - - //RN: all dependent floaters copy follow behavior of "parent" - for(LLFloater::handle_set_iter_t dependent_it = floaterp->mDependents.begin(); - dependent_it != floaterp->mDependents.end(); ++dependent_it) - { - LLFloater* dependent_floaterp = dependent_it->get(); - if (dependent_floaterp) + floaterp->translate(translate_x, translate_y); + BOOST_FOREACH(LLHandle dependent_floater, floaterp->mDependents) { - dependent_floaterp->setFollows(follow_flags); + if (dependent_floater.get()) + { + dependent_floater.get()->translate(translate_x, translate_y); + } } } } - - LLView::reshape(width, height, called_from_parent); } @@ -2631,6 +2621,12 @@ void LLFloaterView::shiftFloaters(S32 x_offset, S32 y_offset) void LLFloaterView::refresh() { + LLRect snap_rect = getSnapRect(); + if (snap_rect != mLastSnapRect) + { + reshape(getRect().getWidth(), getRect().getHeight(), TRUE); + } + // Constrain children to be entirely on the screen for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 73e9c9e831..4e8c539144 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -537,6 +537,7 @@ public: private: void hiddenFloaterClosed(LLFloater* floater); + LLRect mLastSnapRect; LLHandle mSnapView; BOOL mFocusCycleMode; S32 mSnapOffsetBottom; -- cgit v1.2.3 From 28db67c3952f65d9c3ee23ce85851ba8ab29fc50 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 14 Nov 2011 17:16:34 -0800 Subject: Removed unused variable to fix the mac build --- indra/llui/llfloater.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 05bd7fb67f..c5d7d1db56 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2185,9 +2185,6 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) continue; } - // Make if follow the edge it is closest to - U32 follow_flags = 0x0; - if (!floaterp->isMinimized()) { LLRect r = floaterp->getRect(); -- cgit v1.2.3 From 961ce1c4e785103b696a8ec76674aee4c91fe011 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 15 Nov 2011 12:24:31 -0600 Subject: SH-2591 WIP -- fix for UI disappearing, introduces some artifacts in rotation ring, committing to debug elsewhere --- indra/llui/llui.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index c6f7e28027..33bc247987 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -955,10 +955,12 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor if( render_center ) { gGL.color4fv(center_color.mV); + gGL.diffuseColor4fv(center_color.mV); gl_deep_circle( radius, width, steps ); } else { + gGL.diffuseColor4fv(side_color.mV); gl_washer_2d(radius, radius - width, steps, side_color, side_color); gGL.translateUI(0.f, 0.f, width); gl_washer_2d(radius - width, radius, steps, side_color, side_color); -- cgit v1.2.3 From 30beda590a93aca9b2a27edb9be94665290c2e7c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Nov 2011 16:40:31 -0800 Subject: EXP-1588 FIX Floaters do not snap to edge made non-movable floaters not use auto-follow logic toasts will now use own layout logic --- indra/llui/llfloater.cpp | 14 ++++++++++++-- indra/llui/llfloater.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c5d7d1db56..a5fd3ea552 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1951,6 +1951,12 @@ void LLFloater::setCanDrag(BOOL can_drag) } } +bool LLFloater::getCanDrag() +{ + return mDragHandle->getEnabled(); +} + + void LLFloater::updateTitleButtons() { static LLUICachedControl floater_close_box_size ("UIFloaterCloseBoxSize", 0); @@ -2181,7 +2187,7 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) LLFloater* floaterp = (LLFloater*)viewp; if (floaterp->isDependent()) { - // dependents use same follow flags as their "dependee" + // dependents are moved with their "dependee" continue; } @@ -2209,7 +2215,11 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) translate_y = new_top - old_top; } - floaterp->translate(translate_x, translate_y); + // don't reposition immovable floaters + if (floaterp->getCanDrag()) + { + floaterp->translate(translate_x, translate_y); + } BOOST_FOREACH(LLHandle dependent_floater, floaterp->mDependents) { if (dependent_floater.get()) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 4e8c539144..8886ae3393 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -234,6 +234,7 @@ public: void setCanTearOff(BOOL can_tear_off); virtual void setCanResize(BOOL can_resize); void setCanDrag(BOOL can_drag); + bool getCanDrag(); void setHost(LLMultiFloater* host); BOOL isResizable() const { return mResizable; } void setResizeLimits( S32 min_width, S32 min_height ); -- cgit v1.2.3 From d71736f3d92f1a276d4aafcbf70c6a8597457220 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 15 Nov 2011 17:32:09 -0800 Subject: SH-1865 PROGRESS -- Disable the anti-aliasing control on hardware our code doesn't support for anti-aliasing --- indra/llui/llspinctrl.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index d197084e38..87814f838e 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -96,6 +96,9 @@ public: void onUpBtn(const LLSD& data); void onDownBtn(const LLSD& data); + + const LLColor4& getEnabledTextColor() const { return mTextEnabledColor.get(); } + const LLColor4& getDisabledTextColor() const { return mTextDisabledColor.get(); } private: void updateLabelColor(); -- cgit v1.2.3 From eeefec394c932b79a22c5ea2b8aa03690bb6061e Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Wed, 23 Nov 2011 01:30:15 +0000 Subject: Changes to filter out tabs from file load and to test if loading/saving should be allowed. --- indra/llui/lltexteditor.cpp | 26 ++++++++++++++++++++++++++ indra/llui/lltexteditor.h | 5 +++++ 2 files changed, 31 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 9bd445988d..3a23ce1cac 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2250,6 +2250,22 @@ void LLTextEditor::insertText(const std::string &new_text) setEnabled( enabled ); } +void LLTextEditor::insertText(LLWString &new_text) +{ + BOOL enabled = getEnabled(); + setEnabled( TRUE ); + + // Delete any selected characters (the insertion replaces them) + if( hasSelection() ) + { + deleteSelection(TRUE); + } + + setCursorPos(mCursorPos + insert( mCursorPos, new_text, FALSE, LLTextSegmentPtr() )); + + setEnabled( enabled ); +} + void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo) { // Save old state @@ -2838,3 +2854,13 @@ void LLTextEditor::clear() getViewModel()->setDisplay(LLWStringUtil::null); clearSegments(); } + +bool LLTextEditor::canLoadOrSaveToFile() +{ + return !mReadOnly; +} + +S32 LLTextEditor::spacesPerTab() +{ + return SPACES_PER_TAB; +} diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 9e4b95003b..40821ae9fb 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -92,6 +92,8 @@ public: void setParseHighlights(BOOL parsing) {mParseHighlights=parsing;} + static S32 spacesPerTab(); + // mousehandler overrides virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -140,6 +142,8 @@ public: virtual void selectAll(); virtual BOOL canSelectAll() const; + virtual bool canLoadOrSaveToFile(); + void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); void replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive); @@ -158,6 +162,7 @@ public: // inserts text at cursor void insertText(const std::string &text); + void insertText(LLWString &text); void appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo); // Non-undoable -- cgit v1.2.3 From 943789b53ac3f2750cb71dca6facc0de7fa39539 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 23 Nov 2011 12:11:53 -0800 Subject: SH-2710 FIX -- Removed calls to getChild happening every frame and during idle calls. Reviewed by davep. --- indra/llui/llscrolllistctrl.cpp | 8 +++++++- indra/llui/llscrolllistctrl.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 622f3e215c..466fac33ea 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -175,6 +175,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mBorder(NULL), mSortCallback(NULL), mPopupMenu(NULL), + mCommentTextView(NULL), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), mTotalColumnPadding(0), @@ -476,7 +477,12 @@ void LLScrollListCtrl::updateLayout() getRect().getWidth() - 2 * mBorderThickness, getRect().getHeight() - (2 * mBorderThickness ) - heading_size ); - getChildView("comment_text")->setShape(mItemListRect); + if (mCommentTextView == NULL) + { + mCommentTextView = getChildView("comment_text"); + } + + mCommentTextView->setShape(mItemListRect); // how many lines of content in a single "page" S32 page_lines = getLinesPerPage(); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 09ab89960d..ae8aea9245 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -480,6 +480,8 @@ private: S32 mHighlightedItem; class LLViewBorder* mBorder; LLContextMenu *mPopupMenu; + + LLView *mCommentTextView; LLWString mSearchString; LLFrameTimer mSearchTimer; -- cgit v1.2.3 From 2851cd519338ef4a1fde15da8d4015ab4380d6cb Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 28 Nov 2011 11:33:49 -0700 Subject: a try fix for sh-2651: [crashhunters] Crash after google translate failure and sh-2658: crash in LLPluginMessage::parse --- indra/llui/llui.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 79ad99a770..69461ec099 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1823,9 +1823,12 @@ void LLUI::setupPaths() LLXMLNodePtr root; BOOL success = LLXMLNode::parseFile(filename, root, NULL); Paths paths; - LLXUIParser parser; - parser.readXUI(root, paths, filename); + if(success) + { + LLXUIParser parser; + parser.readXUI(root, paths, filename); + } sXUIPaths.clear(); if (success && paths.validateBlock()) -- cgit v1.2.3 From 700277e00aa83506808f2128705143d7ae4937bd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 28 Nov 2011 22:30:12 -0800 Subject: removed unneeded changeversion tracking in param blocks in favor of a simpler dirty bit --- indra/llui/tests/llurlentry_stub.cpp | 3 --- indra/llui/tests/llurlmatch_test.cpp | 5 ----- 2 files changed, 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index 4f251db93b..c75df86891 100644 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -105,8 +105,6 @@ LLStyle::Params::Params() namespace LLInitParam { - BaseBlock::BaseBlock() {} - BaseBlock::~BaseBlock() {} Param::Param(BaseBlock* enclosing_block) : mIsProvided(false) { @@ -114,7 +112,6 @@ namespace LLInitParam const U8* block_addr = reinterpret_cast(enclosing_block); mEnclosingBlockOffset = (U16)(my_addr - block_addr); } - void BaseBlock::paramChanged(const Param& last_param, bool user_provided) {} void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name){} void BaseBlock::addSynonym(Param& param, const std::string& synonym) {} diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp index 627f3129e9..7183413463 100644 --- a/indra/llui/tests/llurlmatch_test.cpp +++ b/indra/llui/tests/llurlmatch_test.cpp @@ -63,9 +63,6 @@ S32 LLUIImage::getHeight() const namespace LLInitParam { - BaseBlock::BaseBlock() {} - BaseBlock::~BaseBlock() {} - BlockDescriptor::BlockDescriptor() {} ParamDescriptor::ParamDescriptor(param_handle_t p, merge_func_t merge_func, @@ -77,8 +74,6 @@ namespace LLInitParam S32 max_count){} ParamDescriptor::~ParamDescriptor() {} - void BaseBlock::paramChanged(const Param& last_param, bool user_provided) {} - void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name){} param_handle_t BaseBlock::getHandleFromParam(const Param* param) const {return 0;} void BaseBlock::addSynonym(Param& param, const std::string& synonym) {} -- cgit v1.2.3 From 770538f992a42cdda091f93e8b318e35372aaad2 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 1 Dec 2011 10:42:15 -0800 Subject: Build fixes for mac, hopefully Linux too --- indra/llui/llhandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h index e6390ee599..37c657dd92 100644 --- a/indra/llui/llhandle.h +++ b/indra/llui/llhandle.h @@ -166,7 +166,7 @@ protected: } template - typename LLHandle getDerivedHandle(typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) const + LLHandle getDerivedHandle(typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) const { LLHandle downcast_handle; downcast_handle.mTombStone = getHandle().mTombStone; -- cgit v1.2.3 From d58b5342dc7e8f49ab956523a3dc743b89803b3a Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 2 Dec 2011 19:10:08 +0200 Subject: EXP-1476 FIXED (Moving speak button to empty toolbar while incoming/outgoing call dialog is open does not move the dialog as well) Reason: A floater can be docked only to a button which is in visible chain, the visibility of the button itself is not enough. After the button was added to the empty toolbar: mButtonAddSignal is called and the floater tries to dock to the button, but the button's parent(mButtonPanel) is yet invisible at this moment (so the button is not in visible chain). mButtonPanel visibility updates in draw() depending on whether it contains some buttons or not. Solution: Updating mButtonPanel visibility right after the button was added, before mButtonAddSignal --- indra/llui/lltoolbar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index e7642ae190..7f96c1373c 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -770,6 +770,12 @@ void LLToolBar::updateLayoutAsNeeded() // re-center toolbar buttons mCenteringStack->updateLayout(); + if (!mButtons.empty()) + { + mButtonPanel->setVisible(TRUE); + mButtonPanel->setMouseOpaque(TRUE); + } + // don't clear flag until after we've resized ourselves, to avoid laying out every frame mNeedsLayout = false; } -- cgit v1.2.3 From 4d14bb02b908c37f73e915af811027c1d193b667 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 2 Dec 2011 12:03:24 -0800 Subject: EXP-1451 FIX -- I want to put my NEARBY CHAT window at the bottom left, but then it obscures chatted text. I repositioned the chat, move and camera floaters. Chat toasts now start 80 up from the bottom left rather than 10. --- indra/llui/lltextparser.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index a4fe4f6ca8..8a85f99e0c 100644 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -46,8 +46,6 @@ LLTextParser::LLTextParser() {} -// Moved triggerAlerts() to llfloaterchat.cpp to break llui/llaudio library dependency. - S32 LLTextParser::findPattern(const std::string &text, LLSD highlight) { if (!highlight.has("pattern")) return -1; -- cgit v1.2.3 From afc19140575fb96826b12139d77c5b2174c4713e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 7 Dec 2011 11:47:33 -0800 Subject: EXP-1652 FIX (Build tool floater size affected by viewer window size) force all floaters to have follows flags = FOLLOWS_NONE and use llfloaterview::reshape logic instead removed existing follows flags from any floater XUI and deprecated the follows parameter for floaters --- indra/llui/llfloater.cpp | 6 +++++- indra/llui/llfloater.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 40b550269c..33548151fd 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -195,7 +195,8 @@ LLFloater::Params::Params() dock_pressed_image("dock_pressed_image"), help_pressed_image("help_pressed_image"), open_callback("open_callback"), - close_callback("close_callback") + close_callback("close_callback"), + follows("follows") { changeDefault(visible, false); } @@ -2965,6 +2966,9 @@ void LLFloater::initFromParams(const LLFloater::Params& p) // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible LLPanel::initFromParams(p); + // override any follows flags + setFollows(FOLLOWS_NONE); + mTitle = p.title; mShortTitle = p.short_title; applyTitle(); diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index c70eb0958d..59b35d206f 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -156,6 +156,8 @@ public: Optional open_callback, close_callback; + + Ignored follows; Params(); }; -- cgit v1.2.3 From e860925818fe9376fa9abb0520680dba986ab42e Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 7 Dec 2011 15:03:45 -0800 Subject: Crash workaround when opening toats windows after a long session. --- indra/llui/llview.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 486babb0ab..d2966fbe98 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1090,6 +1090,11 @@ void LLView::drawChildren() { child_list_reverse_iter_t child = child_iter++; LLView *viewp = *child; + + if (viewp == NULL) + { + continue; + } if (viewp->getVisible() && viewp->getRect().isValid()) { -- cgit v1.2.3 From 0aa2c7343ac2af195e80c8f52b9ef67da785fa00 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 8 Dec 2011 20:36:47 -0800 Subject: EXP-1512 FIX changing UI size changes cursor position in notecards --- indra/llui/lltextbase.cpp | 31 ++++++++++++++++++++++++++++++- indra/llui/lltextbase.h | 2 ++ 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 3b768166f1..1f890b625f 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -598,7 +598,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s pos = getEditableIndex(pos, true); - segment_set_t::iterator seg_iter = getSegIterContaining(pos); + segment_set_t::iterator seg_iter = getEditableSegIterContaining(pos); LLTextSegmentPtr default_segment; @@ -1510,8 +1510,37 @@ void LLTextBase::getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg } } +LLTextBase::segment_set_t::iterator LLTextBase::getEditableSegIterContaining(S32 index) +{ + segment_set_t::iterator it = getSegIterContaining(index); + if (it == mSegments.end()) return it; + + if (!(*it)->canEdit() + && index == (*it)->getStart() + && it != mSegments.begin()) + { + it--; + } + return it; +} + +LLTextBase::segment_set_t::const_iterator LLTextBase::getEditableSegIterContaining(S32 index) const +{ + segment_set_t::const_iterator it = getSegIterContaining(index); + if (it == mSegments.end()) return it; + + if (!(*it)->canEdit() + && index == (*it)->getStart() + && it != mSegments.begin()) + { + it--; + } + return it; +} + LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index) { + static LLPointer index_segment = new LLIndexSegment(); if (index > getLength()) { return mSegments.end(); } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index b699601908..0549141b72 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -461,6 +461,8 @@ protected: void getSegmentAndOffset( S32 startpos, segment_set_t::const_iterator* seg_iter, S32* offsetp ) const; void getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg_iter, S32* offsetp ); LLTextSegmentPtr getSegmentAtLocalPos( S32 x, S32 y, bool hit_past_end_of_line = true); + segment_set_t::iterator getEditableSegIterContaining(S32 index); + segment_set_t::const_iterator getEditableSegIterContaining(S32 index) const; segment_set_t::iterator getSegIterContaining(S32 index); segment_set_t::const_iterator getSegIterContaining(S32 index) const; void clearSegments(); -- cgit v1.2.3 From cc92db1f353de96f6d27863b92671b2d847536f4 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 9 Dec 2011 16:19:03 -0800 Subject: Moved outbox import confirmations to window shades on the merchant outbox floater, rather than modal dialogs. --- indra/llui/llwindowshade.cpp | 5 +++++ indra/llui/llwindowshade.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index cf76202215..b21c088a1f 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -297,6 +297,11 @@ void LLWindowShade::hide() setMouseOpaque(false); } +bool LLWindowShade::isShown() const +{ + return getChildRef("notification_area").getVisible(); +} + void LLWindowShade::onCloseNotification() { LLNotifications::instance().cancel(mNotification); diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h index 09ffc2cd54..cb8f223a84 100644 --- a/indra/llui/llwindowshade.h +++ b/indra/llui/llwindowshade.h @@ -48,6 +48,8 @@ public: void show(); /*virtual*/ void draw(); void hide(); + + bool isShown() const; private: friend class LLUICtrlFactory; -- cgit v1.2.3 From 40a74eb5b77493e66587a01b6655d405c75e3a59 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 12 Dec 2011 12:32:22 -0800 Subject: EXP-1711 FIX LLWindowShade doesn't stack multiple notifications --- indra/llui/lllayoutstack.h | 3 +- indra/llui/llpanel.h | 2 + indra/llui/llwindowshade.cpp | 207 +++++++++++++++++++++++++++---------------- indra/llui/llwindowshade.h | 10 ++- 4 files changed, 142 insertions(+), 80 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index ede6149a80..3b308a359d 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -191,13 +191,12 @@ public: return min_dim; } + F32 getCollapseFactor(); void setOrientation(LLLayoutStack::ELayoutOrientation orientation) { mOrientation = orientation; } protected: LLLayoutPanel(const Params& p); - F32 getCollapseFactor(); - bool mExpandedMinDimSpecified; S32 mExpandedMinDim; diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index cd33938226..f620201020 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -135,6 +135,8 @@ public: const LLColor4& getBackgroundColor() const { return mBgOpaqueColor; } void setTransparentColor(const LLColor4& color) { mBgAlphaColor = color; } const LLColor4& getTransparentColor() const { return mBgAlphaColor; } + void setBackgroundImage(LLUIImage* image) { mBgOpaqueImage = image; } + void setTransparentImage(LLUIImage* image) { mBgAlphaImage = image; } LLPointer getBackgroundImage() const { return mBgOpaqueImage; } LLPointer getTransparentImage() const { return mBgAlphaImage; } LLColor4 getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; } diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index cf76202215..0b4cfe68a6 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -37,6 +37,8 @@ const S32 MIN_NOTIFICATION_AREA_HEIGHT = 30; const S32 MAX_NOTIFICATION_AREA_HEIGHT = 100; +static LLDefaultChildRegistry::Register r("window_shade"); + LLWindowShade::Params::Params() : bg_image("bg_image"), modal("modal", false), @@ -48,7 +50,6 @@ LLWindowShade::Params::Params() LLWindowShade::LLWindowShade(const LLWindowShade::Params& params) : LLUICtrl(params), - mNotification(params.notification), mModal(params.modal), mFormHeight(0), mTextColor(params.text_color) @@ -72,7 +73,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) addChild(stackp); LLLayoutPanel::Params panel_p; - panel_p.rect = LLRect(0, 30, 800, 0); + panel_p.rect = LLRect(0, MIN_NOTIFICATION_AREA_HEIGHT, 800, 0); panel_p.name = "notification_area"; panel_p.visible = false; panel_p.user_resize = false; @@ -107,11 +108,11 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) LLIconCtrl::Params icon_p; icon_p.name = "notification_icon"; - icon_p.rect = LLRect(5, 23, 21, 8); + icon_p.rect = LLRect(5, 25, 21, 10); panel->addChild(LLUICtrlFactory::create(icon_p)); LLTextBox::Params text_p; - text_p.rect = LLRect(31, 20, panel->getRect().getWidth() - 5, 0); + text_p.rect = LLRect(31, 23, panel->getRect().getWidth() - 5, 3); text_p.follows.flags = FOLLOWS_ALL; text_p.text_color = mTextColor; text_p.font = LLFontGL::getFontSansSerifSmall(); @@ -125,41 +126,132 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.auto_resize = false; panel_p.user_resize = false; panel_p.name="form_elements"; - panel_p.rect = LLRect(0, 30, 130, 0); + panel_p.rect = LLRect(0, MIN_NOTIFICATION_AREA_HEIGHT, 130, 0); LLLayoutPanel* form_elements_panel = LLUICtrlFactory::create(panel_p); stackp->addChild(form_elements_panel); - if (params.can_close) + panel_p = LLUICtrlFactory::getDefaultParams(); + panel_p.auto_resize = false; + panel_p.user_resize = false; + panel_p.rect = LLRect(0, MIN_NOTIFICATION_AREA_HEIGHT, 25, 0); + panel_p.name = "close_panel"; + LLLayoutPanel* close_panel = LLUICtrlFactory::create(panel_p); + stackp->addChild(close_panel); + + LLButton::Params button_p; + button_p.name = "close_notification"; + button_p.rect = LLRect(5, 23, 21, 7); + button_p.image_color.control="DkGray_66"; + button_p.image_unselected.name="Icon_Close_Foreground"; + button_p.image_selected.name="Icon_Close_Press"; + button_p.click_callback.function = boost::bind(&LLWindowShade::onCloseNotification, this); + + close_panel->addChild(LLUICtrlFactory::create(button_p)); + + close_panel->setVisible(params.can_close); +} + +void LLWindowShade::draw() +{ + LLRect message_rect = getChild("notification_text")->getTextBoundingRect(); + + LLLayoutPanel* notification_area = getChild("notification_area"); + + notification_area->reshape(notification_area->getRect().getWidth(), + llclamp(message_rect.getHeight() + 15, + llmin(mFormHeight, MAX_NOTIFICATION_AREA_HEIGHT), + MAX_NOTIFICATION_AREA_HEIGHT)); + + LLUICtrl::draw(); + + while(!mNotifications.empty() && !mNotifications.back()->isActive()) + { + mNotifications.pop_back(); + // go ahead and hide + hide(); + } + + if (mNotifications.empty()) + { + hide(); + } + else if (notification_area->getCollapseFactor() < 0.01f) + { + displayLatestNotification(); + } + + if (!notification_area->getVisible() && (notification_area->getCollapseFactor() < 0.001f)) + { + getChildRef("background_area").setBackgroundVisible(false); + setMouseOpaque(false); + } +} + +void LLWindowShade::hide() +{ + getChildRef("notification_area").setVisible(false); +} + +void LLWindowShade::onCloseNotification() +{ + if (!mNotifications.empty()) + LLNotifications::instance().cancel(mNotifications.back()); +} + +void LLWindowShade::onClickIgnore(LLUICtrl* ctrl) +{ + LLNotificationPtr notify = getCurrentNotification(); + if (!notify) return; + + bool check = ctrl->getValue().asBoolean(); + if (notify->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) { - panel_p = LLUICtrlFactory::getDefaultParams(); - panel_p.auto_resize = false; - panel_p.user_resize = false; - panel_p.rect = LLRect(0, 30, 25, 0); - LLLayoutPanel* close_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(close_panel); - - LLButton::Params button_p; - button_p.name = "close_notification"; - button_p.rect = LLRect(5, 23, 21, 7); - button_p.image_color.control="DkGray_66"; - button_p.image_unselected.name="Icon_Close_Foreground"; - button_p.image_selected.name="Icon_Close_Press"; - button_p.click_callback.function = boost::bind(&LLWindowShade::onCloseNotification, this); - - close_panel->addChild(LLUICtrlFactory::create(button_p)); + // question was "show again" so invert value to get "ignore" + check = !check; } + notify->setIgnored(check); +} + +void LLWindowShade::onClickNotificationButton(const std::string& name) +{ + LLNotificationPtr notify = getCurrentNotification(); + if (!notify) return; - LLSD payload = mNotification->getPayload(); + mNotificationResponse[name] = true; - LLNotificationFormPtr formp = mNotification->getForm(); + notify->respond(mNotificationResponse); +} + +void LLWindowShade::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name) +{ + mNotificationResponse[name] = ctrl->getValue().asString(); +} + +void LLWindowShade::show(LLNotificationPtr notification) +{ + mNotifications.push_back(notification); + + displayLatestNotification(); +} + +void LLWindowShade::displayLatestNotification() +{ + if (mNotifications.empty()) return; + + LLNotificationPtr notification = mNotifications.back(); + + LLSD payload = notification->getPayload(); + + LLNotificationFormPtr formp = notification->getForm(); LLLayoutPanel& notification_area = getChildRef("notification_area"); - notification_area.getChild("notification_icon")->setValue(mNotification->getIcon()); - notification_area.getChild("notification_text")->setValue(mNotification->getMessage()); - notification_area.getChild("notification_text")->setToolTip(mNotification->getMessage()); + notification_area.getChild("notification_icon")->setValue(notification->getIcon()); + notification_area.getChild("notification_text")->setValue(notification->getMessage()); + notification_area.getChild("notification_text")->setToolTip(notification->getMessage()); LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); LLLayoutPanel& form_elements = notification_area.getChildRef("form_elements"); form_elements.deleteAllChildren(); + form_elements.reshape(form_elements.getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT); const S32 FORM_PADDING_HORIZONTAL = 10; const S32 FORM_PADDING_VERTICAL = 3; @@ -229,7 +321,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) label_p.v_pad = 5; LLTextBox* textbox = LLUICtrlFactory::create(label_p); textbox->reshapeToFitText(); - textbox->reshape(textbox->getRect().getWidth(), form_elements.getRect().getHeight() - 2 * FORM_PADDING_VERTICAL); + textbox->reshape(textbox->getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT - 2 * FORM_PADDING_VERTICAL); form_elements.addChild(textbox); cur_x = textbox->getRect().mRight + FORM_PADDING_HORIZONTAL; @@ -249,7 +341,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) } } - mFormHeight = form_elements.getRect().getHeight() - (cur_y - FORM_PADDING_VERTICAL) + WIDGET_HEIGHT; + mFormHeight = form_elements.getRect().getHeight() - (cur_y - WIDGET_HEIGHT - FORM_PADDING_VERTICAL); form_elements.reshape(form_width, mFormHeight); form_elements.setMinDim(form_width); @@ -261,68 +353,33 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) { (*it)->translate(0, delta_y); } -} -void LLWindowShade::show() -{ getChildRef("notification_area").setVisible(true); getChildRef("background_area").setBackgroundVisible(mModal); setMouseOpaque(mModal); } -void LLWindowShade::draw() +void LLWindowShade::setBackgroundImage(LLUIImage* image) { - LLRect message_rect = getChild("notification_text")->getTextBoundingRect(); - - LLLayoutPanel* notification_area = getChild("notification_area"); - - notification_area->reshape(notification_area->getRect().getWidth(), - llclamp(message_rect.getHeight() + 10, - llmin(mFormHeight, MAX_NOTIFICATION_AREA_HEIGHT), - MAX_NOTIFICATION_AREA_HEIGHT)); - - LLUICtrl::draw(); - if (mNotification && !mNotification->isActive()) - { - hide(); - } + getChild("notification_area")->setTransparentImage(image); } -void LLWindowShade::hide() +void LLWindowShade::setTextColor(LLColor4 color) { - getChildRef("notification_area").setVisible(false); - getChildRef("background_area").setBackgroundVisible(false); - - setMouseOpaque(false); + getChild("notification_text")->setColor(color); } -void LLWindowShade::onCloseNotification() +void LLWindowShade::setCanClose(bool can_close) { - LLNotifications::instance().cancel(mNotification); + getChildView("close_panel")->setVisible(can_close); } -void LLWindowShade::onClickIgnore(LLUICtrl* ctrl) +LLNotificationPtr LLWindowShade::getCurrentNotification() { - bool check = ctrl->getValue().asBoolean(); - if (mNotification && mNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) + if (mNotifications.empty()) { - // question was "show again" so invert value to get "ignore" - check = !check; + return LLNotificationPtr(); } - mNotification->setIgnored(check); -} - -void LLWindowShade::onClickNotificationButton(const std::string& name) -{ - if (!mNotification) return; - - mNotificationResponse[name] = true; - - mNotification->respond(mNotificationResponse); -} - -void LLWindowShade::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name) -{ - mNotificationResponse[name] = ctrl->getValue().asString(); -} + return mNotifications.back(); +} \ No newline at end of file diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h index 09ffc2cd54..1dcab4e32f 100644 --- a/indra/llui/llwindowshade.h +++ b/indra/llui/llwindowshade.h @@ -36,7 +36,6 @@ class LLWindowShade : public LLUICtrl public: struct Params : public LLInitParam::Block { - Mandatory notification; Optional bg_image; Optional text_color; Optional modal, @@ -45,11 +44,16 @@ public: Params(); }; - void show(); + void show(LLNotificationPtr); /*virtual*/ void draw(); void hide(); + void setBackgroundImage(LLUIImage* image); + void setTextColor(LLColor4 color); + void setCanClose(bool can_close); private: + void displayLatestNotification(); + LLNotificationPtr getCurrentNotification(); friend class LLUICtrlFactory; LLWindowShade(const Params& p); @@ -60,7 +64,7 @@ private: void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name); void onClickIgnore(LLUICtrl* ctrl); - LLNotificationPtr mNotification; + std::vector mNotifications; LLSD mNotificationResponse; bool mModal; S32 mFormHeight; -- cgit v1.2.3 From 35feb03d27036f82a6bca60c1be8d864de990646 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 12 Dec 2011 15:50:10 -0800 Subject: EXP-1711 FIX LLWindowShade doesn't stack multiple notifications added configurable shade color to window_shade --- indra/llui/llwindowshade.cpp | 3 ++- indra/llui/llwindowshade.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index 0b4cfe68a6..1e8b47de29 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -43,6 +43,7 @@ LLWindowShade::Params::Params() : bg_image("bg_image"), modal("modal", false), text_color("text_color"), + shade_color("shade_color"), can_close("can_close", true) { changeDefault(mouse_opaque, false); @@ -90,7 +91,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.name = "background_area"; panel_p.mouse_opaque = false; panel_p.background_visible = false; - panel_p.bg_alpha_color = LLColor4(0.f, 0.f, 0.f, 0.2f); + panel_p.bg_alpha_color = params.shade_color; LLLayoutPanel* dummy_panel = LLUICtrlFactory::create(panel_p); stackp->addChild(dummy_panel); diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h index 1dcab4e32f..1ae84028dd 100644 --- a/indra/llui/llwindowshade.h +++ b/indra/llui/llwindowshade.h @@ -37,7 +37,8 @@ public: struct Params : public LLInitParam::Block { Optional bg_image; - Optional text_color; + Optional text_color, + shade_color; Optional modal, can_close; -- cgit v1.2.3 From e859c3446b5c631fe0a9806434aa19b64a0d9113 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 12 Dec 2011 16:06:22 -0800 Subject: Added missing line end to satisfy coding policy --- indra/llui/llwindowshade.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index 1e8b47de29..ae8b30b1ba 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -383,4 +383,5 @@ LLNotificationPtr LLWindowShade::getCurrentNotification() return LLNotificationPtr(); } return mNotifications.back(); -} \ No newline at end of file +} + -- cgit v1.2.3 From 0c0ff35d19969cc762dce510a4d5ee4649d96a24 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 13 Dec 2011 13:11:55 -0800 Subject: EXP-1551 FIX Ability to toggle button flashing added "EnableButtonFlashing" setting --- indra/llui/llbutton.cpp | 18 +++++++++++++----- indra/llui/lltabcontainer.cpp | 13 +++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 93d8282aa7..f0d92d597a 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -589,15 +589,23 @@ void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height) // virtual void LLButton::draw() { + static LLCachedControl sEnableButtonFlashing(*LLUI::sSettingGroups["config"], "EnableButtonFlashing", true); F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency(); bool flash = FALSE; - if( mFlashing ) + if( mFlashing) { - F32 elapsed = mFlashingTimer.getElapsedTimeF32(); - S32 flash_count = S32(elapsed * mButtonFlashRate * 2.f); - // flash on or off? - flash = (flash_count % 2 == 0) || flash_count > S32((F32)mButtonFlashCount * 2.f); + if ( sEnableButtonFlashing) + { + F32 elapsed = mFlashingTimer.getElapsedTimeF32(); + S32 flash_count = S32(elapsed * mButtonFlashRate * 2.f); + // flash on or off? + flash = (flash_count % 2 == 0) || flash_count > S32((F32)mButtonFlashCount * 2.f); + } + else + { // otherwise just highlight button in flash color + flash = true; + } } bool pressed_by_keyboard = FALSE; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index d5f8707381..5fc2cc350d 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -98,24 +98,25 @@ class LLCustomButtonIconCtrl : public LLButton { public: struct Params - : public LLInitParam::Block + : public LLInitParam::Block { // LEFT, RIGHT, TOP, BOTTOM paddings of LLIconCtrl in this class has same value Optional icon_ctrl_pad; - Params(): - icon_ctrl_pad("icon_ctrl_pad", 1) + Params() + : icon_ctrl_pad("icon_ctrl_pad", 1) {} }; protected: friend class LLUICtrlFactory; - LLCustomButtonIconCtrl(const Params& p): - LLButton(p), + + LLCustomButtonIconCtrl(const Params& p) + : LLButton(p), mIcon(NULL), mIconAlignment(LLFontGL::HCENTER), mIconCtrlPad(p.icon_ctrl_pad) - {} + {} public: -- cgit v1.2.3 From 0ccf2b5a1c08c897326c0ce47caa48e30ec4b5fa Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 21 Dec 2011 14:10:02 +0200 Subject: EXP-1693 FIXED the date localization in Item Profile window, Voice Morphs window and in scroll list widget in general. - Added a customizable date format string to be used for scroll list cell of "date" type. - The date localization does not change the value of a scroll list cell changing only its string representation. - Added using localized week days and month names from strings.xml for all locales not only Ja and Pl as it was before. - Changed the date format in Item Profile window (French locale) as noted in the issue description. - For this fix the French locale still needs the localization of the following strings in strings.xml: --- indra/llui/llscrolllistcell.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 9d25c7180d..786e18b187 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -29,6 +29,8 @@ #include "llscrolllistcell.h" +#include "lltrans.h" + #include "llcheckboxctrl.h" #include "llui.h" // LLUIImage #include "lluictrlfactory.h" @@ -428,7 +430,13 @@ LLScrollListDate::LLScrollListDate( const LLScrollListCell::Params& p) void LLScrollListDate::setValue(const LLSD& value) { mDate = value.asDate(); - LLScrollListText::setValue(mDate.asRFC1123()); + + std::string date_str = LLTrans::getString("ScrollListCellDateFormat"); + LLSD substitution; + substitution["datetime"] = mDate.secondsSinceEpoch(); + LLStringUtil::format(date_str, substitution); + + LLScrollListText::setValue(date_str); } const LLSD LLScrollListDate::getValue() const -- cgit v1.2.3 From 3861249a749c99c2a7b05d15ef82f8ff21453d05 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 3 Jan 2012 09:41:16 -0800 Subject: use lazy deletion of views via die() method to avoid some potential crashes --- indra/llui/llmenugl.cpp | 7 ++++++- indra/llui/llview.cpp | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index cb237fca7c..95ecbb1c94 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -947,9 +947,14 @@ LLMenuItemBranchGL::LLMenuItemBranchGL(const LLMenuItemBranchGL::Params& p) LLMenuItemBranchGL::~LLMenuItemBranchGL() { - delete mBranchHandle.get(); + if (mBranchHandle.get()) + { + mBranchHandle.get()->die(); + } } + + // virtual LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse) const { diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 486babb0ab..1529381773 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -121,6 +121,7 @@ LLView::Params::Params() LLView::LLView(const LLView::Params& p) : mVisible(p.visible), + mInDraw(false), mName(p.name), mParentView(NULL), mReshapeFlags(FOLLOWS_NONE), @@ -281,6 +282,8 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child) // virtual bool LLView::addChild(LLView* child, S32 tab_group) { + llassert_always(mInDraw == false); + if (!child) { return false; @@ -330,6 +333,7 @@ bool LLView::addChildInBack(LLView* child, S32 tab_group) // remove the specified child from the view, and set it's parent to NULL. void LLView::removeChild(LLView* child) { + llassert_always(mInDraw == false); //llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs if (child->mParentView == this) { @@ -1081,6 +1085,7 @@ void LLView::draw() void LLView::drawChildren() { + mInDraw = true; if (!mChildList.empty()) { LLView* rootp = LLUI::getRootView(); @@ -1119,6 +1124,7 @@ void LLView::drawChildren() } --sDepth; } + mInDraw = false; } void LLView::dirtyRect() -- cgit v1.2.3 From 1b1ad93c5d341eb564a7e6fc1ae9298473d8a98e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 3 Jan 2012 12:21:30 -0800 Subject: EXP-1512 FIX changing UI size changes cursor position in notecards fixed case where adding text between 2 consecutive newlines created gibberish --- indra/llui/lltextbase.cpp | 15 +++++++++++++-- indra/llui/llview.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 1f890b625f..0040be45c7 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1513,6 +1513,8 @@ void LLTextBase::getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg LLTextBase::segment_set_t::iterator LLTextBase::getEditableSegIterContaining(S32 index) { segment_set_t::iterator it = getSegIterContaining(index); + segment_set_t::iterator orig_it = it; + if (it == mSegments.end()) return it; if (!(*it)->canEdit() @@ -1520,13 +1522,18 @@ LLTextBase::segment_set_t::iterator LLTextBase::getEditableSegIterContaining(S32 && it != mSegments.begin()) { it--; + if ((*it)->canEdit()) + { + return it; + } } - return it; + return orig_it; } LLTextBase::segment_set_t::const_iterator LLTextBase::getEditableSegIterContaining(S32 index) const { segment_set_t::const_iterator it = getSegIterContaining(index); + segment_set_t::const_iterator orig_it = it; if (it == mSegments.end()) return it; if (!(*it)->canEdit() @@ -1534,8 +1541,12 @@ LLTextBase::segment_set_t::const_iterator LLTextBase::getEditableSegIterContaini && it != mSegments.begin()) { it--; + if ((*it)->canEdit()) + { + return it; + } } - return it; + return orig_it; } LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index) diff --git a/indra/llui/llview.h b/indra/llui/llview.h index f21fb37e18..f1fac5f69c 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -612,6 +612,8 @@ private: S32 mNextInsertionOrdinal; + bool mInDraw; + static LLWindow* sWindow; // All root views must know about their window. typedef std::map default_widget_map_t; -- cgit v1.2.3 From 9c8f6ba6a51b799d16e89e995bbcf3b0dcc15c62 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 4 Jan 2012 17:37:57 -0800 Subject: Modified CRASH assert to not occur in release mode per Richard --- indra/llui/llview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 1529381773..542f57ee5f 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -282,7 +282,8 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child) // virtual bool LLView::addChild(LLView* child, S32 tab_group) { - llassert_always(mInDraw == false); + // NOTE: Changed this to not crash in release mode + llassert(mInDraw == false); if (!child) { -- cgit v1.2.3 From 757a955bd700eb4f838762dcbe789a77ee052064 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 6 Jan 2012 12:07:52 -0800 Subject: Looking for better fix to EXP-1693 - date localization Backed out changeset: 4f3024e9d629 --- indra/llui/llscrolllistcell.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 786e18b187..9d25c7180d 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -29,8 +29,6 @@ #include "llscrolllistcell.h" -#include "lltrans.h" - #include "llcheckboxctrl.h" #include "llui.h" // LLUIImage #include "lluictrlfactory.h" @@ -430,13 +428,7 @@ LLScrollListDate::LLScrollListDate( const LLScrollListCell::Params& p) void LLScrollListDate::setValue(const LLSD& value) { mDate = value.asDate(); - - std::string date_str = LLTrans::getString("ScrollListCellDateFormat"); - LLSD substitution; - substitution["datetime"] = mDate.secondsSinceEpoch(); - LLStringUtil::format(date_str, substitution); - - LLScrollListText::setValue(date_str); + LLScrollListText::setValue(mDate.asRFC1123()); } const LLSD LLScrollListDate::getValue() const -- cgit v1.2.3 From 3169f4a96fd4c62d1390cd53ff2aaa4cb28fb047 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 11 Jan 2012 10:19:11 -0800 Subject: assert for updating views while drawing was too aggressive made assert match actual error condition for list iterators reviewed by Leslie --- indra/llui/llview.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 542f57ee5f..004681325f 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -282,9 +282,6 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child) // virtual bool LLView::addChild(LLView* child, S32 tab_group) { - // NOTE: Changed this to not crash in release mode - llassert(mInDraw == false); - if (!child) { return false; @@ -334,10 +331,11 @@ bool LLView::addChildInBack(LLView* child, S32 tab_group) // remove the specified child from the view, and set it's parent to NULL. void LLView::removeChild(LLView* child) { - llassert_always(mInDraw == false); //llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs if (child->mParentView == this) { + // if we are removing an item we are currently iterating over, that would be bad + llassert(child->mInDraw == false); mChildList.remove( child ); child->mParentView = NULL; if (child->isCtrl()) @@ -1086,7 +1084,6 @@ void LLView::draw() void LLView::drawChildren() { - mInDraw = true; if (!mChildList.empty()) { LLView* rootp = LLUI::getRootView(); @@ -1105,7 +1102,10 @@ void LLView::drawChildren() LLUI::pushMatrix(); { LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f); + // flag the fact we are in draw here, in case overridden draw() method attempts to remove this widget + viewp->mInDraw = true; viewp->draw(); + viewp->mInDraw = false; if (sDebugRects) { @@ -1125,7 +1125,6 @@ void LLView::drawChildren() } --sDepth; } - mInDraw = false; } void LLView::dirtyRect() -- cgit v1.2.3 From 33a17d8a83b3810e344e663395219d3130cb34c3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 11 Jan 2012 17:43:17 -0800 Subject: EXP-1549 : Disable the Remove button menu item in the toolbar contextual menu if no button clicked --- indra/llui/lltoolbar.cpp | 9 ++++++++- indra/llui/lltoolbar.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 7f96c1373c..9b31a6449d 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -151,14 +151,20 @@ void LLToolBar::createContextMenu() if (menu) { menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor")); - mPopupMenuHandle = menu->getHandle(); + mRemoveButtonHandle = menu->getChild("Remove button")->getHandle(); } else { llwarns << "Unable to load toolbars context menu." << llendl; } } + + if (mRemoveButtonHandle.get()) + { + // Disable/Enable the "Remove button" menu item depending on whether or not a button was clicked + mRemoveButtonHandle.get()->setEnabled(mRightMouseTargetButton != NULL); + } } void LLToolBar::initFromParams(const LLToolBar::Params& p) @@ -401,6 +407,7 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { // Determine which button the mouse was over during the click in case the context menu action // is intended to affect the button. + mRightMouseTargetButton = NULL; BOOST_FOREACH(LLToolBarButton* button, mButtons) { LLRect button_rect; diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 51fe23ddd1..a50c60282c 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -271,6 +271,7 @@ private: LLLayoutStack* mCenteringStack; LLPanel* mButtonPanel; LLHandle mPopupMenuHandle; + LLHandle mRemoveButtonHandle; LLToolBarButton* mRightMouseTargetButton; -- cgit v1.2.3 From cd4204b2730350eede126190814621b65308c422 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 16 Jan 2012 11:03:33 -0800 Subject: EXP-1758 WIP Progress spinner not shown during merketplace synch if Merchant Outbox floater was previously minimized rewrote layout_stack resizing logic to be symmetrical --- indra/llui/lllayoutstack.cpp | 784 +++++++++++++++++++++++++------------------ indra/llui/lllayoutstack.h | 69 ++-- indra/llui/llresizebar.cpp | 4 +- indra/llui/llresizebar.h | 1 + indra/llui/llwindowshade.cpp | 4 +- 5 files changed, 498 insertions(+), 364 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 0e7060e22c..b67030dc34 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -34,10 +34,13 @@ #include "llpanel.h" #include "llresizebar.h" #include "llcriticaldamp.h" +#include "boost/foreach.hpp" static LLDefaultChildRegistry::Register register_layout_stack("layout_stack"); static LLLayoutStack::LayoutStackRegistry::Register register_layout_panel("layout_panel"); +static const F32 MAX_FRACTIONAL_VALUE = 0.99999f; + void LLLayoutStack::OrientationNames::declareValues() { declare("horizontal", HORIZONTAL); @@ -49,15 +52,12 @@ void LLLayoutStack::OrientationNames::declareValues() // LLLayoutPanel::Params::Params() : expanded_min_dim("expanded_min_dim", 0), - min_dim("min_dim", 0), - max_dim("max_dim", S32_MAX), - user_resize("user_resize", true), + min_dim("min_dim", -1), + user_resize("user_resize", false), auto_resize("auto_resize", true) { addSynonym(min_dim, "min_width"); addSynonym(min_dim, "min_height"); - addSynonym(max_dim, "max_width"); - addSynonym(max_dim, "max_height"); } LLLayoutPanel::LLLayoutPanel(const Params& p) @@ -65,7 +65,6 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mExpandedMinDimSpecified(false), mExpandedMinDim(p.min_dim), mMinDim(p.min_dim), - mMaxDim(p.max_dim), mAutoResize(p.auto_resize), mUserResize(p.user_resize), mCollapsed(FALSE), @@ -73,6 +72,8 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mVisibleAmt(1.f), // default to fully visible mResizeBar(NULL), mFractionalSize(0.f), + mTargetDim(0), + mIgnoreReshape(false), mOrientation(LLLayoutStack::HORIZONTAL) { // Set the expanded min dim if it is provided, otherwise it gets the p.min_dim value @@ -103,33 +104,85 @@ LLLayoutPanel::~LLLayoutPanel() mResizeBar = NULL; } -void LLLayoutPanel::reshape(S32 width, S32 height, BOOL called_from_parent) +F32 LLLayoutPanel::getAutoResizeFactor() const +{ + return mVisibleAmt * (1.f - mCollapseAmt); +} + +F32 LLLayoutPanel::getVisibleAmount() const +{ + return mVisibleAmt; +} + +S32 LLLayoutPanel::getLayoutDim() const +{ + return llround((mOrientation == LLLayoutStack::HORIZONTAL) + ? getRect().getWidth() + : getRect().getHeight()); +} + +S32 LLLayoutPanel::getVisibleDim() const +{ + F32 min_dim = getRelevantMinDim(); + return llround(mVisibleAmt + * (min_dim + + (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt)))); +} + +void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientation ) { - if (mOrientation == LLLayoutStack::HORIZONTAL) + mOrientation = orientation; + S32 layout_dim = llround((mOrientation == LLLayoutStack::HORIZONTAL) + ? getRect().getWidth() + : getRect().getHeight()); + + if (mMinDim == -1) { - mFractionalSize += width - llround(mFractionalSize); + if (!mAutoResize) + { + setMinDim(layout_dim); + } + else + { + setMinDim(0); + } } - else + + mTargetDim = llmax(layout_dim, getMinDim()); +} + +void LLLayoutPanel::setVisible( BOOL visible ) +{ + if (visible != getVisible()) { - mFractionalSize += height - llround(mFractionalSize); + LLLayoutStack* stackp = dynamic_cast(getParent()); + stackp->mNeedsLayout = true; } - LLPanel::reshape(width, height, called_from_parent); + LLPanel::setVisible(visible); } -F32 LLLayoutPanel::getCollapseFactor() +void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= TRUE*/ ) { - if (mOrientation == LLLayoutStack::HORIZONTAL) + if (!mIgnoreReshape && !mAutoResize) { - F32 collapse_amt = - clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)getRelevantMinDim() / (F32)llmax(1, getRect().getWidth())); - return mVisibleAmt * collapse_amt; + mTargetDim = (mOrientation == LLLayoutStack::HORIZONTAL) ? width : height; } - else + LLPanel::reshape(width, height, called_from_parent); +} + +void LLLayoutPanel::handleReshape(const LLRect& new_rect, bool by_user) +{ + LLLayoutStack* stackp = dynamic_cast(getParent()); + if (stackp) { - F32 collapse_amt = - clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)getRelevantMinDim() / (F32)llmax(1, getRect().getHeight()))); - return mVisibleAmt * collapse_amt; + stackp->mNeedsLayout = true; + if (by_user) + { + // tell layout stack to account for new shape + stackp->updatePanelRect(this, new_rect); + } } + LLPanel::handleReshape(new_rect, by_user); } // @@ -147,12 +200,11 @@ LLLayoutStack::Params::Params() LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) : LLView(p), - mMinWidth(0), - mMinHeight(0), mPanelSpacing(p.border_size), mOrientation(p.orientation), mAnimate(p.animate), mAnimatedThisFrame(false), + mNeedsLayout(true), mClip(p.clip), mOpenTimeConstant(p.open_time_constant), mCloseTimeConstant(p.close_time_constant) @@ -169,26 +221,26 @@ void LLLayoutStack::draw() { updateLayout(); - e_panel_list_t::iterator panel_it; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) + // always clip to stack itself + LLLocalClipRect clip(getLocalRect()); + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) { // clip to layout rectangle, not bounding rectangle - LLRect clip_rect = (*panel_it)->getRect(); + LLRect clip_rect = panelp->getRect(); // scale clipping rectangle by visible amount if (mOrientation == HORIZONTAL) { - clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor()); + clip_rect.mRight = clip_rect.mLeft + panelp->getVisibleDim(); } else { - clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor()); + clip_rect.mBottom = clip_rect.mTop - panelp->getVisibleDim(); } - LLPanel* panelp = (*panel_it); - - LLLocalClipRect clip(clip_rect, mClip); - // only force drawing invisible children if visible amount is non-zero - drawChild(panelp, 0, 0, !clip_rect.isEmpty()); + {LLLocalClipRect clip(clip_rect, mClip); + // only force drawing invisible children if visible amount is non-zero + drawChild(panelp, 0, 0, !clip_rect.isEmpty()); + } } mAnimatedThisFrame = false; } @@ -201,12 +253,10 @@ void LLLayoutStack::removeChild(LLView* view) { mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp)); delete embedded_panelp; + updateFractionalSizes(); + mNeedsLayout = true; } - // need to update resizebars - - calcMinExtents(); - LLView::removeChild(view); } @@ -221,29 +271,15 @@ bool LLLayoutStack::addChild(LLView* child, S32 tab_group) LLLayoutPanel* panelp = dynamic_cast(child); if (panelp) { - panelp->mFractionalSize = (mOrientation == HORIZONTAL) - ? panelp->getRect().getWidth() - : panelp->getRect().getHeight(); panelp->setOrientation(mOrientation); mPanels.push_back(panelp); + createResizeBar(panelp); + mNeedsLayout = true; } - return LLView::addChild(child, tab_group); -} - -void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front) -{ - LLLayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move); - LLLayoutPanel* embedded_target_panel = move_to_front ? *mPanels.begin() : findEmbeddedPanel(target_panel); + BOOL result = LLView::addChild(child, tab_group); - if (!embedded_panel_to_move || !embedded_target_panel || embedded_panel_to_move == embedded_target_panel) - { - llwarns << "One of the panels was not found in stack or NULL was passed instead of valid panel" << llendl; - return; - } - e_panel_list_t::iterator it = std::find(mPanels.begin(), mPanels.end(), embedded_panel_to_move); - mPanels.erase(it); - it = move_to_front ? mPanels.begin() : std::find(mPanels.begin(), mPanels.end(), embedded_target_panel); - mPanels.insert(it, embedded_panel_to_move); + updateFractionalSizes(); + return result; } void LLLayoutStack::addPanel(LLLayoutPanel* panel, EAnimate animate) @@ -258,23 +294,19 @@ void LLLayoutStack::addPanel(LLLayoutPanel* panel, EAnimate animate) } } -void LLLayoutStack::removePanel(LLPanel* panel) -{ - removeChild(panel); -} - void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed) { LLLayoutPanel* panel_container = findEmbeddedPanel(panel); if (!panel_container) return; panel_container->mCollapsed = collapsed; + mNeedsLayout = true; } void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize) { LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name); - + if (panel) { panel->mAutoResize = auto_resize; @@ -291,51 +323,246 @@ void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_ } } -bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_dimp) + +static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks"); + +void LLLayoutStack::updateLayout() +{ + LLFastTimer ft(FTM_UPDATE_LAYOUT); + + if (!mNeedsLayout) return; + + bool animation_in_progress = animatePanels(); + F32 total_visible_fraction = 0.f; + S32 space_to_distribute = (mOrientation == HORIZONTAL) + ? getRect().getWidth() + : getRect().getHeight(); + + // first, assign minimum dimensions + LLLayoutPanel* panelp = NULL; + BOOST_FOREACH(panelp, mPanels) + { + if (panelp->mAutoResize) + { + panelp->mTargetDim = panelp->getRelevantMinDim(); + } + space_to_distribute -= panelp->getVisibleDim() + llround((F32)mPanelSpacing * panelp->getVisibleAmount()); + total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor(); + } + + llassert(total_visible_fraction < 1.01f); + + // don't need spacing after last panel + space_to_distribute += panelp ? llround((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0; + + // scale up space to distribute, since some of might will go to an invisible fraction of the auto-resize space + space_to_distribute = (total_visible_fraction > 0.f) + ? llround((F32)space_to_distribute / total_visible_fraction) + : space_to_distribute; + + if (space_to_distribute > 0) + { // give space proportionally to auto resize panels, even invisible ones + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + { + if (panelp->mAutoResize == TRUE) + { + S32 delta = llround((F32)space_to_distribute * panelp->mFractionalSize/* * panelp->getAutoResizeFactor()*/); + panelp->mTargetDim += delta; + } + } + } + + F32 cur_pos = (mOrientation == HORIZONTAL) ? 0.f : (F32)getRect().getHeight(); + + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + { + F32 panel_dim = panelp->mTargetDim; + F32 panel_visible_dim = panelp->getVisibleDim(); + + LLRect panel_rect; + if (mOrientation == HORIZONTAL) + { + panel_rect.setLeftTopAndSize(llround(cur_pos), + getRect().getHeight(), + llround(panel_dim), + getRect().getHeight()); + } + else + { + panel_rect.setLeftTopAndSize(0, + llround(cur_pos), + getRect().getWidth(), + llround(panel_dim)); + } + panelp->setIgnoreReshape(true); + panelp->setShape(panel_rect); + panelp->setIgnoreReshape(false); + + static LLUICachedControl resize_bar_overlap ("UIResizeBarOverlap", 0); + LLRect resize_bar_rect(panel_rect); + + F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount(); + if (mOrientation == HORIZONTAL) + { + resize_bar_rect.mLeft = panel_rect.mRight - resize_bar_overlap; + resize_bar_rect.mRight = panel_rect.mRight + panel_spacing + resize_bar_overlap; + + cur_pos += panel_visible_dim + panel_spacing; + } + else //VERTICAL + { + resize_bar_rect.mTop = panel_rect.mBottom + resize_bar_overlap; + resize_bar_rect.mBottom = panel_rect.mBottom - panel_spacing - resize_bar_overlap; + + cur_pos -= panel_visible_dim + panel_spacing; + } + panelp->mResizeBar->setShape(resize_bar_rect); + } + + updateResizeBarLimits(); + + // clear animation flag at end, since panel resizes will set it + // and leave it set if there is any animation in progress + mNeedsLayout = animation_in_progress; +} // end LLLayoutStack::updateLayout + +LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const +{ + if (!panelp) return NULL; + + e_panel_list_t::const_iterator panel_it; + BOOST_FOREACH(LLLayoutPanel* p, mPanels) + { + if (p == panelp) + { + return p; + } + } + return NULL; +} + +LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const { - LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name); + LLLayoutPanel* result = NULL; - if (panel && min_dimp) + BOOST_FOREACH(LLLayoutPanel* p, mPanels) { - *min_dimp = panel->getRelevantMinDim(); + if (p->getName() == name) + { + result = p; + break; + } } - return NULL != panel; + return result; } -bool LLLayoutStack::getPanelMaxSize(const std::string& panel_name, S32* max_dimp) +void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) { - LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name); + BOOST_FOREACH(LLLayoutPanel* lp, mPanels) + { + if (lp->mResizeBar == NULL) + { + LLResizeBar::Side side = (mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM; + LLRect resize_bar_rect = getRect(); - if (panel) + LLResizeBar::Params resize_params; + resize_params.name("resize"); + resize_params.resizing_view(lp); + resize_params.min_size(lp->getRelevantMinDim()); + resize_params.side(side); + resize_params.snapping_enabled(false); + LLResizeBar* resize_bar = LLUICtrlFactory::create(resize_params); + lp->mResizeBar = resize_bar; + LLView::addChild(resize_bar, 0); + } + } + // bring all resize bars to the front so that they are clickable even over the panels + // with a bit of overlap + for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { - if (max_dimp) *max_dimp = panel->mMaxDim; + LLResizeBar* resize_barp = (*panel_it)->mResizeBar; + sendChildToFront(resize_barp); } +} - return NULL != panel; +// update layout stack animations, etc. once per frame +// NOTE: we use this to size world view based on animating UI, *before* we draw the UI +// we might still need to call updateLayout during UI draw phase, in case UI elements +// are resizing themselves dynamically +//static +void LLLayoutStack::updateClass() +{ + for (instance_iter it = beginInstances(); it != endInstances(); ++it) + { + it->updateLayout(); + } } -static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks"); -void LLLayoutStack::updateLayout(BOOL force_resize) +void LLLayoutStack::updateFractionalSizes() { - LLFastTimer ft(FTM_UPDATE_LAYOUT); - static LLUICachedControl resize_bar_overlap ("UIResizeBarOverlap", 0); - calcMinExtents(); - createResizeBars(); + F32 total_resizable_dim = 0; + S32 num_auto_resize_panels = 0; + + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + { + if (panelp->mAutoResize) + { + total_resizable_dim += llmax(0, panelp->getLayoutDim() - panelp->getRelevantMinDim()); + num_auto_resize_panels++; + } + } - // calculate current extents - F32 total_size = 0.f; + F32 total_fractional_size = 0.f; + + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + { + if (panelp->mAutoResize) + { + F32 panel_resizable_dim = llmax(0.f, (F32)(panelp->getLayoutDim() - panelp->getRelevantMinDim())); + panelp->mFractionalSize = llmin(MAX_FRACTIONAL_VALUE, (panel_resizable_dim == 0.f) + ? (1.f - MAX_FRACTIONAL_VALUE) + : panel_resizable_dim / total_resizable_dim); + total_fractional_size += panelp->mFractionalSize; + // check for NaNs + llassert(panelp->mFractionalSize == panelp->mFractionalSize); + } + } + if (total_fractional_size == 0.f) + { // equal distribution + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + { + if (panelp->mAutoResize) + { + panelp->mFractionalSize = 1.f / (F32)num_auto_resize_panels; + } + } + } + else + { // renormalize + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + { + if (panelp->mAutoResize) + { + panelp->mFractionalSize /= total_fractional_size; + } + } + } +} + +bool LLLayoutStack::animatePanels() +{ + bool animation_in_progress = false; + // // animate visibility // - e_panel_list_t::iterator panel_it; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) { - LLLayoutPanel* panelp = (*panel_it); - if (panelp->getVisible()) + if (panelp->getVisible()) { - if (mAnimate) + if (mAnimate && panelp->mVisibleAmt < 1.f) { if (!mAnimatedThisFrame) { @@ -345,15 +572,21 @@ void LLLayoutStack::updateLayout(BOOL force_resize) panelp->mVisibleAmt = 1.f; } } + + animation_in_progress = true; } else { - panelp->mVisibleAmt = 1.f; + if (panelp->mVisibleAmt != 1.f) + { + panelp->mVisibleAmt = 1.f; + animation_in_progress = true; + } } } else // not visible { - if (mAnimate) + if (mAnimate && panelp->mVisibleAmt > 0.f) { if (!mAnimatedThisFrame) { @@ -363,297 +596,206 @@ void LLLayoutStack::updateLayout(BOOL force_resize) panelp->mVisibleAmt = 0.f; } } + + animation_in_progress = true; } else { - panelp->mVisibleAmt = 0.f; + if (panelp->mVisibleAmt != 0.f) + { + panelp->mVisibleAmt = 0.f; + animation_in_progress = true; + } } } F32 collapse_state = panelp->mCollapsed ? 1.f : 0.f; - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - - total_size += panelp->mFractionalSize * panelp->getCollapseFactor(); - // want n-1 panel gaps for n panels - if (panel_it != mPanels.begin()) - { - total_size += mPanelSpacing; - } - } - - S32 num_resizable_panels = 0; - F32 shrink_headroom_available = 0.f; - F32 shrink_headroom_total = 0.f; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - LLLayoutPanel* panelp = (*panel_it); - - // panels that are not fully visible do not count towards shrink headroom - if (panelp->getCollapseFactor() < 1.f) - { - continue; - } - - F32 cur_size = panelp->mFractionalSize; - F32 min_size = (F32)panelp->getRelevantMinDim(); - - // if currently resizing a panel or the panel is flagged as not automatically resizing - // only track total available headroom, but don't use it for automatic resize logic - if (panelp->mResizeBar->hasMouseCapture() - || (!panelp->mAutoResize - && !force_resize)) - { - shrink_headroom_total += cur_size - min_size; - } - else - { - num_resizable_panels++; - - shrink_headroom_available += cur_size - min_size; - shrink_headroom_total += cur_size - min_size; - } - } - - // calculate how many pixels need to be distributed among layout panels - // positive means panels need to grow, negative means shrink - F32 pixels_to_distribute = (mOrientation == HORIZONTAL) - ? getRect().getWidth() - total_size - : getRect().getHeight() - total_size; - - // now we distribute the pixels... - F32 cur_x = 0.f; - F32 cur_y = (F32)getRect().getHeight(); - - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - LLLayoutPanel* panelp = (*panel_it); - - F32 min_size = panelp->getRelevantMinDim(); - F32 delta_size = 0.f; - - // if panel can automatically resize (not animating, and resize flag set)... - if (panelp->getCollapseFactor() == 1.f - && (force_resize || panelp->mAutoResize) - && !panelp->mResizeBar->hasMouseCapture()) + if (panelp->mCollapseAmt != collapse_state) { - if (pixels_to_distribute < 0.f) + if (!mAnimatedThisFrame) { - // shrink proportionally to amount over minimum - // so we can do this in one pass - delta_size = (shrink_headroom_available > 0.f) - ? pixels_to_distribute * ((F32)(panelp->mFractionalSize - min_size) / shrink_headroom_available) - : 0.f; - shrink_headroom_available -= (panelp->mFractionalSize - min_size); + panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); } - else + animation_in_progress = true; + + if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f) { - // grow all elements equally - delta_size = pixels_to_distribute / (F32)num_resizable_panels; - num_resizable_panels--; + panelp->mCollapseAmt = collapse_state; } - - panelp->mFractionalSize = llmax(min_size, panelp->mFractionalSize + delta_size); - pixels_to_distribute -= delta_size; } + } - // adjust running headroom count based on new sizes - shrink_headroom_total += delta_size; + mAnimatedThisFrame = true; - LLRect panel_rect; - if (mOrientation == HORIZONTAL) - { - panel_rect.setLeftTopAndSize(llround(cur_x), - llround(cur_y), - llround(panelp->mFractionalSize), - getRect().getHeight()); - } - else - { - panel_rect.setLeftTopAndSize(llround(cur_x), - llround(cur_y), - getRect().getWidth(), - llround(panelp->mFractionalSize)); - } - panelp->setShape(panel_rect); + return animation_in_progress; +} - LLRect resize_bar_rect = panel_rect; - if (mOrientation == HORIZONTAL) - { - resize_bar_rect.mLeft = panel_rect.mRight - resize_bar_overlap; - resize_bar_rect.mRight = panel_rect.mRight + mPanelSpacing + resize_bar_overlap; - } - else - { - resize_bar_rect.mTop = panel_rect.mBottom + resize_bar_overlap; - resize_bar_rect.mBottom = panel_rect.mBottom - mPanelSpacing - resize_bar_overlap; - } - (*panel_it)->mResizeBar->setRect(resize_bar_rect); +void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& new_rect ) +{ + S32 new_dim = (mOrientation == HORIZONTAL) + ? new_rect.getWidth() + : new_rect.getHeight(); + S32 delta_dim = new_dim - resized_panel->getVisibleDim(); + if (delta_dim == 0) return; - F32 size = ((*panel_it)->mFractionalSize * (*panel_it)->getCollapseFactor()) + (F32)mPanelSpacing; - if (mOrientation == HORIZONTAL) - { - cur_x += size; - } - else //VERTICAL - { - cur_y -= size; - } - } + F32 total_visible_fraction = 0.f; + F32 delta_auto_resize_headroom = 0.f; + F32 total_auto_resize_headroom = 0.f; - // update resize bars with new limits - LLLayoutPanel* last_resizeable_panel = NULL; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - LLLayoutPanel* panelp = (*panel_it); - S32 relevant_min = panelp->getRelevantMinDim(); + LLLayoutPanel* other_resize_panel = NULL; + LLLayoutPanel* following_panel = NULL; - if (mOrientation == HORIZONTAL) + BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels) + { + if (panelp->mAutoResize) { - (*panel_it)->mResizeBar->setResizeLimits( - relevant_min, - relevant_min + llround(shrink_headroom_total)); + total_auto_resize_headroom += (F32)(panelp->mTargetDim - panelp->getRelevantMinDim()); + total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor(); } - else //VERTICAL + + if (panelp == resized_panel) { - (*panel_it)->mResizeBar->setResizeLimits( - relevant_min, - relevant_min + llround(shrink_headroom_total)); + other_resize_panel = following_panel; } - // toggle resize bars based on panel visibility, resizability, etc - BOOL resize_bar_enabled = panelp->getVisible() && (*panel_it)->mUserResize; - (*panel_it)->mResizeBar->setVisible(resize_bar_enabled); - - if ((*panel_it)->mUserResize || (*panel_it)->mAutoResize) + if (panelp->getVisible() && !panelp->mCollapsed) { - last_resizeable_panel = (*panel_it); + following_panel = panelp; } } - // hide last resize bar as there is nothing past it - // resize bars need to be in between two resizable panels - if (last_resizeable_panel) + if (resized_panel->mAutoResize == FALSE) { - last_resizeable_panel->mResizeBar->setVisible(FALSE); + delta_auto_resize_headroom += -delta_dim; } - - // not enough room to fit existing contents - if (force_resize == FALSE - // layout did not complete by reaching target position - && ((mOrientation == VERTICAL && llround(cur_y) != -mPanelSpacing) - || (mOrientation == HORIZONTAL && llround(cur_x) != getRect().getWidth() + mPanelSpacing))) + if (other_resize_panel && other_resize_panel->mAutoResize == FALSE) { - // do another layout pass with all stacked elements contributing - // even those that don't usually resize - llassert_always(force_resize == FALSE); - updateLayout(TRUE); + delta_auto_resize_headroom += delta_dim; } - mAnimatedThisFrame = true; -} // end LLLayoutStack::updateLayout + //delta_auto_resize_headroom = (total_visible_fraction > 0.f) + // ? delta_auto_resize_headroom / total_visible_fraction + // : 0.f; -LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const -{ - if (!panelp) return NULL; + F32 fraction_given_up = 0.f; + F32 fraction_remaining = 1.f; + F32 updated_auto_resize_headroom = total_auto_resize_headroom + delta_auto_resize_headroom; - e_panel_list_t::const_iterator panel_it; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) + enum { - if ((*panel_it) == panelp) - { - return *panel_it; - } - } - return NULL; -} - -LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const -{ - LLLayoutPanel* result = NULL; + BEFORE_RESIZED_PANEL, + RESIZED_PANEL, + NEXT_PANEL, + AFTER_RESIZED_PANEL + } which_panel = BEFORE_RESIZED_PANEL; - for (e_panel_list_t::const_iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) { - LLLayoutPanel* p = *panel_it; + if (!panelp->getVisible() || panelp->mCollapsed) continue; - if (p->getName() == name) + if (panelp == resized_panel) { - result = p; - break; + which_panel = RESIZED_PANEL; } - } - - return result; -} -// Compute sum of min_width or min_height of children -void LLLayoutStack::calcMinExtents() -{ - mMinWidth = 0; - mMinHeight = 0; - - e_panel_list_t::iterator panel_it; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - if (mOrientation == HORIZONTAL) + switch(which_panel) { - mMinWidth += (*panel_it)->getRelevantMinDim(); - if (panel_it != mPanels.begin()) + case BEFORE_RESIZED_PANEL: + if (panelp->mAutoResize) + { // freeze current size as fraction of overall auto_resize space + F32 fractional_adjustment_factor = total_auto_resize_headroom / updated_auto_resize_headroom; + F32 new_fractional_size = llclamp(panelp->mFractionalSize * fractional_adjustment_factor, + 0.f, + MAX_FRACTIONAL_VALUE); + F32 fraction_delta = (new_fractional_size - panelp->mFractionalSize); + fraction_given_up -= fraction_delta; + fraction_remaining -= panelp->mFractionalSize; + panelp->mFractionalSize += fraction_delta; + llassert(!llisnan(panelp->mFractionalSize)); + } + else { - mMinWidth += mPanelSpacing; + // leave non auto-resize panels alone } - } - else //VERTICAL - { - mMinHeight += (*panel_it)->getRelevantMinDim(); - if (panel_it != mPanels.begin()) + break; + case RESIZED_PANEL: + if (panelp->mAutoResize) + { // freeze new size as fraction + F32 new_fractional_size = (updated_auto_resize_headroom == 0.f) + ? 1.f + : llmin(MAX_FRACTIONAL_VALUE, ((F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom)); + fraction_given_up -= new_fractional_size - panelp->mFractionalSize; + fraction_remaining -= panelp->mFractionalSize; + panelp->mFractionalSize = new_fractional_size; + llassert(!llisnan(panelp->mFractionalSize)); + } + else + { // freeze new size as original size + panelp->mTargetDim = new_dim; + fraction_remaining -= fraction_given_up; + } + which_panel = NEXT_PANEL; + break; + case NEXT_PANEL: + if (panelp->mAutoResize) + { + F32 new_fractional_size = (F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) + / updated_auto_resize_headroom; + fraction_given_up -= new_fractional_size - panelp->mFractionalSize; + fraction_remaining -= panelp->mFractionalSize; + panelp->mFractionalSize = new_fractional_size; + } + else + { + panelp->mTargetDim -= delta_dim; + } + which_panel = AFTER_RESIZED_PANEL; + break; + case AFTER_RESIZED_PANEL: + if (panelp->mAutoResize) { - mMinHeight += mPanelSpacing; + panelp->mFractionalSize += (panelp->mFractionalSize / fraction_remaining) * fraction_given_up; } + default: + break; } } } -void LLLayoutStack::createResizeBars() +void LLLayoutStack::reshape(S32 width, S32 height, BOOL called_from_parent) { - for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) + mNeedsLayout = true; + LLView::reshape(width, height, called_from_parent); +} + +void LLLayoutStack::updateResizeBarLimits() +{ + LLLayoutPanel* previous_visible_panelp = NULL; + BOOST_REVERSE_FOREACH(LLLayoutPanel* visible_panelp, mPanels) { - LLLayoutPanel* lp = (*panel_it); - if (lp->mResizeBar == NULL) + if (!visible_panelp->getVisible() || visible_panelp->mCollapsed) { - LLResizeBar::Side side = (mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM; - LLRect resize_bar_rect = getRect(); - - LLResizeBar::Params resize_params; - resize_params.name("resize"); - resize_params.resizing_view(lp); - resize_params.min_size(lp->getRelevantMinDim()); - resize_params.side(side); - resize_params.snapping_enabled(false); - LLResizeBar* resize_bar = LLUICtrlFactory::create(resize_params); - lp->mResizeBar = resize_bar; - LLView::addChild(resize_bar, 0); + visible_panelp->mResizeBar->setVisible(FALSE); + continue; + } - // bring all resize bars to the front so that they are clickable even over the panels - // with a bit of overlap - for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - LLResizeBar* resize_barp = (*panel_it)->mResizeBar; - sendChildToFront(resize_barp); - } + // toggle resize bars based on panel visibility, resizability, etc + if (visible_panelp->mUserResize + && previous_visible_panelp + && previous_visible_panelp->mUserResize) + { + visible_panelp->mResizeBar->setVisible(TRUE); + visible_panelp->mResizeBar->setResizeLimits(visible_panelp->getRelevantMinDim(), + visible_panelp->getVisibleDim() + + (previous_visible_panelp->getVisibleDim() + - previous_visible_panelp->getRelevantMinDim())); + } + else + { + visible_panelp->mResizeBar->setVisible(FALSE); } - } -} -// update layout stack animations, etc. once per frame -// NOTE: we use this to size world view based on animating UI, *before* we draw the UI -// we might still need to call updateLayout during UI draw phase, in case UI elements -// are resizing themselves dynamically -//static -void LLLayoutStack::updateClass() -{ - for (instance_iter it = beginInstances(); it != endInstances(); ++it) - { - it->updateLayout(); + previous_visible_panelp = visible_panelp; } } diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 3b308a359d..a343e11cec 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -5,7 +5,7 @@ * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2010, Linden Reshasearch, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -72,12 +72,11 @@ public: /*virtual*/ void removeChild(LLView*); /*virtual*/ BOOL postBuild(); /*virtual*/ bool addChild(LLView* child, S32 tab_group = 0); + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); - S32 getMinWidth() const { return mMinWidth; } - S32 getMinHeight() const { return mMinHeight; } - typedef enum e_animate { NO_ANIMATE, @@ -85,47 +84,27 @@ public: } EAnimate; void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE); - void removePanel(LLPanel* panel); void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE); S32 getNumPanels() { return mPanels.size(); } - /** - * Moves panel_to_move before target_panel inside layout stack (both panels should already be there). - * If move_to_front is true target_panel is ignored and panel_to_move is moved to the beginning of mPanels - */ - void movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front = false); void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize); void setPanelUserResize(const std::string& panel_name, BOOL user_resize); - /** - * Gets minimal dimension along layout_stack axis of the specified by name panel. - * - * @returns true if specified by panel_name internal panel exists, false otherwise. - */ - bool getPanelMinSize(const std::string& panel_name, S32* min_dimp); - - /** - * Gets maximal dimension along layout_stack axis of the specified by name panel. - * - * @returns true if specified by panel_name internal panel exists, false otherwise. - */ - bool getPanelMaxSize(const std::string& panel_name, S32* max_dim); - - void updateLayout(BOOL force_resize = FALSE); - + void updateLayout(); + S32 getPanelSpacing() const { return mPanelSpacing; } - BOOL getAnimate () const { return mAnimate; } - void setAnimate (BOOL animate) { mAnimate = animate; } static void updateClass(); protected: LLLayoutStack(const Params&); friend class LLUICtrlFactory; + friend class LLLayoutPanel; private: - void createResizeBars(); - void calcMinExtents(); + void updateResizeBarLimits(); + bool animatePanels(); + void createResizeBar(LLLayoutPanel* panel); const ELayoutOrientation mOrientation; @@ -134,9 +113,9 @@ private: LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const; LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const; + void updateFractionalSizes(); + void updatePanelRect( LLLayoutPanel* param1, const LLRect& new_rect ); - S32 mMinWidth; // calculated by calcMinExtents - S32 mMinHeight; // calculated by calcMinExtents S32 mPanelSpacing; // true if we already applied animation this frame @@ -145,6 +124,7 @@ private: bool mClip; F32 mOpenTimeConstant; F32 mCloseTimeConstant; + bool mNeedsLayout; }; // end class LLLayoutStack @@ -156,8 +136,7 @@ public: struct Params : public LLInitParam::Block { Optional expanded_min_dim, - min_dim, - max_dim; + min_dim; Optional user_resize, auto_resize; @@ -168,14 +147,17 @@ public: void initFromParams(const Params& p); + void handleReshape(const LLRect& new_rect, bool by_user); + void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + + + void setVisible(BOOL visible); + S32 getLayoutDim() const; S32 getMinDim() const { return mMinDim; } void setMinDim(S32 value) { mMinDim = value; if (!mExpandedMinDimSpecified) mExpandedMinDim = value; } - S32 getMaxDim() const { return mMaxDim; } - void setMaxDim(S32 value) { mMaxDim = value; } - S32 getExpandedMinDim() const { return mExpandedMinDim; } void setExpandedMinDim(S32 value) { mExpandedMinDim = value; mExpandedMinDimSpecified = true; } @@ -191,8 +173,14 @@ public: return min_dim; } - F32 getCollapseFactor(); - void setOrientation(LLLayoutStack::ELayoutOrientation orientation) { mOrientation = orientation; } + F32 getAutoResizeFactor() const; + F32 getVisibleAmount() const; + S32 getVisibleDim() const; + + void setOrientation(LLLayoutStack::ELayoutOrientation orientation); + void storeOriginalDim(); + + void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; } protected: LLLayoutPanel(const Params& p); @@ -201,13 +189,14 @@ protected: S32 mExpandedMinDim; S32 mMinDim; - S32 mMaxDim; bool mAutoResize; bool mUserResize; bool mCollapsed; F32 mVisibleAmt; F32 mCollapseAmt; F32 mFractionalSize; + S32 mTargetDim; + bool mIgnoreReshape; LLLayoutStack::ELayoutOrientation mOrientation; class LLResizeBar* mResizeBar; }; diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index 02f60c76fa..87aeb4d7a7 100644 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -79,6 +79,8 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) { + if (!canResize()) return FALSE; + // Route future Mouse messages here preemptively. (Release on mouse up.) // No handler needed for focus lost since this clas has no state that depends on it. gFocusMgr.setMouseCapture( this ); @@ -243,7 +245,7 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) handled = TRUE; } - if( handled ) + if( handled && canResize() ) { switch( mSide ) { diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index 0725fbd846..6daf191918 100644 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h @@ -70,6 +70,7 @@ public: void setResizeLimits( S32 min_size, S32 max_size ) { mMinSize = min_size; mMaxSize = max_size; } void setEnableSnapping(BOOL enable) { mSnappingEnabled = enable; } void setAllowDoubleClickSnapping(BOOL allow) { mAllowDoubleClickSnapping = allow; } + bool canResize() { return getEnabled() && mMaxSize > mMinSize; } private: S32 mDragLastScreenX; diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index ae8b30b1ba..a8bb29374e 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -176,12 +176,12 @@ void LLWindowShade::draw() { hide(); } - else if (notification_area->getCollapseFactor() < 0.01f) + else if (notification_area->getVisibleAmount() < 0.01f) { displayLatestNotification(); } - if (!notification_area->getVisible() && (notification_area->getCollapseFactor() < 0.001f)) + if (!notification_area->getVisible() && (notification_area->getVisibleAmount() < 0.001f)) { getChildRef("background_area").setBackgroundVisible(false); setMouseOpaque(false); -- cgit v1.2.3 From 7092a07045e0bc17c503c0bc81e3f038bd1516e8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 16 Jan 2012 14:35:00 -0800 Subject: Fix Mac build issue --- indra/llui/lllayoutstack.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index b67030dc34..a1e8eebb47 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -116,9 +116,9 @@ F32 LLLayoutPanel::getVisibleAmount() const S32 LLLayoutPanel::getLayoutDim() const { - return llround((mOrientation == LLLayoutStack::HORIZONTAL) + return llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL) ? getRect().getWidth() - : getRect().getHeight()); + : getRect().getHeight())); } S32 LLLayoutPanel::getVisibleDim() const @@ -132,9 +132,9 @@ S32 LLLayoutPanel::getVisibleDim() const void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientation ) { mOrientation = orientation; - S32 layout_dim = llround((mOrientation == LLLayoutStack::HORIZONTAL) + S32 layout_dim = llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL) ? getRect().getWidth() - : getRect().getHeight()); + : getRect().getHeight())); if (mMinDim == -1) { -- cgit v1.2.3 From 0e7956a4cbdb0772ff6175307475ee6fc8b620ea Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 17 Jan 2012 07:39:14 -0800 Subject: EXP-1758 : Fix crash on login on Mac (bad pointer reference). Might need more work if the intent was to always get that pointer. --- indra/llui/lllayoutstack.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index a1e8eebb47..ac10afe594 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -156,7 +156,10 @@ void LLLayoutPanel::setVisible( BOOL visible ) if (visible != getVisible()) { LLLayoutStack* stackp = dynamic_cast(getParent()); - stackp->mNeedsLayout = true; + if (stackp) + { + stackp->mNeedsLayout = true; + } } LLPanel::setVisible(visible); } -- cgit v1.2.3 From 2589a7e135a9e894eb7bbe0cb1e032c105f72bf8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 17 Jan 2012 12:17:03 -0800 Subject: fix for crash in assert when programmatically toggling user resize --- indra/llui/lllayoutstack.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index ac10afe594..000f729e29 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -314,6 +314,8 @@ void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL au { panel->mAutoResize = auto_resize; } + + mNeedsLayout = true; } void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_resize) @@ -324,6 +326,8 @@ void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_ { panel->mUserResize = user_resize; } + + mNeedsLayout = true; } -- cgit v1.2.3 From f9a17df4d3ec9e0301b287e0a0df6ac1f8ede1ca Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 17 Jan 2012 23:17:52 +0200 Subject: EXP-1806 FIXED CTRL-W no longer closes floaters. Restoring accidentally removed code. --- indra/llui/llfloater.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 33548151fd..cedc4c0aee 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1681,6 +1681,8 @@ LLFloater* LLFloater::getClosableFloaterFromFocus() { if (it->hasFocus()) { + LLFloater& floater = *it; + focused_floater = &floater; break; } } -- cgit v1.2.3 From 1fede65af23248293d4033b8f7557875b499e191 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 17 Jan 2012 16:05:10 -0800 Subject: EXP-1810 FIX Cannot resize Received items panel in Inventory window --- indra/llui/lllayoutstack.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 000f729e29..f7b34bbb38 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -39,8 +39,6 @@ static LLDefaultChildRegistry::Register register_layout_stack("layout_stack"); static LLLayoutStack::LayoutStackRegistry::Register register_layout_panel("layout_panel"); -static const F32 MAX_FRACTIONAL_VALUE = 0.99999f; - void LLLayoutStack::OrientationNames::declareValues() { declare("horizontal", HORIZONTAL); @@ -328,6 +326,7 @@ void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_ } mNeedsLayout = true; + updateFractionalSizes(); } @@ -527,8 +526,8 @@ void LLLayoutStack::updateFractionalSizes() if (panelp->mAutoResize) { F32 panel_resizable_dim = llmax(0.f, (F32)(panelp->getLayoutDim() - panelp->getRelevantMinDim())); - panelp->mFractionalSize = llmin(MAX_FRACTIONAL_VALUE, (panel_resizable_dim == 0.f) - ? (1.f - MAX_FRACTIONAL_VALUE) + panelp->mFractionalSize = llmin(1.f, (panel_resizable_dim == 0.f) + ? 0.f : panel_resizable_dim / total_resizable_dim); total_fractional_size += panelp->mFractionalSize; // check for NaNs @@ -714,7 +713,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& F32 fractional_adjustment_factor = total_auto_resize_headroom / updated_auto_resize_headroom; F32 new_fractional_size = llclamp(panelp->mFractionalSize * fractional_adjustment_factor, 0.f, - MAX_FRACTIONAL_VALUE); + 1.f); F32 fraction_delta = (new_fractional_size - panelp->mFractionalSize); fraction_given_up -= fraction_delta; fraction_remaining -= panelp->mFractionalSize; @@ -731,7 +730,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& { // freeze new size as fraction F32 new_fractional_size = (updated_auto_resize_headroom == 0.f) ? 1.f - : llmin(MAX_FRACTIONAL_VALUE, ((F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom)); + : llmin(1.f, ((F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom)); fraction_given_up -= new_fractional_size - panelp->mFractionalSize; fraction_remaining -= panelp->mFractionalSize; panelp->mFractionalSize = new_fractional_size; @@ -747,11 +746,20 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& case NEXT_PANEL: if (panelp->mAutoResize) { - F32 new_fractional_size = (F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) - / updated_auto_resize_headroom; - fraction_given_up -= new_fractional_size - panelp->mFractionalSize; fraction_remaining -= panelp->mFractionalSize; - panelp->mFractionalSize = new_fractional_size; + if (fraction_given_up != 0.f) + { + panelp->mFractionalSize += fraction_given_up; + fraction_given_up = 0.f; + } + else + { + F32 new_fractional_size = llmin(1.f, + (F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) + / updated_auto_resize_headroom); + fraction_given_up -= new_fractional_size - panelp->mFractionalSize; + panelp->mFractionalSize = new_fractional_size; + } } else { @@ -788,9 +796,9 @@ void LLLayoutStack::updateResizeBarLimits() } // toggle resize bars based on panel visibility, resizability, etc - if (visible_panelp->mUserResize - && previous_visible_panelp - && previous_visible_panelp->mUserResize) + if (previous_visible_panelp + && (visible_panelp->mUserResize + || previous_visible_panelp->mUserResize)) { visible_panelp->mResizeBar->setVisible(TRUE); visible_panelp->mResizeBar->setResizeLimits(visible_panelp->getRelevantMinDim(), -- cgit v1.2.3 From 1eae229cf2470bee506d72ddecbd1305f305670b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 17 Jan 2012 16:28:12 -0800 Subject: EXP-1809 FIX Buttons in right toolbar clipped and can be out of position --- indra/llui/lllayoutstack.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index f7b34bbb38..a309e3ff97 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -167,6 +167,11 @@ void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= if (!mIgnoreReshape && !mAutoResize) { mTargetDim = (mOrientation == LLLayoutStack::HORIZONTAL) ? width : height; + LLLayoutStack* stackp = dynamic_cast(getParent()); + if (stackp) + { + stackp->mNeedsLayout = true; + } } LLPanel::reshape(width, height, called_from_parent); } -- cgit v1.2.3 From 9025656bba1520b6b442ce0a359fad0217e6d970 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 17 Jan 2012 22:41:25 -0800 Subject: EXP-1773 : A bit of code cleanup and defensive coding in an attempt to alleviate some errand crashes. --- indra/llui/lluistring.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index ac69d3bf85..c4e073ccdb 100644 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -128,17 +128,13 @@ void LLUIString::updateResult() const } mResult = mOrig; - // get the defailt args + local args - if (!mArgs || mArgs->empty()) + // get the default args + local args + LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs(); + if (mArgs && !mArgs->empty()) { - LLStringUtil::format(mResult, LLTrans::getDefaultArgs()); - } - else - { - LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs(); combined_args.insert(mArgs->begin(), mArgs->end()); - LLStringUtil::format(mResult, combined_args); } + LLStringUtil::format(mResult, combined_args); } void LLUIString::updateWResult() const -- cgit v1.2.3 From 40687a930c2e37a4da15ff15f004611a734583d7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 18 Jan 2012 12:59:44 -0800 Subject: EXP-1812 FIX Cannot resize location bar / favorites in top navigation bar in viewer --- indra/llui/lllayoutstack.cpp | 13 +++++++------ indra/llui/lllayoutstack.h | 6 ++++-- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index a309e3ff97..9909032707 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -201,6 +201,7 @@ LLLayoutStack::Params::Params() clip("clip", true), open_time_constant("open_time_constant", 0.02f), close_time_constant("close_time_constant", 0.03f), + resize_bar_overlap("resize_bar_overlap", 1), border_size("border_size", LLCachedControl(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0)) {} @@ -213,7 +214,8 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) mNeedsLayout(true), mClip(p.clip), mOpenTimeConstant(p.open_time_constant), - mCloseTimeConstant(p.close_time_constant) + mCloseTimeConstant(p.close_time_constant), + mResizeBarOverlap(p.resize_bar_overlap) {} LLLayoutStack::~LLLayoutStack() @@ -409,21 +411,20 @@ void LLLayoutStack::updateLayout() panelp->setShape(panel_rect); panelp->setIgnoreReshape(false); - static LLUICachedControl resize_bar_overlap ("UIResizeBarOverlap", 0); LLRect resize_bar_rect(panel_rect); F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount(); if (mOrientation == HORIZONTAL) { - resize_bar_rect.mLeft = panel_rect.mRight - resize_bar_overlap; - resize_bar_rect.mRight = panel_rect.mRight + panel_spacing + resize_bar_overlap; + resize_bar_rect.mLeft = panel_rect.mRight - mResizeBarOverlap; + resize_bar_rect.mRight = panel_rect.mRight + panel_spacing + mResizeBarOverlap; cur_pos += panel_visible_dim + panel_spacing; } else //VERTICAL { - resize_bar_rect.mTop = panel_rect.mBottom + resize_bar_overlap; - resize_bar_rect.mBottom = panel_rect.mBottom - panel_spacing - resize_bar_overlap; + resize_bar_rect.mTop = panel_rect.mBottom + mResizeBarOverlap; + resize_bar_rect.mBottom = panel_rect.mBottom - panel_spacing - mResizeBarOverlap; cur_pos -= panel_visible_dim + panel_spacing; } diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index a343e11cec..f00d5e759b 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -60,6 +60,7 @@ public: clip; Optional open_time_constant, close_time_constant; + Optional resize_bar_overlap; Params(); }; @@ -122,9 +123,10 @@ private: bool mAnimatedThisFrame; bool mAnimate; bool mClip; - F32 mOpenTimeConstant; - F32 mCloseTimeConstant; + F32 mOpenTimeConstant; + F32 mCloseTimeConstant; bool mNeedsLayout; + S32 mResizeBarOverlap; }; // end class LLLayoutStack -- cgit v1.2.3 From 916d61e4600df58329524e59c06d9621cab02393 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 18 Jan 2012 15:59:08 -0800 Subject: Fix Linux compilation failure --- indra/llui/lllayoutstack.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 9909032707..34d13610b7 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -417,14 +417,14 @@ void LLLayoutStack::updateLayout() if (mOrientation == HORIZONTAL) { resize_bar_rect.mLeft = panel_rect.mRight - mResizeBarOverlap; - resize_bar_rect.mRight = panel_rect.mRight + panel_spacing + mResizeBarOverlap; + resize_bar_rect.mRight = panel_rect.mRight + (S32)(llround(panel_spacing)) + mResizeBarOverlap; cur_pos += panel_visible_dim + panel_spacing; } else //VERTICAL { resize_bar_rect.mTop = panel_rect.mBottom + mResizeBarOverlap; - resize_bar_rect.mBottom = panel_rect.mBottom - panel_spacing - mResizeBarOverlap; + resize_bar_rect.mBottom = panel_rect.mBottom - (S32)(llround(panel_spacing)) - mResizeBarOverlap; cur_pos -= panel_visible_dim + panel_spacing; } -- cgit v1.2.3 From 3a597af700e55e2017c85220b2b97cc9f3aef9aa Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 18 Jan 2012 16:30:53 -0800 Subject: EXP-1513 FIX Underscore ( _ ) fails to show in first chat entry in Local Chat fixed font metrics rounding error and made corrective adjustments in layout --- indra/llui/llmenugl.cpp | 8 ++++---- indra/llui/llscrolllistcell.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 95ecbb1c94..c624ae2e92 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -508,19 +508,19 @@ void LLMenuItemGL::draw( void ) { if( !mDrawBoolLabel.empty() ) { - mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color, + mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } - mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color, + mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); if( !mDrawAccelLabel.empty() ) { - mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color, + mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } if( !mDrawBranchLabel.empty() ) { - mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color, + mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } } diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 9d25c7180d..b087602a56 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -329,7 +329,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col break; } mFont->render(mText.getWString(), 0, - start_x, 2.f, + start_x, 0.f, display_color, mFontAlignment, LLFontGL::BOTTOM, -- cgit v1.2.3 From 02641d4ef33fd6f296a9a29700ecdd55ef9dffd8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 18 Jan 2012 16:32:07 -0800 Subject: Fix a Linux compilation failure --- indra/llui/lllayoutstack.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 9909032707..34d13610b7 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -417,14 +417,14 @@ void LLLayoutStack::updateLayout() if (mOrientation == HORIZONTAL) { resize_bar_rect.mLeft = panel_rect.mRight - mResizeBarOverlap; - resize_bar_rect.mRight = panel_rect.mRight + panel_spacing + mResizeBarOverlap; + resize_bar_rect.mRight = panel_rect.mRight + (S32)(llround(panel_spacing)) + mResizeBarOverlap; cur_pos += panel_visible_dim + panel_spacing; } else //VERTICAL { resize_bar_rect.mTop = panel_rect.mBottom + mResizeBarOverlap; - resize_bar_rect.mBottom = panel_rect.mBottom - panel_spacing - mResizeBarOverlap; + resize_bar_rect.mBottom = panel_rect.mBottom - (S32)(llround(panel_spacing)) - mResizeBarOverlap; cur_pos -= panel_visible_dim + panel_spacing; } -- cgit v1.2.3 From a662b888ed02691b7790c23e31c7d8bcf7cf7f5b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 19 Jan 2012 19:40:46 -0800 Subject: EXP-1824 FIX Received Items panel does not collapse correct when Height of panel is maximized in Inventory window --- indra/llui/lllayoutstack.cpp | 120 +++++++++++++++++++++------------------ indra/llui/lllayoutstack.h | 12 ++-- indra/llui/llscrollcontainer.cpp | 99 ++++++++++++++++---------------- indra/llui/llwindowshade.cpp | 2 +- 4 files changed, 122 insertions(+), 111 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 34d13610b7..073592b6ec 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -36,6 +36,9 @@ #include "llcriticaldamp.h" #include "boost/foreach.hpp" +static const F32 MIN_FRACTIONAL_SIZE = 0.0001f; +static const F32 MAX_FRACTIONAL_SIZE = 1.f; + static LLDefaultChildRegistry::Register register_layout_stack("layout_stack"); static LLLayoutStack::LayoutStackRegistry::Register register_layout_panel("layout_panel"); @@ -60,7 +63,6 @@ LLLayoutPanel::Params::Params() LLLayoutPanel::LLLayoutPanel(const Params& p) : LLPanel(p), - mExpandedMinDimSpecified(false), mExpandedMinDim(p.min_dim), mMinDim(p.min_dim), mAutoResize(p.auto_resize), @@ -69,7 +71,7 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mCollapseAmt(0.f), mVisibleAmt(1.f), // default to fully visible mResizeBar(NULL), - mFractionalSize(0.f), + mFractionalSize(MIN_FRACTIONAL_SIZE), mTargetDim(0), mIgnoreReshape(false), mOrientation(LLLayoutStack::HORIZONTAL) @@ -77,7 +79,6 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) // Set the expanded min dim if it is provided, otherwise it gets the p.min_dim value if (p.expanded_min_dim.isProvided()) { - mExpandedMinDimSpecified = true; mExpandedMinDim = p.expanded_min_dim(); } @@ -134,18 +135,6 @@ void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientatio ? getRect().getWidth() : getRect().getHeight())); - if (mMinDim == -1) - { - if (!mAutoResize) - { - setMinDim(layout_dim); - } - else - { - setMinDim(0); - } - } - mTargetDim = llmax(layout_dim, getMinDim()); } @@ -164,6 +153,8 @@ void LLLayoutPanel::setVisible( BOOL visible ) void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= TRUE*/ ) { + if (width == getRect().getWidth() && height == getRect().getHeight()) return; + if (!mIgnoreReshape && !mAutoResize) { mTargetDim = (mOrientation == LLLayoutStack::HORIZONTAL) ? width : height; @@ -347,6 +338,7 @@ void LLLayoutStack::updateLayout() bool animation_in_progress = animatePanels(); F32 total_visible_fraction = 0.f; + F32 total_open_fraction = 0.f; S32 space_to_distribute = (mOrientation == HORIZONTAL) ? getRect().getWidth() : getRect().getHeight(); @@ -358,9 +350,13 @@ void LLLayoutStack::updateLayout() if (panelp->mAutoResize) { panelp->mTargetDim = panelp->getRelevantMinDim(); + if (!panelp->mCollapsed && panelp->getVisible()) + { + total_open_fraction += panelp->mFractionalSize; + } } space_to_distribute -= panelp->getVisibleDim() + llround((F32)mPanelSpacing * panelp->getVisibleAmount()); - total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor(); + total_visible_fraction += panelp->mFractionalSize; } llassert(total_visible_fraction < 1.01f); @@ -368,28 +364,45 @@ void LLLayoutStack::updateLayout() // don't need spacing after last panel space_to_distribute += panelp ? llround((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0; - // scale up space to distribute, since some of might will go to an invisible fraction of the auto-resize space - space_to_distribute = (total_visible_fraction > 0.f) - ? llround((F32)space_to_distribute / total_visible_fraction) - : space_to_distribute; - - if (space_to_distribute > 0) - { // give space proportionally to auto resize panels, even invisible ones + F32 fraction_distributed = 0.f; + if (space_to_distribute > 0 && total_visible_fraction > 0.f) + { // give space proportionally to visible auto resize panels BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) { if (panelp->mAutoResize == TRUE) { - S32 delta = llround((F32)space_to_distribute * panelp->mFractionalSize/* * panelp->getAutoResizeFactor()*/); + F32 fraction_to_distribute = (panelp->mFractionalSize * panelp->getAutoResizeFactor()) / (total_visible_fraction); + S32 delta = llround((F32)space_to_distribute * fraction_to_distribute); + fraction_distributed += fraction_to_distribute; panelp->mTargetDim += delta; } } } + if (fraction_distributed < total_visible_fraction) + { // distribute any left over pixels to non-collapsed, visible panels + F32 fraction_left = total_visible_fraction - fraction_distributed; + S32 space_left = llround((F32)space_to_distribute * (fraction_left / total_visible_fraction)); + + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + { + if (panelp->mAutoResize + && !panelp->mCollapsed + && panelp->getVisible()) + { + S32 space_for_panel = llmax(0, llround((F32)space_left * (panelp->mFractionalSize / total_open_fraction))); + panelp->mTargetDim += space_for_panel; + space_left -= space_for_panel; + total_open_fraction -= panelp->mFractionalSize; + } + } + } + F32 cur_pos = (mOrientation == HORIZONTAL) ? 0.f : (F32)getRect().getHeight(); BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) { - F32 panel_dim = panelp->mTargetDim; + F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim); F32 panel_visible_dim = panelp->getVisibleDim(); LLRect panel_rect; @@ -403,9 +416,9 @@ void LLLayoutStack::updateLayout() else { panel_rect.setLeftTopAndSize(0, - llround(cur_pos), - getRect().getWidth(), - llround(panel_dim)); + llround(cur_pos), + getRect().getWidth(), + llround(panel_dim)); } panelp->setIgnoreReshape(true); panelp->setShape(panel_rect); @@ -531,13 +544,12 @@ void LLLayoutStack::updateFractionalSizes() { if (panelp->mAutoResize) { - F32 panel_resizable_dim = llmax(0.f, (F32)(panelp->getLayoutDim() - panelp->getRelevantMinDim())); - panelp->mFractionalSize = llmin(1.f, (panel_resizable_dim == 0.f) - ? 0.f - : panel_resizable_dim / total_resizable_dim); + F32 panel_resizable_dim = llmax(MIN_FRACTIONAL_SIZE, (F32)(panelp->getLayoutDim() - panelp->getRelevantMinDim())); + panelp->mFractionalSize = panel_resizable_dim > 0.f + ? llclamp(panel_resizable_dim / total_resizable_dim, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE) + : MIN_FRACTIONAL_SIZE; total_fractional_size += panelp->mFractionalSize; - // check for NaNs - llassert(panelp->mFractionalSize == panelp->mFractionalSize); + llassert(!llisnan(panelp->mFractionalSize)); } } @@ -547,7 +559,7 @@ void LLLayoutStack::updateFractionalSizes() { if (panelp->mAutoResize) { - panelp->mFractionalSize = 1.f / (F32)num_auto_resize_panels; + panelp->mFractionalSize = MAX_FRACTIONAL_SIZE / (F32)num_auto_resize_panels; } } } @@ -685,11 +697,6 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& delta_auto_resize_headroom += delta_dim; } - - //delta_auto_resize_headroom = (total_visible_fraction > 0.f) - // ? delta_auto_resize_headroom / total_visible_fraction - // : 0.f; - F32 fraction_given_up = 0.f; F32 fraction_remaining = 1.f; F32 updated_auto_resize_headroom = total_auto_resize_headroom + delta_auto_resize_headroom; @@ -718,8 +725,8 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& { // freeze current size as fraction of overall auto_resize space F32 fractional_adjustment_factor = total_auto_resize_headroom / updated_auto_resize_headroom; F32 new_fractional_size = llclamp(panelp->mFractionalSize * fractional_adjustment_factor, - 0.f, - 1.f); + MIN_FRACTIONAL_SIZE, + MAX_FRACTIONAL_SIZE); F32 fraction_delta = (new_fractional_size - panelp->mFractionalSize); fraction_given_up -= fraction_delta; fraction_remaining -= panelp->mFractionalSize; @@ -735,8 +742,8 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& if (panelp->mAutoResize) { // freeze new size as fraction F32 new_fractional_size = (updated_auto_resize_headroom == 0.f) - ? 1.f - : llmin(1.f, ((F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom)); + ? MAX_FRACTIONAL_SIZE + : llclamp((F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); fraction_given_up -= new_fractional_size - panelp->mFractionalSize; fraction_remaining -= panelp->mFractionalSize; panelp->mFractionalSize = new_fractional_size; @@ -755,14 +762,15 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& fraction_remaining -= panelp->mFractionalSize; if (fraction_given_up != 0.f) { - panelp->mFractionalSize += fraction_given_up; + panelp->mFractionalSize = llclamp(panelp->mFractionalSize + fraction_given_up, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); fraction_given_up = 0.f; } else { - F32 new_fractional_size = llmin(1.f, - (F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) - / updated_auto_resize_headroom); + F32 new_fractional_size = llclamp((F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) + / updated_auto_resize_headroom, + MIN_FRACTIONAL_SIZE, + MAX_FRACTIONAL_SIZE); fraction_given_up -= new_fractional_size - panelp->mFractionalSize; panelp->mFractionalSize = new_fractional_size; } @@ -776,7 +784,9 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& case AFTER_RESIZED_PANEL: if (panelp->mAutoResize) { - panelp->mFractionalSize += (panelp->mFractionalSize / fraction_remaining) * fraction_given_up; + panelp->mFractionalSize = llclamp(panelp->mFractionalSize + (panelp->mFractionalSize / fraction_remaining) * fraction_given_up, + MIN_FRACTIONAL_SIZE, + MAX_FRACTIONAL_SIZE); } default: break; @@ -802,15 +812,15 @@ void LLLayoutStack::updateResizeBarLimits() } // toggle resize bars based on panel visibility, resizability, etc - if (previous_visible_panelp - && (visible_panelp->mUserResize - || previous_visible_panelp->mUserResize)) + if (previous_visible_panelp + && (visible_panelp->mUserResize || previous_visible_panelp->mUserResize) // one of the pair is user resizable + && (visible_panelp->mAutoResize || visible_panelp->mUserResize) // current panel is resizable + && (previous_visible_panelp->mAutoResize || previous_visible_panelp->mUserResize)) // previous panel is resizable { visible_panelp->mResizeBar->setVisible(TRUE); + S32 previous_panel_headroom = previous_visible_panelp->getVisibleDim() - previous_visible_panelp->getRelevantMinDim(); visible_panelp->mResizeBar->setResizeLimits(visible_panelp->getRelevantMinDim(), - visible_panelp->getVisibleDim() - + (previous_visible_panelp->getVisibleDim() - - previous_visible_panelp->getRelevantMinDim())); + visible_panelp->getVisibleDim() + previous_panel_headroom); } else { diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index f00d5e759b..da63593f7f 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -157,11 +157,11 @@ public: void setVisible(BOOL visible); S32 getLayoutDim() const; - S32 getMinDim() const { return mMinDim; } - void setMinDim(S32 value) { mMinDim = value; if (!mExpandedMinDimSpecified) mExpandedMinDim = value; } + S32 getMinDim() const { return (mMinDim >= 0 || mAutoResize) ? llmax(0, mMinDim) : getLayoutDim(); } + void setMinDim(S32 value) { mMinDim = value; } - S32 getExpandedMinDim() const { return mExpandedMinDim; } - void setExpandedMinDim(S32 value) { mExpandedMinDim = value; mExpandedMinDimSpecified = true; } + S32 getExpandedMinDim() const { return mExpandedMinDim >= 0 ? mExpandedMinDim : mMinDim; } + void setExpandedMinDim(S32 value) { mExpandedMinDim = value; } S32 getRelevantMinDim() const { @@ -169,7 +169,7 @@ public: if (!mCollapsed) { - min_dim = mExpandedMinDim; + min_dim = getExpandedMinDim(); } return min_dim; @@ -187,9 +187,7 @@ public: protected: LLLayoutPanel(const Params& p); - bool mExpandedMinDimSpecified; S32 mExpandedMinDim; - S32 mMinDim; bool mAutoResize; bool mUserResize; diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index fe3f688fc5..ad4cc20d9a 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -424,63 +424,66 @@ void LLScrollContainer::draw() focusFirstItem(); } - // Draw background - if( mIsOpaque ) + if (getRect().isValid()) { - F32 alpha = getCurrentTransparency(); + // Draw background + if( mIsOpaque ) + { + F32 alpha = getCurrentTransparency(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(mInnerRect, mBackgroundColor.get() % alpha); - } + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gl_rect_2d(mInnerRect, mBackgroundColor.get() % alpha); + } - // Draw mScrolledViews and update scroll bars. - // get a scissor region ready, and draw the scrolling view. The - // scissor region ensures that we don't draw outside of the bounds - // of the rectangle. - if( mScrolledView ) - { - updateScroll(); - - // Draw the scrolled area. + // Draw mScrolledViews and update scroll bars. + // get a scissor region ready, and draw the scrolling view. The + // scissor region ensures that we don't draw outside of the bounds + // of the rectangle. + if( mScrolledView ) { - S32 visible_width = 0; - S32 visible_height = 0; - BOOL show_v_scrollbar = FALSE; - BOOL show_h_scrollbar = FALSE; - calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); - - LLLocalClipRect clip(LLRect(mInnerRect.mLeft, - mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0) + visible_height, - mInnerRect.mRight - (show_v_scrollbar ? scrollbar_size: 0), - mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0) - )); - drawChild(mScrolledView); - } - } - - // Highlight border if a child of this container has keyboard focus - if( mBorder->getVisible() ) - { - mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus(this) ); - } + updateScroll(); - // Draw all children except mScrolledView - // Note: scrollbars have been adjusted by above drawing code - for (child_list_const_reverse_iter_t child_iter = getChildList()->rbegin(); - child_iter != getChildList()->rend(); ++child_iter) - { - LLView *viewp = *child_iter; - if( sDebugRects ) - { - sDepth++; + // Draw the scrolled area. + { + S32 visible_width = 0; + S32 visible_height = 0; + BOOL show_v_scrollbar = FALSE; + BOOL show_h_scrollbar = FALSE; + calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); + + LLLocalClipRect clip(LLRect(mInnerRect.mLeft, + mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0) + visible_height, + mInnerRect.mRight - (show_v_scrollbar ? scrollbar_size: 0), + mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0) + )); + drawChild(mScrolledView); + } } - if( (viewp != mScrolledView) && viewp->getVisible() ) + + // Highlight border if a child of this container has keyboard focus + if( mBorder->getVisible() ) { - drawChild(viewp); + mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus(this) ); } - if( sDebugRects ) + + // Draw all children except mScrolledView + // Note: scrollbars have been adjusted by above drawing code + for (child_list_const_reverse_iter_t child_iter = getChildList()->rbegin(); + child_iter != getChildList()->rend(); ++child_iter) { - sDepth--; + LLView *viewp = *child_iter; + if( sDebugRects ) + { + sDepth++; + } + if( (viewp != mScrolledView) && viewp->getVisible() ) + { + drawChild(viewp); + } + if( sDebugRects ) + { + sDepth--; + } } } } // end draw diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index 48a232c33e..f5c463c961 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -160,7 +160,7 @@ void LLWindowShade::draw() notification_area->reshape(notification_area->getRect().getWidth(), llclamp(message_rect.getHeight() + 15, - llmin(mFormHeight, MAX_NOTIFICATION_AREA_HEIGHT), + llmax(mFormHeight, MIN_NOTIFICATION_AREA_HEIGHT), MAX_NOTIFICATION_AREA_HEIGHT)); LLUICtrl::draw(); -- cgit v1.2.3 From 29ad432c8bdc3a69c7241de28e217d27b71947d6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 19 Jan 2012 19:52:49 -0800 Subject: made layoutPanels have constant user_resize and auto_resize attributes --- indra/llui/lllayoutstack.cpp | 38 +++----------------------------------- indra/llui/lllayoutstack.h | 8 +++----- 2 files changed, 6 insertions(+), 40 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 073592b6ec..2f1c2a47c9 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -63,7 +63,7 @@ LLLayoutPanel::Params::Params() LLLayoutPanel::LLLayoutPanel(const Params& p) : LLPanel(p), - mExpandedMinDim(p.min_dim), + mExpandedMinDim(p.expanded_min_dim.isProvided() ? p.expanded_min_dim : p.min_dim), mMinDim(p.min_dim), mAutoResize(p.auto_resize), mUserResize(p.user_resize), @@ -76,12 +76,6 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mIgnoreReshape(false), mOrientation(LLLayoutStack::HORIZONTAL) { - // Set the expanded min dim if it is provided, otherwise it gets the p.min_dim value - if (p.expanded_min_dim.isProvided()) - { - mExpandedMinDim = p.expanded_min_dim(); - } - // panels initialized as hidden should not start out partially visible if (!getVisible()) { @@ -155,7 +149,7 @@ void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= { if (width == getRect().getWidth() && height == getRect().getHeight()) return; - if (!mIgnoreReshape && !mAutoResize) + if (!mIgnoreReshape && mAutoResize == false) { mTargetDim = (mOrientation == LLLayoutStack::HORIZONTAL) ? width : height; LLLayoutStack* stackp = dynamic_cast(getParent()); @@ -302,32 +296,6 @@ void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed) mNeedsLayout = true; } -void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize) -{ - LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name); - - if (panel) - { - panel->mAutoResize = auto_resize; - } - - mNeedsLayout = true; -} - -void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_resize) -{ - LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name); - - if (panel) - { - panel->mUserResize = user_resize; - } - - mNeedsLayout = true; - updateFractionalSizes(); -} - - static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks"); void LLLayoutStack::updateLayout() @@ -369,7 +337,7 @@ void LLLayoutStack::updateLayout() { // give space proportionally to visible auto resize panels BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) { - if (panelp->mAutoResize == TRUE) + if (panelp->mAutoResize) { F32 fraction_to_distribute = (panelp->mFractionalSize * panelp->getAutoResizeFactor()) / (total_visible_fraction); S32 delta = llround((F32)space_to_distribute * fraction_to_distribute); diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index da63593f7f..efe93f6def 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -88,9 +88,6 @@ public: void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE); S32 getNumPanels() { return mPanels.size(); } - void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize); - void setPanelUserResize(const std::string& panel_name, BOOL user_resize); - void updateLayout(); S32 getPanelSpacing() const { return mPanelSpacing; } @@ -187,10 +184,11 @@ public: protected: LLLayoutPanel(const Params& p); + const bool mAutoResize; + const bool mUserResize; + S32 mExpandedMinDim; S32 mMinDim; - bool mAutoResize; - bool mUserResize; bool mCollapsed; F32 mVisibleAmt; F32 mCollapseAmt; -- cgit v1.2.3 From 77a83dddf54ae5271d2cb3cca4f6102d44a57bcd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 23 Jan 2012 17:47:23 -0800 Subject: EXP-1837 FIX parsing notifications.xml during startup can take > 40 seconds (in non-release builds) added logging to track length of time spent reading notifications templates --- indra/llui/llnotifications.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index d232e27ef2..f2c852aba4 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1412,6 +1412,7 @@ void addPathIfExists(const std::string& new_path, std::vector& path bool LLNotifications::loadTemplates() { + llinfos << "Reading notifications template" << llcont; std::vector search_paths; std::string skin_relative_path = gDirUtilp->getDirDelimiter() + LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + "notifications.xml"; @@ -1484,6 +1485,8 @@ bool LLNotifications::loadTemplates() mTemplates[notification.name] = LLNotificationTemplatePtr(new LLNotificationTemplate(notification)); } + llinfos << "...done" << llendl; + return true; } -- cgit v1.2.3 From e09661f6ec467ea98715a2a04db40fc4e6b7ce02 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 23 Jan 2012 17:49:29 -0800 Subject: fix for compile error --- indra/llui/llnotifications.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index f2c852aba4..8aa548b974 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1412,7 +1412,7 @@ void addPathIfExists(const std::string& new_path, std::vector& path bool LLNotifications::loadTemplates() { - llinfos << "Reading notifications template" << llcont; + llinfos << "Reading notifications template" << llendl; std::vector search_paths; std::string skin_relative_path = gDirUtilp->getDirDelimiter() + LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + "notifications.xml"; -- cgit v1.2.3 From e0a62d894145a6903727e95890bfab6a925a11b7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 27 Jan 2012 12:41:18 -0600 Subject: SH-2768 Put transparency checkerboard back in texture preview --- indra/llui/llui.cpp | 54 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 22 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 6b74c5a6be..a38d0a0b0b 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -972,43 +972,53 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor // Draw gray and white checkerboard with black border void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha) { - // Initialize the first time this is called. - const S32 PIXELS = 32; - static GLubyte checkerboard[PIXELS * PIXELS]; - static BOOL first = TRUE; - if( first ) - { - for( S32 i = 0; i < PIXELS; i++ ) + if (!LLGLSLShader::sNoFixedFunction) + { + // Initialize the first time this is called. + const S32 PIXELS = 32; + static GLubyte checkerboard[PIXELS * PIXELS]; + static BOOL first = TRUE; + if( first ) { - for( S32 j = 0; j < PIXELS; j++ ) + for( S32 i = 0; i < PIXELS; i++ ) { - checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF; + for( S32 j = 0; j < PIXELS; j++ ) + { + checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF; + } } + first = FALSE; } - first = FALSE; - } - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - // ...white squares - gGL.color4f( 1.f, 1.f, 1.f, alpha ); - gl_rect_2d(rect); + // ...white squares + gGL.color4f( 1.f, 1.f, 1.f, alpha ); + gl_rect_2d(rect); - // ...gray squares - gGL.color4f( .7f, .7f, .7f, alpha ); - gGL.flush(); + // ...gray squares + gGL.color4f( .7f, .7f, .7f, alpha ); + gGL.flush(); - if (!LLGLSLShader::sNoFixedFunction) - { //polygon stipple is deprecated glPolygonStipple( checkerboard ); LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); gl_rect_2d(rect); } else - { - gl_rect_2d(rect); + { //polygon stipple is deprecated, use "Checker" texture + LLPointer img = LLUI::getUIImage("Checker"); + gGL.getTexUnit(0)->bind(img->getImage()); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + + LLColor4 color(1.f, 1.f, 1.f, alpha); + LLRectf uv_rect(0, 0, rect.getWidth()/32.f, rect.getHeight()/32.f); + + gl_draw_scaled_image(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), + img->getImage(), color, uv_rect); } + gGL.flush(); } -- cgit v1.2.3 From cf02780ddf927a32214b3f4db050f516367d7421 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 27 Jan 2012 17:48:08 -0800 Subject: EXP-1513 WIP Underscore ( _ ) fails to show in first chat entry in Local Chat cleaned up font positioning on buttons --- indra/llui/llbutton.cpp | 4 ++-- indra/llui/lltextbase.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index f0d92d597a..705fe16559 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -908,9 +908,9 @@ void LLButton::draw() // Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars. mLastDrawCharsCount = mGLFont->render(label, 0, (F32)x, - (F32)(mBottomVPad + y_offset), + (F32)(getRect().getHeight() / 2 + mBottomVPad), label_color % alpha, - mHAlign, LLFontGL::BOTTOM, + mHAlign, LLFontGL::VCENTER, LLFontGL::NORMAL, mDropShadowedText ? LLFontGL::DROP_SHADOW_SOFT : LLFontGL::NO_SHADOW, S32_MAX, text_width, diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 0040be45c7..e3c9c3c561 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2395,8 +2395,8 @@ void LLTextBase::updateRects() } mTextBoundingRect.mTop += mVPad; - // subtract a pixel off the bottom to deal with rounding errors in measuring font height - mTextBoundingRect.mBottom -= 1; + //// subtract a pixel off the bottom to deal with rounding errors in measuring font height + //mTextBoundingRect.mBottom -= 1; S32 delta_pos = -mTextBoundingRect.mBottom; // move line segments to fit new document rect -- cgit v1.2.3 From 2cd7a7550991df90288aa4c7e2fbe2598cc3c296 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 27 Jan 2012 18:40:23 -0800 Subject: EXP-1747, EXP-1152 : Fixed visual glitches in computation of visible width in inventory. --- indra/llui/llscrollcontainer.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index ad4cc20d9a..20bed050ad 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -378,23 +378,21 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height if (!mHideScrollbar) { - if( *visible_height < doc_height ) + // Note: 1 pixel change can happen on final animation and should not trigger + // the display of sliders. + if ((doc_height - *visible_height) > 1) { *show_v_scrollbar = TRUE; *visible_width -= scrollbar_size; } - - if( *visible_width < doc_width ) + if ((doc_width - *visible_width) > 1) { *show_h_scrollbar = TRUE; *visible_height -= scrollbar_size; - - // Must retest now that visible_height has changed - if( !*show_v_scrollbar && (*visible_height < doc_height) ) - { - *show_v_scrollbar = TRUE; - *visible_width -= scrollbar_size; - } + // Note: Do *not* recompute *show_v_scrollbar here because with + // the (- scrollbar_size) we just did we will always add a vertical scrollbar + // even if the height of the items is actually less than the visible size. + // Fear not though: there's enough calcVisibleSize() calls to add a vertical slider later. } } } -- cgit v1.2.3 From f3ddb75b0373f22fe0bb2f46b0a30f018bddc0ee Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 30 Jan 2012 18:32:35 -0800 Subject: EXP-1851 WIP Crash when trying to resize the bottom sections fixed layout logic when dealing with invisibile layout_panels --- indra/llui/lllayoutstack.cpp | 6 +++--- indra/llui/lllayoutstack.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 2f1c2a47c9..f43b84794d 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -36,7 +36,7 @@ #include "llcriticaldamp.h" #include "boost/foreach.hpp" -static const F32 MIN_FRACTIONAL_SIZE = 0.0001f; +static const F32 MIN_FRACTIONAL_SIZE = 0.0f; static const F32 MAX_FRACTIONAL_SIZE = 1.f; static LLDefaultChildRegistry::Register register_layout_stack("layout_stack"); @@ -711,7 +711,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& { // freeze new size as fraction F32 new_fractional_size = (updated_auto_resize_headroom == 0.f) ? MAX_FRACTIONAL_SIZE - : llclamp((F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); + : llclamp(total_visible_fraction * (F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); fraction_given_up -= new_fractional_size - panelp->mFractionalSize; fraction_remaining -= panelp->mFractionalSize; panelp->mFractionalSize = new_fractional_size; @@ -735,7 +735,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& } else { - F32 new_fractional_size = llclamp((F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) + F32 new_fractional_size = llclamp(total_visible_fraction * (F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) / updated_auto_resize_headroom, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index efe93f6def..6c14a56444 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -157,7 +157,7 @@ public: S32 getMinDim() const { return (mMinDim >= 0 || mAutoResize) ? llmax(0, mMinDim) : getLayoutDim(); } void setMinDim(S32 value) { mMinDim = value; } - S32 getExpandedMinDim() const { return mExpandedMinDim >= 0 ? mExpandedMinDim : mMinDim; } + S32 getExpandedMinDim() const { return mExpandedMinDim >= 0 ? mExpandedMinDim : getMinDim(); } void setExpandedMinDim(S32 value) { mExpandedMinDim = value; } S32 getRelevantMinDim() const -- cgit v1.2.3 From 20b46ef6f626c8c7960a4b9c02cae518448497b7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 31 Jan 2012 15:34:32 -0800 Subject: EXP-1851 FIX Crash when trying to resize the bottom sections more layout logic fixes and added renormalization to fractional sizes to eliminate drift --- indra/llui/lllayoutstack.cpp | 56 ++++++++++++++++++++++---------------------- indra/llui/lllayoutstack.h | 6 ++--- 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index f43b84794d..88c2218f24 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -129,6 +129,10 @@ void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientatio ? getRect().getWidth() : getRect().getHeight())); + if (mAutoResize == FALSE && mMinDim == -1) + { + setMinDim(layout_dim); + } mTargetDim = llmax(layout_dim, getMinDim()); } @@ -246,7 +250,7 @@ void LLLayoutStack::removeChild(LLView* view) { mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp)); delete embedded_panelp; - updateFractionalSizes(); + normalizeFractionalSizes(); mNeedsLayout = true; } @@ -271,7 +275,7 @@ bool LLLayoutStack::addChild(LLView* child, S32 tab_group) } BOOL result = LLView::addChild(child, tab_group); - updateFractionalSizes(); + normalizeFractionalSizes(); return result; } @@ -306,7 +310,6 @@ void LLLayoutStack::updateLayout() bool animation_in_progress = animatePanels(); F32 total_visible_fraction = 0.f; - F32 total_open_fraction = 0.f; S32 space_to_distribute = (mOrientation == HORIZONTAL) ? getRect().getWidth() : getRect().getHeight(); @@ -318,20 +321,17 @@ void LLLayoutStack::updateLayout() if (panelp->mAutoResize) { panelp->mTargetDim = panelp->getRelevantMinDim(); - if (!panelp->mCollapsed && panelp->getVisible()) - { - total_open_fraction += panelp->mFractionalSize; - } } space_to_distribute -= panelp->getVisibleDim() + llround((F32)mPanelSpacing * panelp->getVisibleAmount()); - total_visible_fraction += panelp->mFractionalSize; + total_visible_fraction += panelp->mFractionalSize * panelp->getVisibleAmount(); } - llassert(total_visible_fraction < 1.01f); + llassert(total_visible_fraction < 1.05f); // don't need spacing after last panel space_to_distribute += panelp ? llround((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0; + S32 remaining_space = space_to_distribute; F32 fraction_distributed = 0.f; if (space_to_distribute > 0 && total_visible_fraction > 0.f) { // give space proportionally to visible auto resize panels @@ -343,26 +343,23 @@ void LLLayoutStack::updateLayout() S32 delta = llround((F32)space_to_distribute * fraction_to_distribute); fraction_distributed += fraction_to_distribute; panelp->mTargetDim += delta; + remaining_space -= delta; } } } - if (fraction_distributed < total_visible_fraction) - { // distribute any left over pixels to non-collapsed, visible panels - F32 fraction_left = total_visible_fraction - fraction_distributed; - S32 space_left = llround((F32)space_to_distribute * (fraction_left / total_visible_fraction)); + // distribute any left over pixels to non-collapsed, visible panels + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + { + if (remaining_space == 0) break; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + if (panelp->mAutoResize + && !panelp->mCollapsed + && panelp->getVisible()) { - if (panelp->mAutoResize - && !panelp->mCollapsed - && panelp->getVisible()) - { - S32 space_for_panel = llmax(0, llround((F32)space_left * (panelp->mFractionalSize / total_open_fraction))); - panelp->mTargetDim += space_for_panel; - space_left -= space_for_panel; - total_open_fraction -= panelp->mFractionalSize; - } + S32 space_for_panel = remaining_space > 0 ? 1 : -1; + panelp->mTargetDim += space_for_panel; + remaining_space -= space_for_panel; } } @@ -492,7 +489,7 @@ void LLLayoutStack::updateClass() } } -void LLLayoutStack::updateFractionalSizes() +void LLLayoutStack::normalizeFractionalSizes() { F32 total_resizable_dim = 0; S32 num_auto_resize_panels = 0; @@ -691,7 +688,9 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& case BEFORE_RESIZED_PANEL: if (panelp->mAutoResize) { // freeze current size as fraction of overall auto_resize space - F32 fractional_adjustment_factor = total_auto_resize_headroom / updated_auto_resize_headroom; + F32 fractional_adjustment_factor = updated_auto_resize_headroom == 0.f + ? 1.f + : total_auto_resize_headroom / updated_auto_resize_headroom; F32 new_fractional_size = llclamp(panelp->mFractionalSize * fractional_adjustment_factor, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); @@ -720,7 +719,6 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& else { // freeze new size as original size panelp->mTargetDim = new_dim; - fraction_remaining -= fraction_given_up; } which_panel = NEXT_PANEL; break; @@ -728,7 +726,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& if (panelp->mAutoResize) { fraction_remaining -= panelp->mFractionalSize; - if (fraction_given_up != 0.f) + if (resized_panel->mAutoResize) { panelp->mFractionalSize = llclamp(panelp->mFractionalSize + fraction_given_up, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); fraction_given_up = 0.f; @@ -750,7 +748,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& which_panel = AFTER_RESIZED_PANEL; break; case AFTER_RESIZED_PANEL: - if (panelp->mAutoResize) + if (panelp->mAutoResize && fraction_given_up != 0.f) { panelp->mFractionalSize = llclamp(panelp->mFractionalSize + (panelp->mFractionalSize / fraction_remaining) * fraction_given_up, MIN_FRACTIONAL_SIZE, @@ -760,6 +758,8 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& break; } } + updateLayout(); + normalizeFractionalSizes(); } void LLLayoutStack::reshape(S32 width, S32 height, BOOL called_from_parent) diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 6c14a56444..4a8702e318 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -72,7 +72,7 @@ public: /*virtual*/ void draw(); /*virtual*/ void removeChild(LLView*); /*virtual*/ BOOL postBuild(); - /*virtual*/ bool addChild(LLView* child, S32 tab_group = 0); + /*virtual*/ bool addChild(LLView* child, S32 tab_groupdatefractuiona = 0); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); @@ -111,7 +111,7 @@ private: LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const; LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const; - void updateFractionalSizes(); + void normalizeFractionalSizes(); void updatePanelRect( LLLayoutPanel* param1, const LLRect& new_rect ); S32 mPanelSpacing; @@ -154,7 +154,7 @@ public: void setVisible(BOOL visible); S32 getLayoutDim() const; - S32 getMinDim() const { return (mMinDim >= 0 || mAutoResize) ? llmax(0, mMinDim) : getLayoutDim(); } + S32 getMinDim() const { return llmax(0, mMinDim); } void setMinDim(S32 value) { mMinDim = value; } S32 getExpandedMinDim() const { return mExpandedMinDim >= 0 ? mExpandedMinDim : getMinDim(); } -- cgit v1.2.3 From c47c31fdbfb1c02de13bc7f17af1e7d173c048f3 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 31 Jan 2012 17:51:43 -0800 Subject: EXP-1513 FIX Underscore ( _ ) fails to show in first chat entry in Local Chat --- indra/llui/llfloater.cpp | 2 +- indra/llui/llmenugl.cpp | 2 +- indra/llui/llscrolllistcell.cpp | 4 ++-- indra/llui/lltextbase.cpp | 12 ++++++------ indra/llui/lltexteditor.cpp | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index cedc4c0aee..cef5ba3fe7 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1802,7 +1802,7 @@ void LLFloater::draw() const LLFontGL* font = LLFontGL::getFontSansSerif(); LLRect r = getRect(); - gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1, + gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - font->getLineHeight() - 1, titlebar_focus_color % alpha, 0, TRUE); } } diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index c624ae2e92..1db1dac2ec 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -1966,7 +1966,7 @@ void LLMenuGL::arrange( void ) // *FIX: create the item first and then ask for its dimensions? S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::getFontSansSerif()->getWidth( std::string("More") ); // *TODO: Translate - S32 spillover_item_height = llround(LLFontGL::getFontSansSerif()->getLineHeight()) + MENU_ITEM_PADDING; + S32 spillover_item_height = LLFontGL::getFontSansSerif()->getLineHeight() + MENU_ITEM_PADDING; // Scrolling support item_list_t::iterator first_visible_item_iter; diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index b087602a56..8000efad0e 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -232,7 +232,7 @@ BOOL LLScrollListText::getVisible() const //virtual S32 LLScrollListText::getHeight() const { - return llround(mFont->getLineHeight()); + return mFont->getLineHeight(); } @@ -306,7 +306,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col break; } LLRect highlight_rect(left - 2, - llround(mFont->getLineHeight()) + 1, + mFont->getLineHeight() + 1, left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, 1); mRoundedRectImage->draw(highlight_rect, highlight_color); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index e3c9c3c561..7e5974bf0e 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2157,7 +2157,7 @@ LLRect LLTextBase::getLocalRectFromDocIndex(S32 pos) const { // return default height rect in upper left local_rect = content_window_rect; - local_rect.mBottom = local_rect.mTop - (S32)(mDefaultFont->getLineHeight()); + local_rect.mBottom = local_rect.mTop - mDefaultFont->getLineHeight(); return local_rect; } @@ -2578,7 +2578,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e mToken(NULL), mEditor(editor) { - mFontHeight = llceil(mStyle->getFont()->getLineHeight()); + mFontHeight = mStyle->getFont()->getLineHeight(); LLUIImagePtr image = mStyle->getImage(); if (image.notNull()) @@ -2594,7 +2594,7 @@ LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 { mStyle = new LLStyle(LLStyle::Params().visible(is_visible).color(color)); - mFontHeight = llceil(mStyle->getFont()->getLineHeight()); + mFontHeight = mStyle->getFont()->getLineHeight(); } LLNormalTextSegment::~LLNormalTextSegment() @@ -2962,11 +2962,11 @@ LLLineBreakTextSegment::LLLineBreakTextSegment(S32 pos):LLTextSegment(pos,pos+1) { LLStyleSP s( new LLStyle(LLStyle::Params().visible(true))); - mFontHeight = llceil(s->getFont()->getLineHeight()); + mFontHeight = s->getFont()->getLineHeight(); } LLLineBreakTextSegment::LLLineBreakTextSegment(LLStyleConstSP style,S32 pos):LLTextSegment(pos,pos+1) { - mFontHeight = llceil(style->getFont()->getLineHeight()); + mFontHeight = style->getFont()->getLineHeight(); } LLLineBreakTextSegment::~LLLineBreakTextSegment() { @@ -3003,7 +3003,7 @@ static const S32 IMAGE_HPAD = 3; bool LLImageTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const { width = 0; - height = llceil(mStyle->getFont()->getLineHeight());; + height = mStyle->getFont()->getLineHeight(); LLUIImagePtr image = mStyle->getImage(); if( num_chars>0 && image.notNull()) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3a23ce1cac..3409b6817d 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1992,7 +1992,7 @@ void LLTextEditor::drawPreeditMarker() return; } - const S32 line_height = llround( mDefaultFont->getLineHeight() ); + const S32 line_height = mDefaultFont->getLineHeight(); S32 line_start = getLineStart(cur_line); S32 line_y = mVisibleTextRect.mTop - line_height; @@ -2715,7 +2715,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect const LLWString textString(getWText()); const llwchar * const text = textString.c_str(); - const S32 line_height = llround(mDefaultFont->getLineHeight()); + const S32 line_height = mDefaultFont->getLineHeight(); if (coord) { @@ -2818,7 +2818,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length) S32 LLTextEditor::getPreeditFontSize() const { - return llround(mDefaultFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]); + return llround((F32)mDefaultFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]); } BOOL LLTextEditor::isDirty() const -- cgit v1.2.3 From 178b30601b989aa98644c4e5c2ebcd9cd75490f7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 31 Jan 2012 17:52:01 -0800 Subject: fixed layout_stack regression resulting in side toolbars being truncated --- indra/llui/lllayoutstack.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 88c2218f24..05261432e3 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -129,7 +129,9 @@ void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientatio ? getRect().getWidth() : getRect().getHeight())); - if (mAutoResize == FALSE && mMinDim == -1) + if (mAutoResize == FALSE + && mUserResize == TRUE + && mMinDim == -1 ) { setMinDim(layout_dim); } -- cgit v1.2.3 From 1404ba1ffa821c3ecc76cde254c5148fec66a2c0 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Wed, 1 Feb 2012 16:39:06 +0200 Subject: fixed Linux build --- indra/llui/lldraghandle.cpp | 2 +- indra/llui/lllineeditor.cpp | 2 +- indra/llui/llmenugl.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 42e6c3c786..5f69c6af31 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -244,7 +244,7 @@ void LLDragHandleTop::reshapeTitleBox() const LLFontGL* font = LLFontGL::getFontSansSerif(); S32 title_width = getRect().getWidth(); title_width -= LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth(); - S32 title_height = llround(font->getLineHeight()); + S32 title_height = font->getLineHeight(); LLRect title_rect; title_rect.setLeftTopAndSize( LEFT_PAD, diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 06dfc90d83..c53fb40ca2 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1630,7 +1630,7 @@ void LLLineEditor::draw() LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 ); background.stretch( -mBorderThickness ); - S32 lineeditor_v_pad = llround((background.getHeight() - mGLFont->getLineHeight())/2); + S32 lineeditor_v_pad = (background.getHeight() - mGLFont->getLineHeight())/2; drawBackground(); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 1db1dac2ec..3e547efd97 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -317,7 +317,7 @@ void LLMenuItemGL::setJumpKey(KEY key) // virtual U32 LLMenuItemGL::getNominalHeight( void ) const { - return llround(mFont->getLineHeight()) + MENU_ITEM_PADDING; + return mFont->getLineHeight() + MENU_ITEM_PADDING; } //virtual -- cgit v1.2.3 From 5a14a67e060e7f325025e924c83489cfa236e3dc Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 1 Feb 2012 13:03:46 -0800 Subject: converted a bunch of narrowing implicit conversions to explicit --- indra/llui/lldraghandle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 5f69c6af31..42e6c3c786 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -244,7 +244,7 @@ void LLDragHandleTop::reshapeTitleBox() const LLFontGL* font = LLFontGL::getFontSansSerif(); S32 title_width = getRect().getWidth(); title_width -= LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth(); - S32 title_height = font->getLineHeight(); + S32 title_height = llround(font->getLineHeight()); LLRect title_rect; title_rect.setLeftTopAndSize( LEFT_PAD, -- cgit v1.2.3 From c1636911c84f948e542f445d3c7495e6df185912 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 1 Feb 2012 19:09:29 -0800 Subject: EXP-1862 : Make LLClipboard an LLSingleton and clean up the internals (set up for toolbar and never used) --- indra/llui/llclipboard.cpp | 6 ------ indra/llui/llclipboard.h | 15 ++++----------- indra/llui/lllineeditor.cpp | 14 +++++++------- indra/llui/llscrolllistctrl.cpp | 2 +- indra/llui/lltexteditor.cpp | 14 +++++++------- 5 files changed, 19 insertions(+), 32 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 6910b962a1..984c4ec5fb 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -40,7 +40,6 @@ LLClipboard gClipboard; LLClipboard::LLClipboard() { - mSourceItem = NULL; } @@ -135,8 +134,3 @@ BOOL LLClipboard::canPastePrimaryString() const { return LLView::getWindow()->isPrimaryTextAvailable(); } - -void LLClipboard::setSourceObject(const LLUUID& source_id, LLAssetType::EType type) -{ - mSourceItem = new LLInventoryObject (source_id, LLUUID::null, type, ""); -} diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 9371b94284..2567eaab48 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -31,10 +31,10 @@ #include "llstring.h" #include "lluuid.h" #include "stdenums.h" +#include "llsingleton.h" #include "llinventory.h" - -class LLClipboard +class LLClipboard : public LLSingleton { public: LLClipboard(); @@ -54,19 +54,12 @@ public: BOOL canPastePrimaryString() const; const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL); - // Support clipboard for object known only by their uuid and asset type - void setSourceObject(const LLUUID& source_id, LLAssetType::EType type); - const LLInventoryObject* getSourceObject() { return mSourceItem; } + // Support clipboard for object known only by their uuid + void setSourceObject(const LLUUID& source_id) { mSourceID = source_id; } private: LLUUID mSourceID; LLWString mString; - LLInventoryObject* mSourceItem; }; - -// Global singleton -extern LLClipboard gClipboard; - - #endif // LL_LLCLIPBOARD_H diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 06dfc90d83..9292158b7c 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1047,7 +1047,7 @@ void LLLineEditor::cut() // Prepare for possible rollback LLLineEditorRollback rollback( this ); - gClipboard.copyFromSubstring( mText.getWString(), left_pos, length ); + LLClipboard::getInstance()->copyFromSubstring( mText.getWString(), left_pos, length ); deleteSelection(); // Validate new string and rollback the if needed. @@ -1078,13 +1078,13 @@ void LLLineEditor::copy() { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - gClipboard.copyFromSubstring( mText.getWString(), left_pos, length ); + LLClipboard::getInstance()->copyFromSubstring( mText.getWString(), left_pos, length ); } } BOOL LLLineEditor::canPaste() const { - return !mReadOnly && gClipboard.canPasteString(); + return !mReadOnly && LLClipboard::getInstance()->canPasteString(); } void LLLineEditor::paste() @@ -1117,11 +1117,11 @@ void LLLineEditor::pasteHelper(bool is_primary) LLWString paste; if (is_primary) { - paste = gClipboard.getPastePrimaryWString(); + paste = LLClipboard::getInstance()->getPastePrimaryWString(); } else { - paste = gClipboard.getPasteWString(); + paste = LLClipboard::getInstance()->getPasteWString(); } if (!paste.empty()) @@ -1209,13 +1209,13 @@ void LLLineEditor::copyPrimary() { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - gClipboard.copyFromPrimarySubstring( mText.getWString(), left_pos, length ); + LLClipboard::getInstance()->copyFromPrimarySubstring( mText.getWString(), left_pos, length ); } } BOOL LLLineEditor::canPastePrimary() const { - return !mReadOnly && gClipboard.canPastePrimaryString(); + return !mReadOnly && LLClipboard::getInstance()->canPastePrimaryString(); } void LLLineEditor::updatePrimary() diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 466fac33ea..8cbc2a8f99 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -2504,7 +2504,7 @@ void LLScrollListCtrl::copy() { buffer += (*itor)->getContentsCSV() + "\n"; } - gClipboard.copyFromSubstring(utf8str_to_wstring(buffer), 0, buffer.length()); + LLClipboard::getInstance()->copyFromSubstring(utf8str_to_wstring(buffer), 0, buffer.length()); } // virtual diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3a23ce1cac..22a577cda8 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1332,7 +1332,7 @@ void LLTextEditor::cut() } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - gClipboard.copyFromSubstring( getWText(), left_pos, length, mSourceID ); + LLClipboard::getInstance()->copyFromSubstring( getWText(), left_pos, length, mSourceID ); deleteSelection( FALSE ); onKeyStroke(); @@ -1352,12 +1352,12 @@ void LLTextEditor::copy() } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - gClipboard.copyFromSubstring(getWText(), left_pos, length, mSourceID); + LLClipboard::getInstance()->copyFromSubstring(getWText(), left_pos, length, mSourceID); } BOOL LLTextEditor::canPaste() const { - return !mReadOnly && gClipboard.canPasteString(); + return !mReadOnly && LLClipboard::getInstance()->canPasteString(); } // paste from clipboard @@ -1397,11 +1397,11 @@ void LLTextEditor::pasteHelper(bool is_primary) LLWString paste; if (is_primary) { - paste = gClipboard.getPastePrimaryWString(&source_id); + paste = LLClipboard::getInstance()->getPastePrimaryWString(&source_id); } else { - paste = gClipboard.getPasteWString(&source_id); + paste = LLClipboard::getInstance()->getPasteWString(&source_id); } if (paste.empty()) @@ -1475,12 +1475,12 @@ void LLTextEditor::copyPrimary() } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - gClipboard.copyFromPrimarySubstring(getWText(), left_pos, length, mSourceID); + LLClipboard::getInstance()->copyFromPrimarySubstring(getWText(), left_pos, length, mSourceID); } BOOL LLTextEditor::canPastePrimary() const { - return !mReadOnly && gClipboard.canPastePrimaryString(); + return !mReadOnly && LLClipboard::getInstance()->canPastePrimaryString(); } void LLTextEditor::updatePrimary() -- cgit v1.2.3 From 8d6665b5c2ac1d42d72dab025623d3ae14291ccb Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 2 Feb 2012 13:29:24 +0200 Subject: Restoring a call to llround() in lllineeditor.cpp mistakenly removed in changeset 0a9ef58e8f7d. By the way, removing a pointless call to llround() in lldraghandle.cpp. --- indra/llui/lldraghandle.cpp | 2 +- indra/llui/lllineeditor.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 42e6c3c786..5f69c6af31 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -244,7 +244,7 @@ void LLDragHandleTop::reshapeTitleBox() const LLFontGL* font = LLFontGL::getFontSansSerif(); S32 title_width = getRect().getWidth(); title_width -= LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth(); - S32 title_height = llround(font->getLineHeight()); + S32 title_height = font->getLineHeight(); LLRect title_rect; title_rect.setLeftTopAndSize( LEFT_PAD, diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index c53fb40ca2..d600f58b96 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1630,7 +1630,7 @@ void LLLineEditor::draw() LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 ); background.stretch( -mBorderThickness ); - S32 lineeditor_v_pad = (background.getHeight() - mGLFont->getLineHeight())/2; + S32 lineeditor_v_pad = llround(((F32)background.getHeight() - mGLFont->getLineHeight())/2); drawBackground(); -- cgit v1.2.3 From 9721e4f78362da8fce1c66762290ff72df06441c Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 2 Feb 2012 20:45:08 +0200 Subject: Removing a call to llround() per Richard. --- indra/llui/lllineeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index d600f58b96..7e84814c51 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1630,7 +1630,7 @@ void LLLineEditor::draw() LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 ); background.stretch( -mBorderThickness ); - S32 lineeditor_v_pad = llround(((F32)background.getHeight() - mGLFont->getLineHeight())/2); + S32 lineeditor_v_pad = (background.getHeight() - mGLFont->getLineHeight()) / 2; drawBackground(); -- cgit v1.2.3 From 8f1f84212bb0b9ae85ef680ff20acfa4bcacd5cd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 2 Feb 2012 11:35:36 -0800 Subject: EXP-1858 FIX Received Items panel heading in incorrect position didn't account properly for collapsed panels --- indra/llui/lllayoutstack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 05261432e3..31e0434753 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -325,7 +325,7 @@ void LLLayoutStack::updateLayout() panelp->mTargetDim = panelp->getRelevantMinDim(); } space_to_distribute -= panelp->getVisibleDim() + llround((F32)mPanelSpacing * panelp->getVisibleAmount()); - total_visible_fraction += panelp->mFractionalSize * panelp->getVisibleAmount(); + total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor(); } llassert(total_visible_fraction < 1.05f); -- cgit v1.2.3 From db824cff75696c42fff80ba29dbb60f12d10a1da Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 3 Feb 2012 18:38:03 -0800 Subject: EXP-1862 : Suppress LLInventoryClipboard, move its functions to the unified LLClipboard and use this only --- indra/llui/llclipboard.cpp | 102 +++++++++++++++++++++++++++++++++++++-------- indra/llui/llclipboard.h | 27 +++++++++++- 2 files changed, 109 insertions(+), 20 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 984c4ec5fb..8917dc2d88 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -34,44 +34,104 @@ #include "llview.h" #include "llwindow.h" -// Global singleton -LLClipboard gClipboard; +LLClipboard::LLClipboard() +: mCutMode(false) +{ +} +LLClipboard::~LLClipboard() +{ + reset(); +} -LLClipboard::LLClipboard() +void LLClipboard::add(const LLUUID& object) { + mObjects.put(object); } +void LLClipboard::store(const LLUUID& object) +{ + reset(); + mObjects.put(object); +} -LLClipboard::~LLClipboard() +void LLClipboard::store(const LLDynamicArray& inv_objects) { + reset(); + S32 count = inv_objects.count(); + for(S32 i = 0; i < count; i++) + { + mObjects.put(inv_objects[i]); + } +} + +void LLClipboard::cut(const LLUUID& object) +{ + if(!mCutMode && !mObjects.empty()) + { + //looks like there are some stored items, reset clipboard state + reset(); + } + mCutMode = true; + add(object); +} +void LLClipboard::retrieve(LLDynamicArray& inv_objects) const +{ + inv_objects.reset(); + S32 count = mObjects.count(); + for(S32 i = 0; i < count; i++) + { + inv_objects.put(mObjects[i]); + } +} + +void LLClipboard::reset() +{ + mObjects.reset(); + mCutMode = false; +} + +// returns true if the clipboard has something pasteable in it. +BOOL LLClipboard::hasContents() const +{ + return (mObjects.count() > 0); } void LLClipboard::copyFromSubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) { - mSourceID = source_id; + reset(); + if (source_id.notNull()) + { + store(source_id); + } mString = src.substr(pos, len); + llinfos << "Merov debug : copyFromSubstring, string = " << wstring_to_utf8str(mString) << ", uuid = " << (hasContents() ? mObjects[0] : LLUUID::null) << llendl; LLView::getWindow()->copyTextToClipboard( mString ); } void LLClipboard::copyFromString(const LLWString &src, const LLUUID& source_id ) { - mSourceID = source_id; + reset(); + if (source_id.notNull()) + { + store(source_id); + } mString = src; + llinfos << "Merov debug : copyFromString, string = " << wstring_to_utf8str(mString) << ", uuid = " << (hasContents() ? mObjects[0] : LLUUID::null) << llendl; LLView::getWindow()->copyTextToClipboard( mString ); } const LLWString& LLClipboard::getPasteWString( LLUUID* source_id ) { - if( mSourceID.notNull() ) + if (hasContents()) { LLWString temp_string; LLView::getWindow()->pasteTextFromClipboard(temp_string); - if( temp_string != mString ) + if (temp_string != mString) { - mSourceID.setNull(); + reset(); mString = temp_string; } } @@ -80,11 +140,13 @@ const LLWString& LLClipboard::getPasteWString( LLUUID* source_id ) LLView::getWindow()->pasteTextFromClipboard(mString); } - if( source_id ) + if (source_id) { - *source_id = mSourceID; + *source_id = (hasContents() ? mObjects[0] : LLUUID::null); } + llinfos << "Merov debug : getPasteWString, string = " << wstring_to_utf8str(mString) << ", uuid = " << (hasContents() ? mObjects[0] : LLUUID::null) << llendl; + return mString; } @@ -97,7 +159,11 @@ BOOL LLClipboard::canPasteString() const void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) { - mSourceID = source_id; + reset(); + if (source_id.notNull()) + { + store(source_id); + } mString = src.substr(pos, len); LLView::getWindow()->copyTextToPrimary( mString ); } @@ -105,14 +171,14 @@ void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 le const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id ) { - if( mSourceID.notNull() ) + if (hasContents()) { LLWString temp_string; LLView::getWindow()->pasteTextFromPrimary(temp_string); - if( temp_string != mString ) + if (temp_string != mString) { - mSourceID.setNull(); + reset(); mString = temp_string; } } @@ -121,11 +187,11 @@ const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id ) LLView::getWindow()->pasteTextFromPrimary(mString); } - if( source_id ) + if (source_id) { - *source_id = mSourceID; + *source_id = (hasContents() ? mObjects[0] : LLUUID::null); } - + return mString; } diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 2567eaab48..2cb857145e 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -34,6 +34,13 @@ #include "llsingleton.h" #include "llinventory.h" +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLClipboard +// +// This class is used to cut/copy/paste text strings and inventory items around +// the world. Use LLClipboard::getInstance()->method() to use its methods. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + class LLClipboard : public LLSingleton { public: @@ -45,20 +52,36 @@ public: which is implicitly copied upon selection on platforms which expect this (i.e. X11/Linux). */ + // Text strings management void copyFromSubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); void copyFromString(const LLWString ©_from, const LLUUID& source_id = LLUUID::null ); BOOL canPasteString() const; const LLWString& getPasteWString(LLUUID* source_id = NULL); + // Primary text string management (Linux gtk implementation) void copyFromPrimarySubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); BOOL canPastePrimaryString() const; const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL); // Support clipboard for object known only by their uuid - void setSourceObject(const LLUUID& source_id) { mSourceID = source_id; } + //void setSourceObject(const LLUUID& source_id) { mSourceID = source_id; } + + // Object list management + void add(const LLUUID& object); // Adds to the current list of objects on the clipboard + void store(const LLUUID& object); // Stores a single inventory object + void store(const LLDynamicArray& inventory_objects); // Stores an array of objects + void cut(const LLUUID& object); // Adds to the current list of cut objects on the clipboard + void retrieve(LLDynamicArray& inventory_objects) const; // Gets a copy of the objects on the clipboard + void reset(); // Clears the clipboard + BOOL hasContents() const; // true if the clipboard has something pasteable in it + bool isCutMode() const { return mCutMode; } + private: - LLUUID mSourceID; + // *TODO: To know if an asset ID can be serialized, check out LLAssetType::lookupIsAssetIDKnowable(EType asset_type) + LLDynamicArray mObjects; + bool mCutMode; + LLWString mString; }; -- cgit v1.2.3 From e854db064547ae20a87bbeac399295a924cf1c8f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 3 Feb 2012 19:04:36 -0800 Subject: EXP-1513 FIX Underscore ( _ ) fails to show in first chat entry in Local Chat EXP-1854 FIX Text positioning in mini inspector a couple pixels too low --- indra/llui/lltextbase.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++----- indra/llui/lltooltip.cpp | 10 +++++++++- 2 files changed, 55 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 7e5974bf0e..5fe90e1ee3 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2395,10 +2395,21 @@ void LLTextBase::updateRects() } mTextBoundingRect.mTop += mVPad; - //// subtract a pixel off the bottom to deal with rounding errors in measuring font height - //mTextBoundingRect.mBottom -= 1; - S32 delta_pos = -mTextBoundingRect.mBottom; + S32 delta_pos = 0; + + switch(mVAlign) + { + case LLFontGL::TOP: + delta_pos = llmax(mVisibleTextRect.mTop - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom); + break; + case LLFontGL::VCENTER: + delta_pos = (llmax(mVisibleTextRect.mTop - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom) + (mVisibleTextRect.mBottom - mTextBoundingRect.mBottom)) / 2; + break; + case LLFontGL::BOTTOM: + delta_pos = mVisibleTextRect.mBottom - mTextBoundingRect.mBottom; + break; + } // move line segments to fit new document rect for (line_list_t::iterator it = mLineInfoList.begin(); it != mLineInfoList.end(); ++it) { @@ -2408,8 +2419,9 @@ void LLTextBase::updateRects() } // update document container dimensions according to text contents - LLRect doc_rect = mTextBoundingRect; + LLRect doc_rect; // use old mVisibleTextRect constraint document to width of viewable region + doc_rect.mBottom = llmin(mVisibleTextRect.mBottom, mTextBoundingRect.mBottom); doc_rect.mLeft = 0; // allow horizontal scrolling? @@ -2419,11 +2431,22 @@ void LLTextBase::updateRects() doc_rect.mRight = mScroller ? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight) : mVisibleTextRect.getWidth(); + doc_rect.mTop = llmax(mVisibleTextRect.mTop, mTextBoundingRect.mTop); if (!mScroller) { // push doc rect to top of text widget - doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop); + switch(mVAlign) + { + case LLFontGL::TOP: + doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop); + break; + case LLFontGL::VCENTER: + doc_rect.translate(0, (mVisibleTextRect.getHeight() - doc_rect.mTop) / 2); + case LLFontGL::BOTTOM: + default: + break; + } } mDocumentView->setShape(doc_rect); @@ -2444,9 +2467,27 @@ void LLTextBase::updateRects() } // update document container again, using new mVisibleTextRect (that has scrollbars enabled as needed) + doc_rect.mBottom = llmin(mVisibleTextRect.mBottom, mTextBoundingRect.mBottom); + doc_rect.mLeft = 0; doc_rect.mRight = mScroller ? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight) : mVisibleTextRect.getWidth(); + doc_rect.mTop = llmax(mVisibleTextRect.mTop, mTextBoundingRect.mTop); + if (!mScroller) + { + // push doc rect to top of text widget + switch(mVAlign) + { + case LLFontGL::TOP: + doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop); + break; + case LLFontGL::VCENTER: + doc_rect.translate(0, (mVisibleTextRect.getHeight() - doc_rect.mTop) / 2); + case LLFontGL::BOTTOM: + default: + break; + } + } mDocumentView->setShape(doc_rect); } diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 23cdd9ad9a..f737d48abf 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -180,6 +180,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) params.font = p.font; params.use_ellipses = true; params.wrap = p.wrap; + params.font_valign = LLFontGL::VCENTER; params.parse_urls = false; // disallow hyperlinks in tooltips, as they want to spawn their own explanatory tooltips mTextBox = LLUICtrlFactory::create (params); addChild(mTextBox); @@ -190,7 +191,6 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) { LLButton::Params icon_params; icon_params.name = "tooltip_info"; - icon_params.label(""); // provid label but set to empty so name does not overwrite it -angela LLRect icon_rect; LLUIImage* imagep = p.image; TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16); @@ -291,6 +291,12 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p) S32 text_width = llmin(p.max_width(), mTextBox->getTextPixelWidth()); S32 text_height = mTextBox->getTextPixelHeight(); mTextBox->reshape(text_width, text_height); + if (mInfoButton) + { + LLRect text_rect = mTextBox->getRect(); + LLRect icon_rect = mInfoButton->getRect(); + mTextBox->translate(0, icon_rect.getCenterY() - text_rect.getCenterY()); + } // reshape tooltip panel to fit text box LLRect tooltip_rect = calcBoundingRect(); @@ -299,6 +305,8 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p) tooltip_rect.mBottom = 0; tooltip_rect.mLeft = 0; + mTextBox->reshape(mTextBox->getRect().getWidth(), llmax(mTextBox->getRect().getHeight(), tooltip_rect.getHeight() - 2 * mPadding)); + setShape(tooltip_rect); } -- cgit v1.2.3 From 9761375ac244af36635899c73e99efc46b68b589 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 6 Feb 2012 15:43:53 -0800 Subject: EXP-1841 : Refactoring of LLClipboard, simplify the API and make it behave like a normal clipboard. --- indra/llui/llclipboard.cpp | 112 +++++++++++----------------------------- indra/llui/llclipboard.h | 23 +++------ indra/llui/lllineeditor.cpp | 19 +++---- indra/llui/llscrolllistctrl.cpp | 2 +- indra/llui/lltexteditor.cpp | 20 +++---- 5 files changed, 51 insertions(+), 125 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 8917dc2d88..5c8db29ae4 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -91,112 +91,62 @@ void LLClipboard::reset() mCutMode = false; } -// returns true if the clipboard has something pasteable in it. +// Returns true if the LL Clipboard has pasteable items in it BOOL LLClipboard::hasContents() const { return (mObjects.count() > 0); } - -void LLClipboard::copyFromSubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) +// Copy the input string to the LL and the system clipboard +bool LLClipboard::copyToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary) { reset(); - if (source_id.notNull()) - { - store(source_id); - } mString = src.substr(pos, len); - llinfos << "Merov debug : copyFromSubstring, string = " << wstring_to_utf8str(mString) << ", uuid = " << (hasContents() ? mObjects[0] : LLUUID::null) << llendl; - LLView::getWindow()->copyTextToClipboard( mString ); + return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString)); } -void LLClipboard::copyFromString(const LLWString &src, const LLUUID& source_id ) +// Copy the input uuid to the LL clipboard +// Convert the uuid to string and copy that string to the system clipboard if legit +bool LLClipboard::copyToClipboard(const LLUUID& src, const LLAssetType::EType type) { + bool res = false; reset(); - if (source_id.notNull()) - { - store(source_id); - } - mString = src; - llinfos << "Merov debug : copyFromString, string = " << wstring_to_utf8str(mString) << ", uuid = " << (hasContents() ? mObjects[0] : LLUUID::null) << llendl; - LLView::getWindow()->copyTextToClipboard( mString ); -} - -const LLWString& LLClipboard::getPasteWString( LLUUID* source_id ) -{ - if (hasContents()) + if (src.notNull()) { - LLWString temp_string; - LLView::getWindow()->pasteTextFromClipboard(temp_string); - - if (temp_string != mString) + res = true; + if (LLAssetType::lookupIsAssetIDKnowable(type)) { - reset(); - mString = temp_string; + LLWString source = utf8str_to_wstring(src.asString()); + res = copyToClipboard(source, 0, source.size()); + } + if (res) + { + store(src); } } - else - { - LLView::getWindow()->pasteTextFromClipboard(mString); - } - - if (source_id) - { - *source_id = (hasContents() ? mObjects[0] : LLUUID::null); - } - - llinfos << "Merov debug : getPasteWString, string = " << wstring_to_utf8str(mString) << ", uuid = " << (hasContents() ? mObjects[0] : LLUUID::null) << llendl; - - return mString; -} - - -BOOL LLClipboard::canPasteString() const -{ - return LLView::getWindow()->isClipboardTextAvailable(); -} - - -void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) -{ - reset(); - if (source_id.notNull()) - { - store(source_id); - } - mString = src.substr(pos, len); - LLView::getWindow()->copyTextToPrimary( mString ); + return res; } - -const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id ) +// Copy the System clipboard to the output string. +// Manage the LL Clipboard / System clipboard consistency +bool LLClipboard::pasteFromClipboard(LLWString &dst, bool use_primary) { - if (hasContents()) + bool res = (use_primary ? LLView::getWindow()->pasteTextFromPrimary(dst) : LLView::getWindow()->pasteTextFromClipboard(dst)); + if (res) { - LLWString temp_string; - LLView::getWindow()->pasteTextFromPrimary(temp_string); - - if (temp_string != mString) + if (dst != mString) { + // Invalidate the LL clipboard if the System had a different string in it (i.e. some copy/cut was done in some other app) reset(); - mString = temp_string; } + mString = dst; } - else - { - LLView::getWindow()->pasteTextFromPrimary(mString); - } - - if (source_id) - { - *source_id = (hasContents() ? mObjects[0] : LLUUID::null); - } - - return mString; + return res; } - -BOOL LLClipboard::canPastePrimaryString() const +// Return true if there's something on the System clipboard +bool LLClipboard::isTextAvailable(bool use_primary) const { - return LLView::getWindow()->isPrimaryTextAvailable(); + return (use_primary ? LLView::getWindow()->isPrimaryTextAvailable() : LLView::getWindow()->isClipboardTextAvailable()); } + diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 2cb857145e..bb2d003703 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -32,6 +32,7 @@ #include "lluuid.h" #include "stdenums.h" #include "llsingleton.h" +#include "llassettype.h" #include "llinventory.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -52,19 +53,11 @@ public: which is implicitly copied upon selection on platforms which expect this (i.e. X11/Linux). */ - // Text strings management - void copyFromSubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); - void copyFromString(const LLWString ©_from, const LLUUID& source_id = LLUUID::null ); - BOOL canPasteString() const; - const LLWString& getPasteWString(LLUUID* source_id = NULL); - - // Primary text string management (Linux gtk implementation) - void copyFromPrimarySubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); - BOOL canPastePrimaryString() const; - const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL); - - // Support clipboard for object known only by their uuid - //void setSourceObject(const LLUUID& source_id) { mSourceID = source_id; } + // Text strings and single item management + bool copyToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false); + bool copyToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE); + bool pasteFromClipboard(LLWString& dst, bool use_primary = false); + bool isTextAvailable(bool use_primary = false) const; // Object list management void add(const LLUUID& object); // Adds to the current list of objects on the clipboard @@ -78,11 +71,9 @@ public: bool isCutMode() const { return mCutMode; } private: - // *TODO: To know if an asset ID can be serialized, check out LLAssetType::lookupIsAssetIDKnowable(EType asset_type) LLDynamicArray mObjects; bool mCutMode; - - LLWString mString; + LLWString mString; }; #endif // LL_LLCLIPBOARD_H diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 9292158b7c..e961cfb14f 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1047,7 +1047,7 @@ void LLLineEditor::cut() // Prepare for possible rollback LLLineEditorRollback rollback( this ); - LLClipboard::getInstance()->copyFromSubstring( mText.getWString(), left_pos, length ); + LLClipboard::getInstance()->copyToClipboard( mText.getWString(), left_pos, length ); deleteSelection(); // Validate new string and rollback the if needed. @@ -1078,13 +1078,13 @@ void LLLineEditor::copy() { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyFromSubstring( mText.getWString(), left_pos, length ); + LLClipboard::getInstance()->copyToClipboard( mText.getWString(), left_pos, length ); } } BOOL LLLineEditor::canPaste() const { - return !mReadOnly && LLClipboard::getInstance()->canPasteString(); + return !mReadOnly && LLClipboard::getInstance()->isTextAvailable(); } void LLLineEditor::paste() @@ -1115,14 +1115,7 @@ void LLLineEditor::pasteHelper(bool is_primary) if (can_paste_it) { LLWString paste; - if (is_primary) - { - paste = LLClipboard::getInstance()->getPastePrimaryWString(); - } - else - { - paste = LLClipboard::getInstance()->getPasteWString(); - } + LLClipboard::getInstance()->pasteFromClipboard(paste, is_primary); if (!paste.empty()) { @@ -1209,13 +1202,13 @@ void LLLineEditor::copyPrimary() { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyFromPrimarySubstring( mText.getWString(), left_pos, length ); + LLClipboard::getInstance()->copyToClipboard( mText.getWString(), left_pos, length, true); } } BOOL LLLineEditor::canPastePrimary() const { - return !mReadOnly && LLClipboard::getInstance()->canPastePrimaryString(); + return !mReadOnly && LLClipboard::getInstance()->isTextAvailable(true); } void LLLineEditor::updatePrimary() diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 8cbc2a8f99..0a9d862b66 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -2504,7 +2504,7 @@ void LLScrollListCtrl::copy() { buffer += (*itor)->getContentsCSV() + "\n"; } - LLClipboard::getInstance()->copyFromSubstring(utf8str_to_wstring(buffer), 0, buffer.length()); + LLClipboard::getInstance()->copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length()); } // virtual diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 22a577cda8..ffe012c110 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1332,7 +1332,7 @@ void LLTextEditor::cut() } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyFromSubstring( getWText(), left_pos, length, mSourceID ); + LLClipboard::getInstance()->copyToClipboard( getWText(), left_pos, length); deleteSelection( FALSE ); onKeyStroke(); @@ -1352,12 +1352,12 @@ void LLTextEditor::copy() } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyFromSubstring(getWText(), left_pos, length, mSourceID); + LLClipboard::getInstance()->copyToClipboard(getWText(), left_pos, length); } BOOL LLTextEditor::canPaste() const { - return !mReadOnly && LLClipboard::getInstance()->canPasteString(); + return !mReadOnly && LLClipboard::getInstance()->isTextAvailable(); } // paste from clipboard @@ -1393,16 +1393,8 @@ void LLTextEditor::pasteHelper(bool is_primary) return; } - LLUUID source_id; LLWString paste; - if (is_primary) - { - paste = LLClipboard::getInstance()->getPastePrimaryWString(&source_id); - } - else - { - paste = LLClipboard::getInstance()->getPasteWString(&source_id); - } + LLClipboard::getInstance()->pasteFromClipboard(paste, is_primary); if (paste.empty()) { @@ -1475,12 +1467,12 @@ void LLTextEditor::copyPrimary() } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyFromPrimarySubstring(getWText(), left_pos, length, mSourceID); + LLClipboard::getInstance()->copyToClipboard(getWText(), left_pos, length, true); } BOOL LLTextEditor::canPastePrimary() const { - return !mReadOnly && LLClipboard::getInstance()->canPastePrimaryString(); + return !mReadOnly && LLClipboard::getInstance()->isTextAvailable(true); } void LLTextEditor::updatePrimary() -- cgit v1.2.3 From ba32b72a9eea3ded3ee09675cc56670e618f652e Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 6 Feb 2012 16:20:38 -0800 Subject: Mac build fix -- added missing enumeration from switch --- indra/llui/lltextbase.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 5fe90e1ee3..e2d9a6cb81 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2409,6 +2409,9 @@ void LLTextBase::updateRects() case LLFontGL::BOTTOM: delta_pos = mVisibleTextRect.mBottom - mTextBoundingRect.mBottom; break; + case LLFontGL::BASELINE: + // do nothing + break; } // move line segments to fit new document rect for (line_list_t::iterator it = mLineInfoList.begin(); it != mLineInfoList.end(); ++it) -- cgit v1.2.3 From d56be1f1751f66bff09f0d223ed4712974e69e09 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 7 Feb 2012 12:31:48 -0800 Subject: EXP-1181 WIP as a designer I would like to specify default floater positions using realtive coordinates refactored LLCoord code to be templated, ultimately to support arbitrary conversions --- indra/llui/llaccordionctrltab.cpp | 2 +- indra/llui/llfloater.h | 3 +++ indra/llui/llmenugl.cpp | 2 +- indra/llui/llscrolllistitem.cpp | 2 +- indra/llui/llscrolllistitem.h | 2 +- indra/llui/lltoolbar.cpp | 2 +- indra/llui/llui.cpp | 9 +++++---- indra/llui/llview.cpp | 6 +++--- 8 files changed, 16 insertions(+), 12 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 7a5f9f9fd6..c025cd7939 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -976,7 +976,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child) gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); { - LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f); + LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom); child->draw(); } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 59b35d206f..1eb8c964f9 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -82,6 +82,9 @@ namespace LLInitParam }; } +struct LL_COORD_FLOATER; + +typedef LLCoord LLCoordFloater; class LLFloater : public LLPanel, public LLInstanceTracker { diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 3e547efd97..1284231e52 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3425,7 +3425,7 @@ void LLMenuHolderGL::draw() LLUI::pushMatrix(); { - LLUI::translate((F32)item_rect.mLeft, (F32)item_rect.mBottom, 0.f); + LLUI::translate((F32)item_rect.mLeft, (F32)item_rect.mBottom); selecteditem->getMenu()->drawBackground(selecteditem, interpolant); selecteditem->draw(); } diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp index d95752e31c..5a1e96ab03 100644 --- a/indra/llui/llscrolllistitem.cpp +++ b/indra/llui/llscrolllistitem.cpp @@ -138,7 +138,7 @@ void LLScrollListItem::draw(const LLRect& rect, const LLColor4& fg_color, const LLUI::pushMatrix(); { - LLUI::translate((F32) cur_x, (F32) rect.mBottom, 0.0f); + LLUI::translate((F32) cur_x, (F32) rect.mBottom); cell->draw( fg_color, highlight_color ); } diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h index 611df729b4..13655b5873 100644 --- a/indra/llui/llscrolllistitem.h +++ b/indra/llui/llscrolllistitem.h @@ -33,10 +33,10 @@ #include "v4color.h" #include "llinitparam.h" #include "llscrolllistcell.h" +#include "llcoord.h" #include -class LLCoordGL; class LLCheckBoxCtrl; class LLResizeBar; class LLScrollListCtrl; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 9b31a6449d..81ea0ebf0c 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -827,7 +827,7 @@ void LLToolBar::draw() // rect may have shifted during layout LLUI::popMatrix(); LLUI::pushMatrix(); - LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom, 0.f); + LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom); // Position the caret LLIconCtrl* caret = getChild("caret"); diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 6b74c5a6be..931b696c90 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1688,21 +1688,22 @@ void LLUI::translate(F32 x, F32 y, F32 z) gGL.translateUI(x,y,z); LLFontGL::sCurOrigin.mX += (S32) x; LLFontGL::sCurOrigin.mY += (S32) y; - LLFontGL::sCurOrigin.mZ += z; + LLFontGL::sCurDepth += z; } //static void LLUI::pushMatrix() { gGL.pushUIMatrix(); - LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin); + LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth)); } //static void LLUI::popMatrix() { gGL.popUIMatrix(); - LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin(); + LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first; + LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second; LLFontGL::sOriginStack.pop_back(); } @@ -1712,7 +1713,7 @@ void LLUI::loadIdentity() gGL.loadUIIdentity(); LLFontGL::sCurOrigin.mX = 0; LLFontGL::sCurOrigin.mY = 0; - LLFontGL::sCurOrigin.mZ = 0; + LLFontGL::sCurDepth = 0.f; } //static diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index e1ee0a5b14..1a62fe75fc 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1106,7 +1106,7 @@ void LLView::drawChildren() { LLUI::pushMatrix(); { - LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f); + LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom); // flag the fact we are in draw here, in case overridden draw() method attempts to remove this widget viewp->mInDraw = true; viewp->draw(); @@ -1159,7 +1159,7 @@ void LLView::drawDebugRect() if (getUseBoundingRect()) { - LLUI::translate((F32)mBoundingRect.mLeft - (F32)mRect.mLeft, (F32)mBoundingRect.mBottom - (F32)mRect.mBottom, 0.f); + LLUI::translate((F32)mBoundingRect.mLeft - (F32)mRect.mLeft, (F32)mBoundingRect.mBottom - (F32)mRect.mBottom); } LLRect debug_rect = getUseBoundingRect() ? mBoundingRect : mRect; @@ -1231,7 +1231,7 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); { - LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset, 0.f); + LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset); childp->draw(); } LLUI::popMatrix(); -- cgit v1.2.3 From c744603af9b53c6bc73fefbd56de68cf2778ed70 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 7 Feb 2012 17:13:24 -0800 Subject: EXP-1873 : Implement cut in the inventory contextual menu. Works without deleting the items but simply dimming them and moving them. Doesn't work for folders yet. --- indra/llui/llclipboard.cpp | 6 ++++++ indra/llui/llclipboard.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 5c8db29ae4..a2a3f7f285 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -97,6 +97,12 @@ BOOL LLClipboard::hasContents() const return (mObjects.count() > 0); } +// Returns true if the input uuid is in the list of clipboard objects +bool LLClipboard::isOnClipboard(const LLUUID& object) const +{ + return (mObjects.find(object) != LLDynamicArray::FAIL); +} + // Copy the input string to the LL and the system clipboard bool LLClipboard::copyToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary) { diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index bb2d003703..8e417a490d 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -69,6 +69,8 @@ public: BOOL hasContents() const; // true if the clipboard has something pasteable in it bool isCutMode() const { return mCutMode; } + void setCutMode(bool mode) { mCutMode = mode; } + bool isOnClipboard(const LLUUID& object) const; private: LLDynamicArray mObjects; -- cgit v1.2.3 From 4e08461f8ad23fb75ca8587c781c2cf65351b1ab Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 7 Feb 2012 19:29:10 -0800 Subject: EXP-1181 WIP as a designer I would like to specify default floater positions using realtive coordinates changed over to new convert() method added LLCoordFloater --- indra/llui/llfloater.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ indra/llui/llfloater.h | 35 ++++++++++++++++++++++++++++++++--- indra/llui/llui.cpp | 8 ++------ 3 files changed, 77 insertions(+), 9 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index cef5ba3fe7..6274caa97f 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -270,6 +270,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mMinimizeSignal(NULL) // mNotificationContext(NULL) { + mPosition.setFloater(*this); // mNotificationContext = new LLFloaterNotificationContext(getHandle()); // Clicks stop here. @@ -3271,3 +3272,45 @@ void LLFloater::stackWith(LLFloater& other) setShape(next_rect); } +LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater) +: coord_t(x, y) +{ + mFloater = floater.getHandle(); +} + + +LLCoordFloater::LLCoordFloater(const LLCoordCommon& other, LLFloater& floater) +{ + mFloater = floater.getHandle(); + convertFromCommon(other); +} + +LLCoordFloater& LLCoordFloater::operator=(const LLCoordFloater& other) +{ + mFloater = other.mFloater; + coord_t::operator =(other); + return *this; +} + +void LLCoordFloater::setFloater(LLFloater& floater) +{ + mFloater = floater.getHandle(); +} + +bool LLCoordFloater::operator==(const LLCoordFloater& other) const +{ + return mX == other.mX && mY == other.mY && mFloater == other.mFloater; +} + +LLCoordCommon LL_COORD_FLOATER::convertToCommon() const +{ + const LLCoordFloater& self = static_cast(*this); + return LLCoordCommon(self.mX, self.mY); +} + +void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from) +{ + LLCoordFloater& self = static_cast(*this); + self.mX = from.mX; + self.mY = from.mY; +} diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 1eb8c964f9..a7cc9ae961 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -82,9 +82,37 @@ namespace LLInitParam }; } -struct LL_COORD_FLOATER; +struct LL_COORD_FLOATER +{ + typedef F32 value_t; + + LLCoordCommon convertToCommon() const; + void convertFromCommon(const LLCoordCommon& from); +protected: + LLHandle mFloater; +}; + +struct LLCoordFloater : LLCoord +{ + typedef LLCoord coord_t; -typedef LLCoord LLCoordFloater; + LLCoordFloater() {} + LLCoordFloater(F32 x, F32 y, LLFloater& floater); + LLCoordFloater(const LLCoordCommon& other, LLFloater& floater); + + LLCoordFloater& operator=(const LLCoordCommon& other) + { + convertFromCommon(other); + return *this; + } + + LLCoordFloater& operator=(const LLCoordFloater& other); + + bool operator==(const LLCoordFloater& other) const; + bool operator!=(const LLCoordFloater& other) const { return !(*this == other); } + + void setFloater(LLFloater& floater); +}; class LLFloater : public LLPanel, public LLInstanceTracker { @@ -187,7 +215,7 @@ public: bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); - /*virtual*/ BOOL canSnapTo(const LLView* other_view); + /*virtual*/ BOOL canSnapTo(const LLView* other_view); /*virtual*/ void setSnappedTo(const LLView* snap_view); /*virtual*/ void setFocus( BOOL b ); /*virtual*/ void setIsChrome(BOOL is_chrome); @@ -428,6 +456,7 @@ private: LLFloaterEnums::EOpenPositioning mOpenPositioning; S32 mSpecifiedLeft; S32 mSpecifiedBottom; + LLCoordFloater mPosition; S32 mMinWidth; S32 mMinHeight; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 931b696c90..137716743f 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1736,10 +1736,7 @@ void LLUI::setMousePositionScreen(S32 x, S32 y) screen_x = llround((F32)x * sGLScaleFactor.mV[VX]); screen_y = llround((F32)y * sGLScaleFactor.mV[VY]); - LLCoordWindow window_point; - LLView::getWindow()->convertCoords(LLCoordGL(screen_x, screen_y), &window_point); - - LLView::getWindow()->setCursorPosition(window_point); + LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert()); } //static @@ -1747,8 +1744,7 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y) { LLCoordWindow cursor_pos_window; getWindow()->getCursorPosition(&cursor_pos_window); - LLCoordGL cursor_pos_gl; - getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl); + LLCoordGL cursor_pos_gl(cursor_pos_window.convert()); *x = llround((F32)cursor_pos_gl.mX / sGLScaleFactor.mV[VX]); *y = llround((F32)cursor_pos_gl.mY / sGLScaleFactor.mV[VX]); } -- cgit v1.2.3 From ee3c3c15b714f8f68e98a2d4064afaec665bd64a Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 7 Feb 2012 22:46:04 -0800 Subject: EXP-1841 : Final deep scrub on LLClipboard API, clean up the use of copy and cut everywhere. --- indra/llui/llclipboard.cpp | 96 ++++++++++++++++++++++------------------------ indra/llui/llclipboard.h | 44 +++++++++++---------- 2 files changed, 70 insertions(+), 70 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index a2a3f7f285..7794a0537f 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -35,8 +35,8 @@ #include "llwindow.h" LLClipboard::LLClipboard() -: mCutMode(false) { + reset(); } LLClipboard::~LLClipboard() @@ -44,55 +44,59 @@ LLClipboard::~LLClipboard() reset(); } -void LLClipboard::add(const LLUUID& object) +void LLClipboard::reset() { - mObjects.put(object); + mObjects.reset(); + mCutMode = false; + mString = LLWString(); } -void LLClipboard::store(const LLUUID& object) +// Copy the input uuid to the LL clipboard +bool LLClipboard::copyToClipboard(const LLUUID& src, const LLAssetType::EType type) { reset(); - mObjects.put(object); + return addToClipboard(src, type); } -void LLClipboard::store(const LLDynamicArray& inv_objects) +// Add the input uuid to the LL clipboard +// Convert the uuid to string and concatenate that string to the system clipboard if legit +bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType type) { - reset(); - S32 count = inv_objects.count(); - for(S32 i = 0; i < count; i++) + bool res = false; + if (src.notNull()) { - mObjects.put(inv_objects[i]); + res = true; + if (LLAssetType::lookupIsAssetIDKnowable(type)) + { + LLWString source = utf8str_to_wstring(src.asString()); + res = addToClipboard(source, 0, source.size()); + } + if (res) + { + mObjects.put(src); + } } + return res; } -void LLClipboard::cut(const LLUUID& object) +bool LLClipboard::pasteFromClipboard(LLDynamicArray& inv_objects) const { - if(!mCutMode && !mObjects.empty()) - { - //looks like there are some stored items, reset clipboard state - reset(); - } - mCutMode = true; - add(object); -} -void LLClipboard::retrieve(LLDynamicArray& inv_objects) const -{ - inv_objects.reset(); + bool res = false; S32 count = mObjects.count(); - for(S32 i = 0; i < count; i++) + if (count > 0) { - inv_objects.put(mObjects[i]); + res = true; + inv_objects.reset(); + for (S32 i = 0; i < count; i++) + { + inv_objects.put(mObjects[i]); + } } -} - -void LLClipboard::reset() -{ - mObjects.reset(); - mCutMode = false; + return res; } // Returns true if the LL Clipboard has pasteable items in it -BOOL LLClipboard::hasContents() const +bool LLClipboard::hasContents() const { return (mObjects.count() > 0); } @@ -107,30 +111,22 @@ bool LLClipboard::isOnClipboard(const LLUUID& object) const bool LLClipboard::copyToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary) { reset(); - mString = src.substr(pos, len); - return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString)); + return addToClipboard(src, pos, len, use_primary); } -// Copy the input uuid to the LL clipboard -// Convert the uuid to string and copy that string to the system clipboard if legit -bool LLClipboard::copyToClipboard(const LLUUID& src, const LLAssetType::EType type) +// Concatenate the input string to the LL and the system clipboard +bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary) { - bool res = false; - reset(); - if (src.notNull()) + const LLWString sep(utf8str_to_wstring(std::string(", "))); + if (mString.length() == 0) { - res = true; - if (LLAssetType::lookupIsAssetIDKnowable(type)) - { - LLWString source = utf8str_to_wstring(src.asString()); - res = copyToClipboard(source, 0, source.size()); - } - if (res) - { - store(src); - } + mString = src.substr(pos, len); } - return res; + else + { + mString = mString + sep + src.substr(pos, len); + } + return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString)); } // Copy the System clipboard to the output string. diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 8e417a490d..608ea246a7 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -48,34 +48,38 @@ public: LLClipboard(); ~LLClipboard(); - /* We support two flavors of clipboard. The default is the explicitly - copy-and-pasted clipboard. The second is the so-called 'primary' clipboard - which is implicitly copied upon selection on platforms which expect this - (i.e. X11/Linux). */ - - // Text strings and single item management - bool copyToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false); - bool copyToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE); - bool pasteFromClipboard(LLWString& dst, bool use_primary = false); - bool isTextAvailable(bool use_primary = false) const; + // Text strings management: + // ------------------------ + // We support two flavors of text clipboards. The default is the explicitly + // copy-and-pasted clipboard. The second is the so-called 'primary' clipboard + // which is implicitly copied upon selection on platforms which expect this + // (i.e. X11/Linux, Mac). + bool copyToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false); + bool addToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false); + bool pasteFromClipboard(LLWString& dst, bool use_primary = false); + bool isTextAvailable(bool use_primary = false) const; - // Object list management - void add(const LLUUID& object); // Adds to the current list of objects on the clipboard - void store(const LLUUID& object); // Stores a single inventory object - void store(const LLDynamicArray& inventory_objects); // Stores an array of objects - void cut(const LLUUID& object); // Adds to the current list of cut objects on the clipboard - void retrieve(LLDynamicArray& inventory_objects) const; // Gets a copy of the objects on the clipboard - void reset(); // Clears the clipboard + // Object list management: + // ----------------------- + // Clears the clipboard + void reset(); + // Clears and adds one single object to the clipboard + bool copyToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE); + // Adds one object to the current list of objects on the clipboard + bool addToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE); + // Gets a copy of the objects on the clipboard + bool pasteFromClipboard(LLDynamicArray& inventory_objects) const; - BOOL hasContents() const; // true if the clipboard has something pasteable in it + bool hasContents() const; // True if the clipboard has pasteable objects + bool isOnClipboard(const LLUUID& object) const; // True if the input object uuid is on the clipboard + bool isCutMode() const { return mCutMode; } void setCutMode(bool mode) { mCutMode = mode; } - bool isOnClipboard(const LLUUID& object) const; private: LLDynamicArray mObjects; - bool mCutMode; LLWString mString; + bool mCutMode; // This is a convenience flag for the viewer. It has no influence on the cliboard management. }; #endif // LL_LLCLIPBOARD_H -- cgit v1.2.3 From f27ea1aff738f3222c782a7fac5b9172fc3cf67c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 7 Feb 2012 22:50:49 -0800 Subject: EXP-1181 WIP as a designer I would like to specify default floater positions using realtive coordinates fixed build moved conversion funcs to llwindow.cpp as they work on all platforms refactored translateintorect to take overlap as parameter --- indra/llui/llcombobox.cpp | 2 +- indra/llui/llfloater.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++---- indra/llui/llview.cpp | 69 ++++++++++++---------------------------- indra/llui/llview.h | 2 +- 4 files changed, 97 insertions(+), 57 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 89d8842393..806d2ef3f6 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -613,7 +613,7 @@ void LLComboBox::showList() } mList->setOrigin(rect.mLeft, rect.mBottom); mList->reshape(rect.getWidth(), rect.getHeight()); - mList->translateIntoRect(root_view_local, FALSE); + mList->translateIntoRect(root_view_local); // Make sure we didn't go off bottom of screen S32 x, y; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 6274caa97f..3afa1b8e3a 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -926,7 +926,7 @@ void LLFloater::applyPositioning(LLFloater* other) setOrigin(mSpecifiedLeft, mSpecifiedBottom); const LLRect& snap_rect = gFloaterView->getSnapRect(); translate(snap_rect.mLeft, snap_rect.mBottom); - translateIntoRect(snap_rect, FALSE); + translateIntoRect(snap_rect); } break; @@ -950,7 +950,7 @@ void LLFloater::applyPositioning(LLFloater* other) setOrigin(horizontal_offset, vertical_offset - rect_height); translate(snap_rect.mLeft, snap_rect.mBottom); - translateIntoRect(snap_rect, FALSE); + translateIntoRect(snap_rect); } break; @@ -2644,6 +2644,8 @@ void LLFloaterView::refresh() } } +const S32 FLOATER_MIN_VISIBLE_PIXELS = 16; + void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside) { if (floater->getParent() != this) @@ -2697,7 +2699,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out } // move window fully onscreen - if (floater->translateIntoRect( getSnapRect(), allow_partial_outside )) + if (floater->translateIntoRect( getSnapRect(), allow_partial_outside ? FLOATER_MIN_VISIBLE_PIXELS : S32_MAX )) { floater->clearSnapTarget(); } @@ -3305,12 +3307,79 @@ bool LLCoordFloater::operator==(const LLCoordFloater& other) const LLCoordCommon LL_COORD_FLOATER::convertToCommon() const { const LLCoordFloater& self = static_cast(*this); - return LLCoordCommon(self.mX, self.mY); + + LLRect snap_rect = gFloaterView->getSnapRect(); + LLFloater* floaterp = mFloater.get(); + S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0; + S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0; + LLCoordCommon out; + if (self.mX < -0.5f) + { + out.mX = llround(rescale(self.mX, -1.f, -0.5f, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft)); + } + else if (self.mX > 0.5f) + { + out.mX = llround(rescale(self.mX, 0.5f, 1.f, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS)); + } + else + { + out.mX = llround(rescale(self.mX, -0.5f, 0.5f, snap_rect.mLeft, snap_rect.mRight - floater_width)); + } + + if (self.mY < -0.5f) + { + out.mY = llround(rescale(self.mY, -1.f, -0.5f, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom)); + } + else if (self.mY > 0.5f) + { + out.mY = llround(rescale(self.mY, 0.5f, 1.f, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS)); + } + else + { + out.mY = llround(rescale(self.mY, -0.5f, 0.5f, snap_rect.mBottom, snap_rect.mTop - floater_height)); + } + + // return center point instead of lower left + out.mX += floater_width / 2; + out.mY += floater_height / 2; + + return out; } void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from) { LLCoordFloater& self = static_cast(*this); - self.mX = from.mX; - self.mY = from.mY; + LLRect snap_rect = gFloaterView->getSnapRect(); + LLFloater* floaterp = mFloater.get(); + S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0; + S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0; + + S32 from_x = from.mX - floater_width / 2; + S32 from_y = from.mY - floater_height / 2; + + if (from_x < snap_rect.mLeft) + { + self.mX = rescale(from_x, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft, -1.f, -0.5f); + } + else if (from_x + floater_width > snap_rect.mRight) + { + self.mX = rescale(from_x, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS, 0.5f, 1.f); + } + else + { + self.mX = rescale(from_x, snap_rect.mLeft, snap_rect.mRight - floater_width, -0.5f, 0.5f); + } + + if (from_y < snap_rect.mBottom) + { + self.mY = rescale(from_y, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom, -1.f, -0.5f); + } + else if (from_y + floater_height > snap_rect.mTop) + { + self.mY = rescale(from_y, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS, 0.5f, 1.f); + } + else + { + self.mY = rescale(from_y, snap_rect.mBottom, snap_rect.mTop - floater_height, -0.5f, 0.5f); + } } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 1a62fe75fc..d22e14745f 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1616,59 +1616,30 @@ LLView* LLView::findNextSibling(LLView* child) } -LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, BOOL allow_partial_outside) +LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, S32 min_overlap_pixels) { LLCoordGL delta; - if (allow_partial_outside) - { - const S32 KEEP_ONSCREEN_PIXELS = 16; + const S32 KEEP_ONSCREEN_PIXELS_WIDTH = llmin(min_overlap_pixels, input.getWidth()); + const S32 KEEP_ONSCREEN_PIXELS_HEIGHT = llmin(min_overlap_pixels, input.getHeight()); - if( input.mRight - KEEP_ONSCREEN_PIXELS < constraint.mLeft ) - { - delta.mX = constraint.mLeft - (input.mRight - KEEP_ONSCREEN_PIXELS); - } - else - if( input.mLeft + KEEP_ONSCREEN_PIXELS > constraint.mRight ) - { - delta.mX = constraint.mRight - (input.mLeft + KEEP_ONSCREEN_PIXELS); - } + if( input.mRight - KEEP_ONSCREEN_PIXELS_WIDTH < constraint.mLeft ) + { + delta.mX = constraint.mLeft - (input.mRight - KEEP_ONSCREEN_PIXELS_WIDTH); + } + else if( input.mLeft + KEEP_ONSCREEN_PIXELS_WIDTH > constraint.mRight ) + { + delta.mX = constraint.mRight - (input.mLeft + KEEP_ONSCREEN_PIXELS_WIDTH); + } - if( input.mTop > constraint.mTop ) - { - delta.mY = constraint.mTop - input.mTop; - } - else - if( input.mTop - KEEP_ONSCREEN_PIXELS < constraint.mBottom ) - { - delta.mY = constraint.mBottom - (input.mTop - KEEP_ONSCREEN_PIXELS); - } + if( input.mTop > constraint.mTop ) + { + delta.mY = constraint.mTop - input.mTop; } else + if( input.mTop - KEEP_ONSCREEN_PIXELS_HEIGHT < constraint.mBottom ) { - if( input.mLeft < constraint.mLeft ) - { - delta.mX = constraint.mLeft - input.mLeft; - } - else - if( input.mRight > constraint.mRight ) - { - delta.mX = constraint.mRight - input.mRight; - // compensate for left edge possible going off screen - delta.mX += llmax( 0, input.getWidth() - constraint.getWidth() ); - } - - if( input.mTop > constraint.mTop ) - { - delta.mY = constraint.mTop - input.mTop; - } - else - if( input.mBottom < constraint.mBottom ) - { - delta.mY = constraint.mBottom - input.mBottom; - // compensate for top edge possible going off screen - delta.mY -= llmax( 0, input.getHeight() - constraint.getHeight() ); - } + delta.mY = constraint.mBottom - (input.mTop - KEEP_ONSCREEN_PIXELS_HEIGHT); } return delta; @@ -1677,9 +1648,9 @@ LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, BO // Moves the view so that it is entirely inside of constraint. // If the view will not fit because it's too big, aligns with the top and left. // (Why top and left? That's where the drag bars are for floaters.) -BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outside ) +BOOL LLView::translateIntoRect(const LLRect& constraint, S32 min_overlap_pixels) { - LLCoordGL translation = getNeededTranslation(getRect(), constraint, allow_partial_outside); + LLCoordGL translation = getNeededTranslation(getRect(), constraint, min_overlap_pixels); if (translation.mX != 0 || translation.mY != 0) { @@ -1691,9 +1662,9 @@ BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outs // move this view into "inside" but not onto "exclude" // NOTE: if this view is already contained in "inside", we ignore the "exclude" rect -BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, BOOL allow_partial_outside ) +BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels) { - LLCoordGL translation = getNeededTranslation(getRect(), inside, allow_partial_outside); + LLCoordGL translation = getNeededTranslation(getRect(), inside, min_overlap_pixels); if (translation.mX != 0 || translation.mY != 0) { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index f1fac5f69c..de2fab963b 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -370,7 +370,7 @@ public: virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual void translate( S32 x, S32 y ); void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); } - BOOL translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside ); + BOOL translateIntoRect( const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); BOOL translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, BOOL allow_partial_outside ); void centerWithin(const LLRect& bounds); -- cgit v1.2.3 From 91f77318db63d4b2560390551306056c4a6cc2d5 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 8 Feb 2012 15:44:02 -0800 Subject: EXP-1873 : Implement the hiding of cut items on the clipboard --- indra/llui/llclipboard.cpp | 6 +++++- indra/llui/llclipboard.h | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 7794a0537f..ee1f1aa816 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -34,7 +34,8 @@ #include "llview.h" #include "llwindow.h" -LLClipboard::LLClipboard() +LLClipboard::LLClipboard() : + mState(0) { reset(); } @@ -46,6 +47,7 @@ LLClipboard::~LLClipboard() void LLClipboard::reset() { + mState++; mObjects.reset(); mCutMode = false; mString = LLWString(); @@ -74,6 +76,7 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ if (res) { mObjects.put(src); + mState++; } } return res; @@ -126,6 +129,7 @@ bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool us { mString = mString + sep + src.substr(pos, len); } + mState++; return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString)); } diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 608ea246a7..0231169748 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -47,6 +47,11 @@ class LLClipboard : public LLSingleton public: LLClipboard(); ~LLClipboard(); + + // Clears the clipboard + void reset(); + // Returns the state of the clipboard so client can know if it has been modified (comparing with tracked state) + int getState() const { return mState; } // Text strings management: // ------------------------ @@ -61,8 +66,6 @@ public: // Object list management: // ----------------------- - // Clears the clipboard - void reset(); // Clears and adds one single object to the clipboard bool copyToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE); // Adds one object to the current list of objects on the clipboard @@ -74,12 +77,13 @@ public: bool isOnClipboard(const LLUUID& object) const; // True if the input object uuid is on the clipboard bool isCutMode() const { return mCutMode; } - void setCutMode(bool mode) { mCutMode = mode; } + void setCutMode(bool mode) { mCutMode = mode; mState++; } private: - LLDynamicArray mObjects; - LLWString mString; + LLDynamicArray mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat) + LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment). bool mCutMode; // This is a convenience flag for the viewer. It has no influence on the cliboard management. + int mState; // Incremented when the clipboard change so that interested parties can check its state. }; #endif // LL_LLCLIPBOARD_H -- cgit v1.2.3 From e482e677b2dece8cc46008f4fb05e4927ec70b4e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 8 Feb 2012 16:51:19 -0800 Subject: EXP-1767 WIP Received Items panel state does not persist between sessions fixed layout stack so programmatic size updates will work correctly --- indra/llui/lllayoutstack.cpp | 68 +++++++++++++++++++++++++++++--------------- indra/llui/lllayoutstack.h | 1 + 2 files changed, 46 insertions(+), 23 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 31e0434753..ae262f794e 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -252,7 +252,7 @@ void LLLayoutStack::removeChild(LLView* view) { mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp)); delete embedded_panelp; - normalizeFractionalSizes(); + updateFractionalSizes(); mNeedsLayout = true; } @@ -277,7 +277,7 @@ bool LLLayoutStack::addChild(LLView* child, S32 tab_group) } BOOL result = LLView::addChild(child, tab_group); - normalizeFractionalSizes(); + updateFractionalSizes(); return result; } @@ -491,35 +491,48 @@ void LLLayoutStack::updateClass() } } -void LLLayoutStack::normalizeFractionalSizes() +void LLLayoutStack::updateFractionalSizes() { - F32 total_resizable_dim = 0; - S32 num_auto_resize_panels = 0; + F32 total_resizable_dim = 0.f; BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) { if (panelp->mAutoResize) { total_resizable_dim += llmax(0, panelp->getLayoutDim() - panelp->getRelevantMinDim()); - num_auto_resize_panels++; } } - F32 total_fractional_size = 0.f; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) { if (panelp->mAutoResize) { F32 panel_resizable_dim = llmax(MIN_FRACTIONAL_SIZE, (F32)(panelp->getLayoutDim() - panelp->getRelevantMinDim())); panelp->mFractionalSize = panel_resizable_dim > 0.f - ? llclamp(panel_resizable_dim / total_resizable_dim, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE) - : MIN_FRACTIONAL_SIZE; - total_fractional_size += panelp->mFractionalSize; + ? llclamp(panel_resizable_dim / total_resizable_dim, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE) + : MIN_FRACTIONAL_SIZE; llassert(!llisnan(panelp->mFractionalSize)); } } + normalizeFractionalSizes(); +} + + +void LLLayoutStack::normalizeFractionalSizes() +{ + S32 num_auto_resize_panels = 0; + F32 total_fractional_size = 0.f; + + BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + { + if (panelp->mAutoResize) + { + total_fractional_size += panelp->mFractionalSize; + num_auto_resize_panels++; + } + } + if (total_fractional_size == 0.f) { // equal distribution BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) @@ -631,7 +644,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& F32 total_visible_fraction = 0.f; F32 delta_auto_resize_headroom = 0.f; - F32 total_auto_resize_headroom = 0.f; + F32 original_auto_resize_headroom = 0.f; LLLayoutPanel* other_resize_panel = NULL; LLLayoutPanel* following_panel = NULL; @@ -640,8 +653,11 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& { if (panelp->mAutoResize) { - total_auto_resize_headroom += (F32)(panelp->mTargetDim - panelp->getRelevantMinDim()); - total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor(); + original_auto_resize_headroom += (F32)(panelp->mTargetDim - panelp->getRelevantMinDim()); + if (panelp->getVisible() && !panelp->mCollapsed) + { + total_visible_fraction += panelp->mFractionalSize; + } } if (panelp == resized_panel) @@ -655,18 +671,25 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& } } - if (resized_panel->mAutoResize == FALSE) + + if (resized_panel->mAutoResize) { - delta_auto_resize_headroom += -delta_dim; + if (!other_resize_panel || !other_resize_panel->mAutoResize) + { + delta_auto_resize_headroom += delta_dim; + } } - if (other_resize_panel && other_resize_panel->mAutoResize == FALSE) + else { - delta_auto_resize_headroom += delta_dim; + if (!other_resize_panel || other_resize_panel->mAutoResize) + { + delta_auto_resize_headroom -= delta_dim; + } } F32 fraction_given_up = 0.f; F32 fraction_remaining = 1.f; - F32 updated_auto_resize_headroom = total_auto_resize_headroom + delta_auto_resize_headroom; + F32 updated_auto_resize_headroom = original_auto_resize_headroom + delta_auto_resize_headroom; enum { @@ -692,14 +715,13 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& { // freeze current size as fraction of overall auto_resize space F32 fractional_adjustment_factor = updated_auto_resize_headroom == 0.f ? 1.f - : total_auto_resize_headroom / updated_auto_resize_headroom; + : original_auto_resize_headroom / updated_auto_resize_headroom; F32 new_fractional_size = llclamp(panelp->mFractionalSize * fractional_adjustment_factor, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); - F32 fraction_delta = (new_fractional_size - panelp->mFractionalSize); - fraction_given_up -= fraction_delta; + fraction_given_up -= new_fractional_size - panelp->mFractionalSize; fraction_remaining -= panelp->mFractionalSize; - panelp->mFractionalSize += fraction_delta; + panelp->mFractionalSize = new_fractional_size; llassert(!llisnan(panelp->mFractionalSize)); } else diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 4a8702e318..d32caec5f9 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -111,6 +111,7 @@ private: LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const; LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const; + void updateFractionalSizes(); void normalizeFractionalSizes(); void updatePanelRect( LLLayoutPanel* param1, const LLRect& new_rect ); -- cgit v1.2.3 From aa345bd8f3844bdc2c5318d14b26343b91e6e573 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 9 Feb 2012 17:14:37 -0800 Subject: EXP-1874 FIX Unexpected scrollbar in text notification --- indra/llui/lltextbase.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index e2d9a6cb81..35abe48510 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2380,6 +2380,8 @@ S32 LLTextBase::getEditableIndex(S32 index, bool increasing_direction) void LLTextBase::updateRects() { + mVisibleTextRect = getLocalRect(); + if (mLineInfoList.empty()) { mTextBoundingRect = LLRect(0, mVPad, mHPad, 0); @@ -2604,8 +2606,7 @@ BOOL LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; BOOL LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; } const std::string& LLTextSegment::getName() const { - static std::string empty_string(""); - return empty_string; + return LLStringUtil::null; } void LLTextSegment::onMouseCaptureLost() {} void LLTextSegment::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {} -- cgit v1.2.3 From 45e30f35dc1a3dc07862ca9f67bbbdb238d364fe Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 9 Feb 2012 17:50:09 -0800 Subject: EXP-1883 FIX Toolbar button tooltips display off screen for right hand tool bar, bottom tool bar, and tooltips on top bar items show off screen --- indra/llui/llmenugl.cpp | 2 +- indra/llui/llui.cpp | 2 +- indra/llui/llview.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 1284231e52..ff6928ffda 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3082,7 +3082,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) mouse_y + MOUSE_CURSOR_PADDING, CURSOR_WIDTH + MOUSE_CURSOR_PADDING * 2, CURSOR_HEIGHT + MOUSE_CURSOR_PADDING * 2); - menu->translateIntoRectWithExclusion( menu_region_rect, mouse_rect, FALSE ); + menu->translateIntoRectWithExclusion( menu_region_rect, mouse_rect ); menu->getParent()->sendChildToFront(menu); } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 137716743f..31ccec0d2a 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -2049,7 +2049,7 @@ void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) // Start at spawn position (using left/top) view->setOrigin( local_x, local_y - view->getRect().getHeight()); // Make sure we're on-screen and not overlapping the mouse - view->translateIntoRectWithExclusion( virtual_window_rect, mouse_rect, FALSE ); + view->translateIntoRectWithExclusion( virtual_window_rect, mouse_rect ); } LLView* LLUI::resolvePath(LLView* context, const std::string& path) diff --git a/indra/llui/llview.h b/indra/llui/llview.h index de2fab963b..fd19309a56 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -371,7 +371,7 @@ public: virtual void translate( S32 x, S32 y ); void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); } BOOL translateIntoRect( const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); - BOOL translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, BOOL allow_partial_outside ); + BOOL translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels = S32_MAX); void centerWithin(const LLRect& bounds); void setShape(const LLRect& new_rect, bool by_user = false); -- cgit v1.2.3 From 6a6cf3aa78b328c5a4cb78ad1b4f9f2fb831c8e4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 10 Feb 2012 16:35:22 -0800 Subject: EXP-1884 FIX Errors in navigating text when editing Landmarks and picks once a vertical scrollbar is shown --- indra/llui/lltextbase.cpp | 10 +++++----- indra/llui/llview.cpp | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 35abe48510..15c2d4946c 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1192,7 +1192,7 @@ void LLTextBase::reflow() // shrink document to minimum size (visible portion of text widget) // to force inlined widgets with follows set to shrink - mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight()); + //mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight()); S32 cur_top = 0; @@ -2380,7 +2380,8 @@ S32 LLTextBase::getEditableIndex(S32 index, bool increasing_direction) void LLTextBase::updateRects() { - mVisibleTextRect = getLocalRect(); + LLRect old_text_rect = mVisibleTextRect; + mVisibleTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect(); if (mLineInfoList.empty()) { @@ -2403,10 +2404,10 @@ void LLTextBase::updateRects() switch(mVAlign) { case LLFontGL::TOP: - delta_pos = llmax(mVisibleTextRect.mTop - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom); + delta_pos = llmax(mVisibleTextRect.getHeight() - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom); break; case LLFontGL::VCENTER: - delta_pos = (llmax(mVisibleTextRect.mTop - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom) + (mVisibleTextRect.mBottom - mTextBoundingRect.mBottom)) / 2; + delta_pos = (llmax(mVisibleTextRect.getHeight() - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom) + (mVisibleTextRect.mBottom - mTextBoundingRect.mBottom)) / 2; break; case LLFontGL::BOTTOM: delta_pos = mVisibleTextRect.mBottom - mTextBoundingRect.mBottom; @@ -2459,7 +2460,6 @@ void LLTextBase::updateRects() //update mVisibleTextRect *after* mDocumentView has been resized // so that scrollbars are added if document needs to scroll // since mVisibleTextRect does not include scrollbars - LLRect old_text_rect = mVisibleTextRect; mVisibleTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect(); //FIXME: replace border with image? if (mBorderVisible) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d22e14745f..421166dcd4 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1300,7 +1300,10 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft; S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom; viewp->translate( delta_x, delta_y ); - viewp->reshape(child_rect.getWidth(), child_rect.getHeight()); + if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight()) + { + viewp->reshape(child_rect.getWidth(), child_rect.getHeight()); + } } } -- cgit v1.2.3 From 11c53b444d77788044fe0e164fde4364b8206564 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 15 Feb 2012 18:12:26 -0800 Subject: EXP-1884 FIX Errors in navigating text when editing Landmarks and picks once a vertical scrollbar is shown fixed horizontal scrollbar showing up in local chat --- indra/llui/lltextbase.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 15c2d4946c..7aeeae298f 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1192,7 +1192,10 @@ void LLTextBase::reflow() // shrink document to minimum size (visible portion of text widget) // to force inlined widgets with follows set to shrink - //mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight()); + if (mWordWrap) + { + mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight()); + } S32 cur_top = 0; -- cgit v1.2.3 From bb6ace0672fa5e1c47c534ba74396ef04daa408b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 17 Feb 2012 14:42:12 -0800 Subject: EXP-1902, EXP-1903 : Move items cut to the trash when clipboard reset. --- indra/llui/llclipboard.cpp | 8 ++++++++ indra/llui/llclipboard.h | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index ee1f1aa816..e0729366cc 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -47,9 +47,17 @@ LLClipboard::~LLClipboard() void LLClipboard::reset() { + // Increment the clipboard state mState++; + // Call the cleanup function (if any) before releasing the object list + if (mCutMode && mCleanupCallback) + { + mCleanupCallback(); + } + // Clear the clipboard mObjects.reset(); mCutMode = false; + mCleanupCallback = NULL; mString = LLWString(); } diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 0231169748..3947fa0229 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -27,6 +27,7 @@ #ifndef LL_LLCLIPBOARD_H #define LL_LLCLIPBOARD_H +#include #include "llstring.h" #include "lluuid.h" @@ -35,6 +36,8 @@ #include "llassettype.h" #include "llinventory.h" +typedef boost::function cleanup_callback_t; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLClipboard // @@ -77,13 +80,15 @@ public: bool isOnClipboard(const LLUUID& object) const; // True if the input object uuid is on the clipboard bool isCutMode() const { return mCutMode; } - void setCutMode(bool mode) { mCutMode = mode; mState++; } + void setCutMode(bool mode, cleanup_callback_t cb = NULL) { mCutMode = mode; mCleanupCallback = cb; mState++; } private: LLDynamicArray mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat) LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment). - bool mCutMode; // This is a convenience flag for the viewer. It has no influence on the cliboard management. + bool mCutMode; // This is a convenience flag for the viewer. Will determine if mCleanupCallback() needs to be called. + cleanup_callback_t mCleanupCallback;// Function to call when the cut clipboard is being wiped out. Can be set to NULL (nothing done then). int mState; // Incremented when the clipboard change so that interested parties can check its state. + }; #endif // LL_LLCLIPBOARD_H -- cgit v1.2.3 From a5e4b15b7d29a64781eb32ef71e557a5bb8dc870 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 23 Feb 2012 21:02:46 +0200 Subject: Linux build fix. Moved type casts from protected base classes to derived LLCoord. --- indra/llui/llfloater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 3afa1b8e3a..2a40bbf33c 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -3306,7 +3306,7 @@ bool LLCoordFloater::operator==(const LLCoordFloater& other) const LLCoordCommon LL_COORD_FLOATER::convertToCommon() const { - const LLCoordFloater& self = static_cast(*this); + const LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); LLFloater* floaterp = mFloater.get(); @@ -3348,7 +3348,7 @@ LLCoordCommon LL_COORD_FLOATER::convertToCommon() const void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from) { - LLCoordFloater& self = static_cast(*this); + LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); LLFloater* floaterp = mFloater.get(); S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0; -- cgit v1.2.3 From 1b624f5ea686292652978c72d39e5546efe23d0f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 24 Feb 2012 11:43:44 -0800 Subject: potential fix for linux build --- indra/llui/llfloater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 3afa1b8e3a..22b20969fc 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -3275,7 +3275,7 @@ void LLFloater::stackWith(LLFloater& other) } LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater) -: coord_t(x, y) +: coord_t((S32)x, (S32)y) { mFloater = floater.getHandle(); } -- cgit v1.2.3 From 0fc6c5df969681659b1cc20bf06e9b1f8708d7a4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 24 Feb 2012 16:54:54 -0800 Subject: EXP-1181 FIX As a designer, I would like to specify default floater positions using relative coordinates floaters given specified positions will stay in that location floaters that stack will treat that as a specified position moving any floater will switch to relative positioning mode cleaned up some XUI where widgets were relying on a default height of 10 pixels --- indra/llui/llfloater.cpp | 120 +++++++++++++++----------- indra/llui/llfloater.h | 13 +-- indra/llui/llview.cpp | 220 +++++++++++++++++++++++++---------------------- indra/llui/llview.h | 2 +- 4 files changed, 192 insertions(+), 163 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 2a40bbf33c..992f7e1602 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -68,7 +68,7 @@ namespace LLInitParam { void TypeValues::declareValues() { - declare("none", LLFloaterEnums::OPEN_POSITIONING_NONE); + declare("relative", LLFloaterEnums::OPEN_POSITIONING_RELATIVE); declare("cascading", LLFloaterEnums::OPEN_POSITIONING_CASCADING); declare("centered", LLFloaterEnums::OPEN_POSITIONING_CENTERED); declare("specified", LLFloaterEnums::OPEN_POSITIONING_SPECIFIED); @@ -177,9 +177,7 @@ LLFloater::Params::Params() save_visibility("save_visibility", false), can_dock("can_dock", false), show_title("show_title", true), - open_positioning("open_positioning", LLFloaterEnums::OPEN_POSITIONING_NONE), - specified_left("specified_left"), - specified_bottom("specified_bottom"), + positioning("positioning", LLFloaterEnums::OPEN_POSITIONING_RELATIVE), header_height("header_height", 0), legacy_header_height("legacy_header_height", 0), close_image("close_image"), @@ -249,9 +247,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mCanClose(p.can_close), mDragOnLeft(p.can_drag_on_left), mResizable(p.can_resize), - mOpenPositioning(p.open_positioning), - mSpecifiedLeft(p.specified_left), - mSpecifiedBottom(p.specified_bottom), + mPositioning(p.positioning), mMinWidth(p.min_width), mMinHeight(p.min_height), mHeaderHeight(p.header_height), @@ -877,7 +873,7 @@ bool LLFloater::applyRectControl() { // other floaters in our group, position ourselves relative to them and don't save the rect mRectControl.clear(); - mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP; + mPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP; } else if (mRectControl.size() > 1) { @@ -914,20 +910,14 @@ bool LLFloater::applyDockState() void LLFloater::applyPositioning(LLFloater* other) { // Otherwise position according to the positioning code - switch (mOpenPositioning) + switch (mPositioning) { case LLFloaterEnums::OPEN_POSITIONING_CENTERED: center(); break; case LLFloaterEnums::OPEN_POSITIONING_SPECIFIED: - { - // Translate relative to snap rect - setOrigin(mSpecifiedLeft, mSpecifiedBottom); - const LLRect& snap_rect = gFloaterView->getSnapRect(); - translate(snap_rect.mLeft, snap_rect.mBottom); - translateIntoRect(snap_rect); - } + //translateIntoRect(gFloaterView->getSnapRect()); break; case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP: @@ -950,11 +940,25 @@ void LLFloater::applyPositioning(LLFloater* other) setOrigin(horizontal_offset, vertical_offset - rect_height); translate(snap_rect.mLeft, snap_rect.mBottom); - translateIntoRect(snap_rect); + //translateIntoRect(snap_rect); } + mPositioning = LLFloaterEnums::OPEN_POSITIONING_SPECIFIED; + setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); + break; - case LLFloaterEnums::OPEN_POSITIONING_NONE: + case LLFloaterEnums::OPEN_POSITIONING_RELATIVE: + { + LLRect snap_rect = gFloaterView->getSnapRect(); + LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); + snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); + LLRect floater_screen_rect = calcScreenRect(); + + LLCoordGL new_center = mPosition.convert(); + LLCoordGL cur_center(floater_screen_rect.getCenterX(), floater_screen_rect.getCenterY()); + translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY); + break; + } default: // Do nothing break; @@ -1072,7 +1076,9 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) if (by_user && !isMinimized()) { storeRectControl(); - mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE; + mPositioning = LLFloaterEnums::OPEN_POSITIONING_RELATIVE; + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); } // if not minimized, adjust all snapped dependents to new shape @@ -1590,7 +1596,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) if (mDocked) { setMinimized(FALSE); - mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE; + mPositioning = LLFloaterEnums::OPEN_POSITIONING_RELATIVE; } updateTitleButtons(); @@ -2164,19 +2170,14 @@ LLFloaterView::LLFloaterView (const Params& p) mSnapOffsetBottom(0), mSnapOffsetRight(0) { + mSnapView = getHandle(); } // By default, adjust vertical. void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) { - S32 old_right = mLastSnapRect.mRight; - S32 old_top = mLastSnapRect.mTop; - LLView::reshape(width, height, called_from_parent); - S32 new_right = getSnapRect().mRight; - S32 new_top = getSnapRect().mTop; - mLastSnapRect = getSnapRect(); for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) @@ -2189,35 +2190,39 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) continue; } - if (!floaterp->isMinimized()) + if (!floaterp->isMinimized() && floaterp->getCanDrag()) { - LLRect r = floaterp->getRect(); + LLRect old_rect = floaterp->getRect(); + floaterp->applyPositioning(NULL); + LLRect new_rect = floaterp->getRect(); - // Compute absolute distance from each edge of screen - S32 left_offset = llabs(r.mLeft - 0); - S32 right_offset = llabs(old_right - r.mRight); + //LLRect r = floaterp->getRect(); - S32 top_offset = llabs(old_top - r.mTop); - S32 bottom_offset = llabs(r.mBottom - 0); + //// Compute absolute distance from each edge of screen + //S32 left_offset = llabs(r.mLeft - 0); + //S32 right_offset = llabs(old_right - r.mRight); - S32 translate_x = 0; - S32 translate_y = 0; + //S32 top_offset = llabs(old_top - r.mTop); + //S32 bottom_offset = llabs(r.mBottom - 0); - if (left_offset > right_offset) - { - translate_x = new_right - old_right; - } + S32 translate_x = new_rect.mLeft - old_rect.mLeft; + S32 translate_y = new_rect.mBottom - old_rect.mBottom; - if (top_offset < bottom_offset) - { - translate_y = new_top - old_top; - } + //if (left_offset > right_offset) + //{ + // translate_x = new_right - old_right; + //} + + //if (top_offset < bottom_offset) + //{ + // translate_y = new_top - old_top; + //} // don't reposition immovable floaters - if (floaterp->getCanDrag()) - { - floaterp->translate(translate_x, translate_y); - } + //if (floaterp->getCanDrag()) + //{ + // floaterp->translate(translate_x, translate_y); + //} BOOST_FOREACH(LLHandle dependent_floater, floaterp->mDependents) { if (dependent_floater.get()) @@ -2972,7 +2977,10 @@ void LLFloater::initFromParams(const LLFloater::Params& p) LLPanel::initFromParams(p); // override any follows flags - setFollows(FOLLOWS_NONE); + if (mPositioning != LLFloaterEnums::OPEN_POSITIONING_SPECIFIED) + { + setFollows(FOLLOWS_NONE); + } mTitle = p.title; mShortTitle = p.short_title; @@ -2991,9 +2999,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) mSingleInstance = p.single_instance; mReuseInstance = p.reuse_instance.isProvided() ? p.reuse_instance : p.single_instance; - mOpenPositioning = p.open_positioning; - mSpecifiedLeft = p.specified_left; - mSpecifiedBottom = p.specified_bottom; + mPositioning = p.positioning; if (p.save_rect && mRectControl.empty()) { @@ -3113,7 +3119,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str params.rect.left.set(0); } params.from_xui = true; - applyXUILayout(params, parent); + applyXUILayout(params, parent, parent == gFloaterView ? gFloaterView->getSnapRect() : parent->getLocalRect()); initFromParams(params); initFloater(params); @@ -3272,6 +3278,9 @@ void LLFloater::stackWith(LLFloater& other) next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, getRect().getWidth(), getRect().getHeight()); setShape(next_rect); + + other.mPositioning = LLFloaterEnums::OPEN_POSITIONING_SPECIFIED; + other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater) @@ -3309,6 +3318,9 @@ LLCoordCommon LL_COORD_FLOATER::convertToCommon() const const LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); + LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); + snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); + LLFloater* floaterp = mFloater.get(); S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0; S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0; @@ -3350,6 +3362,10 @@ void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from) { LLCoordFloater& self = static_cast(LLCoordFloater::getTypedCoords(*this)); LLRect snap_rect = gFloaterView->getSnapRect(); + LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); + snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); + + LLFloater* floaterp = mFloater.get(); S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0; S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0; diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index a7cc9ae961..9b26adde40 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -64,7 +64,7 @@ namespace LLFloaterEnums { enum EOpenPositioning { - OPEN_POSITIONING_NONE, + OPEN_POSITIONING_RELATIVE, OPEN_POSITIONING_CASCADING, OPEN_POSITIONING_CASCADE_GROUP, OPEN_POSITIONING_CENTERED, @@ -163,10 +163,7 @@ public: can_dock, show_title; - Optional open_positioning; - Optional specified_left; - Optional specified_bottom; - + Optional positioning; Optional header_height, legacy_header_height; // HACK see initFromXML() @@ -355,7 +352,7 @@ public: void enableResizeCtrls(bool enable, bool width = true, bool height = true); - bool isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mOpenPositioning); } + bool isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mPositioning); } protected: void applyControlsAndPosition(LLFloater* other); @@ -453,9 +450,7 @@ private: BOOL mDragOnLeft; BOOL mResizable; - LLFloaterEnums::EOpenPositioning mOpenPositioning; - S32 mSpecifiedLeft; - S32 mSpecifiedBottom; + LLFloaterEnums::EOpenPositioning mPositioning; LLCoordFloater mPosition; S32 mMinWidth; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 421166dcd4..356d5c31d1 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -2225,145 +2225,163 @@ static bool get_last_child_rect(LLView* parent, LLRect *rect) } //static -void LLView::applyXUILayout(LLView::Params& p, LLView* parent) +void LLView::applyXUILayout(LLView::Params& p, LLView* parent, LLRect layout_rect) { + if (!parent) return; + const S32 VPAD = 4; const S32 MIN_WIDGET_HEIGHT = 10; // *NOTE: This will confuse export of floater/panel coordinates unless // the default is also "topleft". JC - if (p.layout().empty() && parent) + if (p.layout().empty()) { p.layout = parent->getLayout(); } - if (parent) + if (layout_rect.isEmpty()) { - LLRect parent_rect = parent->getLocalRect(); - // overwrite uninitialized rect params, using context - LLRect default_rect = parent->getLocalRect(); + layout_rect = parent->getLocalRect(); + } - bool layout_topleft = (p.layout() == "topleft"); + // overwrite uninitialized rect params, using context + LLRect default_rect = parent->getLocalRect(); - // convert negative or centered coordinates to parent relative values - // Note: some of this logic matches the logic in TypedParam::setValueFromBlock() - if (p.rect.left.isProvided() && p.rect.left < 0) p.rect.left = p.rect.left + parent_rect.getWidth(); - if (p.rect.right.isProvided() && p.rect.right < 0) p.rect.right = p.rect.right + parent_rect.getWidth(); - if (p.rect.bottom.isProvided() && p.rect.bottom < 0) p.rect.bottom = p.rect.bottom + parent_rect.getHeight(); - if (p.rect.top.isProvided() && p.rect.top < 0) p.rect.top = p.rect.top + parent_rect.getHeight(); + bool layout_topleft = (p.layout() == "topleft"); + // convert negative or centered coordinates to parent relative values + // Note: some of this logic matches the logic in TypedParam::setValueFromBlock() + if (p.rect.left.isProvided()) + { + p.rect.left = p.rect.left + ((p.rect.left >= 0) ? layout_rect.mLeft : layout_rect.mRight); + } + if (p.rect.right.isProvided()) + { + p.rect.right = p.rect.right + ((p.rect.right >= 0) ? layout_rect.mLeft : layout_rect.mRight); + } + if (p.rect.bottom.isProvided()) + { + p.rect.bottom = p.rect.bottom + ((p.rect.bottom >= 0) ? layout_rect.mBottom : layout_rect.mTop); if (layout_topleft) { //invert top to bottom - if (p.rect.top.isProvided()) p.rect.top = parent_rect.getHeight() - p.rect.top; - if (p.rect.bottom.isProvided()) p.rect.bottom = parent_rect.getHeight() - p.rect.bottom; + p.rect.bottom = layout_rect.mBottom + layout_rect.mTop - p.rect.bottom; } - - // DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels - if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0) + } + if (p.rect.top.isProvided()) + { + p.rect.top = p.rect.top + ((p.rect.top >= 0) ? layout_rect.mBottom : layout_rect.mTop); + if (layout_topleft) { - p.rect.height = MIN_WIDGET_HEIGHT; + //invert top to bottom + p.rect.top = layout_rect.mBottom + layout_rect.mTop - p.rect.top; } + } - default_rect.translate(0, default_rect.getHeight()); + // DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels + if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0) + { + p.rect.height = MIN_WIDGET_HEIGHT; + } - // If there was a recently constructed child, use its rectangle - get_last_child_rect(parent, &default_rect); + default_rect.translate(0, default_rect.getHeight()); - if (layout_topleft) + // If there was a recently constructed child, use its rectangle + get_last_child_rect(parent, &default_rect); + + if (layout_topleft) + { + // Invert the sense of bottom_delta for topleft layout + if (p.bottom_delta.isProvided()) { - // Invert the sense of bottom_delta for topleft layout - if (p.bottom_delta.isProvided()) - { - p.bottom_delta = -p.bottom_delta; - } - else if (p.top_pad.isProvided()) - { - p.bottom_delta = -(p.rect.height + p.top_pad); - } - else if (p.top_delta.isProvided()) - { - p.bottom_delta = - -(p.top_delta + p.rect.height - default_rect.getHeight()); - } - else if (!p.left_delta.isProvided() - && !p.left_pad.isProvided()) - { - // set default position is just below last rect - p.bottom_delta.set(-(p.rect.height + VPAD), false); - } - else - { - p.bottom_delta.set(0, false); - } - - // default to same left edge - if (!p.left_delta.isProvided()) - { - p.left_delta.set(0, false); - } - if (p.left_pad.isProvided()) - { - // left_pad is based on prior widget's right edge - p.left_delta.set(p.left_pad + default_rect.getWidth(), false); - } - - default_rect.translate(p.left_delta, p.bottom_delta); + p.bottom_delta = -p.bottom_delta; } - else - { - // set default position is just below last rect - if (!p.bottom_delta.isProvided()) - { - p.bottom_delta.set(-(p.rect.height + VPAD), false); - } - if (!p.left_delta.isProvided()) - { - p.left_delta.set(0, false); - } - default_rect.translate(p.left_delta, p.bottom_delta); + else if (p.top_pad.isProvided()) + { + p.bottom_delta = -(p.rect.height + p.top_pad); } - - // this handles case where *both* x and x_delta are provided - // ignore x in favor of default x + x_delta - if (p.bottom_delta.isProvided()) p.rect.bottom.set(0, false); - if (p.left_delta.isProvided()) p.rect.left.set(0, false); - - // selectively apply rectangle defaults, making sure that - // params are not flagged as having been "provided" - // as rect params are overconstrained and rely on provided flags - if (!p.rect.left.isProvided()) + else if (p.top_delta.isProvided()) + { + p.bottom_delta = + -(p.top_delta + p.rect.height - default_rect.getHeight()); + } + else if (!p.left_delta.isProvided() + && !p.left_pad.isProvided()) { - p.rect.left.set(default_rect.mLeft, false); - //HACK: get around the fact that setting a rect param component value won't invalidate the existing rect object value - p.rect.paramChanged(p.rect.left, true); + // set default position is just below last rect + p.bottom_delta.set(-(p.rect.height + VPAD), false); } - if (!p.rect.bottom.isProvided()) + else { - p.rect.bottom.set(default_rect.mBottom, false); - p.rect.paramChanged(p.rect.bottom, true); + p.bottom_delta.set(0, false); } - if (!p.rect.top.isProvided()) + + // default to same left edge + if (!p.left_delta.isProvided()) { - p.rect.top.set(default_rect.mTop, false); - p.rect.paramChanged(p.rect.top, true); + p.left_delta.set(0, false); } - if (!p.rect.right.isProvided()) + if (p.left_pad.isProvided()) { - p.rect.right.set(default_rect.mRight, false); - p.rect.paramChanged(p.rect.right, true); - + // left_pad is based on prior widget's right edge + p.left_delta.set(p.left_pad + default_rect.getWidth(), false); } - if (!p.rect.width.isProvided()) + + default_rect.translate(p.left_delta, p.bottom_delta); + } + else + { + // set default position is just below last rect + if (!p.bottom_delta.isProvided()) { - p.rect.width.set(default_rect.getWidth(), false); - p.rect.paramChanged(p.rect.width, true); + p.bottom_delta.set(-(p.rect.height + VPAD), false); } - if (!p.rect.height.isProvided()) + if (!p.left_delta.isProvided()) { - p.rect.height.set(default_rect.getHeight(), false); - p.rect.paramChanged(p.rect.height, true); + p.left_delta.set(0, false); } + default_rect.translate(p.left_delta, p.bottom_delta); + } + + // this handles case where *both* x and x_delta are provided + // ignore x in favor of default x + x_delta + if (p.bottom_delta.isProvided()) p.rect.bottom.set(0, false); + if (p.left_delta.isProvided()) p.rect.left.set(0, false); + + // selectively apply rectangle defaults, making sure that + // params are not flagged as having been "provided" + // as rect params are overconstrained and rely on provided flags + if (!p.rect.left.isProvided()) + { + p.rect.left.set(default_rect.mLeft, false); + //HACK: get around the fact that setting a rect param component value won't invalidate the existing rect object value + p.rect.paramChanged(p.rect.left, true); + } + if (!p.rect.bottom.isProvided()) + { + p.rect.bottom.set(default_rect.mBottom, false); + p.rect.paramChanged(p.rect.bottom, true); + } + if (!p.rect.top.isProvided()) + { + p.rect.top.set(default_rect.mTop, false); + p.rect.paramChanged(p.rect.top, true); + } + if (!p.rect.right.isProvided()) + { + p.rect.right.set(default_rect.mRight, false); + p.rect.paramChanged(p.rect.right, true); + + } + if (!p.rect.width.isProvided()) + { + p.rect.width.set(default_rect.getWidth(), false); + p.rect.paramChanged(p.rect.width, true); + } + if (!p.rect.height.isProvided()) + { + p.rect.height.set(default_rect.getHeight(), false); + p.rect.paramChanged(p.rect.height, true); } } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index fd19309a56..1c35349510 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -505,7 +505,7 @@ public: // Set up params after XML load before calling new(), // usually to adjust layout. - static void applyXUILayout(Params& p, LLView* parent); + static void applyXUILayout(Params& p, LLView* parent, LLRect layout_rect = LLRect()); // For re-export of floaters and panels, convert the coordinate system // to be top-left based. -- cgit v1.2.3 From 0c7e91205f9b2fc8fe55e5a65f4bfa908d105c37 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 24 Feb 2012 16:57:12 -0800 Subject: EXP-1181 FIX As a designer, I would like to specify default floater positions using relative coordinates fixed bug where resizing window would cause stacked floaters to move relative to each other renamed positioning enums to reflect the fact that they apply all the time now, not just when opening floaters --- indra/llui/llfloater.cpp | 32 ++++++++++++++++---------------- indra/llui/llfloater.h | 12 ++++++------ indra/llui/llfloaterreg.cpp | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 992f7e1602..65bd63a187 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -68,10 +68,10 @@ namespace LLInitParam { void TypeValues::declareValues() { - declare("relative", LLFloaterEnums::OPEN_POSITIONING_RELATIVE); - declare("cascading", LLFloaterEnums::OPEN_POSITIONING_CASCADING); - declare("centered", LLFloaterEnums::OPEN_POSITIONING_CENTERED); - declare("specified", LLFloaterEnums::OPEN_POSITIONING_SPECIFIED); + declare("relative", LLFloaterEnums::POSITIONING_RELATIVE); + declare("cascading", LLFloaterEnums::POSITIONING_CASCADING); + declare("centered", LLFloaterEnums::POSITIONING_CENTERED); + declare("specified", LLFloaterEnums::POSITIONING_SPECIFIED); } } @@ -177,7 +177,7 @@ LLFloater::Params::Params() save_visibility("save_visibility", false), can_dock("can_dock", false), show_title("show_title", true), - positioning("positioning", LLFloaterEnums::OPEN_POSITIONING_RELATIVE), + positioning("positioning", LLFloaterEnums::POSITIONING_RELATIVE), header_height("header_height", 0), legacy_header_height("legacy_header_height", 0), close_image("close_image"), @@ -873,7 +873,7 @@ bool LLFloater::applyRectControl() { // other floaters in our group, position ourselves relative to them and don't save the rect mRectControl.clear(); - mPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP; + mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; } else if (mRectControl.size() > 1) { @@ -912,16 +912,16 @@ void LLFloater::applyPositioning(LLFloater* other) // Otherwise position according to the positioning code switch (mPositioning) { - case LLFloaterEnums::OPEN_POSITIONING_CENTERED: + case LLFloaterEnums::POSITIONING_CENTERED: center(); break; - case LLFloaterEnums::OPEN_POSITIONING_SPECIFIED: + case LLFloaterEnums::POSITIONING_SPECIFIED: //translateIntoRect(gFloaterView->getSnapRect()); break; - case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP: - case LLFloaterEnums::OPEN_POSITIONING_CASCADING: + case LLFloaterEnums::POSITIONING_CASCADE_GROUP: + case LLFloaterEnums::POSITIONING_CASCADING: if (other != NULL && other != this) { stackWith(*other); @@ -942,12 +942,12 @@ void LLFloater::applyPositioning(LLFloater* other) translate(snap_rect.mLeft, snap_rect.mBottom); //translateIntoRect(snap_rect); } - mPositioning = LLFloaterEnums::OPEN_POSITIONING_SPECIFIED; + mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); break; - case LLFloaterEnums::OPEN_POSITIONING_RELATIVE: + case LLFloaterEnums::POSITIONING_RELATIVE: { LLRect snap_rect = gFloaterView->getSnapRect(); LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); @@ -1076,7 +1076,7 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) if (by_user && !isMinimized()) { storeRectControl(); - mPositioning = LLFloaterEnums::OPEN_POSITIONING_RELATIVE; + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; LLRect screen_rect = calcScreenRect(); mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); } @@ -1596,7 +1596,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) if (mDocked) { setMinimized(FALSE); - mPositioning = LLFloaterEnums::OPEN_POSITIONING_RELATIVE; + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; } updateTitleButtons(); @@ -2977,7 +2977,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) LLPanel::initFromParams(p); // override any follows flags - if (mPositioning != LLFloaterEnums::OPEN_POSITIONING_SPECIFIED) + if (mPositioning != LLFloaterEnums::POSITIONING_SPECIFIED) { setFollows(FOLLOWS_NONE); } @@ -3279,7 +3279,7 @@ void LLFloater::stackWith(LLFloater& other) setShape(next_rect); - other.mPositioning = LLFloaterEnums::OPEN_POSITIONING_SPECIFIED; + other.mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 9b26adde40..48dc290a93 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -64,12 +64,12 @@ namespace LLFloaterEnums { enum EOpenPositioning { - OPEN_POSITIONING_RELATIVE, - OPEN_POSITIONING_CASCADING, - OPEN_POSITIONING_CASCADE_GROUP, - OPEN_POSITIONING_CENTERED, - OPEN_POSITIONING_SPECIFIED, - OPEN_POSITIONING_COUNT + POSITIONING_RELATIVE, + POSITIONING_CASCADING, + POSITIONING_CASCADE_GROUP, + POSITIONING_CENTERED, + POSITIONING_SPECIFIED, + POSITIONING_COUNT }; } diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index e144b68f5e..7729e855ba 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -96,7 +96,7 @@ LLFloater* LLFloaterReg::getLastFloaterCascading() { LLFloater* inst = *iter; - if (inst->getVisible() && inst->isPositioning(LLFloaterEnums::OPEN_POSITIONING_CASCADING)) + if (inst->getVisible() && inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADING)) { if (candidate_rect.mTop > inst->getRect().mTop) { -- cgit v1.2.3 From fbfad41587a8ba723348eb848a7366f02da87052 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 27 Feb 2012 13:06:10 -0800 Subject: EXP-1181 FIX As a designer, I would like to specify default floater positions using relative coordinates store and load floater relative positions --- indra/llui/llfloater.cpp | 96 +++++++++++++++++++++++++++------------------ indra/llui/llfloater.h | 7 +++- indra/llui/llfloaterreg.cpp | 37 ++++++++++++++--- indra/llui/llfloaterreg.h | 4 +- 4 files changed, 97 insertions(+), 47 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 65bd63a187..b23230bdd4 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -543,10 +543,18 @@ LLFloater::~LLFloater() void LLFloater::storeRectControl() { - if( mRectControl.size() > 1 ) + if (!mRectControl.empty()) { getControlGroup()->setRect( mRectControl, getRect() ); } + if (!mPosXControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE) + { + getControlGroup()->setF32( mPosXControl, mPosition.mX ); + } + if (!mPosYControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE) + { + getControlGroup()->setF32( mPosYControl, mPosition.mY ); + } } void LLFloater::storeVisibilityControl() @@ -565,23 +573,6 @@ void LLFloater::storeDockStateControl() } } -LLRect LLFloater::getSavedRect() const -{ - LLRect rect; - - if (mRectControl.size() > 1) - { - rect = getControlGroup()->getRect(mRectControl); - } - - return rect; -} - -bool LLFloater::hasSavedRect() const -{ - return !getSavedRect().isEmpty(); -} - // static std::string LLFloater::getControlName(const std::string& name, const LLSD& key) { @@ -875,18 +866,39 @@ bool LLFloater::applyRectControl() mRectControl.clear(); mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; } - else if (mRectControl.size() > 1) + else { - // If we have a saved rect, use it - const LLRect& rect = getControlGroup()->getRect(mRectControl); - saved_rect = rect.notEmpty(); - if (saved_rect) + if (!mRectControl.empty()) { - setOrigin(rect.mLeft, rect.mBottom); + // If we have a saved rect, use it + const LLRect& rect = getControlGroup()->getRect(mRectControl); + if (rect.notEmpty()) saved_rect = true; + if (saved_rect) + { + setOrigin(rect.mLeft, rect.mBottom); - if (mResizable) + if (mResizable) + { + reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); + } + } + } + + if (!mPosXControl.empty() && !mPosYControl.empty()) + { + LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); + LLControlVariablePtr y_control = getControlGroup()->getControl(mPosYControl); + if (x_control.notNull() + && y_control.notNull() + && !x_control->isDefault() + && !y_control->isDefault()) { - reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); + mPosition.mX = x_control->getValue().asReal(); + mPosition.mY = y_control->getValue().asReal(); + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; + applyRelativePosition(); + + saved_rect = true; } } } @@ -949,14 +961,8 @@ void LLFloater::applyPositioning(LLFloater* other) case LLFloaterEnums::POSITIONING_RELATIVE: { - LLRect snap_rect = gFloaterView->getSnapRect(); - LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); - snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); - LLRect floater_screen_rect = calcScreenRect(); + applyRelativePosition(); - LLCoordGL new_center = mPosition.convert(); - LLCoordGL cur_center(floater_screen_rect.getCenterX(), floater_screen_rect.getCenterY()); - translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY); break; } default: @@ -1630,7 +1636,7 @@ void LLFloater::onClickTearOff(LLFloater* self) self->openFloater(self->getKey()); // only force position for floaters that don't have that data saved - if (self->mRectControl.size() <= 1) + if (self->mRectControl.empty()) { new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - floater_header_size - 5, self->getRect().getWidth(), self->getRect().getHeight()); self->setRect(new_rect); @@ -2918,9 +2924,11 @@ void LLFloater::setInstanceName(const std::string& name) std::string ctrl_name = getControlName(mInstanceName, mKey); // save_rect and save_visibility only apply to registered floaters - if (!mRectControl.empty()) + if (mSaveRect) { mRectControl = LLFloaterReg::declareRectControl(ctrl_name); + mPosXControl = LLFloaterReg::declarePosXControl(ctrl_name); + mPosYControl = LLFloaterReg::declarePosYControl(ctrl_name); } if (!mVisibilityControl.empty()) { @@ -3001,10 +3009,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) mPositioning = p.positioning; - if (p.save_rect && mRectControl.empty()) - { - mRectControl = "t"; // flag to build mRectControl name once mInstanceName is set - } + mSaveRect = p.save_rect; if (p.save_visibility) { mVisibilityControl = "t"; // flag to build mVisibilityControl name once mInstanceName is set @@ -3283,6 +3288,19 @@ void LLFloater::stackWith(LLFloater& other) other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } +void LLFloater::applyRelativePosition() +{ + LLRect snap_rect = gFloaterView->getSnapRect(); + LLRect floater_view_screen_rect = gFloaterView->calcScreenRect(); + snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom); + LLRect floater_screen_rect = calcScreenRect(); + + LLCoordGL new_center = mPosition.convert(); + LLCoordGL cur_center(floater_screen_rect.getCenterX(), floater_screen_rect.getCenterY()); + translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY); +} + + LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater) : coord_t(x, y) { diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 48dc290a93..4aa663d57e 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -269,8 +269,6 @@ public: BOOL isResizable() const { return mResizable; } void setResizeLimits( S32 min_width, S32 min_height ); void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; } - LLRect getSavedRect() const; - bool hasSavedRect() const; static std::string getControlName(const std::string& name, const LLSD& key); static LLControlGroup* getControlGroup(); @@ -361,6 +359,8 @@ protected: virtual bool applyRectControl(); bool applyDockState(); void applyPositioning(LLFloater* other); + void applyRelativePosition(); + void storeRectControl(); void storeVisibilityControl(); void storeDockStateControl(); @@ -424,7 +424,10 @@ public: commit_signal_t* mMinimizeSignal; protected: + bool mSaveRect; std::string mRectControl; + std::string mPosXControl; + std::string mPosYControl; std::string mVisibilityControl; std::string mDocStateControl; LLSD mKey; // Key used for retrieving instances; set (for now) by LLFLoaterReg diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 7729e855ba..ef55e74166 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -358,9 +358,7 @@ void LLFloaterReg::restoreVisibleInstances() //static std::string LLFloaterReg::getRectControlName(const std::string& name) { - std::string res = std::string("floater_rect_") + name; - LLStringUtil::replaceChar( res, ' ', '_' ); - return res; + return std::string("floater_rect_") + getBaseControlName(name); } //static @@ -368,19 +366,48 @@ std::string LLFloaterReg::declareRectControl(const std::string& name) { std::string controlname = getRectControlName(name); LLFloater::getControlGroup()->declareRect(controlname, LLRect(), - llformat("Window Position and Size for %s", name.c_str()), + llformat("Window Size for %s", name.c_str()), TRUE); return controlname; } +std::string LLFloaterReg::declarePosXControl(const std::string& name) +{ + std::string controlname = std::string("floater_pos_x_") + getBaseControlName(name); + LLFloater::getControlGroup()->declareF32(controlname, + 10.f, + llformat("Window X Position for %s", name.c_str()), + TRUE); + return controlname; +} + +std::string LLFloaterReg::declarePosYControl(const std::string& name) +{ + std::string controlname = std::string("floater_pos_y_") + getBaseControlName(name); + LLFloater::getControlGroup()->declareF32(controlname, + 10.f, + llformat("Window Y Position for %s", name.c_str()), + TRUE); + + return controlname; +} + + //static std::string LLFloaterReg::getVisibilityControlName(const std::string& name) { - std::string res = std::string("floater_vis_") + name; + return std::string("floater_vis_") + getBaseControlName(name); +} + +//static +std::string LLFloaterReg::getBaseControlName(const std::string& name) +{ + std::string res(name); LLStringUtil::replaceChar( res, ' ', '_' ); return res; } + //static std::string LLFloaterReg::declareVisibilityControl(const std::string& name) { diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 534cf8b40a..a1e1f8a988 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -115,9 +115,11 @@ public: // Control Variables static std::string getRectControlName(const std::string& name); static std::string declareRectControl(const std::string& name); + static std::string declarePosXControl(const std::string& name); + static std::string declarePosYControl(const std::string& name); static std::string getVisibilityControlName(const std::string& name); static std::string declareVisibilityControl(const std::string& name); - + static std::string getBaseControlName(const std::string& name); static std::string declareDockStateControl(const std::string& name); static std::string getDockStateControlName(const std::string& name); -- cgit v1.2.3 From 80f2548371328f6fa1936ecc03a85a09f1b19508 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 28 Feb 2012 13:45:36 -0800 Subject: EXP-1918 FIX Floaters that are stacked are not offset EXP-1919 FIX Resizing viewer window with minimized floaters can result in floaters appearing off screen when un-minimized --- indra/llui/llfloater.cpp | 44 +++++++++++++++++++++++--------------------- indra/llui/llfloater.h | 2 +- 2 files changed, 24 insertions(+), 22 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index b23230bdd4..f49b4edb98 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -850,7 +850,7 @@ void LLFloater::applyControlsAndPosition(LLFloater* other) { if (!applyRectControl()) { - applyPositioning(other); + applyPositioning(other, true); } } } @@ -919,7 +919,7 @@ bool LLFloater::applyDockState() return docked; } -void LLFloater::applyPositioning(LLFloater* other) +void LLFloater::applyPositioning(LLFloater* other, bool on_open) { // Otherwise position according to the positioning code switch (mPositioning) @@ -934,29 +934,30 @@ void LLFloater::applyPositioning(LLFloater* other) case LLFloaterEnums::POSITIONING_CASCADE_GROUP: case LLFloaterEnums::POSITIONING_CASCADING: - if (other != NULL && other != this) + if (on_open) { - stackWith(*other); - } - else - { - static const U32 CASCADING_FLOATER_HOFFSET = 0; - static const U32 CASCADING_FLOATER_VOFFSET = 0; + if (other != NULL && other != this) + { + stackWith(*other); + } + else + { + static const U32 CASCADING_FLOATER_HOFFSET = 0; + static const U32 CASCADING_FLOATER_VOFFSET = 0; - const LLRect& snap_rect = gFloaterView->getSnapRect(); + const LLRect& snap_rect = gFloaterView->getSnapRect(); - const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET; - const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET; + const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET; + const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET; - S32 rect_height = getRect().getHeight(); - setOrigin(horizontal_offset, vertical_offset - rect_height); + S32 rect_height = getRect().getHeight(); + setOrigin(horizontal_offset, vertical_offset - rect_height); - translate(snap_rect.mLeft, snap_rect.mBottom); - //translateIntoRect(snap_rect); + translate(snap_rect.mLeft, snap_rect.mBottom); + } + //mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; + setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); } - mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; - setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); - break; case LLFloaterEnums::POSITIONING_RELATIVE: @@ -1262,6 +1263,7 @@ void LLFloater::setMinimized(BOOL minimize) // Reshape *after* setting mMinimized reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); + applyPositioning(NULL, false); } make_ui_sound("UISndWindowClose"); @@ -2199,7 +2201,7 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) if (!floaterp->isMinimized() && floaterp->getCanDrag()) { LLRect old_rect = floaterp->getRect(); - floaterp->applyPositioning(NULL); + floaterp->applyPositioning(NULL, false); LLRect new_rect = floaterp->getRect(); //LLRect r = floaterp->getRect(); @@ -3284,7 +3286,7 @@ void LLFloater::stackWith(LLFloater& other) setShape(next_rect); - other.mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; + //other.mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 4aa663d57e..64d6dcea04 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -358,7 +358,7 @@ protected: virtual bool applyRectControl(); bool applyDockState(); - void applyPositioning(LLFloater* other); + void applyPositioning(LLFloater* other, bool on_open); void applyRelativePosition(); void storeRectControl(); -- cgit v1.2.3 From 6b0f0a89fd6a8285f91c13699327182f513efbd5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 1 Mar 2012 13:23:01 -0800 Subject: CHUI-55 FIX Floaters that have set positions from old viewer versions can appear off screen until user repositions the floaters manually --- indra/llui/llfloater.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index f49b4edb98..d058b4ae44 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -884,22 +884,24 @@ bool LLFloater::applyRectControl() } } - if (!mPosXControl.empty() && !mPosYControl.empty()) - { - LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); - LLControlVariablePtr y_control = getControlGroup()->getControl(mPosYControl); - if (x_control.notNull() - && y_control.notNull() - && !x_control->isDefault() - && !y_control->isDefault()) - { - mPosition.mX = x_control->getValue().asReal(); - mPosition.mY = y_control->getValue().asReal(); - mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; - applyRelativePosition(); + LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); + LLControlVariablePtr y_control = getControlGroup()->getControl(mPosYControl); + if (x_control.notNull() + && y_control.notNull() + && !x_control->isDefault() + && !y_control->isDefault()) + { + mPosition.mX = x_control->getValue().asReal(); + mPosition.mY = y_control->getValue().asReal(); + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; + applyRelativePosition(); - saved_rect = true; - } + saved_rect = true; + } + else + { + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); } } @@ -929,7 +931,6 @@ void LLFloater::applyPositioning(LLFloater* other, bool on_open) break; case LLFloaterEnums::POSITIONING_SPECIFIED: - //translateIntoRect(gFloaterView->getSnapRect()); break; case LLFloaterEnums::POSITIONING_CASCADE_GROUP: @@ -955,7 +956,6 @@ void LLFloater::applyPositioning(LLFloater* other, bool on_open) translate(snap_rect.mLeft, snap_rect.mBottom); } - //mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); } break; -- cgit v1.2.3 From f0a1b43f2270cb8424409babf5ae88233cdd8f6c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 1 Mar 2012 21:35:05 -0800 Subject: EXP-1841 : Use instance instead of getInstance on LLClipboard singleton. --- indra/llui/llclipboard.h | 2 +- indra/llui/lllineeditor.cpp | 12 ++++++------ indra/llui/llscrolllistctrl.cpp | 2 +- indra/llui/lltexteditor.cpp | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 3947fa0229..e8a4f64035 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -42,7 +42,7 @@ typedef boost::function cleanup_callback_t; // Class LLClipboard // // This class is used to cut/copy/paste text strings and inventory items around -// the world. Use LLClipboard::getInstance()->method() to use its methods. +// the world. Use LLClipboard::instance().method() to use its methods. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLClipboard : public LLSingleton diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index ff85afdf25..d0fbf4b913 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1047,7 +1047,7 @@ void LLLineEditor::cut() // Prepare for possible rollback LLLineEditorRollback rollback( this ); - LLClipboard::getInstance()->copyToClipboard( mText.getWString(), left_pos, length ); + LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length ); deleteSelection(); // Validate new string and rollback the if needed. @@ -1078,13 +1078,13 @@ void LLLineEditor::copy() { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyToClipboard( mText.getWString(), left_pos, length ); + LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length ); } } BOOL LLLineEditor::canPaste() const { - return !mReadOnly && LLClipboard::getInstance()->isTextAvailable(); + return !mReadOnly && LLClipboard::instance().isTextAvailable(); } void LLLineEditor::paste() @@ -1115,7 +1115,7 @@ void LLLineEditor::pasteHelper(bool is_primary) if (can_paste_it) { LLWString paste; - LLClipboard::getInstance()->pasteFromClipboard(paste, is_primary); + LLClipboard::instance().pasteFromClipboard(paste, is_primary); if (!paste.empty()) { @@ -1202,13 +1202,13 @@ void LLLineEditor::copyPrimary() { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyToClipboard( mText.getWString(), left_pos, length, true); + LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length, true); } } BOOL LLLineEditor::canPastePrimary() const { - return !mReadOnly && LLClipboard::getInstance()->isTextAvailable(true); + return !mReadOnly && LLClipboard::instance().isTextAvailable(true); } void LLLineEditor::updatePrimary() diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 0a9d862b66..b3e1b63db5 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -2504,7 +2504,7 @@ void LLScrollListCtrl::copy() { buffer += (*itor)->getContentsCSV() + "\n"; } - LLClipboard::getInstance()->copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length()); } // virtual diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 141602ad2e..9720dded6c 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1332,7 +1332,7 @@ void LLTextEditor::cut() } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyToClipboard( getWText(), left_pos, length); + LLClipboard::instance().copyToClipboard( getWText(), left_pos, length); deleteSelection( FALSE ); onKeyStroke(); @@ -1352,12 +1352,12 @@ void LLTextEditor::copy() } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyToClipboard(getWText(), left_pos, length); + LLClipboard::instance().copyToClipboard(getWText(), left_pos, length); } BOOL LLTextEditor::canPaste() const { - return !mReadOnly && LLClipboard::getInstance()->isTextAvailable(); + return !mReadOnly && LLClipboard::instance().isTextAvailable(); } // paste from clipboard @@ -1394,7 +1394,7 @@ void LLTextEditor::pasteHelper(bool is_primary) } LLWString paste; - LLClipboard::getInstance()->pasteFromClipboard(paste, is_primary); + LLClipboard::instance().pasteFromClipboard(paste, is_primary); if (paste.empty()) { @@ -1467,12 +1467,12 @@ void LLTextEditor::copyPrimary() } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); S32 length = llabs( mSelectionStart - mSelectionEnd ); - LLClipboard::getInstance()->copyToClipboard(getWText(), left_pos, length, true); + LLClipboard::instance().copyToClipboard(getWText(), left_pos, length, true); } BOOL LLTextEditor::canPastePrimary() const { - return !mReadOnly && LLClipboard::getInstance()->isTextAvailable(true); + return !mReadOnly && LLClipboard::instance().isTextAvailable(true); } void LLTextEditor::updatePrimary() -- cgit v1.2.3 From 44c66e11ccee4f8370dc9cf2a87c44e323c9c68d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 1 Mar 2012 21:57:16 -0800 Subject: EXP-1841 : Use std::vector instead of LLDynamicArray in LLClipboard. --- indra/llui/llclipboard.cpp | 17 +++++++++-------- indra/llui/llclipboard.h | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index e0729366cc..037b9cb254 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -55,7 +55,7 @@ void LLClipboard::reset() mCleanupCallback(); } // Clear the clipboard - mObjects.reset(); + mObjects.clear(); mCutMode = false; mCleanupCallback = NULL; mString = LLWString(); @@ -83,24 +83,24 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ } if (res) { - mObjects.put(src); + mObjects.push_back(src); mState++; } } return res; } -bool LLClipboard::pasteFromClipboard(LLDynamicArray& inv_objects) const +bool LLClipboard::pasteFromClipboard(std::vector& inv_objects) const { bool res = false; - S32 count = mObjects.count(); + S32 count = mObjects.size(); if (count > 0) { res = true; - inv_objects.reset(); + inv_objects.clear(); for (S32 i = 0; i < count; i++) { - inv_objects.put(mObjects[i]); + inv_objects.push_back(mObjects[i]); } } return res; @@ -109,13 +109,14 @@ bool LLClipboard::pasteFromClipboard(LLDynamicArray& inv_objects) const // Returns true if the LL Clipboard has pasteable items in it bool LLClipboard::hasContents() const { - return (mObjects.count() > 0); + return (mObjects.size() > 0); } // Returns true if the input uuid is in the list of clipboard objects bool LLClipboard::isOnClipboard(const LLUUID& object) const { - return (mObjects.find(object) != LLDynamicArray::FAIL); + std::vector::const_iterator iter = std::find(mObjects.begin(), mObjects.end(), object); + return (iter != mObjects.end()); } // Copy the input string to the LL and the system clipboard diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index e8a4f64035..50b4c7cd77 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -74,7 +74,7 @@ public: // Adds one object to the current list of objects on the clipboard bool addToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE); // Gets a copy of the objects on the clipboard - bool pasteFromClipboard(LLDynamicArray& inventory_objects) const; + bool pasteFromClipboard(std::vector& inventory_objects) const; bool hasContents() const; // True if the clipboard has pasteable objects bool isOnClipboard(const LLUUID& object) const; // True if the input object uuid is on the clipboard @@ -83,7 +83,7 @@ public: void setCutMode(bool mode, cleanup_callback_t cb = NULL) { mCutMode = mode; mCleanupCallback = cb; mState++; } private: - LLDynamicArray mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat) + std::vector mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat) LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment). bool mCutMode; // This is a convenience flag for the viewer. Will determine if mCleanupCallback() needs to be called. cleanup_callback_t mCleanupCallback;// Function to call when the cut clipboard is being wiped out. Can be set to NULL (nothing done then). -- cgit v1.2.3 From a41507eef0a79731d1894ccf3179da6165f310ab Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 1 Mar 2012 23:10:06 -0800 Subject: EXP-1841 : change mState to mGeneration in LLClipboard. --- indra/llui/llclipboard.cpp | 10 +++++----- indra/llui/llclipboard.h | 9 ++++----- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 037b9cb254..75c197463c 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -35,7 +35,7 @@ #include "llwindow.h" LLClipboard::LLClipboard() : - mState(0) + mGeneration(0) { reset(); } @@ -47,8 +47,8 @@ LLClipboard::~LLClipboard() void LLClipboard::reset() { - // Increment the clipboard state - mState++; + // Increment the clipboard count + mGeneration++; // Call the cleanup function (if any) before releasing the object list if (mCutMode && mCleanupCallback) { @@ -84,7 +84,7 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ if (res) { mObjects.push_back(src); - mState++; + mGeneration++; } } return res; @@ -138,7 +138,7 @@ bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool us { mString = mString + sep + src.substr(pos, len); } - mState++; + mGeneration++; return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString)); } diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 50b4c7cd77..8b5a2260ae 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -54,7 +54,7 @@ public: // Clears the clipboard void reset(); // Returns the state of the clipboard so client can know if it has been modified (comparing with tracked state) - int getState() const { return mState; } + int getGeneration() const { return mGeneration; } // Text strings management: // ------------------------ @@ -80,15 +80,14 @@ public: bool isOnClipboard(const LLUUID& object) const; // True if the input object uuid is on the clipboard bool isCutMode() const { return mCutMode; } - void setCutMode(bool mode, cleanup_callback_t cb = NULL) { mCutMode = mode; mCleanupCallback = cb; mState++; } + void setCutMode(bool mode, cleanup_callback_t cb = NULL) { mCutMode = mode; mCleanupCallback = cb; mGeneration++; } private: - std::vector mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat) + std::vector mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat) LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment). bool mCutMode; // This is a convenience flag for the viewer. Will determine if mCleanupCallback() needs to be called. cleanup_callback_t mCleanupCallback;// Function to call when the cut clipboard is being wiped out. Can be set to NULL (nothing done then). - int mState; // Incremented when the clipboard change so that interested parties can check its state. - + int mGeneration; // Incremented when the clipboard changes so that interested parties can check for changes on the clipboard. }; #endif // LL_LLCLIPBOARD_H -- cgit v1.2.3 From 6c60f214fd4959c9cd71df566edbfe0dc902496f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 5 Mar 2012 20:10:17 -0800 Subject: CHUI-55 FIX Floaters that have set positions from old viewer versions can appear off screen until user repositions the floaters manually --- indra/llui/llfloater.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index d058b4ae44..b091a4a1f7 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -933,8 +933,13 @@ void LLFloater::applyPositioning(LLFloater* other, bool on_open) case LLFloaterEnums::POSITIONING_SPECIFIED: break; - case LLFloaterEnums::POSITIONING_CASCADE_GROUP: case LLFloaterEnums::POSITIONING_CASCADING: + if (!on_open) + { + applyRelativePosition(); + } + // fall through + case LLFloaterEnums::POSITIONING_CASCADE_GROUP: if (on_open) { if (other != NULL && other != this) @@ -3286,7 +3291,7 @@ void LLFloater::stackWith(LLFloater& other) setShape(next_rect); - //other.mPositioning = LLFloaterEnums::POSITIONING_SPECIFIED; + other.mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } -- cgit v1.2.3 From 93aa231a18b9b5c9b3ab2ff162fa4928ac60d62b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 6 Mar 2012 16:49:58 -0800 Subject: EXP-1767 WIP Received Items panel state does not persist between sessions ensure that layout stack has updated its layout before manually resizing one of its elements (which was causing the manual resize to be stomped on by the newly triggered layout update) made layout stack animation occur even when layout stack not visible (inventory will appear in proper open/closed state) LLView::setShape() now only calls handleReshape() when dimensions change removed extraneous calls to LLLayoutStack::updateClass() so that it should be called only once per frame now, allowing it to limit animation updates to layout stacks to one per frame. fixed rendering glitches arising from reshaping LLFolderView while in the middle of its draw() method --- indra/llui/lllayoutstack.cpp | 52 ++++++++++++++++++++++++++++---------------- indra/llui/llview.cpp | 5 ++++- 2 files changed, 37 insertions(+), 20 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index ae262f794e..988595f72a 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -172,12 +172,15 @@ void LLLayoutPanel::handleReshape(const LLRect& new_rect, bool by_user) LLLayoutStack* stackp = dynamic_cast(getParent()); if (stackp) { - stackp->mNeedsLayout = true; if (by_user) - { - // tell layout stack to account for new shape + { // tell layout stack to account for new shape + + // make sure that panels have already been auto resized + stackp->updateLayout(); + // now apply requested size to panel stackp->updatePanelRect(this, new_rect); } + stackp->mNeedsLayout = true; } LLPanel::handleReshape(new_rect, by_user); } @@ -241,7 +244,6 @@ void LLLayoutStack::draw() drawChild(panelp, 0, 0, !clip_rect.isEmpty()); } } - mAnimatedThisFrame = false; } void LLLayoutStack::removeChild(LLView* view) @@ -310,7 +312,7 @@ void LLLayoutStack::updateLayout() if (!mNeedsLayout) return; - bool animation_in_progress = animatePanels(); + bool continue_animating = animatePanels(); F32 total_visible_fraction = 0.f; S32 space_to_distribute = (mOrientation == HORIZONTAL) ? getRect().getWidth() @@ -415,7 +417,7 @@ void LLLayoutStack::updateLayout() // clear animation flag at end, since panel resizes will set it // and leave it set if there is any animation in progress - mNeedsLayout = animation_in_progress; + mNeedsLayout = continue_animating; } // end LLLayoutStack::updateLayout LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const @@ -488,6 +490,7 @@ void LLLayoutStack::updateClass() for (instance_iter it = beginInstances(); it != endInstances(); ++it) { it->updateLayout(); + it->mAnimatedThisFrame = false; } } @@ -557,7 +560,7 @@ void LLLayoutStack::normalizeFractionalSizes() bool LLLayoutStack::animatePanels() { - bool animation_in_progress = false; + bool continue_animating = false; // // animate visibility @@ -577,14 +580,15 @@ bool LLLayoutStack::animatePanels() } } - animation_in_progress = true; + mAnimatedThisFrame = true; + continue_animating = true; } else { if (panelp->mVisibleAmt != 1.f) { panelp->mVisibleAmt = 1.f; - animation_in_progress = true; + mAnimatedThisFrame = true; } } } @@ -601,14 +605,15 @@ bool LLLayoutStack::animatePanels() } } - animation_in_progress = true; + continue_animating = true; + mAnimatedThisFrame = true; } else { if (panelp->mVisibleAmt != 0.f) { panelp->mVisibleAmt = 0.f; - animation_in_progress = true; + mAnimatedThisFrame = true; } } } @@ -616,22 +621,31 @@ bool LLLayoutStack::animatePanels() F32 collapse_state = panelp->mCollapsed ? 1.f : 0.f; if (panelp->mCollapseAmt != collapse_state) { - if (!mAnimatedThisFrame) + if (mAnimate) { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - } - animation_in_progress = true; + if (!mAnimatedThisFrame) + { + panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); + } - if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f) + if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f) + { + panelp->mCollapseAmt = collapse_state; + } + + mAnimatedThisFrame = true; + continue_animating = true; + } + else { panelp->mCollapseAmt = collapse_state; + mAnimatedThisFrame = true; } } } - mAnimatedThisFrame = true; - - return animation_in_progress; + if (mAnimatedThisFrame) mNeedsLayout = true; + return continue_animating; } void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& new_rect ) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 356d5c31d1..54843227b7 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1835,7 +1835,10 @@ const LLCtrlQuery & LLView::getFocusRootsQuery() void LLView::setShape(const LLRect& new_rect, bool by_user) { - handleReshape(new_rect, by_user); + if (new_rect != getRect()) + { + handleReshape(new_rect, by_user); + } } void LLView::handleReshape(const LLRect& new_rect, bool by_user) -- cgit v1.2.3 From bea2dfbc22bb2d80755dcf9daf810e1ea0329c2d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 6 Mar 2012 16:59:11 -0800 Subject: EXP-1767 WIP Received Items panel state does not persist between sessions added get/setTargetDim() for managing layout_panel size even if its collapsed/invisible/etc --- indra/llui/lllayoutstack.cpp | 21 ++++++++++++++++++++- indra/llui/lllayoutstack.h | 2 ++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 988595f72a..4c730286da 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -113,7 +113,26 @@ S32 LLLayoutPanel::getLayoutDim() const ? getRect().getWidth() : getRect().getHeight())); } - + +S32 LLLayoutPanel::getTargetDim() const +{ + return mTargetDim; +} + +void LLLayoutPanel::setTargetDim(S32 value) +{ + LLRect new_rect(getRect()); + if (mOrientation == LLLayoutStack::HORIZONTAL) + { + new_rect.mRight = new_rect.mLeft + value; + } + else + { + new_rect.mTop = new_rect.mBottom + value; + } + setShape(new_rect, true); +} + S32 LLLayoutPanel::getVisibleDim() const { F32 min_dim = getRelevantMinDim(); diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index d32caec5f9..648cd5fdce 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -155,6 +155,8 @@ public: void setVisible(BOOL visible); S32 getLayoutDim() const; + S32 getTargetDim() const; + void setTargetDim(S32 value); S32 getMinDim() const { return llmax(0, mMinDim); } void setMinDim(S32 value) { mMinDim = value; } -- cgit v1.2.3 From 5170f18d3cecc757cae2779d9e271272e24d160b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 8 Mar 2012 21:06:00 -0800 Subject: EXP-1917 : Suppress clean up callback now that we move things to the trash immediately --- indra/llui/llclipboard.cpp | 6 ------ indra/llui/llclipboard.h | 7 ++----- 2 files changed, 2 insertions(+), 11 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 75c197463c..cc5b219e6f 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -49,15 +49,9 @@ void LLClipboard::reset() { // Increment the clipboard count mGeneration++; - // Call the cleanup function (if any) before releasing the object list - if (mCutMode && mCleanupCallback) - { - mCleanupCallback(); - } // Clear the clipboard mObjects.clear(); mCutMode = false; - mCleanupCallback = NULL; mString = LLWString(); } diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 8b5a2260ae..7f31f66bbe 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -36,8 +36,6 @@ #include "llassettype.h" #include "llinventory.h" -typedef boost::function cleanup_callback_t; - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLClipboard // @@ -80,13 +78,12 @@ public: bool isOnClipboard(const LLUUID& object) const; // True if the input object uuid is on the clipboard bool isCutMode() const { return mCutMode; } - void setCutMode(bool mode, cleanup_callback_t cb = NULL) { mCutMode = mode; mCleanupCallback = cb; mGeneration++; } + void setCutMode(bool mode) { mCutMode = mode; mGeneration++; } private: std::vector mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat) LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment). - bool mCutMode; // This is a convenience flag for the viewer. Will determine if mCleanupCallback() needs to be called. - cleanup_callback_t mCleanupCallback;// Function to call when the cut clipboard is being wiped out. Can be set to NULL (nothing done then). + bool mCutMode; // This is a convenience flag for the viewer. int mGeneration; // Incremented when the clipboard changes so that interested parties can check for changes on the clipboard. }; -- cgit v1.2.3 From 5cf3f8e3c813d978f318fd59ad422c75b3e171cd Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 9 Mar 2012 14:20:31 -0800 Subject: EXP-1913 : Prevent text clipboard to zap inventory clipboard --- indra/llui/llclipboard.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index cc5b219e6f..53b1b855de 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -116,7 +116,6 @@ bool LLClipboard::isOnClipboard(const LLUUID& object) const // Copy the input string to the LL and the system clipboard bool LLClipboard::copyToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary) { - reset(); return addToClipboard(src, pos, len, use_primary); } @@ -132,7 +131,6 @@ bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool us { mString = mString + sep + src.substr(pos, len); } - mGeneration++; return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString)); } -- cgit v1.2.3 From 8a792a86fad7c610651b964d164b8f099c790562 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 9 Mar 2012 17:34:30 -0800 Subject: EXP-1913 : Suppress the text concatenation on clipboard, unused and confusing. --- indra/llui/llclipboard.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 53b1b855de..7bf62b5bfc 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -122,15 +122,7 @@ bool LLClipboard::copyToClipboard(const LLWString &src, S32 pos, S32 len, bool u // Concatenate the input string to the LL and the system clipboard bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary) { - const LLWString sep(utf8str_to_wstring(std::string(", "))); - if (mString.length() == 0) - { - mString = src.substr(pos, len); - } - else - { - mString = mString + sep + src.substr(pos, len); - } + mString = src.substr(pos, len); return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString)); } -- cgit v1.2.3 From 9dfb6284df315588b0a387725965e3626d63784c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 13 Mar 2012 21:37:54 -0700 Subject: EXP-1924 : Relax the cconsistency policy between text and UUID on the clipboard. --- indra/llui/llclipboard.cpp | 5 ----- indra/llui/llclipboard.h | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 7bf62b5bfc..14173fdbb0 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -133,11 +133,6 @@ bool LLClipboard::pasteFromClipboard(LLWString &dst, bool use_primary) bool res = (use_primary ? LLView::getWindow()->pasteTextFromPrimary(dst) : LLView::getWindow()->pasteTextFromClipboard(dst)); if (res) { - if (dst != mString) - { - // Invalidate the LL clipboard if the System had a different string in it (i.e. some copy/cut was done in some other app) - reset(); - } mString = dst; } return res; diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 7f31f66bbe..fd2e7610df 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -41,6 +41,10 @@ // // This class is used to cut/copy/paste text strings and inventory items around // the world. Use LLClipboard::instance().method() to use its methods. +// Note that the text and UUIDs are loosely coupled only. There are few cases +// where the viewer does offer a serialized version of the UUID on the clipboard. +// In those case, the text is overridden when copying/cutting the item. +// In all other cases, the text and the UUIDs are very much independent. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLClipboard : public LLSingleton @@ -82,7 +86,7 @@ public: private: std::vector mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat) - LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment). + LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment) if the asset type is knowable. bool mCutMode; // This is a convenience flag for the viewer. int mGeneration; // Incremented when the clipboard changes so that interested parties can check for changes on the clipboard. }; -- cgit v1.2.3 From b9521a38f11dd9f44f216adb7d02263d25272572 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 14 Mar 2012 15:00:48 -0700 Subject: CHUI-59 FIX Floater stacking offset only occurs first time a floater is opened changed stacking logic to attempt to stack against any floater that is cascade head *or* in a cascade group --- indra/llui/llfloaterreg.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index ef55e74166..3d124cf885 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -96,7 +96,9 @@ LLFloater* LLFloaterReg::getLastFloaterCascading() { LLFloater* inst = *iter; - if (inst->getVisible() && inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADING)) + if (inst->getVisible() + && (inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADING) + || inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADE_GROUP))) { if (candidate_rect.mTop > inst->getRect().mTop) { -- cgit v1.2.3 From 34c599858bd64b7fbda767ff9c9f7d8bcd2c2c25 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 16 Mar 2012 01:08:20 +0200 Subject: CHUI-53 FIXED vertical scroll bar in inventory floater to appear when horizontal scroll bar hides last item in folder view. Added a scroll container which provides the information about the height of currently displayed folder view contents. It is used for updating vertical scroll bar visibility in inventory panel. --- indra/llui/llscrollcontainer.cpp | 15 +++++++++++---- indra/llui/llscrollcontainer.h | 6 ++++-- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index 20bed050ad..9b7e30bb04 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -389,10 +389,17 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height { *show_h_scrollbar = TRUE; *visible_height -= scrollbar_size; - // Note: Do *not* recompute *show_v_scrollbar here because with - // the (- scrollbar_size) we just did we will always add a vertical scrollbar - // even if the height of the items is actually less than the visible size. - // Fear not though: there's enough calcVisibleSize() calls to add a vertical slider later. + + // The view inside the scroll container should not be extended + // to container's full height to ensure the correct computation + // of *show_v_scrollbar after subtracting horizontal scrollbar_size. + + // Must retest now that visible_height has changed + if( !*show_v_scrollbar && ((doc_height - *visible_height) > 1) ) + { + *show_v_scrollbar = TRUE; + *visible_width -= scrollbar_size; + } } } } diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index 3aa79cc255..d87c95b3d7 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -91,7 +91,7 @@ public: void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; } LLRect getVisibleContentRect(); LLRect getContentWindowRect(); - const LLRect& getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; } + virtual const LLRect getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; } void pageUp(S32 overlap = 0); void pageDown(S32 overlap = 0); void goToTop(); @@ -116,6 +116,9 @@ public: bool autoScroll(S32 x, S32 y); +protected: + LLView* mScrolledView; + private: // internal scrollbar handlers virtual void scrollHorizontal( S32 new_pos ); @@ -124,7 +127,6 @@ private: void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const; LLScrollbar* mScrollbar[SCROLLBAR_COUNT]; - LLView* mScrolledView; S32 mSize; BOOL mIsOpaque; LLUIColor mBackgroundColor; -- cgit v1.2.3 From 7893cc2ed9815f675b760aacc9f3bf38cec9df1a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 16 Mar 2012 17:36:05 -0700 Subject: CHUI-61 FIX Relative floater positions not written to settings file if previous settings exist from old viewer apply relative positioning to floaters that are loaded with rects specified from earlier viewer --- indra/llui/llfloater.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index b091a4a1f7..9c4bf0a5c2 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -882,6 +882,10 @@ bool LLFloater::applyRectControl() reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); } } + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); + storeRectControl(); } LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); @@ -898,11 +902,6 @@ bool LLFloater::applyRectControl() saved_rect = true; } - else - { - LLRect screen_rect = calcScreenRect(); - mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); - } } return saved_rect; -- cgit v1.2.3 From 5f90875a9e92c7c92f92a32e64908a776fce64c6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 16 Mar 2012 17:52:28 -0700 Subject: EXP-1181 FIX as a designer I would like to specify default floater positions using realtive coordinates changed settings naming scheme for floater positioning so that related settings appear together in file --- indra/llui/llfloaterreg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 3d124cf885..9115eb7174 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -375,7 +375,7 @@ std::string LLFloaterReg::declareRectControl(const std::string& name) std::string LLFloaterReg::declarePosXControl(const std::string& name) { - std::string controlname = std::string("floater_pos_x_") + getBaseControlName(name); + std::string controlname = std::string("floater_pos_") + getBaseControlName(name) + "_x"; LLFloater::getControlGroup()->declareF32(controlname, 10.f, llformat("Window X Position for %s", name.c_str()), @@ -385,7 +385,7 @@ std::string LLFloaterReg::declarePosXControl(const std::string& name) std::string LLFloaterReg::declarePosYControl(const std::string& name) { - std::string controlname = std::string("floater_pos_y_") + getBaseControlName(name); + std::string controlname = std::string("floater_pos_") + getBaseControlName(name) + "_y"; LLFloater::getControlGroup()->declareF32(controlname, 10.f, llformat("Window Y Position for %s", name.c_str()), -- cgit v1.2.3 From 3033ca84745f67169caf518ee97d0aab519897fe Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 20 Mar 2012 10:52:41 -0700 Subject: CHUI-61 FIX Relative floater positions not written to settings file if previous settings exist from old viewer only write back floater positioning information generated from legacy saved rect after reading any new floater positioning info --- indra/llui/llfloater.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 9c4bf0a5c2..84754d9c4d 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -885,7 +885,6 @@ bool LLFloater::applyRectControl() mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; LLRect screen_rect = calcScreenRect(); mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); - storeRectControl(); } LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); @@ -904,6 +903,13 @@ bool LLFloater::applyRectControl() } } + if (saved_rect) + { + // propagate any derived positioning data back to settings file + storeRectControl(); + } + + return saved_rect; } -- cgit v1.2.3 From 2fe364dfafe0b68fec4f664312cd943beab1d110 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 21 Mar 2012 11:08:04 -0700 Subject: CHUI-61 FIX Relative floater positions not written to settings file if previous settings exist from old viewer --- indra/llui/llfloater.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 9c4bf0a5c2..1fb10faf1e 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -885,7 +885,6 @@ bool LLFloater::applyRectControl() mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; LLRect screen_rect = calcScreenRect(); mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); - storeRectControl(); } LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); @@ -902,6 +901,12 @@ bool LLFloater::applyRectControl() saved_rect = true; } + + // remember updated position + if (mPositioning == LLFloaterEnums::POSITIONING_RELATIVE) + { + storeRectControl(); + } } return saved_rect; -- cgit v1.2.3 From 71db6d1b91cb8a62959a63ae36d3727e48439245 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 21 Mar 2012 14:01:54 -0700 Subject: CHUI-61 FIX Relative floater positions not written to settings file if previous settings exist from old viewer --- indra/llui/llfloater.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 1fb10faf1e..f6d4daba4e 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -868,6 +868,7 @@ bool LLFloater::applyRectControl() } else { + bool rect_specified = false; if (!mRectControl.empty()) { // If we have a saved rect, use it @@ -881,10 +882,11 @@ bool LLFloater::applyRectControl() { reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); } + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); + rect_specified = true; } - mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; - LLRect screen_rect = calcScreenRect(); - mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); } LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl); @@ -903,7 +905,7 @@ bool LLFloater::applyRectControl() } // remember updated position - if (mPositioning == LLFloaterEnums::POSITIONING_RELATIVE) + if (rect_specified) { storeRectControl(); } -- cgit v1.2.3 From 8ff4c75637ce2b9a55a65ba1fc1db3a23e7b88ec Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 23 Mar 2012 12:03:06 -0700 Subject: CHUI-70 FIX Build floater and other floaters opened in default position become centered in viewer when object is built or viewer resized always initialize mPosition --- indra/llui/llfloater.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 3f8116d8d6..2cbc12defc 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -859,6 +859,9 @@ bool LLFloater::applyRectControl() { bool saved_rect = false; + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); + LLFloater* last_in_group = LLFloaterReg::getLastFloaterInGroup(mInstanceName); if (last_in_group && last_in_group != this) { -- cgit v1.2.3 From 8d0c73dfd4a245ab02760a23255ef3c500ccac46 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Sat, 14 Apr 2012 00:54:59 +0300 Subject: Touched a file to fix the TC build. --- indra/llui/llnotifications.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 462d69be2e..3df2efcac3 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -690,7 +690,7 @@ typedef std::multimap LLNotificationMap; // Abstract base class (interface) for a channel; also used for the master container. // This lets us arrange channels into a call hierarchy. -// We maintain a heirarchy of notification channels; events are always started at the top +// We maintain a hierarchy of notification channels; events are always started at the top // and propagated through the hierarchy only if they pass a filter. // Any channel can be created with a parent. A null parent (empty string) means it's // tied to the root of the tree (the LLNotifications class itself). -- cgit v1.2.3 From 93c68c7c12f2a0d19e94bae833554139f78914e9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 18 May 2012 21:03:45 -0700 Subject: MAINT-959 FIX [PUBLIC]Trouble resizing tabbed floaters don't auto position other floater when it is hosted --- indra/llui/llfloater.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a8a3a1f906..8ca1e685a9 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -3307,8 +3307,11 @@ void LLFloater::stackWith(LLFloater& other) setShape(next_rect); - other.mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; - other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); + if (!other.getHost()) + { + other.mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP; + other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); + } } void LLFloater::applyRelativePosition() -- cgit v1.2.3