summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-10-23 16:44:23 -0700
committerJames Cook <james@lindenlab.com>2009-10-23 16:44:23 -0700
commit07f7247dff19cb7acd320113734773c099b0366d (patch)
tree7072f301675db427686c06eca48592b89d4db227 /indra/llui
parent71822edfe824c5f7c742d6d9b8528f8ff541963b (diff)
parent2b69cb9e9cf5209a8156580b74e6662e4cc4243f (diff)
merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp5
-rw-r--r--indra/llui/llbutton.h4
-rw-r--r--indra/llui/lldockablefloater.cpp15
-rw-r--r--indra/llui/lldockcontrol.cpp45
-rw-r--r--indra/llui/lldockcontrol.h2
-rw-r--r--indra/llui/llflatlistview.cpp18
-rw-r--r--indra/llui/llflatlistview.h2
-rw-r--r--indra/llui/lllayoutstack.cpp28
-rw-r--r--indra/llui/lllayoutstack.h3
9 files changed, 110 insertions, 12 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/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