diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbutton.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 4 | ||||
-rw-r--r-- | indra/llui/lldockablefloater.cpp | 15 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.cpp | 45 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.h | 2 | ||||
-rw-r--r-- | indra/llui/llflatlistview.cpp | 18 | ||||
-rw-r--r-- | indra/llui/llflatlistview.h | 2 | ||||
-rw-r--r-- | indra/llui/lliconctrl.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lliconctrl.h | 5 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 28 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.h | 3 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llui.h | 8 |
13 files changed, 126 insertions, 24 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index f28fca35c5..fd369730d6 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -147,7 +147,8 @@ LLButton::LLButton(const LLButton::Params& p) mHoverGlowStrength(p.hover_glow_amount), mCommitOnReturn(p.commit_on_return), mFadeWhenDisabled(FALSE), - mForcePressedState(FALSE) + mForcePressedState(FALSE), + mLastDrawCharsCount(0) { static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>()); @@ -814,7 +815,7 @@ void LLButton::draw() // LLFontGL::render expects S32 max_chars variable but process in a separate way -1 value. // Due to U32_MAX is equal to S32 -1 value I have rest this value for non-ellipses mode. // Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars. - mGLFont->render(label, 0, (F32)x, (F32)(LLBUTTON_V_PAD + y_offset), + mLastDrawCharsCount = mGLFont->render(label, 0, (F32)x, (F32)(LLBUTTON_V_PAD + y_offset), label_color % alpha, mHAlign, LLFontGL::BOTTOM, LLFontGL::NORMAL, diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 7ca520b935..7fc4997133 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -210,6 +210,9 @@ public: void setFont(const LLFontGL *font) { mGLFont = ( font ? font : LLFontGL::getFontSansSerif()); } + + S32 getLastDrawCharsCount() const { return mLastDrawCharsCount; } + void setScaleImage(BOOL scale) { mScaleImage = scale; } BOOL getScaleImage() const { return mScaleImage; } @@ -260,6 +263,7 @@ private: S32 mMouseHeldDownCount; // Counter for parameter passed to held-down callback F32 mHeldDownDelay; // seconds, after which held-down callbacks get called S32 mHeldDownFrameDelay; // frames, after which held-down callbacks get called + S32 mLastDrawCharsCount; LLPointer<LLUIImage> mImageOverlay; LLFontGL::HAlign mImageOverlayAlignment; diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 35b3e486af..f56cb2eee7 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -136,7 +136,15 @@ void LLDockableFloater::setMinimized(BOOL minimize) { setVisible(FALSE); } - setCanDock(!minimize); + + if (minimize) + { + setCanDock(false); + } + else if (!minimize && mDockControl.get() != NULL && mDockControl.get()->isDockVisible()) + { + setCanDock(true); + } LLFloater::setMinimized(minimize); } @@ -158,7 +166,10 @@ void LLDockableFloater::onDockHidden() void LLDockableFloater::onDockShown() { - setCanDock(TRUE); + if (!isMinimized()) + { + setCanDock(TRUE); + } } void LLDockableFloater::setDocked(bool docked, bool pop_on_undock) diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index cdcd823b1c..35a854267a 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -37,7 +37,7 @@ LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, const LLUIImagePtr& dockTongue, DocAt dockAt, get_allowed_rect_callback_t get_allowed_rect_callback) : - mDockWidget(dockWidget), mDockableFloater(dockableFloater), mDockTongue(dockTongue) + mDockWidget(dockWidget), mDockableFloater(dockableFloater), mDockTongue(dockTongue) { mDockAt = dockAt; @@ -63,6 +63,15 @@ LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, { repositionDockable(); } + + if (mDockWidget != NULL) + { + mDockWidgetVisible = isDockVisible(); + } + else + { + mDockWidgetVisible = false; + } } LLDockControl::~LLDockControl() @@ -75,6 +84,11 @@ void LLDockControl::setDock(LLView* dockWidget) if (mDockWidget != NULL) { repositionDockable(); + mDockWidgetVisible = isDockVisible(); + } + else + { + mDockWidgetVisible = false; } } @@ -88,11 +102,10 @@ void LLDockControl::repositionDockable() LLRect dockRect = mDockWidget->calcScreenRect(); LLRect rootRect; mGetAllowedRectCallback(rootRect); - static BOOL prev_visibility = !mDockWidget->getVisible(); // recalculate dockable position if dock position changed, dock visibility changed, // root view rect changed or recalculation is forced - if (mPrevDockRect != dockRect || prev_visibility != mDockWidget->getVisible() + if (mPrevDockRect != dockRect || mDockWidgetVisible != isDockVisible() || mRootRect != rootRect || mRecalculateDocablePosition) { // undock dockable and off() if dock not visible @@ -125,7 +138,7 @@ void LLDockControl::repositionDockable() mPrevDockRect = dockRect; mRootRect = rootRect; mRecalculateDocablePosition = false; - prev_visibility = mDockWidget->getVisible(); + mDockWidgetVisible = isDockVisible(); } } @@ -143,6 +156,8 @@ bool LLDockControl::isDockVisible() switch (mDockAt) { + case LEFT: // to keep compiler happy + break; case TOP: // check is dock inside parent rect LLRect dockParentRect = @@ -170,8 +185,27 @@ void LLDockControl::moveDockable() LLRect dockableRect = mDockableFloater->calcScreenRect(); S32 x = 0; S32 y = 0; + LLRect dockParentRect; switch (mDockAt) { + case LEFT: + x = dockRect.mLeft; + y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight(); + // check is dockable inside root view rect + if (x < rootRect.mLeft) + { + x = rootRect.mLeft; + } + if (x + dockableRect.getWidth() > rootRect.mRight) + { + x = rootRect.mRight - dockableRect.getWidth(); + } + + mDockTongueX = x + dockableRect.getWidth()/2 - mDockTongue->getWidth() / 2; + + mDockTongueY = dockRect.mTop; + break; + case TOP: x = dockRect.getCenterX() - dockableRect.getWidth() / 2; y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight(); @@ -187,8 +221,7 @@ void LLDockControl::moveDockable() // calculate dock tongue position - LLRect dockParentRect = - mDockWidget->getParent()->calcScreenRect(); + dockParentRect = mDockWidget->getParent()->calcScreenRect(); if (dockRect.getCenterX() < dockParentRect.mLeft) { mDockTongueX = dockParentRect.mLeft - mDockTongue->getWidth() / 2; diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index 756a2900d3..eaedb4c307 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -48,6 +48,7 @@ public: enum DocAt { TOP + ,LEFT }; public: @@ -80,6 +81,7 @@ private: get_allowed_rect_callback_t mGetAllowedRectCallback; bool mEnabled; bool mRecalculateDocablePosition; + bool mDockWidgetVisible; DocAt mDockAt; LLView* mDockWidget; LLRect mPrevDockRect; diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index bba5464b00..19f203b80c 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -92,7 +92,7 @@ bool LLFlatListView::addItem(LLPanel * item, const LLSD& value /*= LLUUID::null* //_4 is for MASK item->setMouseDownCallback(boost::bind(&LLFlatListView::onItemMouseClick, this, new_pair, _4)); - item->setRightMouseDownCallback(boost::bind(&LLFlatListView::onItemMouseClick, this, new_pair, _4)); + item->setRightMouseDownCallback(boost::bind(&LLFlatListView::onItemRightMouseClick, this, new_pair, _4)); rearrangeItems(); notifyParentItemsRectChanged(); @@ -137,7 +137,7 @@ bool LLFlatListView::insertItemAfter(LLPanel* after_item, LLPanel* item_to_add, //_4 is for MASK item_to_add->setMouseDownCallback(boost::bind(&LLFlatListView::onItemMouseClick, this, new_pair, _4)); - item_to_add->setRightMouseDownCallback(boost::bind(&LLFlatListView::onItemMouseClick, this, new_pair, _4)); + item_to_add->setRightMouseDownCallback(boost::bind(&LLFlatListView::onItemRightMouseClick, this, new_pair, _4)); rearrangeItems(); notifyParentItemsRectChanged(); @@ -459,6 +459,20 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask) selectItemPair(item_pair, select_item); } +void LLFlatListView::onItemRightMouseClick(item_pair_t* item_pair, MASK mask) +{ + if (!item_pair) + return; + + // Forbid deselecting of items on right mouse button click if mMultipleSelection flag is set on, + // because some of derived classes may have context menu and selected items must be kept. + if ( !(mask & MASK_CONTROL) && mMultipleSelection && isSelected(item_pair) ) + return; + + // else got same behavior as at onItemMouseClick + onItemMouseClick(item_pair, mask); +} + LLFlatListView::item_pair_t* LLFlatListView::getItemPair(LLPanel* item) const { llassert(item); diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 888258efdc..97772bc677 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -304,6 +304,8 @@ protected: /** Manage selection on mouse events */ void onItemMouseClick(item_pair_t* item_pair, MASK mask); + void onItemRightMouseClick(item_pair_t* item_pair, MASK mask); + /** * Updates position of items. * It does not take into account invisible items. diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 0330a2b374..66c2ba682f 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -56,7 +56,8 @@ LLIconCtrl::Params::Params() LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) : LLUICtrl(p), mColor(p.color()), - mImagep(p.image) + mImagep(p.image), + mPriority(0) { if (mImagep.notNull()) { @@ -93,11 +94,11 @@ void LLIconCtrl::setValue(const LLSD& value ) LLUICtrl::setValue(tvalue); if (tvalue.isUUID()) { - mImagep = LLUI::getUIImageByID(tvalue.asUUID()); + mImagep = LLUI::getUIImageByID(tvalue.asUUID(), mPriority); } else { - mImagep = LLUI::getUIImage(tvalue.asString()); + mImagep = LLUI::getUIImage(tvalue.asString(), mPriority); } } diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index ff25b0d53e..90f1693060 100644 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -72,10 +72,13 @@ public: std::string getImageName() const; void setColor(const LLColor4& color) { mColor = color; } + +protected: + S32 mPriority; private: LLUIColor mColor; - LLPointer<LLUIImage> mImagep; + LLPointer<LLUIImage> mImagep; }; #endif diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 24fd380bb1..bac5491943 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -401,6 +401,16 @@ void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed) panel_container->mCollapsed = collapsed; } +void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize) +{ + LayoutPanel* panel = findEmbeddedPanelByName(panel_name); + + if (panel) + { + panel->mAutoResize = auto_resize; + } +} + void LLLayoutStack::updateLayout(BOOL force_resize) { static LLUICachedControl<S32> resize_bar_overlap ("UIResizeBarOverlap", 0); @@ -713,6 +723,24 @@ LLLayoutStack::LayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) co return NULL; } +LLLayoutStack::LayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const +{ + LayoutPanel* result = NULL; + + for (e_panel_list_t::const_iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) + { + LayoutPanel* p = *panel_it; + + if (p->mPanel->getName() == name) + { + result = p; + break; + } + } + + return result; +} + // Compute sum of min_width or min_height of children void LLLayoutStack::calcMinExtents() { diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 49cbe7270f..9ded48ef6a 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -80,6 +80,7 @@ public: void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE); S32 getNumPanels() { return mPanels.size(); } + void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize); protected: LLLayoutStack(const Params&); friend class LLUICtrlFactory; @@ -96,7 +97,9 @@ private: typedef std::vector<LayoutPanel*> e_panel_list_t; e_panel_list_t mPanels; + LayoutPanel* findEmbeddedPanel(LLPanel* panelp) const; + LayoutPanel* findEmbeddedPanelByName(const std::string& name) const; S32 mMinWidth; // calculated by calcMinExtents S32 mMinHeight; // calculated by calcMinExtents diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index da9384f876..48504a1e54 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1807,11 +1807,11 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen) } //static -LLPointer<LLUIImage> LLUI::getUIImageByID(const LLUUID& image_id) +LLPointer<LLUIImage> LLUI::getUIImageByID(const LLUUID& image_id, S32 priority) { if (sImageProvider) { - return sImageProvider->getUIImageByID(image_id); + return sImageProvider->getUIImageByID(image_id, priority); } else { @@ -1820,10 +1820,10 @@ LLPointer<LLUIImage> LLUI::getUIImageByID(const LLUUID& image_id) } //static -LLPointer<LLUIImage> LLUI::getUIImage(const std::string& name) +LLPointer<LLUIImage> LLUI::getUIImage(const std::string& name, S32 priority) { if (!name.empty() && sImageProvider) - return sImageProvider->getUIImage(name); + return sImageProvider->getUIImage(name, priority); else return NULL; } diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 6ab78ab3cd..efb1b0a36f 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -195,8 +195,8 @@ public: static void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y); static void setScaleFactor(const LLVector2& scale_factor); static void setLineWidth(F32 width); - static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id); - static LLPointer<LLUIImage> getUIImage(const std::string& name); + static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0); + static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0); static LLVector2 getWindowSize(); static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); @@ -241,8 +241,8 @@ protected: LLImageProviderInterface() {}; virtual ~LLImageProviderInterface() {}; public: - virtual LLPointer<LLUIImage> getUIImage(const std::string& name) = 0; - virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id) = 0; + virtual LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) = 0; + virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) = 0; virtual void cleanUp() = 0; }; |