summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMelinda Green <melinda@lindenlab.com>2008-12-15 21:21:19 +0000
committerMelinda Green <melinda@lindenlab.com>2008-12-15 21:21:19 +0000
commite1d8dac25a93db837c780428a23f81cbf9109270 (patch)
treea0bcaec0cec1ba6b3ce813764650eada61fcde4f /indra/llui
parent9c0dbb123376608e464fcd8d1a2e288e01d78a3f (diff)
svn merge -r105329:105903 svn+ssh://svn/svn/linden/branches/featurettes/featurettes-batch4-merge
Resolving QAR-1051 Merge featurettes batch #4
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/CMakeLists.txt2
-rw-r--r--indra/llui/llbutton.cpp8
-rw-r--r--indra/llui/llfloater.h2
-rw-r--r--indra/llui/llpanel.cpp4
-rw-r--r--indra/llui/llpanel.h2
-rw-r--r--indra/llui/llprogressbar.cpp180
-rw-r--r--indra/llui/llprogressbar.h75
-rw-r--r--indra/llui/llscrollbar.cpp7
-rw-r--r--indra/llui/lltextbox.cpp110
-rw-r--r--indra/llui/lltextbox.h10
-rw-r--r--indra/llui/lltexteditor.cpp12
-rw-r--r--indra/llui/lltexteditor.h4
-rw-r--r--indra/llui/llui.cpp12
-rw-r--r--indra/llui/llui.h1
-rw-r--r--indra/llui/lluictrl.cpp13
-rw-r--r--indra/llui/lluictrl.h4
-rw-r--r--indra/llui/llview.cpp18
-rw-r--r--indra/llui/llview.h3
18 files changed, 343 insertions, 124 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index 77efec5696..897cc4275d 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -44,6 +44,7 @@ set(llui_SOURCE_FILES
llmultislider.cpp
llmultisliderctrl.cpp
llpanel.cpp
+ llprogressbar.cpp
llradiogroup.cpp
llresizebar.cpp
llresizehandle.cpp
@@ -95,6 +96,7 @@ set(llui_HEADER_FILES
llmultisliderctrl.h
llmultislider.h
llpanel.h
+ llprogressbar.h
llradiogroup.h
llresizebar.h
llresizehandle.h
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 47b7067f63..7441d2f734 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -422,13 +422,7 @@ void LLButton::draw()
// Unselected image assignments
S32 local_mouse_x;
S32 local_mouse_y;
- LLCoordWindow cursor_pos_window;
- getWindow()->getCursorPosition(&cursor_pos_window);
- LLCoordGL cursor_pos_gl;
- getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
- cursor_pos_gl.mX = llround((F32)cursor_pos_gl.mX / LLUI::sGLScaleFactor.mV[VX]);
- cursor_pos_gl.mY = llround((F32)cursor_pos_gl.mY / LLUI::sGLScaleFactor.mV[VY]);
- screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &local_mouse_x, &local_mouse_y);
+ LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y);
BOOL pressed = pressed_by_keyboard
|| (hasMouseCapture() && pointInView(local_mouse_x, local_mouse_y))
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index f3941ff7d1..415419748f 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -456,7 +456,7 @@ public:
// singleton implementation for floaters (provides visibility policy)
-// https://wiki.lindenlab.com/mediawiki/index.php?title=LLFloaterSingleton&oldid=79410
+// https://wiki.lindenlab.com/mediawiki/index.php?title=LLFloaterSingleton&oldid=164990
template <class T> class LLFloaterSingleton : public LLUISingleton<T, VisibilityPolicy<LLFloater> >
{
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index f6c621444d..22934450e7 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -982,12 +982,12 @@ void LLPanel::childSetAction(const std::string& id, void(*function)(void*), void
}
}
-void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*))
+void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*), void* value)
{
LLTextBox* textbox = getChild<LLTextBox>(id);
if (textbox)
{
- textbox->setClickedCallback(function);
+ textbox->setClickedCallback(function, value);
}
}
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 355e32f1cd..c55eb6bba2 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -220,7 +220,7 @@ public:
// LLButton
void childSetAction(const std::string& id, void(*function)(void*), void* value);
- void childSetActionTextbox(const std::string& id, void(*function)(void*));
+ void childSetActionTextbox(const std::string& id, void(*function)(void*), void* value = NULL);
void childSetControlName(const std::string& id, const std::string& control_name);
// Error reporting
diff --git a/indra/llui/llprogressbar.cpp b/indra/llui/llprogressbar.cpp
new file mode 100644
index 0000000000..4425bad7bf
--- /dev/null
+++ b/indra/llui/llprogressbar.cpp
@@ -0,0 +1,180 @@
+/**
+ * @file llprogressbar.cpp
+ * @brief LLProgressBar class implementation
+ *
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ *
+ * Copyright (c) 2002-2008, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "llprogressbar.h"
+
+#include "indra_constants.h"
+#include "llmath.h"
+#include "llgl.h"
+#include "llui.h"
+#include "llfontgl.h"
+#include "llimagegl.h"
+#include "lltimer.h"
+#include "llglheaders.h"
+
+#include "llfocusmgr.h"
+
+static LLRegisterWidget<LLProgressBar> r("progress_bar");
+
+LLProgressBar::LLProgressBar(const std::string& name, const LLRect &rect)
+ : LLView(name, rect, FALSE),
+ mImageBar( NULL ),
+ mImageShadow( NULL )
+{
+ mPercentDone = 0.f;
+
+ // Defaults:
+
+ setImageBar("rounded_square.tga");
+ setImageShadow("rounded_square_soft.tga");
+
+ mColorBackground = LLColor4(0.3254f, 0.4000f, 0.5058f, 1.0f);
+ mColorBar = LLColor4(0.5764f, 0.6627f, 0.8352f, 1.0f);
+ mColorBar2 = LLColor4(0.5764f, 0.6627f, 0.8352f, 1.0f);
+ mColorShadow = LLColor4(0.2000f, 0.2000f, 0.4000f, 1.0f);
+}
+
+LLProgressBar::~LLProgressBar()
+{
+ gFocusMgr.releaseFocusIfNeeded( this );
+}
+
+void LLProgressBar::draw()
+{
+ static LLTimer timer;
+
+ LLUIImagePtr shadow_imagep = LLUI::getUIImage("rounded_square_soft.tga");
+ LLUIImagePtr bar_fg_imagep = LLUI::getUIImage("progressbar_fill.tga");
+ LLUIImagePtr bar_bg_imagep = LLUI::getUIImage("progressbar_track.tga");
+ LLUIImagePtr bar_imagep = LLUI::getUIImage("rounded_square.tga");
+ LLColor4 background_color = LLUI::sColorsGroup->getColor("LoginProgressBarBgColor");
+
+ bar_bg_imagep->draw(getLocalRect(),
+ background_color);
+
+ F32 alpha = 0.5f + 0.5f*0.5f*(1.f + (F32)sin(3.f*timer.getElapsedTimeF32()));
+ LLColor4 bar_color = LLUI::sColorsGroup->getColor("LoginProgressBarFgColor");
+ bar_color.mV[3] = alpha;
+ LLRect progress_rect = getLocalRect();
+ progress_rect.mRight = llround(getRect().getWidth() * (mPercentDone / 100.f));
+ bar_fg_imagep->draw(progress_rect);
+}
+
+void LLProgressBar::setPercent(const F32 percent)
+{
+ mPercentDone = llclamp(percent, 0.f, 100.f);
+}
+
+void LLProgressBar::setImageBar( const std::string &bar_name )
+{
+ mImageBar = LLUI::sImageProvider->getUIImage(bar_name)->getImage();
+}
+
+void LLProgressBar::setImageShadow(const std::string &shadow_name)
+{
+ mImageShadow = LLUI::sImageProvider->getUIImage(shadow_name)->getImage();
+}
+
+void LLProgressBar::setColorBar(const LLColor4 &c)
+{
+ mColorBar = c;
+}
+void LLProgressBar::setColorBar2(const LLColor4 &c)
+{
+ mColorBar2 = c;
+}
+void LLProgressBar::setColorShadow(const LLColor4 &c)
+{
+ mColorShadow = c;
+}
+void LLProgressBar::setColorBackground(const LLColor4 &c)
+{
+ mColorBackground = c;
+}
+
+
+// static
+LLView* LLProgressBar::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
+{
+ std::string name("progress_bar");
+ node->getAttributeString("name", name);
+
+ LLProgressBar *progress = new LLProgressBar(name, LLRect());
+
+
+ std::string image_bar;
+ if (node->hasAttribute("image_bar")) node->getAttributeString("image_bar",image_bar);
+ if (image_bar != LLStringUtil::null) progress->setImageBar(image_bar);
+
+
+ std::string image_shadow;
+ if (node->hasAttribute("image_shadow")) node->getAttributeString("image_shadow",image_shadow);
+ if (image_shadow != LLStringUtil::null) progress->setImageShadow(image_shadow);
+
+
+ LLColor4 color_bar;
+ if (node->hasAttribute("color_bar"))
+ {
+ node->getAttributeColor4("color_bar",color_bar);
+ progress->setColorBar(color_bar);
+ }
+
+
+ LLColor4 color_bar2;
+ if (node->hasAttribute("color_bar2"))
+ {
+ node->getAttributeColor4("color_bar2",color_bar2);
+ progress->setColorBar2(color_bar2);
+ }
+
+
+ LLColor4 color_shadow;
+ if (node->hasAttribute("color_shadow"))
+ {
+ node->getAttributeColor4("color_shadow",color_shadow);
+ progress->setColorShadow(color_shadow);
+ }
+
+
+ LLColor4 color_bg;
+ if (node->hasAttribute("color_bg"))
+ {
+ node->getAttributeColor4("color_bg",color_bg);
+ progress->setColorBackground(color_bg);
+ }
+
+
+ progress->initFromXML(node, parent);
+
+ return progress;
+}
diff --git a/indra/llui/llprogressbar.h b/indra/llui/llprogressbar.h
new file mode 100644
index 0000000000..6c720290fc
--- /dev/null
+++ b/indra/llui/llprogressbar.h
@@ -0,0 +1,75 @@
+/**
+ * @file llprogressbar.h
+ * @brief LLProgressBar class definition
+ *
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ *
+ * Copyright (c) 2002-2007, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLPROGRESSBAR_H
+#define LL_LLPROGRESSBAR_H
+
+#include "llview.h"
+#include "llframetimer.h"
+
+class LLProgressBar
+ : public LLView
+{
+public:
+ LLProgressBar(const std::string& name, const LLRect &rect);
+ virtual ~LLProgressBar();
+
+ void setPercent(const F32 percent);
+
+ void setImageBar(const std::string &bar_name);
+ void setImageShadow(const std::string &shadow_name);
+
+ void setColorBar(const LLColor4 &c);
+ void setColorBar2(const LLColor4 &c);
+ void setColorShadow(const LLColor4 &c);
+ void setColorBackground(const LLColor4 &c);
+
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+
+ /*virtual*/ void draw();
+
+protected:
+ F32 mPercentDone;
+
+ LLPointer<LLImageGL> mImageBar;
+ //LLUUID mImageBarID;
+ //LLString mImageBarName;
+ LLColor4 mColorBar;
+ LLColor4 mColorBar2;
+
+ LLPointer<LLImageGL> mImageShadow;
+ //LLUUID mImageShadowID;
+ //LLString mImageShadowName;
+ LLColor4 mColorShadow;
+ LLColor4 mColorBackground;
+};
+
+#endif // LL_LLPROGRESSBAR_H
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 07babd9f55..a7163323bd 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -464,12 +464,7 @@ void LLScrollbar::draw()
{
S32 local_mouse_x;
S32 local_mouse_y;
- LLCoordWindow cursor_pos_window;
- getWindow()->getCursorPosition(&cursor_pos_window);
- LLCoordGL cursor_pos_gl;
- getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
-
- screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &local_mouse_x, &local_mouse_y);
+ LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y);
BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this;
BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
if (hovered)
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index ac2f2a64a3..c616931cd6 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -33,32 +33,16 @@
#include "lltextbox.h"
#include "lluictrlfactory.h"
#include "llfocusmgr.h"
+#include "llwindow.h"
static LLRegisterWidget<LLTextBox> r("text");
LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::string& text,
const LLFontGL* font, BOOL mouse_opaque)
: LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ),
- mFontGL(font ? font : LLFontGL::sSansSerifSmall),
- mTextColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ),
- mDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
- mBackgroundColor( LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ) ),
- mBorderColor( LLUI::sColorsGroup->getColor( "DefaultHighlightLight" ) ),
- mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ),
- mHoverActive( FALSE ),
- mHasHover( FALSE ),
- mBackgroundVisible( FALSE ),
- mBorderVisible( FALSE ),
- mFontStyle(LLFontGL::DROP_SHADOW_SOFT),
- mBorderDropShadowVisible( FALSE ),
- mUseEllipses( FALSE ),
- mHPad(0),
- mVPad(0),
- mHAlign( LLFontGL::LEFT ),
- mVAlign( LLFontGL::TOP ),
- mClickedCallback(NULL),
- mCallbackUserData(NULL)
+ mFontGL(font ? font : LLFontGL::sSansSerifSmall)
{
+ initDefaults();
setText( text );
setTabStop(FALSE);
}
@@ -66,26 +50,9 @@ LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::str
LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_width,
const LLFontGL* font, BOOL mouse_opaque) :
LLUICtrl(name, LLRect(0, 0, 1, 1), mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),
- mFontGL(font ? font : LLFontGL::sSansSerifSmall),
- mTextColor(LLUI::sColorsGroup->getColor("LabelTextColor")),
- mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")),
- mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")),
- mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")),
- mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ),
- mHoverActive( FALSE ),
- mHasHover( FALSE ),
- mBackgroundVisible(FALSE),
- mBorderVisible(FALSE),
- mFontStyle(LLFontGL::DROP_SHADOW_SOFT),
- mBorderDropShadowVisible(FALSE),
- mUseEllipses( FALSE ),
- mHPad(0),
- mVPad(0),
- mHAlign(LLFontGL::LEFT),
- mVAlign( LLFontGL::TOP ),
- mClickedCallback(NULL),
- mCallbackUserData(NULL)
+ mFontGL(font ? font : LLFontGL::sSansSerifSmall)
{
+ initDefaults();
setWrappedText(text, max_width);
reshapeToFitText();
setTabStop(FALSE);
@@ -93,47 +60,34 @@ LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_w
LLTextBox::LLTextBox(const std::string& name_and_label, const LLRect& rect) :
LLUICtrl(name_and_label, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),
- mFontGL(LLFontGL::sSansSerifSmall),
- mTextColor(LLUI::sColorsGroup->getColor("LabelTextColor")),
- mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")),
- mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")),
- mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")),
- mBackgroundVisible(FALSE),
- mBorderVisible(FALSE),
- mFontStyle(LLFontGL::DROP_SHADOW_SOFT),
- mBorderDropShadowVisible(FALSE),
- mHPad(0),
- mVPad(0),
- mHAlign(LLFontGL::LEFT),
- mVAlign( LLFontGL::TOP ),
- mClickedCallback(NULL),
- mCallbackUserData(NULL)
+ mFontGL(LLFontGL::sSansSerifSmall)
{
+ initDefaults();
setText( name_and_label );
setTabStop(FALSE);
}
-LLTextBox::LLTextBox(const std::string& name_and_label) :
- LLUICtrl(name_and_label, LLRect(0, 0, 1, 1), TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),
- mFontGL(LLFontGL::sSansSerifSmall),
- mTextColor(LLUI::sColorsGroup->getColor("LabelTextColor")),
- mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")),
- mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")),
- mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")),
- mBackgroundVisible(FALSE),
- mBorderVisible(FALSE),
- mFontStyle(LLFontGL::DROP_SHADOW_SOFT),
- mBorderDropShadowVisible(FALSE),
- mHPad(0),
- mVPad(0),
- mHAlign(LLFontGL::LEFT),
- mVAlign( LLFontGL::TOP ),
- mClickedCallback(NULL),
- mCallbackUserData(NULL)
+void LLTextBox::initDefaults()
{
- setWrappedText(name_and_label);
- reshapeToFitText();
- setTabStop(FALSE);
+ mTextColor = LLUI::sColorsGroup->getColor("LabelTextColor");
+ mDisabledColor = LLUI::sColorsGroup->getColor("LabelDisabledColor");
+ mBackgroundColor = LLUI::sColorsGroup->getColor("DefaultBackgroundColor");
+ mBorderColor = LLUI::sColorsGroup->getColor("DefaultHighlightLight");
+ mHoverColor = LLUI::sColorsGroup->getColor( "LabelSelectedColor" );
+ mHoverActive = FALSE;
+ mHasHover = FALSE;
+ mBackgroundVisible = FALSE;
+ mBorderVisible = FALSE;
+ mFontStyle = LLFontGL::DROP_SHADOW_SOFT;
+ mBorderDropShadowVisible = FALSE;
+ mUseEllipses = FALSE;
+ mLineSpacing = 0;
+ mHPad = 0;
+ mVPad = 0;
+ mHAlign = LLFontGL::LEFT;
+ mVAlign = LLFontGL::TOP;
+ mClickedCallback = NULL;
+ mCallbackUserData = NULL;
}
BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -193,12 +147,14 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask)
BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask)
{
+ BOOL handled = LLView::handleHover(x,y,mask);
if(mHoverActive)
{
mHasHover = TRUE; // This should be set every frame during a hover.
- return TRUE;
+ getWindow()->setCursor(UI_CURSOR_ARROW);
}
- return LLView::handleHover(x,y,mask);
+
+ return (handled || mHasHover);
}
void LLTextBox::setText(const LLStringExplicit& text)
@@ -412,7 +368,7 @@ void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color )
mFontStyle,
line_length, getRect().getWidth(), NULL, TRUE, mUseEllipses );
cur_pos += line_length + 1;
- y -= llfloor(mFontGL->getLineHeight());
+ y -= llfloor(mFontGL->getLineHeight()) + mLineSpacing;
}
}
}
@@ -469,6 +425,8 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
text_box->initFromXML(node, parent);
+ node->getAttributeS32("line_spacing", text_box->mLineSpacing);
+
std::string font_style;
if (node->getAttributeString("font-style", font_style))
{
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index b1e8e0b7c6..c28d0e5f94 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -54,7 +54,10 @@ public:
// "Simple" constructors for text boxes that have the same name and label *TO BE DEPRECATED*
LLTextBox(const std::string& name_and_label, const LLRect& rect);
- LLTextBox(const std::string& name_and_label);
+
+ // Consolidate common member initialization
+ // 20+ initializers times 3+ constructors is unmaintainable.
+ void initDefaults();
virtual ~LLTextBox() {}
@@ -88,8 +91,7 @@ public:
void setVPad(S32 pixels) { mVPad = pixels; }
void setRightAlign() { mHAlign = LLFontGL::RIGHT; }
void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
- void setClickedCallback( void (*cb)(void *data) ){ mClickedCallback = cb; } // mouse down and up within button
- void setCallbackUserData( void* data ) { mCallbackUserData = data; }
+ void setClickedCallback( void (*cb)(void *data), void* data = NULL ){ mClickedCallback = cb; mCallbackUserData = data; } // mouse down and up within button
const LLFontGL* getFont() const { return mFontGL; }
@@ -124,6 +126,8 @@ private:
BOOL mBorderDropShadowVisible;
BOOL mUseEllipses;
+ S32 mLineSpacing;
+
S32 mHPad;
S32 mVPad;
LLFontGL::HAlign mHAlign;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 92b6cc8bb6..f2562a015d 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -3520,13 +3520,13 @@ void LLTextEditor::appendColoredText(const std::string &new_text,
style->setVisible(true);
style->setColor(color);
style->setFontName(font_name);
- appendStyledText(new_text, allow_undo, prepend_newline, &style);
+ appendStyledText(new_text, allow_undo, prepend_newline, style);
}
void LLTextEditor::appendStyledText(const std::string &new_text,
bool allow_undo,
bool prepend_newline,
- const LLStyleSP *stylep)
+ const LLStyleSP stylep)
{
if(mParseHTML)
{
@@ -3540,13 +3540,13 @@ void LLTextEditor::appendStyledText(const std::string &new_text,
html->setColor(mLinkColor);
if (stylep)
{
- html->setFontName((*stylep)->getFontString());
+ html->setFontName(stylep->getFontString());
}
html->mUnderline = TRUE;
if (start > 0) appendText(text.substr(0,start),allow_undo, prepend_newline, stylep);
html->setLinkHREF(text.substr(start,end-start));
- appendText(text.substr(start, end-start),allow_undo, prepend_newline, &html);
+ appendText(text.substr(start, end-start),allow_undo, prepend_newline, html);
if (end < (S32)text.length())
{
text = text.substr(end,text.length() - end);
@@ -3567,7 +3567,7 @@ void LLTextEditor::appendStyledText(const std::string &new_text,
// Appends new text to end of document
void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool prepend_newline,
- const LLStyleSP *stylep)
+ const LLStyleSP stylep)
{
// Save old state
BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax());
@@ -3599,7 +3599,7 @@ void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool
{
S32 segment_start = old_length;
S32 segment_end = getLength();
- LLTextSegment* segment = new LLTextSegment(*stylep, segment_start, segment_end );
+ LLTextSegment* segment = new LLTextSegment(stylep, segment_start, segment_end );
mSegments.push_back(segment);
}
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 4f41f67ce8..8209f6d798 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -139,7 +139,7 @@ public:
void insertText(const std::string &text);
// appends text at end
void appendText(const std::string &wtext, bool allow_undo, bool prepend_newline,
- const LLStyleSP *stylep = NULL);
+ const LLStyleSP stylep = NULL);
void appendColoredText(const std::string &wtext, bool allow_undo,
bool prepend_newline,
@@ -148,7 +148,7 @@ public:
// if styled text starts a line, you need to prepend a newline.
void appendStyledText(const std::string &new_text, bool allow_undo,
bool prepend_newline,
- const LLStyleSP *stylep = NULL);
+ const LLStyleSP stylep = NULL);
// Removes text from the end of document
// Does not change highlight or cursor position.
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index f1e7b98a60..a4b16dc2de 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1645,6 +1645,18 @@ void LLUI::setCursorPositionLocal(const LLView* viewp, S32 x, S32 y)
setCursorPositionScreen(screen_x, screen_y);
}
+//static
+void LLUI::getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y)
+{
+ LLCoordWindow cursor_pos_window;
+ LLView::getWindow()->getCursorPosition(&cursor_pos_window);
+ LLCoordGL cursor_pos_gl;
+ LLView::getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
+ cursor_pos_gl.mX = llround((F32)cursor_pos_gl.mX / LLUI::sGLScaleFactor.mV[VX]);
+ cursor_pos_gl.mY = llround((F32)cursor_pos_gl.mY / LLUI::sGLScaleFactor.mV[VY]);
+ viewp->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, x, y);
+}
+
// On Windows, the user typically sets the language when they install the
// app (by running it with a shortcut that sets InstallLanguage). On Mac,
// or on Windows if the SecondLife.exe executable is run directly, the
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index aa3cff433e..e2629ee2a4 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -175,6 +175,7 @@ public:
static std::string locateSkin(const std::string& filename);
static void setCursorPositionScreen(S32 x, S32 y);
static void setCursorPositionLocal(const LLView* viewp, S32 x, S32 y);
+ static void getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y);
static void setScaleFactor(const LLVector2& scale_factor);
static void setLineWidth(F32 width);
static LLUIImage* getUIImage(const std::string& name);
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index c01845e524..f7419d615b 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -551,19 +551,6 @@ LLView* LLUICtrl::fromXML(LLXMLNodePtr node, LLView* parent, class LLUICtrlFacto
}
-// *NOTE: If other classes derive from LLPanel, they will need to be
-// added to this function.
-LLPanel* LLUICtrl::getParentPanel() const
-{
- LLView* parent = getParent();
- LLPanel* parent_panel = dynamic_cast<LLPanel*>(parent);
- while (!parent_panel)
- {
- parent = parent->getParent();
- }
- return (LLPanel*)(parent);
-}
-
// Skip over any parents that are not LLUICtrl's
// Used in focus logic since only LLUICtrl elements can have focus
LLUICtrl* LLUICtrl::getParentUICtrl() const
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index 52ea37ffdd..4ad9042b9a 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -130,9 +130,7 @@ public:
void setTabStop( BOOL b );
BOOL hasTabStop() const;
- // Returns containing panel/floater or NULL if none found.
- class LLPanel* getParentPanel() const;
- class LLUICtrl* getParentUICtrl() const;
+ LLUICtrl* getParentUICtrl() const;
void* getCallbackUserData() const { return mCallbackUserData; }
void setCallbackUserData( void* data ) { mCallbackUserData = data; }
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 5b71851520..5ea9d6b5d8 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -85,7 +85,8 @@ LLView::LLView() :
mLastVisible(TRUE),
mUseBoundingRect(FALSE),
mVisible(TRUE),
- mNextInsertionOrdinal(0)
+ mNextInsertionOrdinal(0),
+ mHoverCursor(UI_CURSOR_ARROW)
{
}
@@ -102,7 +103,8 @@ LLView::LLView(const std::string& name, BOOL mouse_opaque) :
mLastVisible(TRUE),
mUseBoundingRect(FALSE),
mVisible(TRUE),
- mNextInsertionOrdinal(0)
+ mNextInsertionOrdinal(0),
+ mHoverCursor(UI_CURSOR_ARROW)
{
}
@@ -123,7 +125,8 @@ LLView::LLView(
mLastVisible(TRUE),
mUseBoundingRect(FALSE),
mVisible(TRUE),
- mNextInsertionOrdinal(0)
+ mNextInsertionOrdinal(0),
+ mHoverCursor(UI_CURSOR_ARROW)
{
}
@@ -657,7 +660,7 @@ BOOL LLView::handleHover(S32 x, S32 y, MASK mask)
if( !handled
&& blockMouseEvent(x, y) )
{
- LLUI::sWindow->setCursor(UI_CURSOR_ARROW);
+ LLUI::sWindow->setCursor(mHoverCursor);
lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl;
handled = TRUE;
}
@@ -2664,6 +2667,13 @@ void LLView::initFromXML(LLXMLNodePtr node, LLView* parent)
node->getAttributeBOOL("visible", visible);
setVisible(visible);
}
+
+ if (node->hasAttribute("hover_cursor"))
+ {
+ std::string cursor_string;
+ node->getAttributeString("hover_cursor", cursor_string);
+ mHoverCursor = getCursorFromString(cursor_string);
+ }
node->getAttributeBOOL("use_bounding_rect", mUseBoundingRect);
node->getAttributeBOOL("mouse_opaque", mMouseOpaque);
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 130c3b52f7..ff7a1afb38 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -51,6 +51,7 @@
#include "llxmlnode.h"
#include "stdenums.h"
#include "lluistring.h"
+#include "llcursortypes.h"
const U32 FOLLOWS_NONE = 0x00;
const U32 FOLLOWS_LEFT = 0x01;
@@ -649,6 +650,8 @@ private:
mutable dummy_widget_map_t mDummyWidgets;
boost::signals::connection mControlConnection;
+
+ ECursorType mHoverCursor;
public:
static BOOL sDebugRects; // Draw debug rects behind everything.