summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-02-19 21:42:32 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-02-19 21:42:32 +0000
commit2e32d44e7165775936beae5d9ef636ff9d3f2bd2 (patch)
tree8153bc399994aabf6e1c41c2d8332e4e8c4ddb78
parentdb0f5847ea8b96b3c1ac08e7aeb43d83daacb8e4 (diff)
merge svn+ssh://svn.lindenlab.com/svn/linden/qa/combo-merge-ui-2008-02-13 -r 79986 : 80178 -> release.
QAR-290 = QAR-271 + QAR-191
-rw-r--r--indra/llcommon/linden_common.h6
-rw-r--r--indra/llcommon/llmemory.h50
-rw-r--r--indra/llmath/llrect.h32
-rw-r--r--indra/llmessage/llcachename.cpp65
-rw-r--r--indra/llmessage/llcachename.h3
-rw-r--r--indra/llui/llbutton.cpp56
-rw-r--r--indra/llui/llbutton.h39
-rw-r--r--indra/llui/llcheckboxctrl.cpp2
-rw-r--r--indra/llui/llclipboard.cpp4
-rw-r--r--indra/llui/llclipboard.h18
-rw-r--r--indra/llui/llcombobox.cpp50
-rw-r--r--indra/llui/llcombobox.h16
-rw-r--r--indra/llui/llctrlselectioninterface.h12
-rw-r--r--indra/llui/lldraghandle.cpp91
-rw-r--r--indra/llui/lldraghandle.h7
-rw-r--r--indra/llui/lleditmenuhandler.cpp96
-rw-r--r--indra/llui/lleditmenuhandler.h46
-rw-r--r--indra/llui/llfloater.cpp466
-rw-r--r--indra/llui/llfloater.h172
-rw-r--r--indra/llui/llfocusmgr.cpp34
-rw-r--r--indra/llui/llfocusmgr.h33
-rw-r--r--indra/llui/lliconctrl.cpp4
-rw-r--r--indra/llui/lliconctrl.h2
-rw-r--r--indra/llui/llkeywords.cpp2
-rw-r--r--indra/llui/llkeywords.h34
-rw-r--r--indra/llui/lllineeditor.cpp214
-rw-r--r--indra/llui/lllineeditor.h143
-rw-r--r--indra/llui/llmenugl.cpp543
-rw-r--r--indra/llui/llmenugl.h268
-rw-r--r--indra/llui/llmodaldialog.cpp23
-rw-r--r--indra/llui/llmodaldialog.h8
-rw-r--r--indra/llui/llpanel.cpp231
-rw-r--r--indra/llui/llpanel.h174
-rw-r--r--indra/llui/llradiogroup.cpp24
-rw-r--r--indra/llui/llradiogroup.h41
-rw-r--r--indra/llui/llresizebar.cpp42
-rw-r--r--indra/llui/llresizebar.h11
-rw-r--r--indra/llui/llresizehandle.cpp27
-rw-r--r--indra/llui/llresizehandle.h9
-rw-r--r--indra/llui/llresmgr.h5
-rw-r--r--indra/llui/llscrollbar.cpp43
-rw-r--r--indra/llui/llscrollbar.h26
-rw-r--r--indra/llui/llscrollcontainer.cpp65
-rw-r--r--indra/llui/llscrollcontainer.h39
-rw-r--r--indra/llui/llscrollingpanellist.cpp20
-rw-r--r--indra/llui/llscrollingpanellist.h28
-rw-r--r--indra/llui/llscrolllistctrl.cpp107
-rw-r--r--indra/llui/llscrolllistctrl.h126
-rw-r--r--indra/llui/llslider.cpp30
-rw-r--r--indra/llui/llslider.h15
-rw-r--r--indra/llui/llsliderctrl.cpp31
-rw-r--r--indra/llui/llsliderctrl.h38
-rw-r--r--indra/llui/llspinctrl.cpp25
-rw-r--r--indra/llui/llspinctrl.h35
-rw-r--r--indra/llui/llstyle.cpp94
-rw-r--r--indra/llui/llstyle.h51
-rw-r--r--indra/llui/lltabcontainer.cpp2393
-rw-r--r--indra/llui/lltabcontainer.h263
-rw-r--r--indra/llui/lltextbox.cpp124
-rw-r--r--indra/llui/lltextbox.h30
-rw-r--r--indra/llui/lltexteditor.cpp820
-rw-r--r--indra/llui/lltexteditor.h314
-rw-r--r--indra/llui/llui.cpp14
-rw-r--r--indra/llui/llui.h328
-rw-r--r--indra/llui/lluictrl.cpp187
-rw-r--r--indra/llui/lluictrl.h132
-rw-r--r--indra/llui/lluictrlfactory.cpp220
-rw-r--r--indra/llui/lluictrlfactory.h125
-rw-r--r--indra/llui/lluistring.cpp12
-rw-r--r--indra/llui/lluistring.h10
-rw-r--r--indra/llui/llundo.cpp7
-rw-r--r--indra/llui/llundo.h48
-rw-r--r--indra/llui/llview.cpp1017
-rw-r--r--indra/llui/llview.h486
-rw-r--r--indra/llui/llviewborder.cpp55
-rw-r--r--indra/llui/llviewborder.h35
-rw-r--r--indra/llui/llviewquery.cpp17
-rw-r--r--indra/llui/llviewquery.h27
-rw-r--r--indra/llwindow/llmousehandler.h2
-rw-r--r--indra/llxml/llxmlnode.cpp107
-rw-r--r--indra/newview/llagent.cpp4
-rw-r--r--indra/newview/llagent.h2
-rw-r--r--indra/newview/llcallingcard.cpp17
-rw-r--r--indra/newview/llcallingcard.h12
-rw-r--r--indra/newview/llchatbar.cpp6
-rw-r--r--indra/newview/llclassifiedstatsresponder.cpp4
-rw-r--r--indra/newview/llclassifiedstatsresponder.h4
-rw-r--r--indra/newview/llcolorswatch.cpp36
-rw-r--r--indra/newview/llcolorswatch.h2
-rw-r--r--indra/newview/llfasttimerview.cpp19
-rw-r--r--indra/newview/llfilepicker.cpp2
-rw-r--r--indra/newview/llfloaterabout.cpp4
-rw-r--r--indra/newview/llfloateranimpreview.cpp51
-rw-r--r--indra/newview/llfloaterauction.cpp2
-rw-r--r--indra/newview/llfloaterauction.h2
-rw-r--r--indra/newview/llfloateravatarpicker.cpp5
-rw-r--r--indra/newview/llfloateravatartextures.cpp52
-rw-r--r--indra/newview/llfloaterbump.cpp4
-rw-r--r--indra/newview/llfloaterbuy.cpp10
-rw-r--r--indra/newview/llfloaterbuy.h2
-rw-r--r--indra/newview/llfloaterbuycontents.cpp10
-rw-r--r--indra/newview/llfloaterbuycontents.h2
-rw-r--r--indra/newview/llfloaterbuycurrency.cpp2
-rw-r--r--indra/newview/llfloaterbuyland.cpp164
-rw-r--r--indra/newview/llfloaterbuyland.h2
-rw-r--r--indra/newview/llfloaterchat.cpp53
-rw-r--r--indra/newview/llfloaterchat.h9
-rw-r--r--indra/newview/llfloaterchatterbox.cpp80
-rw-r--r--indra/newview/llfloaterchatterbox.h123
-rw-r--r--indra/newview/llfloatercolorpicker.cpp149
-rw-r--r--indra/newview/llfloaterfriends.cpp84
-rw-r--r--indra/newview/llfloaterfriends.h9
-rw-r--r--indra/newview/llfloatergesture.cpp2
-rw-r--r--indra/newview/llfloatergroupinvite.cpp2
-rw-r--r--indra/newview/llfloatergroups.h10
-rw-r--r--indra/newview/llfloaterinspect.cpp15
-rw-r--r--indra/newview/llfloaterinspect.h2
-rw-r--r--indra/newview/llfloaterlagmeter.cpp116
-rw-r--r--indra/newview/llfloaterlagmeter.h2
-rw-r--r--indra/newview/llfloaterland.cpp132
-rw-r--r--indra/newview/llfloaterland.h28
-rw-r--r--indra/newview/llfloatermap.cpp11
-rw-r--r--indra/newview/llfloaternamedesc.cpp19
-rw-r--r--indra/newview/llfloaternamedesc.h1
-rw-r--r--indra/newview/llfloateropenobject.h2
-rw-r--r--indra/newview/llfloaterpostcard.cpp8
-rw-r--r--indra/newview/llfloaterpreference.cpp6
-rw-r--r--indra/newview/llfloaterpreference.h6
-rw-r--r--indra/newview/llfloaterproperties.cpp28
-rw-r--r--indra/newview/llfloaterregioninfo.cpp50
-rw-r--r--indra/newview/llfloaterregioninfo.h6
-rw-r--r--indra/newview/llfloaterreporter.cpp2
-rw-r--r--indra/newview/llfloaterscriptdebug.cpp8
-rw-r--r--indra/newview/llfloatersellland.cpp8
-rw-r--r--indra/newview/llfloatersellland.h2
-rw-r--r--indra/newview/llfloatersnapshot.cpp50
-rw-r--r--indra/newview/llfloatertelehub.h2
-rw-r--r--indra/newview/llfloatertools.cpp44
-rw-r--r--indra/newview/llfloatertools.h6
-rw-r--r--indra/newview/llfloatertopobjects.cpp14
-rw-r--r--indra/newview/llfloatertos.cpp10
-rw-r--r--indra/newview/llfloaterurldisplay.h2
-rw-r--r--indra/newview/llfloaterurlentry.cpp15
-rw-r--r--indra/newview/llfloaterurlentry.h8
-rw-r--r--indra/newview/llfloaterworldmap.cpp24
-rw-r--r--indra/newview/llfloaterworldmap.h2
-rw-r--r--indra/newview/llfolderview.cpp168
-rw-r--r--indra/newview/llfolderview.h21
-rw-r--r--indra/newview/llglsandbox.cpp4
-rw-r--r--indra/newview/llimpanel.cpp16
-rw-r--r--indra/newview/llimpanel.h2
-rw-r--r--indra/newview/llimview.cpp42
-rw-r--r--indra/newview/llimview.h4
-rw-r--r--indra/newview/llinventorybridge.cpp4
-rw-r--r--indra/newview/llinventorybridge.h2
-rw-r--r--indra/newview/lljoystickbutton.cpp50
-rw-r--r--indra/newview/lljoystickbutton.h2
-rw-r--r--indra/newview/llmanip.h4
-rw-r--r--indra/newview/llmemoryview.cpp4
-rw-r--r--indra/newview/llnamebox.cpp15
-rw-r--r--indra/newview/llnameeditor.cpp14
-rw-r--r--indra/newview/llnamelistctrl.cpp43
-rw-r--r--indra/newview/llnetmap.cpp85
-rw-r--r--indra/newview/llnetmap.h2
-rw-r--r--indra/newview/lloverlaybar.cpp2
-rw-r--r--indra/newview/llpanelavatar.cpp85
-rw-r--r--indra/newview/llpanelavatar.h5
-rw-r--r--indra/newview/llpanelclassified.cpp32
-rw-r--r--indra/newview/llpanelclassified.h4
-rw-r--r--indra/newview/llpanelface.cpp14
-rw-r--r--indra/newview/llpanelgroup.cpp43
-rw-r--r--indra/newview/llpanelgroup.h6
-rw-r--r--indra/newview/llpanelgroupgeneral.cpp52
-rw-r--r--indra/newview/llpanelgroupinvite.cpp16
-rw-r--r--indra/newview/llpanelgrouplandmoney.cpp72
-rw-r--r--indra/newview/llpanelgroupnotices.cpp43
-rw-r--r--indra/newview/llpanelgrouproles.cpp103
-rw-r--r--indra/newview/llpanelgrouproles.h4
-rw-r--r--indra/newview/llpanellandmedia.cpp8
-rw-r--r--indra/newview/llpanellandmedia.h7
-rw-r--r--indra/newview/llpanellogin.cpp34
-rw-r--r--indra/newview/llpanelobject.cpp8
-rw-r--r--indra/newview/llpanelpermissions.cpp14
-rw-r--r--indra/newview/llpanelpick.cpp4
-rw-r--r--indra/newview/llpanelplace.cpp21
-rw-r--r--indra/newview/llpanelvolume.cpp14
-rw-r--r--indra/newview/llparcelselection.cpp5
-rw-r--r--indra/newview/llparcelselection.h2
-rw-r--r--indra/newview/llpreview.cpp23
-rw-r--r--indra/newview/llpreview.h8
-rw-r--r--indra/newview/llpreviewanim.cpp8
-rw-r--r--indra/newview/llpreviewgesture.cpp16
-rw-r--r--indra/newview/llpreviewnotecard.cpp6
-rw-r--r--indra/newview/llpreviewscript.cpp84
-rw-r--r--indra/newview/llpreviewscript.h4
-rw-r--r--indra/newview/llpreviewtexture.cpp20
-rw-r--r--indra/newview/llprogressview.cpp16
-rw-r--r--indra/newview/llremoteparcelrequest.cpp6
-rw-r--r--indra/newview/llremoteparcelrequest.h6
-rw-r--r--indra/newview/llselectmgr.cpp54
-rw-r--r--indra/newview/llselectmgr.h14
-rw-r--r--indra/newview/llstatusbar.cpp33
-rw-r--r--indra/newview/llstatusbar.h33
-rw-r--r--indra/newview/lltexturectrl.cpp47
-rw-r--r--indra/newview/lltexturectrl.h3
-rw-r--r--indra/newview/lltextureview.cpp11
-rw-r--r--indra/newview/lltool.cpp1
-rw-r--r--indra/newview/lltool.h2
-rw-r--r--indra/newview/lltoolbar.cpp8
-rw-r--r--indra/newview/lltoolbrush.h6
-rw-r--r--indra/newview/lltoolcomp.cpp8
-rw-r--r--indra/newview/lltoolfocus.cpp1
-rw-r--r--indra/newview/lltoolpie.cpp2
-rw-r--r--indra/newview/lltoolpie.h2
-rw-r--r--indra/newview/lltoolselect.cpp3
-rw-r--r--indra/newview/lltoolselect.h2
-rw-r--r--indra/newview/lltoolselectland.h2
-rw-r--r--indra/newview/lltoolview.cpp3
-rw-r--r--indra/newview/lluploaddialog.cpp16
-rw-r--r--indra/newview/lluploaddialog.h2
-rw-r--r--indra/newview/llviewercontrol.cpp10
-rw-r--r--indra/newview/llviewerkeyboard.cpp7
-rw-r--r--indra/newview/llviewermedia.cpp9
-rw-r--r--indra/newview/llviewermenu.cpp149
-rw-r--r--indra/newview/llviewermenu.h8
-rw-r--r--indra/newview/llviewermessage.cpp65
-rw-r--r--indra/newview/llviewerparcelmedia.cpp2
-rw-r--r--indra/newview/llviewerparcelmgr.cpp11
-rw-r--r--indra/newview/llviewerparcelmgr.h2
-rw-r--r--indra/newview/llviewertexteditor.cpp188
-rw-r--r--indra/newview/llviewertexteditor.h36
-rw-r--r--indra/newview/llviewerwindow.cpp39
-rw-r--r--indra/newview/llworldmapview.cpp40
233 files changed, 6692 insertions, 7623 deletions
diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h
index 39ee014241..504552a9d2 100644
--- a/indra/llcommon/linden_common.h
+++ b/indra/llcommon/linden_common.h
@@ -58,6 +58,12 @@
#ifdef LL_WINDOWS
#pragma warning (3 : 4702) // we like level 3, not 4
+// level 4 warnings that we need to disable:
+#pragma warning (disable : 4100) // unreferenced formal parameter
+#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) )
+#pragma warning (disable : 4244) // possible loss of data on conversions
+#pragma warning (disable : 4512) // assignment operator could not be generated
+#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) )
#endif // LL_WINDOWS
// Linden only libs in alpha-order other than stdtypes.h
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index b72046c104..b0a47b6820 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -243,25 +243,25 @@ protected:
// Expands LLPointer to return a pointer to a special instance of class Type instead of NULL.
// This is useful in instances where operations on NULL pointers are semantically safe and/or
// when error checking occurs at a different granularity or in a different part of the code
-// than when referencing an object via a LLHandle.
+// than when referencing an object via a LLSafeHandle.
//
template <class Type>
-class LLHandle
+class LLSafeHandle
{
public:
- LLHandle() :
+ LLSafeHandle() :
mPointer(NULL)
{
}
- LLHandle(Type* ptr) :
+ LLSafeHandle(Type* ptr) :
mPointer(NULL)
{
assign(ptr);
}
- LLHandle(const LLHandle<Type>& ptr) :
+ LLSafeHandle(const LLSafeHandle<Type>& ptr) :
mPointer(NULL)
{
assign(ptr.mPointer);
@@ -269,13 +269,13 @@ public:
// support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass>
- LLHandle(const LLHandle<Subclass>& ptr) :
+ LLSafeHandle(const LLSafeHandle<Subclass>& ptr) :
mPointer(NULL)
{
assign(ptr.get());
}
- ~LLHandle()
+ ~LLSafeHandle()
{
unref();
}
@@ -300,17 +300,17 @@ public:
operator const Type*() const { return mPointer; }
bool operator !=(Type* ptr) const { return (mPointer != ptr); }
bool operator ==(Type* ptr) const { return (mPointer == ptr); }
- bool operator ==(const LLHandle<Type>& ptr) const { return (mPointer == ptr.mPointer); }
- bool operator < (const LLHandle<Type>& ptr) const { return (mPointer < ptr.mPointer); }
- bool operator > (const LLHandle<Type>& ptr) const { return (mPointer > ptr.mPointer); }
+ bool operator ==(const LLSafeHandle<Type>& ptr) const { return (mPointer == ptr.mPointer); }
+ bool operator < (const LLSafeHandle<Type>& ptr) const { return (mPointer < ptr.mPointer); }
+ bool operator > (const LLSafeHandle<Type>& ptr) const { return (mPointer > ptr.mPointer); }
- LLHandle<Type>& operator =(Type* ptr)
+ LLSafeHandle<Type>& operator =(Type* ptr)
{
assign(ptr);
return *this;
}
- LLHandle<Type>& operator =(const LLHandle<Type>& ptr)
+ LLSafeHandle<Type>& operator =(const LLSafeHandle<Type>& ptr)
{
assign(ptr.mPointer);
return *this;
@@ -318,7 +318,7 @@ public:
// support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass>
- LLHandle<Type>& operator =(const LLHandle<Subclass>& ptr)
+ LLSafeHandle<Type>& operator =(const LLSafeHandle<Subclass>& ptr)
{
assign(ptr.get());
return *this;
@@ -399,11 +399,25 @@ protected:
//----------------------------------------------------------------------------
-// LLSingleton implements the getInstance() method part of the Singleton pattern. It can't make
-// the derived class constructors protected, though, so you have to do that yourself.
-// The proper way to use LLSingleton is to inherit from it while using the typename that you'd
-// like to be static as the template parameter, like so:
-// class FooBar: public LLSingleton<FooBar>
+// LLSingleton implements the getInstance() method part of the Singleton
+// pattern. It can't make the derived class constructors protected, though, so
+// you have to do that yourself.
+//
+// There are two ways to use LLSingleton. The first way is to inherit from it
+// while using the typename that you'd like to be static as the template
+// parameter, like so:
+//
+// class Foo: public LLSingleton<Foo>{};
+//
+// Foo* instance = Foo::getInstance();
+//
+// The second way is to define a seperate class that exposes the singleton
+// interface:
+//
+// class FooSingleton: public LLSingleton<Foo>{};
+//
+// Foo* instance = FooSingleton::getInstance();
+//
// As currently written, it is not thread-safe.
template <typename T>
class LLSingleton
diff --git a/indra/llmath/llrect.h b/indra/llmath/llrect.h
index e7b15dcc58..1fa5a741d5 100644
--- a/indra/llmath/llrect.h
+++ b/indra/llmath/llrect.h
@@ -152,68 +152,74 @@ public:
mBottom <= rect->mTop && rect->mBottom <= mTop ;
}
- void set(Type left, Type top, Type right, Type bottom)
+ LLRectBase& set(Type left, Type top, Type right, Type bottom)
{
mLeft = left;
mTop = top;
mRight = right;
mBottom = bottom;
+ return *this;
}
// Note: follows GL_QUAD conventions: the top and right edges are not considered part of the rect
- void setOriginAndSize( Type left, Type bottom, Type width, Type height)
+ LLRectBase& setOriginAndSize( Type left, Type bottom, Type width, Type height)
{
mLeft = left;
mTop = bottom + height;
mRight = left + width;
mBottom = bottom;
+ return *this;
}
// Note: follows GL_QUAD conventions: the top and right edges are not considered part of the rect
- void setLeftTopAndSize( Type left, Type top, Type width, Type height)
+ LLRectBase& setLeftTopAndSize( Type left, Type top, Type width, Type height)
{
mLeft = left;
mTop = top;
mRight = left + width;
mBottom = top - height;
+ return *this;
}
- void setCenterAndSize(Type x, Type y, Type width, Type height)
+ LLRectBase& setCenterAndSize(Type x, Type y, Type width, Type height)
{
mLeft = x - width/2;
mTop = y + height/2;
mRight = x + width/2;
mBottom = y - height/2;
+ return *this;
}
- void translate(Type horiz, Type vertical)
+ LLRectBase& translate(Type horiz, Type vertical)
{
mLeft += horiz;
mRight += horiz;
mTop += vertical;
mBottom += vertical;
+ return *this;
}
- void stretch( Type dx, Type dy)
+ LLRectBase& stretch( Type dx, Type dy)
{
mLeft -= dx;
mRight += dx;
mTop += dy;
mBottom -= dy;
- makeValid();
+ return makeValid();
}
- void stretch( Type delta )
+ LLRectBase& stretch( Type delta )
{
stretch(delta, delta);
-
+ return *this;
}
- void makeValid()
+ LLRectBase& makeValid()
{
mLeft = llmin(mLeft, mRight);
mBottom = llmin(mBottom, mTop);
+ return *this;
}
bool isNull() const
@@ -221,15 +227,16 @@ public:
return mLeft == mRight || mBottom == mTop;
}
- void unionWith(const LLRectBase &other)
+ LLRectBase& unionWith(const LLRectBase &other)
{
mLeft = llmin(mLeft, other.mLeft);
mRight = llmax(mRight, other.mRight);
mBottom = llmin(mBottom, other.mBottom);
mTop = llmax(mTop, other.mTop);
+ return *this;
}
- void intersectWith(const LLRectBase &other)
+ LLRectBase& intersectWith(const LLRectBase &other)
{
mLeft = llmax(mLeft, other.mLeft);
mRight = llmin(mRight, other.mRight);
@@ -243,6 +250,7 @@ public:
{
mBottom = mTop;
}
+ return *this;
}
friend std::ostream &operator<<(std::ostream &s, const LLRectBase &rect)
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 3472c3eb5d..274bf5cc04 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -46,8 +46,6 @@
const char* CN_WAITING = "(waiting)";
const char* CN_NOBODY = "(nobody)";
const char* CN_NONE = "(none)";
-const char* CN_HIPPOS = "(hippos)";
-const F32 HIPPO_PROBABILITY = 0.01f;
// llsd serialization constants
static const std::string AGENTS("agents");
@@ -498,35 +496,26 @@ void LLCacheName::exportFile(std::ostream& ostr)
}
-BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last)
+BOOL LLCacheName::getName(const LLUUID& id, std::string& first, std::string& last)
{
if(id.isNull())
{
- // The function signature needs to change to pass in the
- // length of first and last.
- strcpy(first, CN_NOBODY); /*Flawfinder: ignore*/
- last[0] = '\0';
+ first = CN_NOBODY;
+ last.clear();
return FALSE;
}
LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id );
if (entry)
{
- // The function signature needs to change to pass in the
- // length of first and last.
- strcpy(first, entry->mFirstName); /*Flawfinder: ignore*/
- strcpy(last, entry->mLastName); /*Flawfinder: ignore*/
+ first = entry->mFirstName;
+ last = entry->mLastName;
return TRUE;
}
else
{
- //The function signature needs to change to pass in the
- //length of first and last.
- strcpy(first,(ll_frand() < HIPPO_PROBABILITY)
- ? CN_HIPPOS
- : CN_WAITING);
- strcpy(last, ""); /*Flawfinder: ignore*/
-
+ first = CN_WAITING;
+ last.clear();
if (!impl.isRequestPending(id))
{
impl.mAskNameQueue.insert(id);
@@ -536,15 +525,29 @@ BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last)
}
+BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname)
+{
+ std::string first_name, last_name;
+ BOOL res = getName(id, first_name, last_name);
+ fullname = first_name + " " + last_name;
+ return res;
+}
+// *TODO: Deprecate
+BOOL LLCacheName::getName(const LLUUID& id, char* first, char* last)
+{
+ std::string first_name, last_name;
+ BOOL res = getName(id, first_name, last_name);
+ strcpy(first, first_name.c_str());
+ strcpy(last, last_name.c_str());
+ return res;
+}
-BOOL LLCacheName::getGroupName(const LLUUID& id, char* group)
+BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
{
if(id.isNull())
{
- // The function signature needs to change to pass in the
- // length of first and last.
- strcpy(group, CN_NONE); /*Flawfinder: ignore*/
+ group = CN_NONE;
return FALSE;
}
@@ -560,16 +563,12 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, char* group)
if (entry)
{
- // The function signature needs to change to pass in the length
- // of group.
- strcpy(group, entry->mGroupName); /*Flawfinder: ignore*/
+ group = entry->mGroupName;
return TRUE;
}
else
{
- // The function signature needs to change to pass in the length
- // of first and last.
- strcpy(group, CN_WAITING); /*Flawfinder: ignore*/
+ group = CN_WAITING;
if (!impl.isRequestPending(id))
{
impl.mAskGroupQueue.insert(id);
@@ -578,6 +577,16 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, char* group)
}
}
+// *TODO: Deprecate
+BOOL LLCacheName::getGroupName(const LLUUID& id, char* group)
+{
+ std::string group_name;
+ BOOL res = getGroupName(id, group_name);
+ strcpy(group, group_name.c_str());
+ return res;
+}
+
+
// TODO: Make the cache name callback take a SINGLE std::string,
// not a separate first and last name.
void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data)
diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h
index 4eae6365bc..d9518e0f91 100644
--- a/indra/llmessage/llcachename.h
+++ b/indra/llmessage/llcachename.h
@@ -76,12 +76,15 @@ public:
// If not available, copies the string "waiting".
// Returns TRUE iff available.
BOOL getName(const LLUUID& id, char* first, char* last);
+ BOOL getName(const LLUUID& id, std::string& first, std::string& last);
+ BOOL getFullName(const LLUUID& id, std::string& fullname);
// If available, this method copies the group name into the string
// provided. The caller must allocate at least
// DB_GROUP_NAME_BUF_SIZE characters. If not available, this
// method copies the string "waiting". Returns TRUE iff available.
BOOL getGroupName(const LLUUID& id, char* group);
+ BOOL getGroupName(const LLUUID& id, std::string& group);
// Call the callback with the group or avatar name.
// If the data is currently available, may call the callback immediatly
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index ce3a4b64c7..6c27ccc037 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -189,7 +189,7 @@ void LLButton::init(void (*click_callback)(void*), void *callback_data, const LL
mGLFont = ( font ? font : LLFontGL::sSansSerif);
// Hack to make sure there is space for at least one character
- if (mRect.getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(" "))
+ if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(" "))
{
// Use old defaults
mLeftHPad = LLBUTTON_ORIG_H_PAD;
@@ -252,12 +252,12 @@ void LLButton::onCommit()
(*mMouseUpCallback)(mCallbackUserData);
}
- if (mSoundFlags & MOUSE_DOWN)
+ if (getSoundFlags() & MOUSE_DOWN)
{
make_ui_sound("UISndClick");
}
- if (mSoundFlags & MOUSE_UP)
+ if (getSoundFlags() & MOUSE_UP)
{
make_ui_sound("UISndClickRelease");
}
@@ -279,7 +279,7 @@ void LLButton::onCommit()
BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent)
{
BOOL handled = FALSE;
- if( getVisible() && mEnabled && !called_from_parent && ' ' == uni_char && !gKeyboard->getKeyRepeated(' '))
+ if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char && !gKeyboard->getKeyRepeated(' '))
{
if (mIsToggle)
{
@@ -298,7 +298,7 @@ BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent)
BOOL LLButton::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent )
{
BOOL handled = FALSE;
- if( getVisible() && mEnabled && !called_from_parent )
+ if( getVisible() && getEnabled() && !called_from_parent )
{
if( mCommitOnReturn && KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key))
{
@@ -337,7 +337,7 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask)
mMouseDownTimer.start();
mMouseDownFrame = LLFrameTimer::getFrameCount();
- if (mSoundFlags & MOUSE_DOWN)
+ if (getSoundFlags() & MOUSE_DOWN)
{
make_ui_sound("UISndClick");
}
@@ -367,7 +367,7 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask)
// If mouseup in the widget, it's been clicked
if (pointInView(x, y))
{
- if (mSoundFlags & MOUSE_UP)
+ if (getSoundFlags() & MOUSE_UP)
{
make_ui_sound("UISndClickRelease");
}
@@ -400,7 +400,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
if (mMouseDownTimer.getStarted() && NULL != mHeldDownCallback)
{
- F32 elapsed = mMouseDownTimer.getElapsedTimeF32();
+ F32 elapsed = getHeldDownTime();
if( mHeldDownDelay <= elapsed && mHeldDownFrameDelay <= LLFrameTimer::getFrameCount() - mMouseDownFrame)
{
mHeldDownCallback( mCallbackUserData );
@@ -505,11 +505,11 @@ void LLButton::draw()
// enabled and tentative
// or
// disabled but checked
- if (!mImageDisabledSelected.isNull() && ( (mEnabled && mTentative) || (!mEnabled && pressed ) ) )
+ if (!mImageDisabledSelected.isNull() && ( (getEnabled() && getTentative()) || (!getEnabled() && pressed ) ) )
{
mImagep = mImageDisabledSelected;
}
- else if (!mImageDisabled.isNull() && !mEnabled && !pressed)
+ else if (!mImageDisabled.isNull() && !getEnabled() && !pressed)
{
mImagep = mImageDisabled;
}
@@ -523,7 +523,7 @@ void LLButton::draw()
LLColor4 label_color;
// label changes when button state changes, not when pressed
- if ( mEnabled )
+ if ( getEnabled() )
{
if ( mToggleState )
{
@@ -551,7 +551,7 @@ void LLButton::draw()
if( mToggleState )
{
- if( mEnabled || mDisabledSelectedLabel.empty() )
+ if( getEnabled() || mDisabledSelectedLabel.empty() )
{
label = mSelectedLabel;
}
@@ -562,7 +562,7 @@ void LLButton::draw()
}
else
{
- if( mEnabled || mDisabledLabel.empty() )
+ if( getEnabled() || mDisabledLabel.empty() )
{
label = mUnselectedLabel;
}
@@ -573,7 +573,7 @@ void LLButton::draw()
}
// draw default button border
- if (mEnabled && mBorderEnabled && gFocusMgr.getAppHasFocus()) // because we're the default button in a panel
+ if (getEnabled() && mBorderEnabled && gFocusMgr.getAppHasFocus()) // because we're the default button in a panel
{
drawBorder(LLUI::sColorsGroup->getColor( "ButtonBorderColor" ), BORDER_SIZE);
}
@@ -598,7 +598,7 @@ void LLButton::draw()
// Otherwise draw basic rectangular button.
if( mImagep.notNull() && !mScaleImage)
{
- mImagep->draw(0, 0, mEnabled ? mImageColor : mDisabledImageColor );
+ mImagep->draw(0, 0, getEnabled() ? mImageColor : mDisabledImageColor );
if (mCurGlowStrength > 0.01f)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
@@ -609,26 +609,26 @@ void LLButton::draw()
else
if ( mImagep.notNull() && mScaleImage)
{
- mImagep->draw(0, 0, mRect.getWidth(), mRect.getHeight(), mEnabled ? mImageColor : mDisabledImageColor );
+ mImagep->draw(0, 0, getRect().getWidth(), getRect().getHeight(), getEnabled() ? mImageColor : mDisabledImageColor );
if (mCurGlowStrength > 0.01f)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- mImagep->drawSolid(0, 0, mRect.getWidth(), mRect.getHeight(), LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
+ mImagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
else
{
// no image
- llwarns << "No image for button " << mName << llendl;
+ llwarns << "No image for button " << getName() << llendl;
// draw it in pink so we can find it
- gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0, LLColor4::pink1, FALSE);
+ gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4::pink1, FALSE);
}
// let overlay image and text play well together
S32 text_left = mLeftHPad;
- S32 text_right = mRect.getWidth() - mRightHPad;
- S32 text_width = mRect.getWidth() - mLeftHPad - mRightHPad;
+ S32 text_right = getRect().getWidth() - mRightHPad;
+ S32 text_width = getRect().getWidth() - mLeftHPad - mRightHPad;
// draw overlay image
if (mImageOverlay.notNull())
@@ -637,7 +637,7 @@ void LLButton::draw()
S32 overlay_width = mImageOverlay->getWidth();
S32 overlay_height = mImageOverlay->getHeight();
- F32 scale_factor = llmin((F32)mRect.getWidth() / (F32)overlay_width, (F32)mRect.getHeight() / (F32)overlay_height, 1.f);
+ F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f);
overlay_width = llround((F32)overlay_width * scale_factor);
overlay_height = llround((F32)overlay_height * scale_factor);
@@ -682,7 +682,7 @@ void LLButton::draw()
text_right -= overlay_width + 1;
text_width -= overlay_width + 1;
mImageOverlay->draw(
- mRect.getWidth() - mRightHPad - overlay_width,
+ getRect().getWidth() - mRightHPad - overlay_width,
center_y - (overlay_height / 2),
overlay_width,
overlay_height,
@@ -706,7 +706,7 @@ void LLButton::draw()
x = text_right;
break;
case LLFontGL::HCENTER:
- x = mRect.getWidth() / 2;
+ x = getRect().getWidth() / 2;
break;
case LLFontGL::LEFT:
default:
@@ -714,7 +714,7 @@ void LLButton::draw()
break;
}
- S32 y_offset = 2 + (mRect.getHeight() - 20)/2;
+ S32 y_offset = 2 + (getRect().getHeight() - 20)/2;
if (pressed)
{
@@ -743,8 +743,8 @@ void LLButton::draw()
void LLButton::drawBorder(const LLColor4& color, S32 size)
{
S32 left = -size;
- S32 top = mRect.getHeight() + size;
- S32 right = mRect.getWidth() + size;
+ S32 top = getRect().getHeight() + size;
+ S32 right = getRect().getWidth() + size;
S32 bottom = -size;
if (mImagep.isNull())
@@ -1146,7 +1146,7 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
return button;
}
-void LLButton::setHelpURLCallback(std::string help_url)
+void LLButton::setHelpURLCallback(const LLString &help_url)
{
mHelpURL = help_url;
setClickedCallback(clicked_help,this);
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 0e140a45a6..a181fbbf56 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -52,10 +52,14 @@ extern S32 LLBUTTON_V_PAD;
extern S32 BTN_HEIGHT_SMALL;
extern S32 BTN_HEIGHT;
-
// All button widths should be rounded up to this size
extern S32 BTN_GRID;
+//
+// Helpful functions
+//
+S32 round_up(S32 grid, S32 value);
+
class LLUICtrlFactory;
@@ -124,6 +128,7 @@ public:
BOOL getFlashing() const { return mFlashing; }
void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
+ LLFontGL::HAlign getHAlign() const { return mHAlign; }
void setLeftHPad( S32 pad ) { mLeftHPad = pad; }
void setRightHPad( S32 pad ) { mRightHPad = pad; }
@@ -162,6 +167,7 @@ public:
void setFont(const LLFontGL *font)
{ mGLFont = ( font ? font : LLFontGL::sSansSerif); }
void setScaleImage(BOOL scale) { mScaleImage = scale; }
+ BOOL getScaleImage() const { return mScaleImage; }
void setDropShadowedText(BOOL b) { mDropShadowedText = b; }
@@ -171,9 +177,10 @@ public:
void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; }
-public:
void setImageUnselected(const LLString &image_name);
+ const LLString& getImageUnselectedName() const { return mImageUnselectedName; }
void setImageSelected(const LLString &image_name);
+ const LLString& getImageSelectedName() const { return mImageSelectedName; }
void setImageHoverSelected(const LLString &image_name);
void setImageHoverUnselected(const LLString &image_name);
void setImageDisabled(const LLString &image_name);
@@ -187,14 +194,29 @@ public:
void setImageDisabledSelected(LLPointer<LLUIImage> image);
void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; }
- BOOL getCommitOnReturn() { return mCommitOnReturn; }
+ BOOL getCommitOnReturn() const { return mCommitOnReturn; }
+
+ void setHelpURLCallback(const LLString &help_url);
+ const LLString& getHelpURL() const { return mHelpURL; }
- void setHelpURLCallback(std::string help_url);
- LLString getHelpURL() { return mHelpURL; }
protected:
+
virtual void drawBorder(const LLColor4& color, S32 size);
-protected:
+ void setImageUnselectedID(const LLUUID &image_id);
+ const LLUUID& getImageUnselectedID() const { return mImageUnselectedID; }
+ void setImageSelectedID(const LLUUID &image_id);
+ const LLUUID& getImageSelectedID() const { return mImageSelectedID; }
+ void setImageHoverSelectedID(const LLUUID &image_id);
+ void setImageHoverUnselectedID(const LLUUID &image_id);
+ void setImageDisabledID(const LLUUID &image_id);
+ void setImageDisabledSelectedID(const LLUUID &image_id);
+ const LLPointer<LLUIImage>& getImageUnselected() const { return mImageUnselected; }
+ const LLPointer<LLUIImage>& getImageSelected() const { return mImageSelected; }
+
+ LLFrameTimer mMouseDownTimer;
+
+private:
void (*mClickedCallback)(void* data );
void (*mMouseDownCallback)(void *data);
@@ -203,7 +225,6 @@ protected:
const LLFontGL *mGLFont;
- LLFrameTimer mMouseDownTimer;
S32 mMouseDownFrame;
F32 mHeldDownDelay; // seconds, after which held-down callbacks get called
S32 mHeldDownFrameDelay; // frames, after which held-down callbacks get called
@@ -232,7 +253,6 @@ protected:
LLUIString mDisabledSelectedLabel;
LLColor4 mDisabledSelectedLabelColor;
-
LLUUID mImageUnselectedID;
LLUUID mImageSelectedID;
LLUUID mImageHoverSelectedID;
@@ -280,7 +300,4 @@ protected:
LLFrameTimer mFlashingTimer;
};
-// Helpful functions
-S32 round_up(S32 grid, S32 value);
-
#endif // LL_LLBUTTON_H
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index b0a7e9d27f..536e9a6dc6 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -212,7 +212,7 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
void LLCheckBoxCtrl::draw()
{
- if (mEnabled)
+ if (getEnabled())
{
mLabel->setColor( mTextEnabledColor );
}
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp
index fc3967f5bf..b5c46cdff1 100644
--- a/indra/llui/llclipboard.cpp
+++ b/indra/llui/llclipboard.cpp
@@ -61,7 +61,7 @@ void LLClipboard::copyFromSubstring(const LLWString &src, S32 pos, S32 len, cons
}
-LLWString LLClipboard::getPasteWString( LLUUID* source_id )
+const LLWString& LLClipboard::getPasteWString( LLUUID* source_id )
{
if( mSourceID.notNull() )
{
@@ -88,7 +88,7 @@ LLWString LLClipboard::getPasteWString( LLUUID* source_id )
}
-BOOL LLClipboard::canPasteString()
+BOOL LLClipboard::canPasteString() const
{
return LLView::getWindow()->isClipboardTextAvailable();
}
diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h
index 999a17acc2..31ebd04826 100644
--- a/indra/llui/llclipboard.h
+++ b/indra/llui/llclipboard.h
@@ -36,24 +36,20 @@
#include "llstring.h"
#include "lluuid.h"
-//
-// Classes
-//
+
class LLClipboard
{
-protected:
- LLUUID mSourceID;
- LLWString mString;
-
public:
LLClipboard();
~LLClipboard();
void copyFromSubstring(const LLWString &copy_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null );
-
-
- BOOL canPasteString();
- LLWString getPasteWString(LLUUID* source_id = NULL);
+ BOOL canPasteString() const;
+ const LLWString& getPasteWString(LLUUID* source_id = NULL);
+
+private:
+ LLUUID mSourceID;
+ LLWString mString;
};
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 28237823dd..250ca523d2 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -99,7 +99,7 @@ LLComboBox::LLComboBox( const LLString& name, const LLRect &rect, const LLString
mList->setCommitOnKeyboardMovement(FALSE);
addChild(mList);
- LLRect border_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
+ LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
mBorder = new LLViewBorder( "combo border", border_rect );
addChild( mBorder );
mBorder->setFollowsAll();
@@ -444,7 +444,7 @@ void LLComboBox::setButtonVisible(BOOL visible)
mButton->setVisible(visible);
if (mTextEntry)
{
- LLRect text_entry_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
+ LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
if (visible)
{
text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth(0)) + 2 * LLUI::sConfigGroup->getS32("DropShadowButton");
@@ -460,7 +460,7 @@ void LLComboBox::draw()
{
mBorder->setKeyboardFocusHighlight(hasFocus());
- mButton->setEnabled(mEnabled /*&& !mList->isEmpty()*/);
+ mButton->setEnabled(getEnabled() /*&& !mList->isEmpty()*/);
// Draw children normally
LLUICtrl::draw();
@@ -494,13 +494,13 @@ void LLComboBox::updateLayout()
if (mAllowTextEntry)
{
S32 shadow_size = LLUI::sConfigGroup->getS32("DropShadowButton");
- mButton->setRect(LLRect( mRect.getWidth() - llmax(8,mArrowImage->getWidth(0)) - 2 * shadow_size,
+ mButton->setRect(LLRect( getRect().getWidth() - llmax(8,mArrowImage->getWidth(0)) - 2 * shadow_size,
rect.mTop, rect.mRight, rect.mBottom));
mButton->setTabStop(FALSE);
if (!mTextEntry)
{
- LLRect text_entry_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
+ LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth(0)) + 2 * LLUI::sConfigGroup->getS32("DropShadowButton");
// clear label on button
LLString cur_label = mButton->getLabelSelected();
@@ -575,7 +575,7 @@ void LLComboBox::showList()
LLRect rect = mList->getRect();
- S32 min_width = mRect.getWidth();
+ S32 min_width = getRect().getWidth();
S32 max_width = llmax(min_width, MAX_COMBO_WIDTH);
S32 list_width = llclamp(mList->getMaxContentWidth(), min_width, max_width);
@@ -589,7 +589,7 @@ void LLComboBox::showList()
else
{
// stack on top or bottom, depending on which has more room
- if (-root_view_local.mBottom > root_view_local.mTop - mRect.getHeight())
+ if (-root_view_local.mBottom > root_view_local.mTop - getRect().getHeight())
{
// Move rect so it hangs off the bottom of this view
rect.setLeftTopAndSize(0, 0, list_width, llmin(-root_view_local.mBottom, rect.getHeight()));
@@ -597,21 +597,21 @@ void LLComboBox::showList()
else
{
// move rect so it stacks on top of this view (clipped to size of screen)
- rect.setOriginAndSize(0, mRect.getHeight(), list_width, llmin(root_view_local.mTop - mRect.getHeight(), rect.getHeight()));
+ rect.setOriginAndSize(0, getRect().getHeight(), list_width, llmin(root_view_local.mTop - getRect().getHeight(), rect.getHeight()));
}
}
}
else // ABOVE
{
- if (rect.getHeight() <= root_view_local.mTop - mRect.getHeight())
+ if (rect.getHeight() <= root_view_local.mTop - getRect().getHeight())
{
// move rect so it stacks on top of this view (clipped to size of screen)
- rect.setOriginAndSize(0, mRect.getHeight(), list_width, llmin(root_view_local.mTop - mRect.getHeight(), rect.getHeight()));
+ rect.setOriginAndSize(0, getRect().getHeight(), list_width, llmin(root_view_local.mTop - getRect().getHeight(), rect.getHeight()));
}
else
{
// stack on top or bottom, depending on which has more room
- if (-root_view_local.mBottom > root_view_local.mTop - mRect.getHeight())
+ if (-root_view_local.mBottom > root_view_local.mTop - getRect().getHeight())
{
// Move rect so it hangs off the bottom of this view
rect.setLeftTopAndSize(0, 0, list_width, llmin(-root_view_local.mBottom, rect.getHeight()));
@@ -619,7 +619,7 @@ void LLComboBox::showList()
else
{
// move rect so it stacks on top of this view (clipped to size of screen)
- rect.setOriginAndSize(0, mRect.getHeight(), list_width, llmin(root_view_local.mTop - mRect.getHeight(), rect.getHeight()));
+ rect.setOriginAndSize(0, getRect().getHeight(), list_width, llmin(root_view_local.mTop - getRect().getHeight(), rect.getHeight()));
}
}
@@ -752,15 +752,15 @@ BOOL LLComboBox::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_
{
tool_tip = getShowNamesToolTip();
}
- else if (!mToolTipMsg.empty())
- {
- tool_tip = mToolTipMsg;
- }
else
{
- tool_tip = getValue().asString();
+ tool_tip = getToolTip();
+ if (tool_tip.empty())
+ {
+ tool_tip = getValue().asString();
+ }
}
-
+
if( !tool_tip.empty() )
{
msg = tool_tip;
@@ -770,7 +770,7 @@ BOOL LLComboBox::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_
0, 0,
&(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
localPointToScreen(
- mRect.getWidth(), mRect.getHeight(),
+ getRect().getWidth(), getRect().getHeight(),
&(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) );
}
return TRUE;
@@ -1037,11 +1037,11 @@ BOOL LLComboBox::setCurrentByID(const LLUUID& id)
return found;
}
-LLUUID LLComboBox::getCurrentID()
+LLUUID LLComboBox::getCurrentID() const
{
return mList->getStringUUIDSelectedItem();
}
-BOOL LLComboBox::setSelectedByValue(LLSD value, BOOL selected)
+BOOL LLComboBox::setSelectedByValue(const LLSD& value, BOOL selected)
{
BOOL found = mList->setSelectedByValue(value, selected);
if (found)
@@ -1056,7 +1056,7 @@ LLSD LLComboBox::getSelectedValue()
return mList->getSelectedValue();
}
-BOOL LLComboBox::isSelected(LLSD value)
+BOOL LLComboBox::isSelected(const LLSD& value) const
{
return mList->isSelected(value);
}
@@ -1190,14 +1190,14 @@ void LLFlyoutButton::updateLayout()
{
LLComboBox::updateLayout();
- mButton->setOrigin(mRect.getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, 0);
- mButton->reshape(FLYOUT_BUTTON_ARROW_WIDTH, mRect.getHeight());
+ mButton->setOrigin(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, 0);
+ mButton->reshape(FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight());
mButton->setFollows(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM);
mButton->setTabStop(FALSE);
mButton->setImageOverlay(mListPosition == BELOW ? "down_arrow.tga" : "up_arrow.tga", LLFontGL::RIGHT);
mActionButton->setOrigin(0, 0);
- mActionButton->reshape(mRect.getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, mRect.getHeight());
+ mActionButton->reshape(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight());
}
//static
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 303ba83e92..13c2455d61 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -158,10 +158,10 @@ public:
virtual BOOL selectNthItem( S32 index ) { return setCurrentByIndex(index); }
virtual S32 getFirstSelectedIndex() const { return getCurrentIndex(); }
virtual BOOL setCurrentByID( const LLUUID& id );
- virtual LLUUID getCurrentID(); // LLUUID::null if no items in menu
- virtual BOOL setSelectedByValue(LLSD value, BOOL selected);
+ virtual LLUUID getCurrentID() const; // LLUUID::null if no items in menu
+ virtual BOOL setSelectedByValue(const LLSD& value, BOOL selected);
virtual LLSD getSelectedValue();
- virtual BOOL isSelected(LLSD value);
+ virtual BOOL isSelected(const LLSD& value) const;
virtual BOOL operateOnSelection(EOperation op);
virtual BOOL operateOnAll(EOperation op);
@@ -182,18 +182,20 @@ public:
void updateSelection();
virtual void showList();
virtual void hideList();
-
+
protected:
LLButton* mButton;
LLScrollListCtrl* mList;
- S32 mButtonPadding;
LLViewBorder* mBorder;
+ EPreferredPosition mListPosition;
+ LLPointer<LLImageGL> mArrowImage;
+
+private:
+ S32 mButtonPadding;
LLLineEditor* mTextEntry;
- LLPointer<LLImageGL> mArrowImage;
BOOL mAllowTextEntry;
S32 mMaxChars;
BOOL mTextEntryTentative;
- EPreferredPosition mListPosition;
void (*mPrearrangeCallback)(LLUICtrl*,void*);
void (*mTextEntryCallback)(LLLineEditor*, void*);
};
diff --git a/indra/llui/llctrlselectioninterface.h b/indra/llui/llctrlselectioninterface.h
index 77811d049b..e43e20a4c0 100644
--- a/indra/llui/llctrlselectioninterface.h
+++ b/indra/llui/llctrlselectioninterface.h
@@ -63,14 +63,14 @@ public:
// TomY TODO: Simply cast the UUIDs to LLSDs, using the selectByValue function
virtual BOOL setCurrentByID( const LLUUID& id ) = 0;
- virtual LLUUID getCurrentID() = 0;
+ virtual LLUUID getCurrentID() const = 0;
- BOOL selectByValue(LLSD value);
- BOOL deselectByValue(LLSD value);
- virtual BOOL setSelectedByValue(LLSD value, BOOL selected) = 0;
+ BOOL selectByValue(const LLSD value);
+ BOOL deselectByValue(const LLSD value);
+ virtual BOOL setSelectedByValue(const LLSD& value, BOOL selected) = 0;
virtual LLSD getSelectedValue() = 0;
- virtual BOOL isSelected(LLSD value) = 0;
+ virtual BOOL isSelected(const LLSD& value) const = 0;
virtual BOOL operateOnSelection(EOperation op) = 0;
virtual BOOL operateOnAll(EOperation op) = 0;
@@ -100,7 +100,7 @@ class LLCtrlScrollInterface
public:
virtual ~LLCtrlScrollInterface();
- virtual S32 getScrollPos() = 0;
+ virtual S32 getScrollPos() const = 0;
virtual void setScrollPos( S32 pos ) = 0;
virtual void scrollToShowSelected() = 0;
};
diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp
index ca536ea024..a4e92e11d0 100644
--- a/indra/llui/lldraghandle.cpp
+++ b/indra/llui/lldraghandle.cpp
@@ -74,7 +74,24 @@ LLDragHandle::LLDragHandle( const LLString& name, const LLRect& rect, const LLSt
void LLDragHandle::setTitleVisible(BOOL visible)
{
- mTitleBox->setVisible(visible);
+ if(mTitleBox)
+ {
+ mTitleBox->setVisible(visible);
+ }
+}
+
+void LLDragHandle::setTitleBox(LLTextBox* titlebox)
+{
+ if( mTitleBox )
+ {
+ removeChild(mTitleBox);
+ delete mTitleBox;
+ }
+ mTitleBox = titlebox;
+ if(mTitleBox)
+ {
+ addChild( mTitleBox );
+ }
}
LLDragHandleTop::LLDragHandleTop(const LLString& name, const LLRect &rect, const LLString& title)
@@ -113,46 +130,28 @@ LLString LLDragHandleLeft::getWidgetTag() const
void LLDragHandleTop::setTitle(const LLString& title)
{
- if( mTitleBox )
- {
- removeChild(mTitleBox);
- delete mTitleBox;
- }
-
LLString trimmed_title = title;
LLString::trim(trimmed_title);
const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF );
- mTitleBox = new LLTextBox( "Drag Handle Title", mRect, trimmed_title, font );
- mTitleBox->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT);
- mTitleBox->setFontStyle(LLFontGL::DROP_SHADOW_SOFT);
- reshapeTitleBox();
+ LLTextBox* titlebox = new LLTextBox( "Drag Handle Title", getRect(), trimmed_title, font );
+ titlebox->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT);
+ titlebox->setFontStyle(LLFontGL::DROP_SHADOW_SOFT);
- // allow empty titles, as default behavior replaces them with title box name
- if (trimmed_title.empty())
- {
- mTitleBox->setText(LLString::null);
- }
- addChild( mTitleBox );
+ setTitleBox(titlebox);
+ reshapeTitleBox();
}
const LLString& LLDragHandleTop::getTitle() const
{
- return mTitleBox->getText();
+ return getTitleBox() == NULL ? LLString::null : getTitleBox()->getText();
}
void LLDragHandleLeft::setTitle(const LLString& )
{
- if( mTitleBox )
- {
- removeChild(mTitleBox);
- delete mTitleBox;
- }
-
- mTitleBox = NULL;
-
+ setTitleBox(NULL);
/* no title on left edge */
}
@@ -166,14 +165,14 @@ const LLString& LLDragHandleLeft::getTitle() const
void LLDragHandleTop::draw()
{
/* Disable lines. Can drag anywhere in most windows. JC
- if( getVisible() && mEnabled && mForeground)
+ if( getVisible() && getEnabled() && mForeground)
{
const S32 BORDER_PAD = 2;
const S32 HPAD = 2;
const S32 VPAD = 2;
S32 left = BORDER_PAD + HPAD;
- S32 top = mRect.getHeight() - 2 * VPAD;
- S32 right = mRect.getWidth() - HPAD;
+ S32 top = getRect().getHeight() - 2 * VPAD;
+ S32 right = getRect().getWidth() - HPAD;
// S32 bottom = VPAD;
// draw lines for drag areas
@@ -183,7 +182,7 @@ void LLDragHandleTop::draw()
LLRect title_rect = mTitleBox->getRect();
S32 title_right = title_rect.mLeft + mTitleWidth;
- BOOL show_right_side = title_right < mRect.getWidth();
+ BOOL show_right_side = title_right < getRect().getWidth();
for( S32 i=0; i<4; i++ )
{
@@ -204,9 +203,9 @@ void LLDragHandleTop::draw()
*/
// Colorize the text to match the frontmost state
- if (mTitleBox)
+ if (getTitleBox())
{
- mTitleBox->setEnabled(mForeground);
+ getTitleBox()->setEnabled(getForeground());
}
LLView::draw();
@@ -217,7 +216,7 @@ void LLDragHandleTop::draw()
void LLDragHandleLeft::draw()
{
/* Disable lines. Can drag anywhere in most windows. JC
- if( getVisible() && mEnabled && mForeground )
+ if( getVisible() && getEnabled() && mForeground )
{
const S32 BORDER_PAD = 2;
// const S32 HPAD = 2;
@@ -225,8 +224,8 @@ void LLDragHandleLeft::draw()
const S32 LINE_SPACING = 3;
S32 left = BORDER_PAD + LINE_SPACING;
- S32 top = mRect.getHeight() - 2 * VPAD;
-// S32 right = mRect.getWidth() - HPAD;
+ S32 top = getRect().getHeight() - 2 * VPAD;
+// S32 right = getRect().getWidth() - HPAD;
S32 bottom = VPAD;
// draw lines for drag areas
@@ -234,7 +233,7 @@ void LLDragHandleLeft::draw()
// no titles yet
//LLRect title_rect = mTitleBox->getRect();
//S32 title_right = title_rect.mLeft + mTitleWidth;
- //BOOL show_right_side = title_right < mRect.getWidth();
+ //BOOL show_right_side = title_right < getRect().getWidth();
S32 line = left;
for( S32 i=0; i<4; i++ )
@@ -249,9 +248,9 @@ void LLDragHandleLeft::draw()
*/
// Colorize the text to match the frontmost state
- if (mTitleBox)
+ if (getTitleBox())
{
- mTitleBox->setEnabled(mForeground);
+ getTitleBox()->setEnabled(getForeground());
}
LLView::draw();
@@ -259,19 +258,23 @@ void LLDragHandleLeft::draw()
void LLDragHandleTop::reshapeTitleBox()
{
+ if( ! getTitleBox())
+ {
+ return;
+ }
const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF );
- S32 title_width = font->getWidth( mTitleBox->getText() ) + TITLE_PAD;
- if (mMaxTitleWidth > 0)
- title_width = llmin(title_width, mMaxTitleWidth);
+ S32 title_width = font->getWidth( getTitleBox()->getText() ) + TITLE_PAD;
+ if (getMaxTitleWidth() > 0)
+ title_width = llmin(title_width, getMaxTitleWidth());
S32 title_height = llround(font->getLineHeight());
LLRect title_rect;
title_rect.setLeftTopAndSize(
LEFT_PAD,
- mRect.getHeight() - BORDER_PAD,
- mRect.getWidth() - LEFT_PAD - RIGHT_PAD,
+ getRect().getHeight() - BORDER_PAD,
+ getRect().getWidth() - LEFT_PAD - RIGHT_PAD,
title_height);
- mTitleBox->setRect( title_rect );
+ getTitleBox()->setRect( title_rect );
}
void LLDragHandleTop::reshape(S32 width, S32 height, BOOL called_from_parent)
diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h
index cd3ce04718..940eb21e66 100644
--- a/indra/llui/lldraghandle.h
+++ b/indra/llui/lldraghandle.h
@@ -45,11 +45,14 @@ class LLDragHandle : public LLView
{
public:
LLDragHandle(const LLString& name, const LLRect& rect, const LLString& title );
+ virtual ~LLDragHandle() { setTitleBox(NULL); }
virtual void setValue(const LLSD& value);
void setForeground(BOOL b) { mForeground = b; }
+ BOOL getForeground() const { return mForeground; }
void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); }
+ S32 getMaxTitleWidth() const { return mMaxTitleWidth; }
void setTitleVisible(BOOL visible);
virtual void setTitle( const LLString& title ) = 0;
@@ -61,6 +64,10 @@ public:
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
protected:
+ LLTextBox* getTitleBox() const { return mTitleBox; }
+ void setTitleBox(LLTextBox*);
+
+private:
S32 mDragLastScreenX;
S32 mDragLastScreenY;
S32 mLastMouseScreenX;
diff --git a/indra/llui/lleditmenuhandler.cpp b/indra/llui/lleditmenuhandler.cpp
index 9fb9cbe16c..435556b56c 100644
--- a/indra/llui/lleditmenuhandler.cpp
+++ b/indra/llui/lleditmenuhandler.cpp
@@ -33,98 +33,6 @@
#include "lleditmenuhandler.h"
-LLEditMenuHandler* gEditMenuHandler = NULL;
+/* static */
+LLEditMenuHandler* LLEditMenuHandler::gEditMenuHandler = NULL;
-// virtual
-LLEditMenuHandler::~LLEditMenuHandler()
-{ }
-
-// virtual
-void LLEditMenuHandler::undo()
-{ }
-
-// virtual
-BOOL LLEditMenuHandler::canUndo()
-{
- return FALSE;
-}
-
-// virtual
-void LLEditMenuHandler::redo()
-{ }
-
-// virtual
-BOOL LLEditMenuHandler::canRedo()
-{
- return FALSE;
-}
-
-// virtual
-void LLEditMenuHandler::cut()
-{ }
-
-// virtual
-BOOL LLEditMenuHandler::canCut()
-{
- return FALSE;
-}
-
-// virtual
-void LLEditMenuHandler::copy()
-{ }
-
-// virtual
-BOOL LLEditMenuHandler::canCopy()
-{
- return FALSE;
-}
-
-// virtual
-void LLEditMenuHandler::paste()
-{ }
-
-// virtual
-BOOL LLEditMenuHandler::canPaste()
-{
- return FALSE;
-}
-
-// virtual
-void LLEditMenuHandler::doDelete()
-{ }
-
-// virtual
-BOOL LLEditMenuHandler::canDoDelete()
-{
- return FALSE;
-}
-
-// virtual
-void LLEditMenuHandler::selectAll()
-{ }
-
-// virtual
-BOOL LLEditMenuHandler::canSelectAll()
-{
- return FALSE;
-}
-
-// virtual
-void LLEditMenuHandler::deselect()
-{ }
-
-// virtual
-BOOL LLEditMenuHandler::canDeselect()
-{
- return FALSE;
-}
-
-// virtual
-void LLEditMenuHandler::duplicate()
-{ }
-
-// virtual
-BOOL LLEditMenuHandler::canDuplicate()
-{
- return FALSE;
-}
diff --git a/indra/llui/lleditmenuhandler.h b/indra/llui/lleditmenuhandler.h
index b035a29fb4..22f5076c93 100644
--- a/indra/llui/lleditmenuhandler.h
+++ b/indra/llui/lleditmenuhandler.h
@@ -37,37 +37,43 @@ class LLEditMenuHandler
{
public:
// this is needed even though this is just an interface class.
- virtual ~LLEditMenuHandler();
+ virtual ~LLEditMenuHandler() {};
- virtual void undo();
- virtual BOOL canUndo();
+ virtual void undo() {};
+ virtual BOOL canUndo() const { return FALSE; }
- virtual void redo();
- virtual BOOL canRedo();
+ virtual void redo() {};
+ virtual BOOL canRedo() const { return FALSE; }
- virtual void cut();
- virtual BOOL canCut();
+ virtual void cut() {};
+ virtual BOOL canCut() const { return FALSE; }
- virtual void copy();
- virtual BOOL canCopy();
+ virtual void copy() {};
+ virtual BOOL canCopy() const { return FALSE; }
- virtual void paste();
- virtual BOOL canPaste();
+ virtual void paste() {};
+ virtual BOOL canPaste() const { return FALSE; }
// "delete" is a keyword
- virtual void doDelete();
- virtual BOOL canDoDelete();
+ virtual void doDelete() {};
+ virtual BOOL canDoDelete() const { return FALSE; }
- virtual void selectAll();
- virtual BOOL canSelectAll();
+ virtual void selectAll() {};
+ virtual BOOL canSelectAll() const { return FALSE; }
- virtual void deselect();
- virtual BOOL canDeselect();
+ virtual void deselect() {};
+ virtual BOOL canDeselect() const { return FALSE; }
- virtual void duplicate();
- virtual BOOL canDuplicate();
+ virtual void duplicate() {};
+ virtual BOOL canDuplicate() const { return FALSE; }
+
+ // TODO: Instead of being a public data member, it would be better to hide it altogether
+ // and have a "set" method and then a bunch of static versions of the cut, copy, paste
+ // methods, etc that operate on the current global instance. That would drastically
+ // simplify the existing code that accesses this global variable by putting all the
+ // null checks in the one implementation of those static methods. -MG
+ static LLEditMenuHandler* gEditMenuHandler;
};
-extern LLEditMenuHandler* gEditMenuHandler;
#endif
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 0754d0eda9..5c1f8429d1 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -142,20 +142,18 @@ LLFloater::LLFloater() :
mButtons[i] = NULL;
}
mDragHandle = NULL;
+ mHandle.bind(this);
}
LLFloater::LLFloater(const LLString& name)
-: LLPanel(name)
+: LLPanel(name), mAutoFocus(TRUE) // automatically take focus when opened
{
for (S32 i = 0; i < BUTTON_COUNT; i++)
{
mButtonsEnabled[i] = FALSE;
mButtons[i] = NULL;
}
-
LLString title; // null string
- // automatically take focus when opened
- mAutoFocus = TRUE;
init(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults
}
@@ -168,15 +166,13 @@ LLFloater::LLFloater(const LLString& name, const LLRect& rect, const LLString& t
BOOL minimizable,
BOOL close_btn,
BOOL bordered)
-: LLPanel(name, rect, bordered)
+: LLPanel(name, rect, bordered), mAutoFocus(TRUE) // automatically take focus when opened
{
for (S32 i = 0; i < BUTTON_COUNT; i++)
{
mButtonsEnabled[i] = FALSE;
mButtons[i] = NULL;
}
- // automatically take focus when opened
- mAutoFocus = TRUE;
init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
}
@@ -188,15 +184,13 @@ LLFloater::LLFloater(const LLString& name, const LLString& rect_control, const L
BOOL minimizable,
BOOL close_btn,
BOOL bordered)
-: LLPanel(name, rect_control, bordered)
+: LLPanel(name, rect_control, bordered), mAutoFocus(TRUE) // automatically take focus when opened
{
for (S32 i = 0; i < BUTTON_COUNT; i++)
{
mButtonsEnabled[i] = FALSE;
mButtons[i] = NULL;
}
- // automatically take focus when opened
- mAutoFocus = TRUE;
init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
}
@@ -206,6 +200,8 @@ void LLFloater::init(const LLString& title,
BOOL resizable, S32 min_width, S32 min_height,
BOOL drag_on_left, BOOL minimizable, BOOL close_btn)
{
+ mHandle.bind(this);
+
// Init function can be called more than once, so clear out old data.
for (S32 i = 0; i < BUTTON_COUNT; i++)
{
@@ -219,20 +215,20 @@ void LLFloater::init(const LLString& title,
}
mButtonScale = 1.f;
- BOOL need_border = mBorder != NULL;
-
+ //sjb: Thia is a bit of a hack:
+ BOOL need_border = hasBorder();
+ // remove the border since deleteAllChildren() will also delete the border (but not clear mBorder)
+ removeBorder();
// this will delete mBorder too
deleteAllChildren();
- // make sure we don't have a pointer to an old, deleted border
- mBorder = NULL;
- //sjb: HACK! we had a border which was just deleted, so re-create it
+ // add the border back if we want it
if (need_border)
{
- addBorder();
+ addBorder();
}
// chrome floaters don't take focus at all
- mIsFocusRoot = !getIsChrome();
+ setFocusRoot(!getIsChrome());
// Reset cached pointers
mDragHandle = NULL;
@@ -257,7 +253,7 @@ void LLFloater::init(const LLString& title,
// Floaters start not minimized. When minimized, they save their
// prior rectangle to be used on restore.
mMinimized = FALSE;
- mPreviousRect.set(0,0,0,0);
+ mExpandedRect.set(0,0,0,0);
S32 close_pad; // space to the right of close box
S32 close_box_size; // For layout purposes, how big is the close box?
@@ -288,31 +284,20 @@ void LLFloater::init(const LLString& title,
// Drag Handle
// Add first so it's in the background.
// const S32 drag_pad = 2;
- LLRect drag_handle_rect;
- if (!drag_on_left)
- {
- drag_handle_rect.set( 0, mRect.getHeight(), mRect.getWidth(), 0 );
-
- /*
- drag_handle_rect.setLeftTopAndSize(
- 0, mRect.getHeight(),
- mRect.getWidth()
- - LLPANEL_BORDER_WIDTH
- - drag_pad
- - minimize_box_size - minimize_pad
- - close_box_size - close_pad,
- DRAG_HANDLE_HEIGHT);
- */
- mDragHandle = new LLDragHandleTop( "Drag Handle", drag_handle_rect, title );
- }
- else
+ if (drag_on_left)
{
+ LLRect drag_handle_rect;
drag_handle_rect.setOriginAndSize(
0, 0,
DRAG_HANDLE_WIDTH,
- mRect.getHeight() - LLPANEL_BORDER_WIDTH - close_box_size);
+ getRect().getHeight() - LLPANEL_BORDER_WIDTH - close_box_size);
mDragHandle = new LLDragHandleLeft("drag", drag_handle_rect, title );
}
+ else // drag on top
+ {
+ LLRect drag_handle_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
+ mDragHandle = new LLDragHandleTop( "Drag Handle", drag_handle_rect, title );
+ }
addChild(mDragHandle);
// Resize Handle
@@ -327,28 +312,28 @@ void LLFloater::init(const LLString& title,
mResizeBar[LLResizeBar::LEFT] = new LLResizeBar(
"resizebar_left",
this,
- LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0),
+ LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0),
min_width, S32_MAX, LLResizeBar::LEFT );
addChild( mResizeBar[0] );
mResizeBar[LLResizeBar::TOP] = new LLResizeBar(
"resizebar_top",
this,
- LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS),
+ LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS),
min_height, S32_MAX, LLResizeBar::TOP );
addChild( mResizeBar[1] );
mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar(
"resizebar_right",
this,
- LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0),
+ LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0),
min_width, S32_MAX, LLResizeBar::RIGHT );
addChild( mResizeBar[2] );
mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar(
"resizebar_bottom",
this,
- LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0),
+ LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0),
min_height, S32_MAX, LLResizeBar::BOTTOM );
addChild( mResizeBar[3] );
@@ -356,14 +341,14 @@ void LLFloater::init(const LLString& title,
// Resize handles (corners)
mResizeHandle[0] = new LLResizeHandle(
"Resize Handle",
- LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, mRect.getWidth(), 0),
+ LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0),
min_width,
min_height,
LLResizeHandle::RIGHT_BOTTOM);
addChild(mResizeHandle[0]);
mResizeHandle[1] = new LLResizeHandle( "resize",
- LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_HANDLE_HEIGHT),
+ LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT),
min_width,
min_height,
LLResizeHandle::RIGHT_TOP );
@@ -377,7 +362,7 @@ void LLFloater::init(const LLString& title,
addChild(mResizeHandle[2]);
mResizeHandle[3] = new LLResizeHandle( "resize",
- LLRect( 0, mRect.getHeight(), RESIZE_HANDLE_WIDTH, mRect.getHeight() - RESIZE_HANDLE_HEIGHT ),
+ LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ),
min_width,
min_height,
LLResizeHandle::LEFT_TOP );
@@ -413,7 +398,7 @@ void LLFloater::init(const LLString& title,
setVisible(FALSE);
// add self to handle->floater map
- sFloaterMap[mViewHandle] = this;
+ sFloaterMap[mHandle] = this;
if (!getParent())
{
@@ -450,7 +435,7 @@ LLFloater::~LLFloater()
// correct, non-minimized positions.
setMinimized( FALSE );
- sFloaterMap.erase(mViewHandle);
+ sFloaterMap.erase(mHandle);
delete mDragHandle;
for (S32 i = 0; i < 4; i++)
@@ -460,22 +445,6 @@ LLFloater::~LLFloater()
}
}
-// virtual
-EWidgetType LLFloater::getWidgetType() const
-{
- return WIDGET_TYPE_FLOATER;
-}
-
-// virtual
-LLString LLFloater::getWidgetTag() const
-{
- return LL_FLOATER_TAG;
-}
-
-void LLFloater::destroy()
-{
- die();
-}
void LLFloater::setVisible( BOOL visible )
{
@@ -501,7 +470,7 @@ void LLFloater::setVisible( BOOL visible )
for(handle_set_iter_t dependent_it = mDependents.begin();
dependent_it != mDependents.end(); )
{
- LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it);
+ LLFloater* floaterp = dependent_it->get();
if (floaterp)
{
@@ -513,10 +482,10 @@ void LLFloater::setVisible( BOOL visible )
void LLFloater::open() /* Flawfinder: ignore */
{
- if (mSoundFlags != SILENT
+ if (getSoundFlags() != SILENT
// don't play open sound for hosted (tabbed) windows
&& !getHost()
- && !sHostp
+ && !getFloaterHost()
&& (!getVisible() || isMinimized()))
{
make_ui_sound("UISndWindowOpen");
@@ -524,17 +493,16 @@ void LLFloater::open() /* Flawfinder: ignore */
//RN: for now, we don't allow rehosting from one multifloater to another
// just need to fix the bugs
- LLMultiFloater* hostp = getHost();
- if (sHostp != NULL && hostp == NULL)
+ if (getFloaterHost() != NULL && getHost() == NULL)
{
// needs a host
// only select tabs if window they are hosted in is visible
- sHostp->addFloater(this, sHostp->getVisible());
+ getFloaterHost()->addFloater(this, getFloaterHost()->getVisible());
}
- else if (hostp != NULL)
+ else if (getHost() != NULL)
{
// already hosted
- hostp->showFloater(this);
+ getHost()->showFloater(this);
}
else
{
@@ -558,7 +526,7 @@ void LLFloater::close(bool app_quitting)
((LLMultiFloater*)getHost())->removeFloater(this);
}
- if (mSoundFlags != SILENT
+ if (getSoundFlags() != SILENT
&& getVisible()
&& !getHost()
&& !app_quitting)
@@ -571,7 +539,7 @@ void LLFloater::close(bool app_quitting)
dependent_it != mDependents.end(); )
{
- LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it);
+ LLFloater* floaterp = dependent_it->get();
if (floaterp)
{
++dependent_it;
@@ -595,7 +563,7 @@ void LLFloater::close(bool app_quitting)
// give focus to dependee floater if it exists, and we had focus first
if (isDependent())
{
- LLFloater* dependee = LLFloater::getFloaterByHandle(mDependeeHandle);
+ LLFloater* dependee = mDependeeHandle.get();
if (dependee && !dependee->isDead())
{
dependee->setFocus(TRUE);
@@ -661,20 +629,15 @@ void LLFloater::center()
// hosted floaters can't move
return;
}
- const LLRect &window = gFloaterView->getRect();
-
- S32 left = window.mLeft + (window.getWidth() - mRect.getWidth()) / 2;
- S32 bottom = window.mBottom + (window.getHeight() - mRect.getHeight()) / 2;
-
- translate( left - mRect.mLeft, bottom - mRect.mBottom );
+ centerWithin(gFloaterView->getRect());
}
void LLFloater::applyRectControl()
{
- if (!mRectControl.empty())
+ if (!getRectControl().empty())
{
- const LLRect& rect = LLUI::sConfigGroup->getRect(mRectControl);
- translate( rect.mLeft - mRect.mLeft, rect.mBottom - mRect.mBottom);
+ const LLRect& rect = LLUI::sConfigGroup->getRect(getRectControl());
+ translate( rect.mLeft - getRect().mLeft, rect.mBottom - getRect().mBottom);
if (mResizable)
{
reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight()));
@@ -715,7 +678,7 @@ LLString LLFloater::getShortTitle()
-BOOL LLFloater::canSnapTo(LLView* other_view)
+BOOL LLFloater::canSnapTo(const LLView* other_view)
{
if (NULL == other_view)
{
@@ -727,7 +690,7 @@ BOOL LLFloater::canSnapTo(LLView* other_view)
{
LLFloater* other_floaterp = (LLFloater*)other_view;
- if (other_floaterp->getSnapTarget() == mViewHandle && mDependents.find(other_floaterp->getHandle()) != mDependents.end())
+ if (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;
@@ -737,7 +700,7 @@ BOOL LLFloater::canSnapTo(LLView* other_view)
return LLPanel::canSnapTo(other_view);
}
-void LLFloater::snappedTo(LLView* snap_view)
+void LLFloater::snappedTo(const LLView* snap_view)
{
if (!snap_view || snap_view == getParent())
{
@@ -754,7 +717,7 @@ void LLFloater::snappedTo(LLView* snap_view)
void LLFloater::userSetShape(const LLRect& new_rect)
{
- LLRect old_rect = mRect;
+ const LLRect& old_rect = getRect();
LLView::userSetShape(new_rect);
// if not minimized, adjust all snapped dependents to new shape
@@ -764,22 +727,22 @@ void LLFloater::userSetShape(const LLRect& new_rect)
for(handle_set_iter_t dependent_it = mDependents.begin();
dependent_it != mDependents.end(); ++dependent_it)
{
- LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it);
+ LLFloater* floaterp = dependent_it->get();
// is a dependent snapped to us?
- if (floaterp && floaterp->getSnapTarget() == mViewHandle)
+ if (floaterp && floaterp->getSnapTarget() == getHandle())
{
S32 delta_x = 0;
S32 delta_y = 0;
// check to see if it snapped to right or top, and move if dependee floater is resizing
LLRect dependent_rect = floaterp->getRect();
- if (dependent_rect.mLeft - mRect.mLeft >= old_rect.getWidth() || // dependent on my right?
- dependent_rect.mRight == mRect.mLeft + old_rect.getWidth()) // dependent aligned with my right
+ if (dependent_rect.mLeft - getRect().mLeft >= old_rect.getWidth() || // dependent on my right?
+ dependent_rect.mRight == getRect().mLeft + old_rect.getWidth()) // dependent aligned with my right
{
// was snapped directly onto right side or aligned with it
delta_x += new_rect.getWidth() - old_rect.getWidth();
}
- if (dependent_rect.mBottom - mRect.mBottom >= old_rect.getHeight() ||
- dependent_rect.mTop == mRect.mBottom + old_rect.getHeight())
+ if (dependent_rect.mBottom - getRect().mBottom >= old_rect.getHeight() ||
+ dependent_rect.mTop == getRect().mBottom + old_rect.getHeight())
{
// was snapped directly onto top side or aligned with it
delta_y += new_rect.getHeight() - old_rect.getHeight();
@@ -812,7 +775,7 @@ void LLFloater::setMinimized(BOOL minimize)
if (minimize)
{
- mPreviousRect = mRect;
+ mExpandedRect = getRect();
reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE);
@@ -843,7 +806,7 @@ void LLFloater::setMinimized(BOOL minimize)
LLView* viewp = *child_it;
if (!viewp->getVisible())
{
- mMinimizedHiddenChildren.push_back(viewp->mViewHandle);
+ mMinimizedHiddenChildren.push_back(viewp->getHandle());
}
viewp->setVisible(FALSE);
}
@@ -860,7 +823,7 @@ void LLFloater::setMinimized(BOOL minimize)
dependent_it != mDependents.end();
++dependent_it)
{
- LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it);
+ LLFloater* floaterp = dependent_it->get();
if (floaterp)
{
if (floaterp->isMinimizeable())
@@ -890,8 +853,8 @@ void LLFloater::setMinimized(BOOL minimize)
mPreviousMinimizedBottom = currentRect.mBottom;
}
- reshape( mPreviousRect.getWidth(), mPreviousRect.getHeight(), TRUE );
- setOrigin( mPreviousRect.mLeft, mPreviousRect.mBottom );
+ reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE );
+ setOrigin( mExpandedRect.mLeft, mExpandedRect.mBottom );
if (mButtonsEnabled[BUTTON_RESTORE])
{
@@ -906,10 +869,10 @@ void LLFloater::setMinimized(BOOL minimize)
viewp->setVisible(TRUE);
}
- std::vector<LLViewHandle>::iterator itor = mMinimizedHiddenChildren.begin();
+ std::vector<LLHandle<LLView> >::iterator itor = mMinimizedHiddenChildren.begin();
for ( ; itor != mMinimizedHiddenChildren.end(); ++itor)
{
- LLView* viewp = LLView::getViewByHandle(*itor);
+ LLView* viewp = itor->get();
if(viewp)
{
viewp->setVisible(FALSE);
@@ -922,7 +885,7 @@ void LLFloater::setMinimized(BOOL minimize)
dependent_it != mDependents.end();
++dependent_it)
{
- LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it);
+ LLFloater* floaterp = dependent_it->get();
if (floaterp)
{
floaterp->setMinimized(FALSE);
@@ -979,7 +942,7 @@ void LLFloater::setIsChrome(BOOL is_chrome)
// remove focus if we're changing to chrome
setFocus(FALSE);
// can't Ctrl-Tab to "chrome" floaters
- mIsFocusRoot = FALSE;
+ setFocusRoot(FALSE);
}
// no titles displayed on "chrome" floaters
@@ -1011,7 +974,7 @@ void LLFloater::cleanupHandles()
for(handle_set_iter_t dependent_it = mDependents.begin();
dependent_it != mDependents.end(); )
{
- LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it);
+ LLFloater* floaterp = dependent_it->get();
if (!floaterp)
{
mDependents.erase(dependent_it++);
@@ -1085,7 +1048,7 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition)
if (reposition)
{
floaterp->setRect(gFloaterView->findNeighboringPosition(this, floaterp));
- floaterp->setSnapTarget(mViewHandle);
+ floaterp->setSnapTarget(getHandle());
}
gFloaterView->adjustToFitScreen(floaterp, FALSE);
if (floaterp->isFrontmost())
@@ -1095,9 +1058,9 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition)
}
}
-void LLFloater::addDependentFloater(LLViewHandle dependent, BOOL reposition)
+void LLFloater::addDependentFloater(LLHandle<LLFloater> dependent, BOOL reposition)
{
- LLFloater* dependent_floaterp = LLFloater::getFloaterByHandle(dependent);
+ LLFloater* dependent_floaterp = dependent.get();
if(dependent_floaterp)
{
addDependentFloater(dependent_floaterp, reposition);
@@ -1107,7 +1070,7 @@ void LLFloater::addDependentFloater(LLViewHandle dependent, BOOL reposition)
void LLFloater::removeDependentFloater(LLFloater* floaterp)
{
mDependents.erase(floaterp->getHandle());
- floaterp->mDependeeHandle = LLViewHandle::sDeadHandle;
+ floaterp->mDependeeHandle = LLHandle<LLFloater>();
}
// virtual
@@ -1215,32 +1178,13 @@ void LLFloater::setFrontmost(BOOL take_focus)
}
}
-// static
-LLFloater* LLFloater::getFloaterByHandle(LLViewHandle handle)
-{
- LLFloater* floater = NULL;
- if (sFloaterMap.count(handle))
- {
- floater = sFloaterMap[handle];
- }
- if (floater && !floater->isDead())
- {
- return floater;
- }
- else
- {
- return NULL;
- }
-}
-
//static
void LLFloater::setEditModeEnabled(BOOL enable)
{
if (enable != sEditModeEnabled)
{
S32 count = 0;
- std::map<LLViewHandle, LLFloater*>::iterator iter;
- for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
+ for(handle_map_iter_t iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
{
LLFloater* floater = iter->second;
if (!floater->isDead())
@@ -1255,41 +1199,6 @@ void LLFloater::setEditModeEnabled(BOOL enable)
sEditModeEnabled = enable;
}
-//static
-BOOL LLFloater::getEditModeEnabled()
-{
- return sEditModeEnabled;
-}
-
-//static
-void LLFloater::show(LLFloater* floaterp)
-{
- if (floaterp)
- {
- gFocusMgr.triggerFocusFlash();
- floaterp->open();
- if (floaterp->getHost())
- {
- floaterp->getHost()->open();
- }
- }
-}
-
-//static
-void LLFloater::hide(LLFloater* floaterp)
-{
- if (floaterp) floaterp->close();
-}
-
-//static
-BOOL LLFloater::visible(LLFloater* floaterp)
-{
- if (floaterp)
- {
- return !floaterp->isMinimized() && floaterp->isInVisibleChain();
- }
- return FALSE;
-}
// static
void LLFloater::onClickMinimize(void *userdata)
@@ -1316,9 +1225,9 @@ void LLFloater::onClickTearOff(void *userdata)
self->open(); /* Flawfinder: ignore */
// only force position for floaters that don't have that data saved
- if (self->mRectControl.empty())
+ if (self->getRectControl().empty())
{
- new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->mRect.getWidth(), self->mRect.getHeight());
+ new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->getRect().getWidth(), self->getRect().getHeight());
self->setRect(new_rect);
}
gFloaterView->adjustToFitScreen(self, FALSE);
@@ -1327,7 +1236,7 @@ void LLFloater::onClickTearOff(void *userdata)
}
else //Attach to parent.
{
- LLMultiFloater* new_host = (LLMultiFloater*)LLFloater::getFloaterByHandle(self->mLastHostHandle);
+ LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get();
if (new_host)
{
new_host->showFloater(self);
@@ -1351,7 +1260,7 @@ void LLFloater::closeFocusedFloater()
{
LLFloater* focused_floater = NULL;
- std::map<LLViewHandle, LLFloater*>::iterator iter;
+ handle_map_iter_t iter;
for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
{
focused_floater = iter->second;
@@ -1396,16 +1305,16 @@ void LLFloater::draw()
if( getVisible() )
{
// draw background
- if( mBgVisible )
+ if( isBackgroundVisible() )
{
S32 left = LLPANEL_BORDER_WIDTH;
- S32 top = mRect.getHeight() - LLPANEL_BORDER_WIDTH;
- S32 right = mRect.getWidth() - LLPANEL_BORDER_WIDTH;
+ S32 top = getRect().getHeight() - LLPANEL_BORDER_WIDTH;
+ S32 right = getRect().getWidth() - LLPANEL_BORDER_WIDTH;
S32 bottom = LLPANEL_BORDER_WIDTH;
LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow");
F32 shadow_offset = (F32)LLUI::sConfigGroup->getS32("DropShadowFloater");
- if (!mBgOpaque)
+ if (!isBackgroundOpaque())
{
shadow_offset *= 0.2f;
shadow_color.mV[VALPHA] *= 0.5f;
@@ -1415,13 +1324,13 @@ void LLFloater::draw()
llround(shadow_offset));
// No transparent windows in simple UI
- if (mBgOpaque)
+ if (isBackgroundOpaque())
{
- gl_rect_2d( left, top, right, bottom, mBgColorOpaque );
+ gl_rect_2d( left, top, right, bottom, getBackgroundColor() );
}
else
{
- gl_rect_2d( left, top, right, bottom, mBgColorAlpha );
+ gl_rect_2d( left, top, right, bottom, getTransparentColor() );
}
if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getTitle().empty())
@@ -1434,19 +1343,19 @@ void LLFloater::draw()
}
}
- if( mDefaultBtn)
+ if( getDefaultButton() )
{
- if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled())
+ if (gFocusMgr.childHasKeyboardFocus( this ) && getDefaultButton()->getEnabled())
{
LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus();
// is this button a direct descendent and not a nested widget (e.g. checkbox)?
BOOL focus_is_child_button = focus_ctrl->getWidgetType() == WIDGET_TYPE_BUTTON && focus_ctrl->getParent() == this;
// only enable default button when current focus is not a button
- mDefaultBtn->setBorderEnabled(!focus_is_child_button);
+ getDefaultButton()->setBorderEnabled(!focus_is_child_button);
}
else
{
- mDefaultBtn->setBorderEnabled(FALSE);
+ getDefaultButton()->setBorderEnabled(FALSE);
}
}
@@ -1461,13 +1370,13 @@ void LLFloater::draw()
LLView::draw();
- if( mBgVisible )
+ if( isBackgroundVisible() )
{
// add in a border to improve spacialized visual aclarity ;)
// use lines instead of gl_rect_2d so we can round the edges as per james' recommendation
LLUI::setLineWidth(1.5f);
LLColor4 outlineColor = gFocusMgr.childHasKeyboardFocus(this) ? LLUI::sColorsGroup->getColor("FloaterFocusBorderColor") : LLUI::sColorsGroup->getColor("FloaterUnfocusBorderColor");
- gl_rect_2d_offset_local(0, mRect.getHeight() + 1, mRect.getWidth() + 1, 0, outlineColor, -LLPANEL_BORDER_WIDTH, FALSE);
+ gl_rect_2d_offset_local(0, getRect().getHeight() + 1, getRect().getWidth() + 1, 0, outlineColor, -LLPANEL_BORDER_WIDTH, FALSE);
LLUI::setLineWidth(1.f);
}
@@ -1481,7 +1390,7 @@ void LLFloater::draw()
// when last host goes away
if (mCanTearOff && !getHost())
{
- LLFloater* old_host = gFloaterView->getFloaterByHandle(mLastHostHandle);
+ LLFloater* old_host = mLastHostHandle.get();
if (!old_host)
{
setCanTearOff(FALSE);
@@ -1490,33 +1399,6 @@ void LLFloater::draw()
}
}
-// virtual
-void LLFloater::onOpen()
-{
-}
-
-// virtual
-void LLFloater::onClose(bool app_quitting)
-{
- destroy();
-}
-
-// virtual
-BOOL LLFloater::canClose()
-{
- return TRUE;
-}
-
-// virtual
-BOOL LLFloater::canSaveAs()
-{
- return FALSE;
-}
-
-// virtual
-void LLFloater::saveAs()
-{
-}
void LLFloater::setCanMinimize(BOOL can_minimize)
{
@@ -1585,28 +1467,28 @@ void LLFloater::setCanResize(BOOL can_resize)
mResizeBar[0] = new LLResizeBar(
"resizebar_left",
this,
- LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0),
+ LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0),
mMinWidth, S32_MAX, LLResizeBar::LEFT );
addChild( mResizeBar[0] );
mResizeBar[1] = new LLResizeBar(
"resizebar_top",
this,
- LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS),
+ LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS),
mMinHeight, S32_MAX, LLResizeBar::TOP );
addChild( mResizeBar[1] );
mResizeBar[2] = new LLResizeBar(
"resizebar_right",
this,
- LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0),
+ LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0),
mMinWidth, S32_MAX, LLResizeBar::RIGHT );
addChild( mResizeBar[2] );
mResizeBar[3] = new LLResizeBar(
"resizebar_bottom",
this,
- LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0),
+ LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0),
mMinHeight, S32_MAX, LLResizeBar::BOTTOM );
addChild( mResizeBar[3] );
@@ -1614,14 +1496,14 @@ void LLFloater::setCanResize(BOOL can_resize)
// Resize handles (corners)
mResizeHandle[0] = new LLResizeHandle(
"Resize Handle",
- LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, mRect.getWidth(), 0),
+ LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0),
mMinWidth,
mMinHeight,
LLResizeHandle::RIGHT_BOTTOM);
addChild(mResizeHandle[0]);
mResizeHandle[1] = new LLResizeHandle( "resize",
- LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_HANDLE_HEIGHT),
+ LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT),
mMinWidth,
mMinHeight,
LLResizeHandle::RIGHT_TOP );
@@ -1635,7 +1517,7 @@ void LLFloater::setCanResize(BOOL can_resize)
addChild(mResizeHandle[2]);
mResizeHandle[3] = new LLResizeHandle( "resize",
- LLRect( 0, mRect.getHeight(), RESIZE_HANDLE_WIDTH, mRect.getHeight() - RESIZE_HANDLE_HEIGHT ),
+ LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ),
mMinWidth,
mMinHeight,
LLResizeHandle::LEFT_TOP );
@@ -1672,15 +1554,15 @@ void LLFloater::updateButtons()
{
btn_rect.setLeftTopAndSize(
LLPANEL_BORDER_WIDTH,
- mRect.getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
+ getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
}
else
{
btn_rect.setLeftTopAndSize(
- mRect.getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
- mRect.getHeight() - CLOSE_BOX_FROM_TOP,
+ getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
+ getRect().getHeight() - CLOSE_BOX_FROM_TOP,
llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
}
@@ -1698,7 +1580,7 @@ void LLFloater::updateButtons()
}
}
- mDragHandle->setMaxTitleWidth(mRect.getWidth() - (button_count * (LLFLOATER_CLOSE_BOX_SIZE + 1)));
+ mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (LLFLOATER_CLOSE_BOX_SIZE + 1)));
}
void LLFloater::buildButtons()
@@ -1710,15 +1592,15 @@ void LLFloater::buildButtons()
{
btn_rect.setLeftTopAndSize(
LLPANEL_BORDER_WIDTH,
- mRect.getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
+ getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
}
else
{
btn_rect.setLeftTopAndSize(
- mRect.getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
- mRect.getHeight() - CLOSE_BOX_FROM_TOP,
+ getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
+ getRect().getHeight() - CLOSE_BOX_FROM_TOP,
llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
}
@@ -1761,16 +1643,6 @@ LLFloaterView::LLFloaterView( const LLString& name, const LLRect& rect )
resetStartingFloaterPosition();
}
-EWidgetType LLFloaterView::getWidgetType() const
-{
- return WIDGET_TYPE_FLOATER_VIEW;
-}
-
-LLString LLFloaterView::getWidgetTag() const
-{
- return LL_FLOATER_VIEW_TAG;
-}
-
// By default, adjust vertical.
void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
{
@@ -1780,8 +1652,8 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
// When reshaping this view, make the floaters follow their closest edge.
void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical)
{
- S32 old_width = mRect.getWidth();
- S32 old_height = mRect.getHeight();
+ S32 old_width = getRect().getWidth();
+ S32 old_height = getRect().getHeight();
for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
{
@@ -1835,7 +1707,7 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent, BOOL
for(LLFloater::handle_set_iter_t dependent_it = floaterp->mDependents.begin();
dependent_it != floaterp->mDependents.end(); ++dependent_it)
{
- LLFloater* dependent_floaterp = getFloaterByHandle(*dependent_it);
+ LLFloater* dependent_floaterp = dependent_it->get();
if (dependent_floaterp)
{
dependent_floaterp->setFollows(follow_flags);
@@ -1937,7 +1809,7 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
for(LLFloater::handle_set_iter_t dependent_it = reference_floater->mDependents.begin();
dependent_it != reference_floater->mDependents.end(); ++dependent_it)
{
- LLFloater* sibling = LLFloater::getFloaterByHandle(*dependent_it);
+ LLFloater* sibling = dependent_it->get();
// check for dependents within 10 pixels of base floater
if (sibling &&
sibling != neighbor &&
@@ -1949,8 +1821,8 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
}
S32 left_margin = llmax(0, base_rect.mLeft);
- S32 right_margin = llmax(0, mRect.getWidth() - base_rect.mRight);
- S32 top_margin = llmax(0, mRect.getHeight() - base_rect.mTop);
+ S32 right_margin = llmax(0, getRect().getWidth() - base_rect.mRight);
+ S32 top_margin = llmax(0, getRect().getHeight() - base_rect.mTop);
S32 bottom_margin = llmax(0, base_rect.mBottom);
// find position for floater in following order
@@ -1959,22 +1831,22 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
{
if (right_margin > width)
{
- new_rect.translate(base_rect.mRight - neighbor->mRect.mLeft, base_rect.mTop - neighbor->mRect.mTop);
+ new_rect.translate(base_rect.mRight - neighbor->getRect().mLeft, base_rect.mTop - neighbor->getRect().mTop);
return new_rect;
}
else if (left_margin > width)
{
- new_rect.translate(base_rect.mLeft - neighbor->mRect.mRight, base_rect.mTop - neighbor->mRect.mTop);
+ new_rect.translate(base_rect.mLeft - neighbor->getRect().mRight, base_rect.mTop - neighbor->getRect().mTop);
return new_rect;
}
else if (bottom_margin > height)
{
- new_rect.translate(base_rect.mLeft - neighbor->mRect.mLeft, base_rect.mBottom - neighbor->mRect.mTop);
+ new_rect.translate(base_rect.mLeft - neighbor->getRect().mLeft, base_rect.mBottom - neighbor->getRect().mTop);
return new_rect;
}
else if (top_margin > height)
{
- new_rect.translate(base_rect.mLeft - neighbor->mRect.mLeft, base_rect.mTop - neighbor->mRect.mBottom);
+ new_rect.translate(base_rect.mLeft - neighbor->getRect().mLeft, base_rect.mTop - neighbor->getRect().mBottom);
return new_rect;
}
@@ -1989,15 +1861,6 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
return new_rect;
}
-void LLFloaterView::setCycleMode(BOOL mode)
-{
- mFocusCycleMode = mode;
-}
-
-BOOL LLFloaterView::getCycleMode()
-{
- return mFocusCycleMode;
-}
void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
{
@@ -2027,7 +1890,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin();
dependent_it != floater->mDependents.end(); )
{
- LLFloater* sibling = LLFloater::getFloaterByHandle(*dependent_it);
+ LLFloater* sibling = dependent_it->get();
if (sibling)
{
floaters_to_move.push_back(sibling);
@@ -2058,7 +1921,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
for(LLFloater::handle_set_iter_t dependent_it = child->mDependents.begin();
dependent_it != child->mDependents.end(); )
{
- LLFloater* dependent = getFloaterByHandle(*dependent_it);
+ LLFloater* dependent = dependent_it->get();
if (dependent)
{
sendChildToFront(dependent);
@@ -2099,7 +1962,7 @@ void LLFloaterView::highlightFocusedFloater()
dependent_it != floater->mDependents.end();
++dependent_it)
{
- LLFloater* dependent_floaterp = getFloaterByHandle(*dependent_it);
+ LLFloater* dependent_floaterp = dependent_it->get();
if (dependent_floaterp && gFocusMgr.childHasKeyboardFocus(dependent_floaterp))
{
floater_or_dependent_has_focus = TRUE;
@@ -2112,7 +1975,7 @@ void LLFloaterView::highlightFocusedFloater()
for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin();
dependent_it != floater->mDependents.end(); )
{
- LLFloater* dependent_floaterp = getFloaterByHandle(*dependent_it);
+ LLFloater* dependent_floaterp = dependent_it->get();
if (dependent_floaterp)
{
dependent_floaterp->setForeground(floater_or_dependent_has_focus);
@@ -2341,9 +2204,9 @@ void LLFloaterView::draw()
}
}
-const LLRect LLFloaterView::getSnapRect() const
+LLRect LLFloaterView::getSnapRect() const
{
- LLRect snap_rect = mRect;
+ LLRect snap_rect = getRect();
snap_rect.mBottom += mSnapOffsetBottom;
return snap_rect;
@@ -2410,23 +2273,6 @@ void LLFloaterView::syncFloaterTabOrder()
}
}
-LLFloater* LLFloaterView::getFloaterByHandle(LLViewHandle handle)
-{
- if (handle == LLViewHandle::sDeadHandle)
- {
- return NULL;
- }
- for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
- {
- LLView* viewp = *child_it;
- if (((LLFloater*)viewp)->getHandle() == handle)
- {
- return (LLFloater*)viewp;
- }
- }
- return NULL;
-}
-
LLFloater* LLFloaterView::getParentFloater(LLView* viewp)
{
LLView* parentp = viewp->getParent();
@@ -2492,13 +2338,13 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list)
LLMultiFloater::LLMultiFloater() :
mTabContainer(NULL),
- mTabPos(LLTabContainerCommon::TOP),
+ mTabPos(LLTabContainer::TOP),
mAutoResize(TRUE)
{
}
-LLMultiFloater::LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos) :
+LLMultiFloater::LLMultiFloater(LLTabContainer::TabPosition tab_pos) :
mTabContainer(NULL),
mTabPos(tab_pos),
mAutoResize(TRUE)
@@ -2509,7 +2355,7 @@ LLMultiFloater::LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos) :
LLMultiFloater::LLMultiFloater(const LLString &name) :
LLFloater(name),
mTabContainer(NULL),
- mTabPos(LLTabContainerCommon::TOP),
+ mTabPos(LLTabContainer::TOP),
mAutoResize(FALSE)
{
}
@@ -2521,16 +2367,16 @@ LLMultiFloater::LLMultiFloater(
BOOL auto_resize) :
LLFloater(name, rect, name),
mTabContainer(NULL),
- mTabPos(LLTabContainerCommon::TOP),
+ mTabPos(LLTabContainer::TOP),
mAutoResize(auto_resize)
{
mTabContainer = new LLTabContainer("Preview Tabs",
- LLRect(LLPANEL_BORDER_WIDTH, mRect.getHeight() - LLFLOATER_HEADER_SIZE, mRect.getWidth() - LLPANEL_BORDER_WIDTH, 0),
+ LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0),
mTabPos,
- NULL,
- NULL);
+ FALSE,
+ FALSE);
mTabContainer->setFollowsAll();
- if (mResizable)
+ if (isResizable())
{
mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
}
@@ -2549,12 +2395,12 @@ LLMultiFloater::LLMultiFloater(
mAutoResize(auto_resize)
{
mTabContainer = new LLTabContainer("Preview Tabs",
- LLRect(LLPANEL_BORDER_WIDTH, mRect.getHeight() - LLFLOATER_HEADER_SIZE, mRect.getWidth() - LLPANEL_BORDER_WIDTH, 0),
- mTabPos,
- NULL,
- NULL);
+ LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0),
+ mTabPos,
+ FALSE,
+ FALSE);
mTabContainer->setFollowsAll();
- if (mResizable && mTabPos == LLTabContainerCommon::BOTTOM)
+ if (isResizable() && mTabPos == LLTabContainer::BOTTOM)
{
mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
}
@@ -2563,21 +2409,6 @@ LLMultiFloater::LLMultiFloater(
}
-LLMultiFloater::~LLMultiFloater()
-{
-}
-
-// virtual
-EWidgetType LLMultiFloater::getWidgetType() const
-{
- return WIDGET_TYPE_MULTI_FLOATER;
-}
-
-// virtual
-LLString LLMultiFloater::getWidgetTag() const
-{
- return LL_MULTI_FLOATER_TAG;
-}
void LLMultiFloater::open() /* Flawfinder: ignore */
{
@@ -2597,7 +2428,7 @@ void LLMultiFloater::onClose(bool app_quitting)
{
if(closeAllFloaters() == TRUE)
{
- LLFloater::onClose(app_quitting ? true : false);
+ LLFloater::onClose(app_quitting);
}//else not all tabs could be closed...
}
@@ -2648,16 +2479,18 @@ BOOL LLMultiFloater::closeAllFloaters()
void LLMultiFloater::growToFit(S32 content_width, S32 content_height)
{
- S32 new_width = llmax(mRect.getWidth(), content_width + LLPANEL_BORDER_WIDTH * 2);
- S32 new_height = llmax(mRect.getHeight(), content_height + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT);
+ S32 new_width = llmax(getRect().getWidth(), content_width + LLPANEL_BORDER_WIDTH * 2);
+ S32 new_height = llmax(getRect().getHeight(), content_height + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT);
- if (isMinimized())
- {
- mPreviousRect.setLeftTopAndSize(mPreviousRect.mLeft, mPreviousRect.mTop, new_width, new_height);
- }
+ if (isMinimized())
+ {
+ LLRect newrect;
+ newrect.setLeftTopAndSize(getExpandedRect().mLeft, getExpandedRect().mTop, new_width, new_height);
+ setExpandedRect(newrect);
+ }
else
{
- S32 old_height = mRect.getHeight();
+ S32 old_height = getRect().getHeight();
reshape(new_width, new_height);
// keep top left corner in same position
translate(0, old_height - new_height);
@@ -2737,7 +2570,7 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater,
}
floaterp->setHost(this);
- if (mMinimized)
+ if (isMinimized())
{
floaterp->setVisible(FALSE);
}
@@ -2920,7 +2753,7 @@ void LLMultiFloater::onTabSelected(void* userdata, bool from_click)
void LLMultiFloater::setCanResize(BOOL can_resize)
{
LLFloater::setCanResize(can_resize);
- if (mResizable && mTabContainer->getTabPosition() == LLTabContainer::BOTTOM)
+ if (isResizable() && mTabContainer->getTabPosition() == LLTabContainer::BOTTOM)
{
mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
}
@@ -2963,20 +2796,23 @@ void LLMultiFloater::updateResizeLimits()
}
setResizeLimits(new_min_width, new_min_height);
- S32 cur_height = mRect.getHeight();
- S32 new_width = llmax(mRect.getWidth(), new_min_width);
- S32 new_height = llmax(mRect.getHeight(), new_min_height);
+ S32 cur_height = getRect().getHeight();
+ S32 new_width = llmax(getRect().getWidth(), new_min_width);
+ S32 new_height = llmax(getRect().getHeight(), new_min_height);
if (isMinimized())
{
- mPreviousRect.setLeftTopAndSize(mPreviousRect.mLeft, mPreviousRect.mTop, llmax(mPreviousRect.getWidth(), new_width), llmax(mPreviousRect.getHeight(), new_height));
+ const LLRect& expanded = getExpandedRect();
+ LLRect newrect;
+ newrect.setLeftTopAndSize(expanded.mLeft, expanded.mTop, llmax(expanded.getWidth(), new_width), llmax(expanded.getHeight(), new_height));
+ setExpandedRect(newrect);
}
else
{
reshape(new_width, new_height);
// make sure upper left corner doesn't move
- translate(0, cur_height - mRect.getHeight());
+ translate(0, cur_height - getRect().getHeight());
// make sure this window is visible on screen when it has been modified
// (tab added, etc)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 1d88501b01..5eb55e0420 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -112,8 +112,8 @@ public:
void initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open = TRUE);
/*virtual*/ void userSetShape(const LLRect& new_rect);
- /*virtual*/ BOOL canSnapTo(LLView* other_view);
- /*virtual*/ void snappedTo(LLView* snap_view);
+ /*virtual*/ BOOL canSnapTo(const LLView* other_view);
+ /*virtual*/ void snappedTo(const LLView* snap_view);
/*virtual*/ void setFocus( BOOL b );
/*virtual*/ void setIsChrome(BOOL is_chrome);
@@ -122,16 +122,14 @@ public:
virtual void init(const LLString& title, BOOL resizable,
S32 min_width, S32 min_height, BOOL drag_on_left,
BOOL minimizable, BOOL close_btn);
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_FLOATER; }
+ virtual LLString getWidgetTag() const { return LL_FLOATER_TAG; };
virtual void open(); /* Flawfinder: ignore */
// If allowed, close the floater cleanly, releasing focus.
// app_quitting is passed to onClose() below.
virtual void close(bool app_quitting = false);
-
- void setAutoFocus(BOOL focus) { mAutoFocus = focus; setFocus(focus); }
// Release keyboard and mouse focus
void releaseFocus();
@@ -142,18 +140,18 @@ public:
void applyRectControl();
- LLMultiFloater* getHost() { return (LLMultiFloater*)LLFloater::getFloaterByHandle(mHostHandle); }
+ LLMultiFloater* getHost() { return (LLMultiFloater*)mHostHandle.get(); }
void setTitle( const LLString& title );
- const LLString& getTitle() const;
+ const LLString& getTitle() const;
void setShortTitle( const LLString& short_title );
LLString getShortTitle();
virtual void setMinimized(BOOL b);
void moveResizeHandlesToFront();
void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE);
- void addDependentFloater(LLViewHandle dependent_handle, BOOL reposition = TRUE);
- LLFloater* getDependee() { return (LLFloater*)LLFloater::getFloaterByHandle(mDependeeHandle); }
- void removeDependentFloater(LLFloater* dependent);
+ void addDependentFloater(LLHandle<LLFloater> dependent_handle, BOOL reposition = TRUE);
+ LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); }
+ void removeDependentFloater(LLFloater* dependent);
BOOL isMinimized() { return mMinimized; }
BOOL isFrontmost();
BOOL isDependent() { return !mDependeeHandle.isDead(); }
@@ -167,10 +165,9 @@ public:
void setResizeLimits( S32 min_width, S32 min_height );
void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; }
-
bool isMinimizeable() const{ return mButtonsEnabled[BUTTON_MINIMIZE]; }
// Does this window have a close button, NOT can we close it right now.
- bool isCloseable() const{ return (mButtonsEnabled[BUTTON_CLOSE] ? true : false); }
+ bool isCloseable() const{ return (mButtonsEnabled[BUTTON_CLOSE]); }
bool isDragOnLeft() const{ return mDragOnLeft; }
S32 getMinWidth() const{ return mMinWidth; }
S32 getMinHeight() const{ return mMinHeight; }
@@ -181,29 +178,28 @@ public:
virtual void draw();
- // does nothing by default
- virtual void onOpen();
+ virtual void onOpen() {}
// Call destroy() to free memory, or setVisible(FALSE) to keep it
// If app_quitting, you might not want to save your visibility.
// Defaults to destroy().
- virtual void onClose(bool app_quitting);
+ virtual void onClose(bool app_quitting) { destroy(); }
- // Defaults to true.
- virtual BOOL canClose();
+ virtual BOOL canClose() const { return TRUE; }
virtual void setVisible(BOOL visible);
void setFrontmost(BOOL take_focus = TRUE);
// Defaults to false.
- virtual BOOL canSaveAs();
+ virtual BOOL canSaveAs() const { return FALSE; }
- // Defaults to no-op.
- virtual void saveAs();
+ virtual void saveAs() {}
- void setSnapTarget(LLViewHandle handle) { mSnappedTo = handle; }
+ void setSnapTarget(LLHandle<LLFloater> handle) { mSnappedTo = handle; }
void clearSnapTarget() { mSnappedTo.markDead(); }
- LLViewHandle getSnapTarget() { return mSnappedTo; }
+ LLHandle<LLFloater> getSnapTarget() { return mSnappedTo; }
+
+ LLHandle<LLFloater> getHandle() { return mHandle; }
static void closeFocusedFloater();
@@ -214,39 +210,39 @@ public:
static void setFloaterHost(LLMultiFloater* hostp) {sHostp = hostp; }
static void setEditModeEnabled(BOOL enable);
- static BOOL getEditModeEnabled();
+ static BOOL getEditModeEnabled() { return sEditModeEnabled; }
static LLMultiFloater* getFloaterHost() {return sHostp; }
- static void show(LLFloater* floaterp);
- static void hide(LLFloater* floaterp);
- static BOOL visible(LLFloater* floaterp);
-
- static LLFloater* getFloaterByHandle(LLViewHandle handle);
-
protected:
- // Don't call this directly. You probably want to call close(). JC
- void destroy();
+
virtual void bringToFront(S32 x, S32 y);
- virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE);
+ virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE);
+
+ void setExpandedRect(const LLRect& rect) { mExpandedRect = rect; } // size when not minimized
+ const LLRect& getExpandedRect() const { return mExpandedRect; }
+
+ void setAutoFocus(BOOL focus) { mAutoFocus = focus; } // whether to automatically take focus when opened
+ LLDragHandle* getDragHandle() const { return mDragHandle; }
+
+ void destroy() { die(); } // Don't call this directly. You probably want to call close(). JC
+
+private:
+
void setForeground(BOOL b); // called only by floaterview
void cleanupHandles(); // remove handles to dead floaters
void createMinimizeButton();
void updateButtons();
void buildButtons();
-protected:
-// static LLViewerImage* sBackgroundImage;
-// static LLViewerImage* sShadowImage;
-
+ LLRect mExpandedRect;
LLDragHandle* mDragHandle;
LLResizeBar* mResizeBar[4];
LLResizeHandle* mResizeHandle[4];
LLButton *mMinimizeButton;
BOOL mCanTearOff;
BOOL mMinimized;
- LLRect mPreviousRect;
BOOL mForeground;
- LLViewHandle mDependeeHandle;
+ LLHandle<LLFloater> mDependeeHandle;
LLString mShortTitle;
BOOL mFirstLook; // TRUE if the _next_ time this floater is visible will be the first time in the session that it is visible.
@@ -255,25 +251,24 @@ protected:
S32 mMinWidth;
S32 mMinHeight;
- BOOL mAutoFocus;
BOOL mEditing;
- typedef std::set<LLViewHandle> handle_set_t;
- typedef std::set<LLViewHandle>::iterator handle_set_iter_t;
+ typedef std::set<LLHandle<LLFloater> > handle_set_t;
+ typedef std::set<LLHandle<LLFloater> >::iterator handle_set_iter_t;
handle_set_t mDependents;
bool mDragOnLeft;
BOOL mButtonsEnabled[BUTTON_COUNT];
LLButton* mButtons[BUTTON_COUNT];
F32 mButtonScale;
-
- LLViewHandle mSnappedTo;
+ BOOL mAutoFocus;
+ LLHandle<LLFloater> mSnappedTo;
- LLViewHandle mHostHandle;
- LLViewHandle mLastHostHandle;
+ LLHandle<LLFloater> mHostHandle;
+ LLHandle<LLFloater> mLastHostHandle;
- static BOOL sEditModeEnabled;
static LLMultiFloater* sHostp;
+ static BOOL sEditModeEnabled;
static LLString sButtonActiveImageNames[BUTTON_COUNT];
static LLString sButtonInactiveImageNames[BUTTON_COUNT];
static LLString sButtonPressedImageNames[BUTTON_COUNT];
@@ -282,15 +277,18 @@ protected:
typedef void (*click_callback)(void *);
static click_callback sButtonCallbacks[BUTTON_COUNT];
- typedef std::map<LLViewHandle, LLFloater*> handle_map_t;
- typedef std::map<LLViewHandle, LLFloater*>::iterator handle_map_iter_t;
+ typedef std::map<LLHandle<LLFloater>, LLFloater*> handle_map_t;
+ typedef std::map<LLHandle<LLFloater>, LLFloater*>::iterator handle_map_iter_t;
static handle_map_t sFloaterMap;
- std::vector<LLViewHandle> mMinimizedHiddenChildren;
+ std::vector<LLHandle<LLView> > mMinimizedHiddenChildren;
BOOL mHasBeenDraggedWhileMinimized;
S32 mPreviousMinimizedBottom;
S32 mPreviousMinimizedLeft;
+
+private:
+ LLRootHandle<LLFloater> mHandle;
};
/////////////////////////////////////////////////////////////
@@ -302,14 +300,14 @@ class LLFloaterView : public LLUICtrl
public:
LLFloaterView( const LLString& name, const LLRect& rect );
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_FLOATER_VIEW; }
+ virtual LLString getWidgetTag() const { return LL_FLOATER_VIEW_TAG; }
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
void reshape(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical);
/*virtual*/ void draw();
- /*virtual*/ const LLRect getSnapRect() const;
+ /*virtual*/ LLRect getSnapRect() const;
void refresh();
void getNewFloaterPosition( S32* left, S32* top );
@@ -325,8 +323,8 @@ public:
void pushVisibleAll(BOOL visible, const skip_list_t& skip_list = skip_list_t());
void popVisibleAll(const skip_list_t& skip_list = skip_list_t());
- void setCycleMode(BOOL mode);
- BOOL getCycleMode();
+ void setCycleMode(BOOL mode) { mFocusCycleMode = mode; }
+ BOOL getCycleMode() const { return mFocusCycleMode; }
void bringToFront( LLFloater* child, BOOL give_focus = TRUE );
void highlightFocusedFloater();
void unhighlightFocusedFloater();
@@ -342,10 +340,6 @@ public:
LLFloater* getFocusedFloater();
void syncFloaterTabOrder();
- // Get a floater based the handle. If this returns NULL, it is up
- // to the caller to discard the handle.
- LLFloater* getFloaterByHandle(LLViewHandle handle);
-
// Returns z order of child provided. 0 is closest, larger numbers
// are deeper in the screen. If there is no such child, the return
// value is not defined.
@@ -361,15 +355,16 @@ private:
S32 mSnapOffsetBottom;
};
+// https://wiki.lindenlab.com/mediawiki/index.php?title=LLMultiFloater&oldid=81376
class LLMultiFloater : public LLFloater
{
public:
LLMultiFloater();
- LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos);
+ LLMultiFloater(LLTabContainer::TabPosition tab_pos);
LLMultiFloater(const LLString& name);
LLMultiFloater(const LLString& name, const LLRect& rect, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE);
LLMultiFloater(const LLString& name, const LLString& rect_control, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE);
- virtual ~LLMultiFloater();
+ virtual ~LLMultiFloater() {};
virtual BOOL postBuild();
/*virtual*/ void open(); /* Flawfinder: ignore */
@@ -377,12 +372,12 @@ public:
/*virtual*/ void draw();
/*virtual*/ void setVisible(BOOL visible);
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
- /*virtual*/ EWidgetType getWidgetType() const;
- /*virtual*/ LLString getWidgetTag() const;
+ /*virtual*/ EWidgetType getWidgetType() const { return WIDGET_TYPE_MULTI_FLOATER; }
+ /*virtual*/ LLString getWidgetTag() const { return LL_MULTI_FLOATER_TAG; };
virtual void setCanResize(BOOL can_resize);
virtual void growToFit(S32 content_width, S32 content_height);
- virtual void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainerCommon::eInsertionPoint insertion_point = LLTabContainerCommon::END);
+ virtual void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
virtual void showFloater(LLFloater* floaterp);
virtual void removeFloater(LLFloater* floaterp);
@@ -400,7 +395,7 @@ public:
virtual void setFloaterFlashing(LLFloater* floaterp, BOOL flashing);
virtual BOOL closeAllFloaters(); //Returns FALSE if the floater could not be closed due to pending confirmation dialogs
- void setTabContainer(LLTabContainerCommon* tab_container) { if (!mTabContainer) mTabContainer = tab_container; }
+ void setTabContainer(LLTabContainer* tab_container) { if (!mTabContainer) mTabContainer = tab_container; }
static void onTabSelected(void* userdata, bool);
virtual void updateResizeLimits();
@@ -414,15 +409,56 @@ protected:
BOOL mCanResize;
};
- LLTabContainerCommon* mTabContainer;
+ LLTabContainer* mTabContainer;
- typedef std::map<LLViewHandle, LLFloaterData> floater_data_map_t;
+ typedef std::map<LLHandle<LLFloater>, LLFloaterData> floater_data_map_t;
floater_data_map_t mFloaterDataMap;
- LLTabContainerCommon::TabPosition mTabPos;
+ LLTabContainer::TabPosition mTabPos;
BOOL mAutoResize;
};
+// visibility policy specialized for floaters
+template<>
+class VisibilityPolicy<LLFloater>
+{
+public:
+ // visibility methods
+ static bool visible(LLFloater* instance, const LLSD& key)
+ {
+ if (instance)
+ {
+ return !instance->isMinimized() && instance->isInVisibleChain();
+ }
+ return FALSE;
+ }
+
+ static void show(LLFloater* instance, const LLSD& key)
+ {
+ if (instance)
+ {
+ instance->open();
+ if (instance->getHost())
+ {
+ instance->getHost()->open();
+ }
+ }
+ }
+
+ static void hide(LLFloater* instance, const LLSD& key)
+ {
+ if (instance) instance->close();
+ }
+};
+
+
+// singleton implementation for floaters (provides visibility policy)
+// https://wiki.lindenlab.com/mediawiki/index.php?title=LLFloaterSingleton&oldid=79410
+
+template <class T> class LLFloaterSingleton : public LLUISingleton<T, VisibilityPolicy<LLFloater> >
+{
+};
+
extern LLFloaterView* gFloaterView;
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index e3337eb588..29c6aa3c30 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -57,12 +57,8 @@ LLFocusMgr::LLFocusMgr()
{
}
-LLFocusMgr::~LLFocusMgr()
-{
- mFocusHistory.clear();
-}
-void LLFocusMgr::releaseFocusIfNeeded( LLView* view )
+void LLFocusMgr::releaseFocusIfNeeded( const LLView* view )
{
if( childHasMouseCapture( view ) )
{
@@ -146,7 +142,7 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock)
if (focus_subtree)
{
- mFocusHistory[focus_subtree->mViewHandle] = mKeyboardFocus ? mKeyboardFocus->mViewHandle : LLViewHandle::sDeadHandle;
+ mFocusHistory[focus_subtree->getHandle()] = mKeyboardFocus ? mKeyboardFocus->getHandle() : LLHandle<LLView>();
}
}
@@ -156,10 +152,6 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock)
}
}
-void LLFocusMgr::setDefaultKeyboardFocus(LLUICtrl* default_focus)
-{
- mDefaultKeyboardFocus = default_focus;
-}
// Returns TRUE is parent or any descedent of parent has keyboard focus.
BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const
@@ -177,7 +169,7 @@ BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const
}
// Returns TRUE is parent or any descedent of parent is the mouse captor.
-BOOL LLFocusMgr::childHasMouseCapture( LLView* parent )
+BOOL LLFocusMgr::childHasMouseCapture( const LLView* parent ) const
{
if( mMouseCaptor && mMouseCaptor->isView() )
{
@@ -194,7 +186,7 @@ BOOL LLFocusMgr::childHasMouseCapture( LLView* parent )
return FALSE;
}
-void LLFocusMgr::removeKeyboardFocusWithoutCallback( LLView* focus )
+void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLView* focus )
{
// should be ok to unlock here, as you have to know the locked view
// in order to unlock it
@@ -253,7 +245,7 @@ void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
}
}
-void LLFocusMgr::removeMouseCaptureWithoutCallback( LLMouseHandler* captor )
+void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor )
{
//if (mFocusLocked)
//{
@@ -269,7 +261,7 @@ void LLFocusMgr::removeMouseCaptureWithoutCallback( LLMouseHandler* captor )
}
-BOOL LLFocusMgr::childIsTopCtrl( LLView* parent )
+BOOL LLFocusMgr::childIsTopCtrl( const LLView* parent ) const
{
LLView* top_view = (LLView*)mTopCtrl;
while( top_view )
@@ -304,7 +296,7 @@ void LLFocusMgr::setTopCtrl( LLUICtrl* new_top )
}
}
-void LLFocusMgr::removeTopCtrlWithoutCallback( LLUICtrl* top_view )
+void LLFocusMgr::removeTopCtrlWithoutCallback( const LLUICtrl* top_view )
{
if( mTopCtrl == top_view )
{
@@ -325,12 +317,12 @@ void LLFocusMgr::unlockFocus()
mLockedView = NULL;
}
-F32 LLFocusMgr::getFocusFlashAmt()
+F32 LLFocusMgr::getFocusFlashAmt() const
{
return clamp_rescale(getFocusTime(), 0.f, FOCUS_FADE_TIME, mFocusWeight, 0.f);
}
-LLColor4 LLFocusMgr::getFocusColor()
+LLColor4 LLFocusMgr::getFocusColor() const
{
LLColor4 focus_color = lerp(LLUI::sColorsGroup->getColor( "FocusColor" ), LLColor4::white, getFocusFlashAmt());
// de-emphasize keyboard focus when app has lost focus (to avoid typing into wrong window problem)
@@ -362,15 +354,15 @@ void LLFocusMgr::setAppHasFocus(BOOL focus)
mAppHasFocus = focus;
}
-LLUICtrl* LLFocusMgr::getLastFocusForGroup(LLView* subtree_root)
+LLUICtrl* LLFocusMgr::getLastFocusForGroup(LLView* subtree_root) const
{
if (subtree_root)
{
- focus_history_map_t::iterator found_it = mFocusHistory.find(subtree_root->mViewHandle);
+ focus_history_map_t::const_iterator found_it = mFocusHistory.find(subtree_root->getHandle());
if (found_it != mFocusHistory.end())
{
// found last focus for this subtree
- return static_cast<LLUICtrl*>(LLView::getViewByHandle(found_it->second));
+ return static_cast<LLUICtrl*>(found_it->second.get());
}
}
return NULL;
@@ -380,6 +372,6 @@ void LLFocusMgr::clearLastFocusForGroup(LLView* subtree_root)
{
if (subtree_root)
{
- mFocusHistory.erase(subtree_root->mViewHandle);
+ mFocusHistory.erase(subtree_root->getHandle());
}
}
diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h
index 20dc21fc3a..a3ca8bee26 100644
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -45,48 +45,48 @@ class LLFocusMgr
{
public:
LLFocusMgr();
- ~LLFocusMgr();
+ ~LLFocusMgr() { mFocusHistory.clear(); }
// Mouse Captor
void setMouseCapture(LLMouseHandler* new_captor); // new_captor = NULL to release the mouse.
- LLMouseHandler* getMouseCapture() { return mMouseCaptor; }
- void removeMouseCaptureWithoutCallback( LLMouseHandler* captor );
- BOOL childHasMouseCapture( LLView* parent );
+ LLMouseHandler* getMouseCapture() const { return mMouseCaptor; }
+ void removeMouseCaptureWithoutCallback( const LLMouseHandler* captor );
+ BOOL childHasMouseCapture( const LLView* parent ) const;
// Keyboard Focus
void setKeyboardFocus(LLUICtrl* new_focus, BOOL lock = FALSE); // new_focus = NULL to release the focus.
LLUICtrl* getKeyboardFocus() const { return mKeyboardFocus; }
LLUICtrl* getLastKeyboardFocus() const { return mLastKeyboardFocus; }
BOOL childHasKeyboardFocus( const LLView* parent ) const;
- void removeKeyboardFocusWithoutCallback( LLView* focus );
+ void removeKeyboardFocusWithoutCallback( const LLView* focus );
F32 getFocusTime() const { return mFocusTimer.getElapsedTimeF32(); }
- F32 getFocusFlashAmt();
- LLColor4 getFocusColor();
+ F32 getFocusFlashAmt() const;
+ LLColor4 getFocusColor() const;
void triggerFocusFlash();
- BOOL getAppHasFocus() { return mAppHasFocus; }
+ BOOL getAppHasFocus() const { return mAppHasFocus; }
void setAppHasFocus(BOOL focus);
- LLUICtrl* getLastFocusForGroup(LLView* subtree_root);
+ LLUICtrl* getLastFocusForGroup(LLView* subtree_root) const;
void clearLastFocusForGroup(LLView* subtree_root);
// If setKeyboardFocus(NULL) is called, and there is a non-NULL default
// keyboard focus view, focus goes there. JC
- void setDefaultKeyboardFocus(LLUICtrl* default_focus);
+ void setDefaultKeyboardFocus(LLUICtrl* default_focus) { mDefaultKeyboardFocus = default_focus; }
LLUICtrl* getDefaultKeyboardFocus() const { return mDefaultKeyboardFocus; }
// Top View
void setTopCtrl(LLUICtrl* new_top);
LLUICtrl* getTopCtrl() const { return mTopCtrl; }
- void removeTopCtrlWithoutCallback( LLUICtrl* top_view );
- BOOL childIsTopCtrl( LLView* parent );
+ void removeTopCtrlWithoutCallback( const LLUICtrl* top_view );
+ BOOL childIsTopCtrl( const LLView* parent ) const;
// All Three
- void releaseFocusIfNeeded( LLView* top_view );
+ void releaseFocusIfNeeded( const LLView* top_view );
void lockFocus();
void unlockFocus();
- BOOL focusLocked() { return mLockedView != NULL; }
+ BOOL focusLocked() const { return mLockedView != NULL; }
-protected:
+private:
LLUICtrl* mLockedView;
// Mouse Captor
@@ -105,7 +105,7 @@ protected:
BOOL mAppHasFocus;
- typedef std::map<LLViewHandle, LLViewHandle> focus_history_map_t;
+ typedef std::map<LLHandle<LLView>, LLHandle<LLView> > focus_history_map_t;
focus_history_map_t mFocusHistory;
#ifdef _DEBUG
@@ -119,3 +119,4 @@ extern LLFocusMgr gFocusMgr;
#endif // LL_LLFOCUSMGR_H
+
diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp
index a063ebcd25..f47f166c45 100644
--- a/indra/llui/lliconctrl.cpp
+++ b/indra/llui/lliconctrl.cpp
@@ -91,8 +91,8 @@ void LLIconCtrl::draw()
if( mImagep.notNull() )
{
mImagep->draw(0, 0,
- mRect.getWidth(), mRect.getHeight(),
- mColor );
+ getRect().getWidth(), getRect().getHeight(),
+ mColor );
}
LLUICtrl::draw();
diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h
index 1e474d0935..6535c0bb0b 100644
--- a/indra/llui/lliconctrl.h
+++ b/indra/llui/lliconctrl.h
@@ -69,7 +69,7 @@ public:
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
-protected:
+private:
LLColor4 mColor;
LLString mImageName;
LLUUID mImageID;
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 85d8f4b5c2..a81e26f880 100644
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -41,7 +41,7 @@
const U32 KEYWORD_FILE_CURRENT_VERSION = 2;
-inline BOOL LLKeywordToken::isHead(const llwchar* s)
+inline BOOL LLKeywordToken::isHead(const llwchar* s) const
{
// strncmp is much faster than string compare
BOOL res = TRUE;
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index d279d2e627..fe36d7cbf6 100644
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -56,11 +56,12 @@ public:
{
}
- S32 getLength() { return mToken.size(); }
- BOOL isHead(const llwchar* s);
- const LLColor3& getColor() { return mColor; }
- TOKEN_TYPE getType() { return mType; }
- const LLWString& getToolTip() { return mToolTip; }
+ S32 getLength() const { return mToken.size(); }
+ BOOL isHead(const llwchar* s) const;
+ const LLWString& getToken() const { return mToken; }
+ const LLColor3& getColor() const { return mColor; }
+ TOKEN_TYPE getType() const { return mType; }
+ const LLWString& getToolTip() const { return mToolTip; }
#ifdef _DEBUG
void dump();
@@ -68,10 +69,8 @@ public:
private:
TOKEN_TYPE mType;
-public:
LLWString mToken;
LLColor3 mColor;
-private:
LLWString mToolTip;
};
@@ -82,30 +81,31 @@ public:
~LLKeywords();
BOOL loadFromFile(const LLString& filename);
- BOOL isLoaded() { return mLoaded; }
+ BOOL isLoaded() const { return mLoaded; }
void findSegments(std::vector<LLTextSegment *> *seg_list, const LLWString& text, const LLColor4 &defaultColor );
-#ifdef _DEBUG
- void dump();
-#endif
-
// Add the token as described
void addToken(LLKeywordToken::TOKEN_TYPE type,
const LLString& key,
const LLColor3& color,
const LLString& tool_tip = LLString::null);
+ typedef std::map<LLWString, LLKeywordToken*> word_token_map_t;
+ typedef word_token_map_t::const_iterator keyword_iterator_t;
+ keyword_iterator_t begin() const { return mWordTokenMap.begin(); }
+ keyword_iterator_t end() const { return mWordTokenMap.end(); }
+
+#ifdef _DEBUG
+ void dump();
+#endif
+
private:
LLColor3 readColor(const LLString& s);
void insertSegment(std::vector<LLTextSegment *> *seg_list, LLTextSegment* new_segment, S32 text_len, const LLColor4 &defaultColor);
-private:
- BOOL mLoaded;
-public:
- typedef std::map<LLWString, LLKeywordToken*> word_token_map_t;
+ BOOL mLoaded;
word_token_map_t mWordTokenMap;
-private:
typedef std::deque<LLKeywordToken*> token_list_t;
token_list_t mLineTokenList;
token_list_t mDelimiterTokenList;
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 4297f5fef8..391b28a21f 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -81,44 +81,6 @@ const S32 PREEDIT_STANDOUT_GAP = 1;
const S32 PREEDIT_STANDOUT_POSITION = 2;
const S32 PREEDIT_STANDOUT_THICKNESS = 2;
-// This is a friend class of and is only used by LLLineEditor
-class LLLineEditorRollback
-{
-public:
- LLLineEditorRollback( LLLineEditor* ed )
- :
- mCursorPos( ed->mCursorPos ),
- mScrollHPos( ed->mScrollHPos ),
- mIsSelecting( ed->mIsSelecting ),
- mSelectionStart( ed->mSelectionStart ),
- mSelectionEnd( ed->mSelectionEnd )
- {
- mText = ed->getText();
- }
-
- void doRollback( LLLineEditor* ed )
- {
- ed->mCursorPos = mCursorPos;
- ed->mScrollHPos = mScrollHPos;
- ed->mIsSelecting = mIsSelecting;
- ed->mSelectionStart = mSelectionStart;
- ed->mSelectionEnd = mSelectionEnd;
- ed->mText = mText;
- ed->mPrevText = mText;
- }
-
- LLString getText() { return mText; }
-
-private:
- LLString mText;
- S32 mCursorPos;
- S32 mScrollHPos;
- BOOL mIsSelecting;
- S32 mSelectionStart;
- S32 mSelectionEnd;
-};
-
-
//
// Member functions
//
@@ -190,7 +152,7 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect,
setFocusLostCallback(focus_lost_callback);
mMinHPixels = mBorderThickness + UI_LINEEDITOR_H_PAD + mBorderLeft;
- mMaxHPixels = mRect.getWidth() - mMinHPixels - mBorderThickness - mBorderRight;
+ mMaxHPixels = getRect().getWidth() - mMinHPixels - mBorderThickness - mBorderRight;
mScrollTimer.reset();
@@ -200,7 +162,7 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect,
// Scalable UI somehow made these rectangles off-by-one.
// I don't know why. JC
- LLRect border_rect(0, mRect.getHeight()-1, mRect.getWidth()-1, 0);
+ LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0);
mBorder = new LLViewBorder( "line ed border", border_rect, border_bevel, border_style, mBorderThickness );
addChild( mBorder );
mBorder->setFollows(FOLLOWS_LEFT|FOLLOWS_RIGHT|FOLLOWS_TOP|FOLLOWS_BOTTOM);
@@ -219,17 +181,6 @@ LLLineEditor::~LLLineEditor()
}
}
-//virtual
-EWidgetType LLLineEditor::getWidgetType() const
-{
- return WIDGET_TYPE_LINE_EDITOR;
-}
-
-//virtual
-LLString LLLineEditor::getWidgetTag() const
-{
- return LL_LINE_EDITOR_TAG;
-}
void LLLineEditor::onFocusReceived()
{
@@ -269,18 +220,6 @@ void LLLineEditor::onCommit()
selectAll();
}
-// virtual
-BOOL LLLineEditor::isDirty() const
-{
- return ( mText.getString() != mPrevText );
-}
-
-// virtual
-void LLLineEditor::resetDirty()
-{
- mPrevText = mText.getString();
-}
-
// line history support
void LLLineEditor::updateHistory()
@@ -306,12 +245,7 @@ void LLLineEditor::reshape(S32 width, S32 height, BOOL called_from_parent)
{
LLUICtrl::reshape(width, height, called_from_parent );
- mMaxHPixels = mRect.getWidth() - 2 * (mBorderThickness + UI_LINEEDITOR_H_PAD) + 1 - mBorderRight;
-}
-
-void LLLineEditor::setEnableLineHistory( BOOL enabled )
-{
- mHaveHistory = enabled;
+ mMaxHPixels = getRect().getWidth() - 2 * (mBorderThickness + UI_LINEEDITOR_H_PAD) + 1 - mBorderRight;
}
void LLLineEditor::setEnabled(BOOL enabled)
@@ -330,16 +264,12 @@ void LLLineEditor::setMaxTextLength(S32 max_text_length)
void LLLineEditor::setBorderWidth(S32 left, S32 right)
{
- mBorderLeft = llclamp(left, 0, mRect.getWidth());
- mBorderRight = llclamp(right, 0, mRect.getWidth());
+ mBorderLeft = llclamp(left, 0, getRect().getWidth());
+ mBorderRight = llclamp(right, 0, getRect().getWidth());
mMinHPixels = mBorderThickness + UI_LINEEDITOR_H_PAD + mBorderLeft;
- mMaxHPixels = mRect.getWidth() - mMinHPixels - mBorderThickness - mBorderRight;
+ mMaxHPixels = getRect().getWidth() - mMinHPixels - mBorderThickness - mBorderRight;
}
-void LLLineEditor::setLabel(const LLStringExplicit &new_label)
-{
- mLabel = new_label;
-}
void LLLineEditor::setText(const LLStringExplicit &new_text)
{
@@ -451,12 +381,11 @@ void LLLineEditor::setCursorToEnd()
deselect();
}
-BOOL LLLineEditor::canDeselect()
+BOOL LLLineEditor::canDeselect() const
{
return hasSelection();
}
-
void LLLineEditor::deselect()
{
mSelectionStart = 0;
@@ -481,7 +410,7 @@ void LLLineEditor::endSelection()
}
}
-BOOL LLLineEditor::canSelectAll()
+BOOL LLLineEditor::canSelectAll() const
{
return TRUE;
}
@@ -554,7 +483,7 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if (x < mBorderLeft || x > (mRect.getWidth() - mBorderRight))
+ if (x < mBorderLeft || x > (getRect().getWidth() - mBorderRight))
{
return LLUICtrl::handleMouseDown(x, y, mask);
}
@@ -634,7 +563,7 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
{
BOOL handled = FALSE;
- if (!hasMouseCapture() && (x < mBorderLeft || x > (mRect.getWidth() - mBorderRight)))
+ if (!hasMouseCapture() && (x < mBorderLeft || x > (getRect().getWidth() - mBorderRight)))
{
return LLUICtrl::handleHover(x, y, mask);
}
@@ -705,7 +634,7 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask)
handled = TRUE;
}
- if (!handled && (x < mBorderLeft || x > (mRect.getWidth() - mBorderRight)))
+ if (!handled && (x < mBorderLeft || x > (getRect().getWidth() - mBorderRight)))
{
return LLUICtrl::handleMouseUp(x, y, mask);
}
@@ -856,11 +785,6 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
switch( key )
{
case KEY_LEFT:
- if (mIgnoreArrowKeys)
- {
- handled = FALSE;
- break;
- }
if( 0 < getCursor() )
{
S32 cursorPos = getCursor() - 1;
@@ -877,11 +801,6 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
break;
case KEY_RIGHT:
- if (mIgnoreArrowKeys)
- {
- handled = FALSE;
- break;
- }
if( getCursor() < mText.length())
{
S32 cursorPos = getCursor() + 1;
@@ -899,22 +818,12 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
case KEY_PAGE_UP:
case KEY_HOME:
- if (mIgnoreArrowKeys)
- {
- handled = FALSE;
- break;
- }
extendSelection( 0 );
break;
case KEY_PAGE_DOWN:
case KEY_END:
{
- if (mIgnoreArrowKeys)
- {
- handled = FALSE;
- break;
- }
S32 len = mText.length();
if( len )
{
@@ -962,7 +871,7 @@ void LLLineEditor::deleteSelection()
}
}
-BOOL LLLineEditor::canCut()
+BOOL LLLineEditor::canCut() const
{
return !mReadOnly && !mDrawAsterixes && hasSelection();
}
@@ -996,7 +905,7 @@ void LLLineEditor::cut()
}
}
-BOOL LLLineEditor::canCopy()
+BOOL LLLineEditor::canCopy() const
{
return !mDrawAsterixes && hasSelection();
}
@@ -1013,7 +922,7 @@ void LLLineEditor::copy()
}
}
-BOOL LLLineEditor::canPaste()
+BOOL LLLineEditor::canPaste() const
{
return !mReadOnly && gClipboard.canPasteString();
}
@@ -1148,8 +1057,9 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
break;
case KEY_LEFT:
- if (!mIgnoreArrowKeys
- && mask != MASK_ALT)
+ if (mIgnoreArrowKeys && mask == MASK_NONE)
+ break;
+ if ((mask & MASK_ALT) == 0)
{
if( hasSelection() )
{
@@ -1174,8 +1084,9 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
break;
case KEY_RIGHT:
- if (!mIgnoreArrowKeys
- && mask != MASK_ALT)
+ if (mIgnoreArrowKeys && mask == MASK_NONE)
+ break;
+ if ((mask & MASK_ALT) == 0)
{
if (hasSelection())
{
@@ -1428,7 +1339,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare
}
-BOOL LLLineEditor::canDoDelete()
+BOOL LLLineEditor::canDoDelete() const
{
return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
}
@@ -1490,7 +1401,7 @@ void LLLineEditor::draw()
}
// draw rectangle for the background
- LLRect background( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 );
background.stretch( -mBorderThickness );
LLColor4 bg_color = mReadOnlyBgColor;
@@ -1521,7 +1432,7 @@ void LLLineEditor::draw()
LLColor4 text_color;
if (!mReadOnly)
{
- if (!mTentative)
+ if (!getTentative())
{
text_color = mFgColor;
}
@@ -1846,7 +1757,7 @@ BOOL LLLineEditor::prevalidateFloat(const LLWString &str)
if( 0 < len )
{
// May be a comma or period, depending on the locale
- char decimal_point = gResMgr->getDecimalPoint();
+ llwchar decimal_point = (llwchar)gResMgr->getDecimalPoint();
S32 i = 0;
@@ -1895,7 +1806,7 @@ BOOL LLLineEditor::postvalidateFloat(const LLString &str)
}
// May be a comma or period, depending on the locale
- char decimal_point = gResMgr->getDecimalPoint();
+ llwchar decimal_point = (llwchar)gResMgr->getDecimalPoint();
for( ; i < len; i++ )
{
@@ -2366,18 +2277,6 @@ void LLLineEditor::setColorParameters(LLXMLNodePtr node)
}
}
-void LLLineEditor::setValue(const LLSD& value )
-{
- setText(value.asString());
-}
-
-LLSD LLLineEditor::getValue() const
-{
- LLString str = getText();
- LLSD ret(str);
- return ret;
-}
-
BOOL LLLineEditor::setTextArg( const LLString& key, const LLStringExplicit& text )
{
mText.setArg(key, text);
@@ -2504,7 +2403,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
if (control)
{
LLRect control_rect_screen;
- localRectToScreen(mRect, &control_rect_screen);
+ localRectToScreen(getRect(), &control_rect_screen);
LLUI::screenRectToGL(control_rect_screen, control);
}
@@ -2534,21 +2433,21 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
{
S32 query_local = findPixelNearestPos(query - getCursor());
S32 query_screen_x, query_screen_y;
- localPointToScreen(query_local, mRect.getHeight() / 2, &query_screen_x, &query_screen_y);
+ localPointToScreen(query_local, getRect().getHeight() / 2, &query_screen_x, &query_screen_y);
LLUI::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
}
if (bounds)
{
S32 preedit_left_local = findPixelNearestPos(llmax(preedit_left_column, mScrollHPos) - getCursor());
- S32 preedit_right_local = llmin(findPixelNearestPos(preedit_right_column - getCursor()), mRect.getWidth() - mBorderThickness);
+ S32 preedit_right_local = llmin(findPixelNearestPos(preedit_right_column - getCursor()), getRect().getWidth() - mBorderThickness);
if (preedit_left_local > preedit_right_local)
{
// Is this condition possible?
preedit_right_local = preedit_left_local;
}
- LLRect preedit_rect_local(preedit_left_local, mRect.getHeight(), preedit_right_local, 0);
+ LLRect preedit_rect_local(preedit_left_local, getRect().getHeight(), preedit_right_local, 0);
LLRect preedit_rect_screen;
localRectToScreen(preedit_rect_local, &preedit_rect_screen);
LLUI::screenRectToGL(preedit_rect_screen, bounds);
@@ -2632,7 +2531,7 @@ LLSearchEditor::LLSearchEditor(const LLString& name,
LLUICtrl(name, rect, TRUE, NULL, userdata),
mSearchCallback(search_callback)
{
- LLRect search_edit_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
+ LLRect search_edit_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
mSearchEdit = new LLLineEditor("search edit",
search_edit_rect,
LLString::null,
@@ -2668,55 +2567,6 @@ LLSearchEditor::LLSearchEditor(const LLString& name,
mSearchEdit->setBorderWidth(0, btn_width);
}
-LLSearchEditor::~LLSearchEditor()
-{
-}
-
-//virtual
-EWidgetType LLSearchEditor::getWidgetType() const
-{
- return WIDGET_TYPE_SEARCH_EDITOR;
-}
-
-//virtual
-LLString LLSearchEditor::getWidgetTag() const
-{
- return LL_SEARCH_EDITOR_TAG;
-}
-
-//virtual
-void LLSearchEditor::setValue(const LLSD& value )
-{
- mSearchEdit->setValue(value);
-}
-
-//virtual
-LLSD LLSearchEditor::getValue() const
-{
- return mSearchEdit->getValue();
-}
-
-//virtual
-BOOL LLSearchEditor::setTextArg( const LLString& key, const LLStringExplicit& text )
-{
- return mSearchEdit->setTextArg(key, text);
-}
-
-//virtual
-BOOL LLSearchEditor::setLabelArg( const LLString& key, const LLStringExplicit& text )
-{
- return mSearchEdit->setLabelArg(key, text);
-}
-
-//virtual
-void LLSearchEditor::clear()
-{
- if (mSearchEdit)
- {
- mSearchEdit->clear();
- }
-}
-
void LLSearchEditor::draw()
{
@@ -2725,10 +2575,6 @@ void LLSearchEditor::draw()
LLUICtrl::draw();
}
-void LLSearchEditor::setText(const LLStringExplicit &new_text)
-{
- mSearchEdit->setText(new_text);
-}
//static
void LLSearchEditor::onSearchEdit(LLLineEditor* caller, void* user_data )
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 0739315c4d..6210c37ef3 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -1,6 +1,15 @@
/**
* @file lllineeditor.h
- * @brief LLLineEditor base class
+ * @brief Text editor widget to let users enter/edit a single line.
+ *
+ * Features:
+ * Text entry of a single line (text, delete, left and right arrow, insert, return).
+ * Callbacks either on every keystroke or just on the return key.
+ * Focus (allow multiple text entry widgets)
+ * Clipboard (cut, copy, and paste)
+ * Horizontal scrolling to allow strings longer than widget size allows
+ * Pre-validation (limit which keys can be used)
+ * Optional line history so previous entries can be recalled by CTRL UP/DOWN
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -29,19 +38,6 @@
* $/LicenseInfo$
*/
-// Text editor widget to let users enter/edit a single line.
-//
-//
-// Features:
-// Text entry of a single line (text, delete, left and right arrow, insert, return).
-// Callbacks either on every keystroke or just on the return key.
-// Focus (allow multiple text entry widgets)
-// Clipboard (cut, copy, and paste)
-// Horizontal scrolling to allow strings longer than widget size allows
-// Pre-validation (limit which keys can be used)
-// Optional line history so previous entries can be recalled by CTRL UP/DOWN
-
-
#ifndef LL_LLLINEEDITOR_H
#define LL_LLLINEEDITOR_H
@@ -61,13 +57,10 @@ class LLButton;
typedef BOOL (*LLLinePrevalidateFunc)(const LLWString &wstr);
-//
-// Classes
-//
+
class LLLineEditor
: public LLUICtrl, public LLEditMenuHandler, protected LLPreeditor
{
- friend class LLLineEditorRollback;
public:
LLLineEditor(const LLString& name,
@@ -85,8 +78,8 @@ public:
S32 border_thickness = 1);
virtual ~LLLineEditor();
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_LINE_EDITOR; }
+ virtual LLString getWidgetTag() const { return LL_LINE_EDITOR_TAG; };
virtual LLXMLNodePtr getXML(bool save_children = true) const;
void setColorParameters(LLXMLNodePtr node);
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
@@ -102,22 +95,22 @@ public:
// LLEditMenuHandler overrides
virtual void cut();
- virtual BOOL canCut();
+ virtual BOOL canCut() const;
virtual void copy();
- virtual BOOL canCopy();
+ virtual BOOL canCopy() const;
virtual void paste();
- virtual BOOL canPaste();
+ virtual BOOL canPaste() const;
virtual void doDelete();
- virtual BOOL canDoDelete();
+ virtual BOOL canDoDelete() const;
virtual void selectAll();
- virtual BOOL canSelectAll();
+ virtual BOOL canSelectAll() const;
virtual void deselect();
- virtual BOOL canDeselect();
+ virtual BOOL canDeselect() const;
// view overrides
virtual void draw();
@@ -133,16 +126,16 @@ public:
virtual void setRect(const LLRect& rect);
virtual BOOL acceptsTextInput() const;
virtual void onCommit();
- virtual BOOL isDirty() const; // Returns TRUE if the user has changed value at all
- virtual void resetDirty(); // Clear dirty state
+ virtual BOOL isDirty() const { return mText.getString() != mPrevText; } // Returns TRUE if user changed value at all
+ virtual void resetDirty() { mPrevText = mText.getString(); } // Clear dirty state
// assumes UTF8 text
- virtual void setValue(const LLSD& value );
- virtual LLSD getValue() const;
+ virtual void setValue(const LLSD& value ) { setText(value.asString()); }
+ virtual LLSD getValue() const { return LLSD(getText()); }
virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
- void setLabel(const LLStringExplicit &new_label);
+ void setLabel(const LLStringExplicit &new_label) { mLabel = new_label; }
void setText(const LLStringExplicit &new_text);
const LLString& getText() const { return mText.getString(); }
@@ -179,7 +172,6 @@ public:
void setIgnoreArrowKeys(BOOL b) { mIgnoreArrowKeys = b; }
void setIgnoreTab(BOOL b) { mIgnoreTab = b; }
void setPassDelete(BOOL b) { mPassDelete = b; }
-
void setDrawAsterixes(BOOL b);
// get the cursor position of the beginning/end of the prev/next word in the text
@@ -216,23 +208,24 @@ public:
static BOOL postvalidateFloat(const LLString &str);
// line history support:
- void setEnableLineHistory( BOOL enabled ); // switches line history on or off
+ void setEnableLineHistory( BOOL enabled ) { mHaveHistory = enabled; } // switches line history on or off
void updateHistory(); // stores current line in history
-protected:
+private:
+ // private helper classes
void removeChar();
void addChar(const llwchar c);
void setCursorAtLocalPos(S32 local_mouse_x);
-
S32 findPixelNearestPos(S32 cursor_offset = 0) const;
void reportBadKeystroke();
-
BOOL handleSpecialKey(KEY key, MASK mask);
BOOL handleSelectionKey(KEY key, MASK mask);
BOOL handleControlKey(KEY key, MASK mask);
S32 handleCommitKey(KEY key, MASK mask);
-protected:
+ //
+ // private data members
+ //
void updateAllowingLanguageInput();
BOOL hasPreeditString() const;
// Implementation (overrides) of LLPreeditor
@@ -308,13 +301,53 @@ protected:
LLWString mPreeditOverwrittenWString;
std::vector<S32> mPreeditPositions;
LLPreeditor::standouts_t mPreeditStandouts;
-};
-
+ // private helper class
+ class LLLineEditorRollback
+ {
+ public:
+ LLLineEditorRollback( LLLineEditor* ed )
+ :
+ mCursorPos( ed->mCursorPos ),
+ mScrollHPos( ed->mScrollHPos ),
+ mIsSelecting( ed->mIsSelecting ),
+ mSelectionStart( ed->mSelectionStart ),
+ mSelectionEnd( ed->mSelectionEnd )
+ {
+ mText = ed->getText();
+ }
+
+ void doRollback( LLLineEditor* ed )
+ {
+ ed->mCursorPos = mCursorPos;
+ ed->mScrollHPos = mScrollHPos;
+ ed->mIsSelecting = mIsSelecting;
+ ed->mSelectionStart = mSelectionStart;
+ ed->mSelectionEnd = mSelectionEnd;
+ ed->mText = mText;
+ ed->mPrevText = mText;
+ }
+
+ LLString getText() { return mText; }
+
+ private:
+ LLString mText;
+ S32 mCursorPos;
+ S32 mScrollHPos;
+ BOOL mIsSelecting;
+ S32 mSelectionStart;
+ S32 mSelectionEnd;
+ }; // end class LLLineEditorRollback
+
+}; // end class LLLineEditor
+
+
+
+/*
+ * @brief A line editor with a button to clear it and a callback to call on every edit event.
+ */
class LLSearchEditor : public LLUICtrl
{
-friend class LLLineEditorRollback;
-
public:
LLSearchEditor(const LLString& name,
const LLRect& rect,
@@ -322,34 +355,34 @@ public:
void (*search_callback)(const LLString& search_string, void* user_data),
void* userdata);
- virtual ~LLSearchEditor();
+ virtual ~LLSearchEditor() {}
/*virtual*/ void draw();
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SEARCH_EDITOR; }
+ virtual LLString getWidgetTag() const { return LL_SEARCH_EDITOR_TAG; }
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
- void setText(const LLStringExplicit &new_text);
+ void setText(const LLStringExplicit &new_text) { mSearchEdit->setText(new_text); }
void setSearchCallback(void (*search_callback)(const LLString& search_string, void* user_data), void* data) { mSearchCallback = search_callback; mCallbackUserData = data; }
// LLUICtrl interface
- virtual void setValue(const LLSD& value );
- virtual LLSD getValue() const;
- virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
- virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
- virtual void clear();
+ virtual void setValue(const LLSD& value ) { mSearchEdit->setValue(value); }
+ virtual LLSD getValue() const { return mSearchEdit->getValue(); }
+ virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ) { return mSearchEdit->setTextArg( key, text); }
+ virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ) { return mSearchEdit->setLabelArg(key, text); }
+ virtual void clear() { if (mSearchEdit) mSearchEdit->clear(); }
-protected:
- LLLineEditor* mSearchEdit;
- LLButton* mClearSearchButton;
+private:
+ static void onSearchEdit(LLLineEditor* caller, void* user_data );
+ static void onClearSearch(void* user_data);
+ LLLineEditor* mSearchEdit;
+ class LLButton* mClearSearchButton;
void (*mSearchCallback)(const LLString& search_string, void* user_data);
- static void onSearchEdit(LLLineEditor* caller, void* user_data );
- static void onClearSearch(void* user_data);
};
#endif // LL_LINEEDITOR_
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 19a5085a25..4e94aff7a5 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -112,12 +112,11 @@ LLColor4 LLMenuItemGL::sEnabledColor( 0.0f, 0.0f, 0.0f, 1.0f );
LLColor4 LLMenuItemGL::sDisabledColor( 0.5f, 0.5f, 0.5f, 1.0f );
LLColor4 LLMenuItemGL::sHighlightBackground( 0.0f, 0.0f, 0.7f, 1.0f );
LLColor4 LLMenuItemGL::sHighlightForeground( 1.0f, 1.0f, 1.0f, 1.0f );
-BOOL LLMenuItemGL::sDropShadowText = TRUE;
LLColor4 LLMenuGL::sDefaultBackgroundColor( 0.25f, 0.25f, 0.25f, 0.75f );
BOOL LLMenuGL::sKeyboardMode = FALSE;
-LLViewHandle LLMenuHolderGL::sItemLastSelectedHandle;
+LLHandle<LLView> LLMenuHolderGL::sItemLastSelectedHandle;
LLFrameTimer LLMenuHolderGL::sItemActivationTimer;
//LLColor4 LLMenuGL::sBackgroundColor( 0.8f, 0.8f, 0.0f, 1.0f );
@@ -199,7 +198,7 @@ BOOL LLMenuItemGL::handleKey(KEY key, MASK mask, BOOL called_from_parent)
if( called_from_parent )
{
// Downward traversal
- if (mEnabled)
+ if (getEnabled())
{
handled = childrenHandleKey( key, mask ) != NULL;
}
@@ -215,7 +214,7 @@ BOOL LLMenuItemGL::handleKey(KEY key, MASK mask, BOOL called_from_parent)
BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask)
{
- if( mEnabled && (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) )
+ if( getEnabled() && (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) )
{
doIt();
return TRUE;
@@ -225,15 +224,10 @@ BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask)
BOOL LLMenuItemGL::handleHover(S32 x, S32 y, MASK mask)
{
- mGotHover = TRUE;
+ setHover(TRUE);
getWindow()->setCursor(UI_CURSOR_ARROW);
return TRUE;
}
-
-void LLMenuItemGL::setBriefItem(BOOL b)
-{
- mBriefItem = b;
-}
// This function checks to see if the accelerator key is already in use;
// if not, it will be added to the list
@@ -282,7 +276,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLKeyBinding*> *listp)
// This function appends the character string representation of
// the current accelerator key and mask to the provided string.
-void LLMenuItemGL::appendAcceleratorString( LLString& st )
+void LLMenuItemGL::appendAcceleratorString( LLString& st ) const
{
// break early if this is a silly thing to do.
if( KEY_NONE == mAcceleratorKey )
@@ -332,52 +326,14 @@ void LLMenuItemGL::setJumpKey(KEY key)
mJumpKey = LLStringOps::toUpper((char)key);
}
-KEY LLMenuItemGL::getJumpKey()
-{
- return mJumpKey;
-}
-
-
-// set the font used by all of the menu objects
-void LLMenuItemGL::setFont(LLFontGL* font)
-{
- mFont = font;
-}
-
-// returns the height in pixels for the current font.
-U32 LLMenuItemGL::getNominalHeight( void )
-{
- return llround(mFont->getLineHeight()) + MENU_ITEM_PADDING;
-}
-
-// functions to control the color scheme
-void LLMenuItemGL::setEnabledColor( const LLColor4& color )
-{
- sEnabledColor = color;
-}
-
-void LLMenuItemGL::setDisabledColor( const LLColor4& color )
-{
- sDisabledColor = color;
-}
-
-void LLMenuItemGL::setHighlightBGColor( const LLColor4& color )
-{
- sHighlightBackground = color;
-}
-void LLMenuItemGL::setHighlightFGColor( const LLColor4& color )
-{
- sHighlightForeground = color;
+// virtual
+U32 LLMenuItemGL::getNominalHeight( void ) const
+{
+ return llround(mFont->getLineHeight()) + MENU_ITEM_PADDING;
}
-// change the label
-void LLMenuItemGL::setLabel( const LLStringExplicit& label )
-{
- mLabel = label;
-}
-
// Get the parent menu for this item
LLMenuGL* LLMenuItemGL::getMenu()
{
@@ -388,7 +344,7 @@ LLMenuGL* LLMenuItemGL::getMenu()
// getNominalWidth() - returns the normal width of this control in
// pixels - this is used for calculating the widest item, as well as
// for horizontal arrangement.
-U32 LLMenuItemGL::getNominalWidth( void )
+U32 LLMenuItemGL::getNominalWidth( void ) const
{
U32 width;
@@ -442,17 +398,6 @@ void LLMenuItemGL::doIt( void )
mHighlight = highlight;
}
-// determine if this object represents an active sub-menu
-BOOL LLMenuItemGL::isActive( void ) const
-{
- return FALSE;
-}
-
-// determine if this object represents an open sub-menu
-BOOL LLMenuItemGL::isOpen( void ) const
-{
- return FALSE;
-}
BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
{
@@ -490,7 +435,7 @@ BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK )
{
- if (mEnabled)
+ if (getEnabled())
{
// switch to mouse navigation mode
LLMenuGL::setKeyboardMode(FALSE);
@@ -504,7 +449,7 @@ BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK )
BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK )
{
- if (mEnabled)
+ if (getEnabled())
{
// switch to mouse navigation mode
LLMenuGL::setKeyboardMode(FALSE);
@@ -512,10 +457,7 @@ BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK )
setHighlight(TRUE);
return TRUE;
}
- else
- {
- return FALSE;
- }
+ return FALSE;
}
@@ -529,13 +471,13 @@ void LLMenuItemGL::draw( void )
if( getEnabled() && getHighlight() && !mBriefItem)
{
glColor4fv( sHighlightBackground.mV );
- gl_rect_2d( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
}
LLColor4 color;
U8 font_style = mStyle;
- if (LLMenuItemGL::sDropShadowText && getEnabled() && !mDrawTextDisabled )
+ if (getEnabled() && !mDrawTextDisabled )
{
font_style |= LLFontGL::DROP_SHADOW_SOFT;
}
@@ -570,12 +512,12 @@ void LLMenuItemGL::draw( void )
LLFontGL::LEFT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
if( !mDrawAccelLabel.empty() )
{
- mFont->render( mDrawAccelLabel.getWString(), 0, (F32)mRect.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) + 1.f, color,
LLFontGL::RIGHT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
}
if( !mDrawBranchLabel.empty() )
{
- mFont->render( mDrawBranchLabel.getWString(), 0, (F32)mRect.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) + 1.f, color,
LLFontGL::RIGHT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
}
}
@@ -595,7 +537,7 @@ void LLMenuItemGL::draw( void )
}
// clear got hover every frame
- mGotHover = FALSE;
+ setHover(FALSE);
}
BOOL LLMenuItemGL::setLabelArg( const LLString& key, const LLStringExplicit& text )
@@ -628,7 +570,7 @@ public:
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual U32 getNominalHeight( void ) { return SEPARATOR_HEIGHT_PIXELS; }
+ virtual U32 getNominalHeight( void ) const { return SEPARATOR_HEIGHT_PIXELS; }
};
LLMenuItemSeparatorGL::LLMenuItemSeparatorGL( const LLString &name ) :
@@ -638,42 +580,42 @@ LLMenuItemSeparatorGL::LLMenuItemSeparatorGL( const LLString &name ) :
void LLMenuItemSeparatorGL::draw( void )
{
- glColor4fv( sDisabledColor.mV );
- const S32 y = mRect.getHeight() / 2;
+ glColor4fv( getDisabledColor().mV );
+ const S32 y = getRect().getHeight() / 2;
const S32 PAD = 6;
- gl_line_2d( PAD, y, mRect.getWidth() - PAD, y );
+ gl_line_2d( PAD, y, getRect().getWidth() - PAD, y );
}
BOOL LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask)
{
LLMenuGL* parent_menu = getMenu();
- if (y > mRect.getHeight() / 2)
+ if (y > getRect().getHeight() / 2)
{
- return parent_menu->handleMouseDown(x + mRect.mLeft, mRect.mTop + 1, mask);
+ return parent_menu->handleMouseDown(x + getRect().mLeft, getRect().mTop + 1, mask);
}
else
{
- return parent_menu->handleMouseDown(x + mRect.mLeft, mRect.mBottom - 1, mask);
+ return parent_menu->handleMouseDown(x + getRect().mLeft, getRect().mBottom - 1, mask);
}
}
BOOL LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask)
{
LLMenuGL* parent_menu = getMenu();
- if (y > mRect.getHeight() / 2)
+ if (y > getRect().getHeight() / 2)
{
- return parent_menu->handleMouseUp(x + mRect.mLeft, mRect.mTop + 1, mask);
+ return parent_menu->handleMouseUp(x + getRect().mLeft, getRect().mTop + 1, mask);
}
else
{
- return parent_menu->handleMouseUp(x + mRect.mLeft, mRect.mBottom - 1, mask);
+ return parent_menu->handleMouseUp(x + getRect().mLeft, getRect().mBottom - 1, mask);
}
}
BOOL LLMenuItemSeparatorGL::handleHover(S32 x, S32 y, MASK mask)
{
LLMenuGL* parent_menu = getMenu();
- if (y > mRect.getHeight() / 2)
+ if (y > getRect().getHeight() / 2)
{
parent_menu->highlightPrevItem(this, FALSE);
return FALSE;
@@ -711,24 +653,13 @@ LLMenuItemVerticalSeparatorGL::LLMenuItemVerticalSeparatorGL( void )
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLMenuItemTearOffGL
-//
-// This class represents a separator.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LLMenuItemTearOffGL::LLMenuItemTearOffGL(LLViewHandle parent_floater_handle) :
+LLMenuItemTearOffGL::LLMenuItemTearOffGL(LLHandle<LLFloater> parent_floater_handle) :
LLMenuItemGL("tear off", TEAROFF_SEPARATOR_LABEL),
mParentHandle(parent_floater_handle)
{
}
-EWidgetType LLMenuItemTearOffGL::getWidgetType() const
-{
- return WIDGET_TYPE_TEAROFF_MENU;
-}
-
-LLString LLMenuItemTearOffGL::getWidgetTag() const
-{
- return LL_MENU_ITEM_TEAR_OFF_GL_TAG;
-}
void LLMenuItemTearOffGL::doIt()
{
@@ -747,7 +678,7 @@ void LLMenuItemTearOffGL::doIt()
getMenu()->arrange();
- LLFloater* parent_floater = LLFloater::getFloaterByHandle(mParentHandle);
+ LLFloater* parent_floater = mParentHandle.get();
LLFloater* tear_off_menu = LLTearOffMenu::create(getMenu());
if (tear_off_menu)
@@ -768,27 +699,31 @@ void LLMenuItemTearOffGL::doIt()
void LLMenuItemTearOffGL::draw()
{
// disabled items can be highlighted, but shouldn't render as such
- if( getEnabled() && getHighlight() && !mBriefItem)
+ if( getEnabled() && getHighlight() && !isBriefItem())
{
- glColor4fv( sHighlightBackground.mV );
- gl_rect_2d( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ glColor4fv( getHighlightBGColor().mV );
+ gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
}
- if (mEnabled)
+ if (getEnabled())
{
- glColor4fv( sEnabledColor.mV );
+ glColor4fv( getEnabledColor().mV );
}
else
{
- glColor4fv( sDisabledColor.mV );
+ glColor4fv( getDisabledColor().mV );
}
- const S32 y = mRect.getHeight() / 3;
+ const S32 y = getRect().getHeight() / 3;
const S32 PAD = 6;
- gl_line_2d( PAD, y, mRect.getWidth() - PAD, y );
- gl_line_2d( PAD, y * 2, mRect.getWidth() - PAD, y * 2 );
+ gl_line_2d( PAD, y, getRect().getWidth() - PAD, y );
+ gl_line_2d( PAD, y * 2, getRect().getWidth() - PAD, y * 2 );
+}
+
+U32 LLMenuItemTearOffGL::getNominalHeight( void ) const
+{
+ return TEAROFF_SEPARATOR_HEIGHT_PIXELS;
}
-U32 LLMenuItemTearOffGL::getNominalHeight( void ) { return TEAROFF_SEPARATOR_HEIGHT_PIXELS; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLMenuItemBlankGL
@@ -799,22 +734,16 @@ U32 LLMenuItemTearOffGL::getNominalHeight( void ) { return TEAROFF_SEPARATOR_HEI
class LLMenuItemBlankGL : public LLMenuItemGL
{
public:
- LLMenuItemBlankGL( void );
-
+ LLMenuItemBlankGL( void ) : LLMenuItemGL( "", "" )
+ {
+ setEnabled(FALSE);
+ }
virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_BLANK; }
virtual LLString getWidgetTag() const { return LL_MENU_ITEM_BLANK_GL_TAG; }
-
- // doIt() - do the primary funcationality of the menu item.
virtual void doIt( void ) {}
-
virtual void draw( void ) {}
};
-LLMenuItemBlankGL::LLMenuItemBlankGL( void )
-: LLMenuItemGL( "", "" )
-{
- mEnabled = FALSE;
-}
///============================================================================
/// Class LLMenuItemCallGL
@@ -905,7 +834,7 @@ void LLMenuItemCallGL::setEnabledControl(LLString enabled_control, LLView *conte
}
else
{
- context->addBoolControl(enabled_control, mEnabled);
+ context->addBoolControl(enabled_control, getEnabled());
control = context->findControl(enabled_control);
control->registerListener(this, "ENABLED");
}
@@ -925,7 +854,7 @@ void LLMenuItemCallGL::setVisibleControl(LLString enabled_control, LLView *conte
}
else
{
- context->addBoolControl(enabled_control, mEnabled);
+ context->addBoolControl(enabled_control, getEnabled());
control = context->findControl(enabled_control);
control->registerListener(this, "VISIBLE");
}
@@ -989,16 +918,6 @@ void LLMenuItemCallGL::doIt( void )
LLMenuItemGL::doIt();
}
-EWidgetType LLMenuItemCallGL::getWidgetType() const
-{
- return WIDGET_TYPE_MENU_ITEM_CALL;
-}
-
-LLString LLMenuItemCallGL::getWidgetTag() const
-{
- return LL_MENU_ITEM_CALL_GL_TAG;
-}
-
void LLMenuItemCallGL::buildDrawLabel( void )
{
LLPointer<LLEvent> fired_event = new LLEvent(this);
@@ -1018,7 +937,7 @@ void LLMenuItemCallGL::buildDrawLabel( void )
BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask )
{
- if( (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) )
+ if( (!gKeyboard->getKeyRepeated(key) || getAllowKeyRepeat()) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) )
{
LLPointer<LLEvent> fired_event = new LLEvent(this);
fireEvent(fired_event, "on_build");
@@ -1026,7 +945,7 @@ BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask )
{
setEnabled( mEnabledCallback( mUserData ) );
}
- if( !mEnabled )
+ if( !getEnabled() )
{
if( mOnDisabledCallback )
{
@@ -1127,20 +1046,10 @@ LLXMLNodePtr LLMenuItemCheckGL::getXML(bool save_children) const
return node;
}
-EWidgetType LLMenuItemCheckGL::getWidgetType() const
-{
- return WIDGET_TYPE_MENU_ITEM_CHECK;
-}
-
-LLString LLMenuItemCheckGL::getWidgetTag() const
-{
- return LL_MENU_ITEM_CHECK_GL_TAG;
-}
-
// called to rebuild the draw label
void LLMenuItemCheckGL::buildDrawLabel( void )
{
- if(mChecked || (mCheckCallback && mCheckCallback( mUserData ) ) )
+ if(mChecked || (mCheckCallback && mCheckCallback( getUserData() ) ) )
{
mDrawBoolLabel = BOOLEAN_TRUE_PREFIX;
}
@@ -1216,23 +1125,13 @@ LLView* LLMenuItemBranchGL::getChildByName(const LLString& name, BOOL recurse) c
return mBranch;
}
// Always recurse on branches
- return mBranch->getChildByName(name, recurse);
-}
-
-EWidgetType LLMenuItemBranchGL::getWidgetType() const
-{
- return WIDGET_TYPE_MENU_ITEM_BRANCH;
-}
-
-LLString LLMenuItemBranchGL::getWidgetTag() const
-{
- return LL_MENU_ITEM_BRANCH_GL_TAG;
+ return mBranch->getChild<LLView>(name, recurse);
}
// virtual
BOOL LLMenuItemBranchGL::handleMouseUp(S32 x, S32 y, MASK mask)
{
- if (mEnabled)
+ if (getEnabled())
{
// switch to mouse navigation mode
LLMenuGL::setKeyboardMode(FALSE);
@@ -1335,18 +1234,11 @@ BOOL LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa
}
-// set the hover status (called by it's menu)
void LLMenuItemBranchGL::setHighlight( BOOL highlight )
{
if (highlight == getHighlight()) return;
- // make sure only yourself is highlighted
- if (highlight)
- {
- getMenu()->clearHoverItem();
- }
-
- BOOL auto_open = mEnabled && (!mBranch->getVisible() || mBranch->getTornOff());
+ BOOL auto_open = getEnabled() && (!mBranch->getVisible() || mBranch->getTornOff());
// torn off menus don't open sub menus on hover unless they have focus
if (getMenu()->getTornOff() && !((LLFloater*)getMenu()->getParent())->hasFocus())
{
@@ -1357,8 +1249,7 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight )
{
auto_open = FALSE;
}
-
- mHighlight = highlight;
+ LLMenuItemGL::setHighlight(highlight);
if( highlight )
{
if(auto_open)
@@ -1380,11 +1271,6 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight )
}
}
-void LLMenuItemBranchGL::setEnabledSubMenus(BOOL enabled)
-{
- mBranch->setEnabledSubMenus(enabled);
-}
-
void LLMenuItemBranchGL::draw()
{
LLMenuItemGL::draw();
@@ -1394,18 +1280,6 @@ void LLMenuItemBranchGL::draw()
}
}
-// determine if this object is active
-// which, for branching menus, means the branch is open and has "focus"
-BOOL LLMenuItemBranchGL::isActive( void ) const
-{
- return isOpen() && mBranch->getHighlightedItem();
-}
-
-BOOL LLMenuItemBranchGL::isOpen( void ) const
-{
- return mBranch->isOpen();
-}
-
void LLMenuItemBranchGL::updateBranchParent(LLView* parentp)
{
if (mBranch->getParent() == NULL)
@@ -1478,8 +1352,8 @@ void LLMenuItemBranchGL::openMenu()
LLRect rect = mBranch->getRect();
// calculate root-view relative position for branch menu
- S32 left = mRect.mRight;
- S32 top = mRect.mTop - mRect.mBottom;
+ S32 left = getRect().mRight;
+ S32 top = getRect().mTop - getRect().mBottom;
localPointToOtherView(left, top, &left, &top, mBranch->getParent());
@@ -1505,7 +1379,7 @@ void LLMenuItemBranchGL::openMenu()
if( x - menu_region_rect.mLeft > menu_region_width - rect.getWidth() )
{
// move sub-menu over to left side
- delta_x = llmax(-x, (-1 * (rect.getWidth() + mRect.getWidth())));
+ delta_x = llmax(-x, (-1 * (rect.getWidth() + getRect().getWidth())));
}
mBranch->translate( delta_x, delta_y );
mBranch->setVisible( TRUE );
@@ -1536,7 +1410,7 @@ public:
// returns the normal width of this control in pixels - this is
// used for calculating the widest item, as well as for horizontal
// arrangement.
- virtual U32 getNominalWidth( void );
+ virtual U32 getNominalWidth( void ) const;
// called to rebuild the draw label
virtual void buildDrawLabel( void );
@@ -1570,10 +1444,10 @@ LLMenuItemBranchDownGL::LLMenuItemBranchDownGL( const LLString& name,
// returns the normal width of this control in pixels - this is used
// for calculating the widest item, as well as for horizontal
// arrangement.
-U32 LLMenuItemBranchDownGL::getNominalWidth( void )
+U32 LLMenuItemBranchDownGL::getNominalWidth( void ) const
{
U32 width = LEFT_PAD_PIXELS + LEFT_WIDTH_PIXELS + RIGHT_PAD_PIXELS;
- width += mFont->getWidth( mLabel.getWString().c_str() );
+ width += getFont()->getWidth( mLabel.getWString().c_str() );
return width;
}
@@ -1588,32 +1462,33 @@ void LLMenuItemBranchDownGL::buildDrawLabel( void )
void LLMenuItemBranchDownGL::openMenu( void )
{
- if( mBranch->getVisible() && !mBranch->getTornOff() )
+ LLMenuGL* branch = getBranch();
+ if( branch->getVisible() && !branch->getTornOff() )
{
- mBranch->setVisible( FALSE );
+ branch->setVisible( FALSE );
}
else
{
- if (mBranch->getTornOff())
+ if (branch->getTornOff())
{
- gFloaterView->bringToFront((LLFloater*)mBranch->getParent());
+ gFloaterView->bringToFront((LLFloater*)branch->getParent());
}
else
{
// We're showing the drop-down menu, so patch up its labels/rects
- mBranch->arrange();
+ branch->arrange();
- LLRect rect = mBranch->getRect();
+ LLRect rect = branch->getRect();
S32 left = 0;
- S32 top = mRect.mBottom;
- localPointToOtherView(left, top, &left, &top, mBranch->getParent());
+ S32 top = getRect().mBottom;
+ localPointToOtherView(left, top, &left, &top, branch->getParent());
rect.setLeftTopAndSize( left, top,
rect.getWidth(), rect.getHeight() );
- mBranch->setRect( rect );
+ branch->setRect( rect );
S32 x = 0;
S32 y = 0;
- mBranch->localPointToScreen( 0, 0, &x, &y );
+ branch->localPointToScreen( 0, 0, &x, &y );
S32 delta_x = 0;
LLCoordScreen window_size;
@@ -1625,13 +1500,11 @@ void LLMenuItemBranchDownGL::openMenu( void )
{
delta_x = (window_width - rect.getWidth()) - x;
}
- mBranch->translate( delta_x, 0 );
+ branch->translate( delta_x, 0 );
setHighlight(TRUE);
- mBranch->setVisible( TRUE );
+ branch->setVisible( TRUE );
}
-
-
}
}
@@ -1640,21 +1513,18 @@ void LLMenuItemBranchDownGL::setHighlight( BOOL highlight )
{
if (highlight == getHighlight()) return;
- if (highlight)
- {
- getMenu()->clearHoverItem();
- }
- mHighlight = highlight;
+ //NOTE: Purposely calling all the way to the base to bypass auto-open.
+ LLMenuItemGL::setHighlight(highlight);
if( !highlight)
{
- if (mBranch->getTornOff())
+ if (getBranch()->getTornOff())
{
- ((LLFloater*)mBranch->getParent())->setFocus(FALSE);
- mBranch->clearHoverItem();
+ ((LLFloater*)getBranch()->getParent())->setFocus(FALSE);
+ getBranch()->clearHoverItem();
}
else
{
- mBranch->setVisible( FALSE );
+ getBranch()->setVisible( FALSE );
}
}
}
@@ -1684,8 +1554,8 @@ BOOL LLMenuItemBranchDownGL::handleMouseUp( S32 x, S32 y, MASK mask )
BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask)
{
- BOOL branch_visible = mBranch->getVisible();
- BOOL handled = mBranch->handleAcceleratorKey(key, mask);
+ BOOL branch_visible = getBranch()->getVisible();
+ BOOL handled = getBranch()->handleAcceleratorKey(key, mask);
if (handled && !branch_visible && getVisible())
{
// flash this menu entry because we triggered an invisible menu item
@@ -1697,7 +1567,7 @@ BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask)
BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
{
- BOOL menu_open = mBranch->getVisible();
+ BOOL menu_open = getBranch()->getVisible();
// don't do keyboard navigation of top-level menus unless in keyboard mode, or menu expanded
if (getHighlight() && getMenu()->getVisible() && (isActive() || LLMenuGL::getKeyboardMode()))
{
@@ -1738,7 +1608,7 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_
{
doIt();
}
- mBranch->highlightNextItem(NULL);
+ getBranch()->highlightNextItem(NULL);
return TRUE;
}
else if (key == KEY_UP)
@@ -1750,7 +1620,7 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_
{
doIt();
}
- mBranch->highlightPrevItem(NULL);
+ getBranch()->highlightPrevItem(NULL);
return TRUE;
}
}
@@ -1761,19 +1631,19 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_
void LLMenuItemBranchDownGL::draw( void )
{
//FIXME: try removing this
- if (mBranch->getVisible() && !mBranch->getTornOff())
+ if (getBranch()->getVisible() && !getBranch()->getTornOff())
{
setHighlight(TRUE);
}
if( getHighlight() )
{
- glColor4fv( sHighlightBackground.mV );
- gl_rect_2d( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ glColor4fv( getHighlightBGColor().mV );
+ gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
}
- U8 font_style = mStyle;
- if (LLMenuItemGL::sDropShadowText && getEnabled() && !mDrawTextDisabled )
+ U8 font_style = getFontStyle();
+ if (getEnabled() && !getDrawTextDisabled() )
{
font_style |= LLFontGL::DROP_SHADOW_SOFT;
}
@@ -1781,17 +1651,17 @@ void LLMenuItemBranchDownGL::draw( void )
LLColor4 color;
if (getHighlight())
{
- color = sHighlightForeground;
+ color = getHighlightFGColor();
}
- else if( mEnabled )
+ else if( getEnabled() )
{
- color = sEnabledColor;
+ color = getEnabledColor();
}
else
{
- color = sDisabledColor;
+ color = getDisabledColor();
}
- mFont->render( mLabel.getWString(), 0, (F32)mRect.getWidth() / 2.f, (F32)LABEL_BOTTOM_PAD_PIXELS, color,
+ getFont()->render( mLabel.getWString(), 0, (F32)getRect().getWidth() / 2.f, (F32)LABEL_BOTTOM_PAD_PIXELS, color,
LLFontGL::HCENTER, LLFontGL::BOTTOM, font_style );
@@ -1800,19 +1670,19 @@ void LLMenuItemBranchDownGL::draw( void )
{
LLString upper_case_label = mLabel.getString();
LLString::toUpper(upper_case_label);
- std::string::size_type offset = upper_case_label.find(mJumpKey);
+ std::string::size_type offset = upper_case_label.find(getJumpKey());
if (offset != std::string::npos)
{
- S32 x_offset = llround((F32)mRect.getWidth() / 2.f - mFont->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f);
- S32 x_begin = x_offset + mFont->getWidth(mLabel, 0, offset);
- S32 x_end = x_offset + mFont->getWidth(mLabel, 0, offset + 1);
+ S32 x_offset = llround((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f);
+ S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, offset);
+ S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, offset + 1);
gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS);
}
}
// reset every frame so that we only show highlight
// when we get hover events on that frame
- mGotHover = FALSE;
+ setHover(FALSE);
}
///============================================================================
@@ -1820,7 +1690,7 @@ void LLMenuItemBranchDownGL::draw( void )
///============================================================================
// Default constructor
-LLMenuGL::LLMenuGL( const LLString& name, const LLString& label, LLViewHandle parent_floater_handle )
+LLMenuGL::LLMenuGL( const LLString& name, const LLString& label, LLHandle<LLFloater> parent_floater_handle )
: LLUICtrl( name, LLRect(), FALSE, NULL, NULL ),
mBackgroundColor( sDefaultBackgroundColor ),
mBgVisible( TRUE ),
@@ -1845,7 +1715,7 @@ LLMenuGL::LLMenuGL( const LLString& name, const LLString& label, LLViewHandle pa
setTabStop(FALSE);
}
-LLMenuGL::LLMenuGL( const LLString& label, LLViewHandle parent_floater_handle )
+LLMenuGL::LLMenuGL( const LLString& label, LLHandle<LLFloater> parent_floater_handle )
: LLUICtrl( label, LLRect(), FALSE, NULL, NULL ),
mBackgroundColor( sDefaultBackgroundColor ),
mBgVisible( TRUE ),
@@ -1879,7 +1749,7 @@ LLMenuGL::~LLMenuGL( void )
mJumpKeys.clear();
}
-void LLMenuGL::setCanTearOff(BOOL tear_off, LLViewHandle parent_floater_handle )
+void LLMenuGL::setCanTearOff(BOOL tear_off, LLHandle<LLFloater> parent_floater_handle )
{
if (tear_off && mTearOffItem == NULL)
{
@@ -2317,29 +2187,13 @@ LLView* LLMenuGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
return menu;
}
-// control the color scheme
-void LLMenuGL::setDefaultBackgroundColor( const LLColor4& color )
-{
- sDefaultBackgroundColor = color;
-}
-
-void LLMenuGL::setBackgroundColor( const LLColor4& color )
-{
- mBackgroundColor = color;
-}
-
-LLColor4 LLMenuGL::getBackgroundColor()
-{
- return mBackgroundColor;
-}
-
// rearrange the child rects so they fit the shape of the menu.
void LLMenuGL::arrange( void )
{
// calculate the height & width, and set our rect based on that
// information.
- LLRect initial_rect = mRect;
+ const LLRect& initial_rect = getRect();
U32 width = 0, height = MENU_ITEM_PADDING;
@@ -2349,8 +2203,9 @@ void LLMenuGL::arrange( void )
{
const LLRect menu_region_rect = LLMenuGL::sMenuContainer ? LLMenuGL::sMenuContainer->getMenuRect() : LLRect(0, S32_MAX, S32_MAX, 0);
- U32 max_width = menu_region_rect.getWidth();
- U32 max_height = menu_region_rect.getHeight();
+ // torn off menus are not constrained to the size of the screen
+ U32 max_width = getTornOff() ? U32_MAX : menu_region_rect.getWidth();
+ U32 max_height = getTornOff() ? U32_MAX : menu_region_rect.getHeight();
// *FIX: create the item first and then ask for its dimensions?
S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( "More" );
S32 spillover_item_height = llround(LLFontGL::sSansSerif->getLineHeight()) + MENU_ITEM_PADDING;
@@ -2429,8 +2284,7 @@ void LLMenuGL::arrange( void )
}
}
- mRect.mRight = mRect.mLeft + width;
- mRect.mTop = mRect.mBottom + height;
+ setRect(LLRect(getRect().mLeft, getRect().mBottom + height, getRect().mLeft + width, getRect().mBottom));
S32 cur_height = (S32)llmin(max_height, height);
S32 cur_width = 0;
@@ -2622,8 +2476,7 @@ void LLMenuGL::empty( void )
// Adjust rectangle of the menu
void LLMenuGL::setLeftAndBottom(S32 left, S32 bottom)
{
- mRect.mLeft = left;
- mRect.mBottom = bottom;
+ setRect(LLRect(left, getRect().mTop, getRect().mRight, bottom));
arrange();
}
@@ -2953,7 +2806,7 @@ BOOL LLMenuGL::handleKey( KEY key, MASK mask, BOOL called_from_parent )
BOOL handled = FALSE;
// Pass down even if not visible
- if( mEnabled && called_from_parent )
+ if( getEnabled() && called_from_parent )
{
for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
{
@@ -2981,7 +2834,7 @@ BOOL LLMenuGL::handleKey( KEY key, MASK mask, BOOL called_from_parent )
BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask)
{
// don't handle if not enabled
- if(!mEnabled)
+ if(!getEnabled())
{
return FALSE;
}
@@ -3080,7 +2933,7 @@ void LLMenuGL::draw( void )
{
if (mDropShadowed && !mTornOff)
{
- gl_drop_shadow(0, mRect.getHeight(), mRect.getWidth(), 0,
+ gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
LLUI::sColorsGroup->getColor("ColorDropShadow"),
LLUI::sConfigGroup->getS32("DropShadowFloater") );
}
@@ -3089,7 +2942,7 @@ void LLMenuGL::draw( void )
if( mBgVisible )
{
- gl_rect_2d( 0, mRect.getHeight(), mRect.getWidth(), 0, mBackgroundColor );
+ gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0, mBackgroundColor );
}
LLView::draw();
}
@@ -3139,7 +2992,7 @@ LLMenuGL* LLMenuGL::getChildMenuByName(const LLString& name, BOOL recurse) const
return (LLMenuGL*)view;
}
}
- llwarns << "Child Menu " << name << " not found in menu " << mName << llendl;
+ llwarns << "Child Menu " << name << " not found in menu " << getName() << llendl;
return NULL;
}
@@ -3254,7 +3107,7 @@ void LLPieMenuBranch::buildDrawLabel( void )
if(mEnabledCallback)
{
setEnabled(mEnabledCallback(mUserData));
- mDrawTextDisabled = FALSE;
+ setDrawTextDisabled(FALSE);
}
else
{
@@ -3273,7 +3126,7 @@ void LLPieMenuBranch::buildDrawLabel( void )
break;
}
}
- mDrawTextDisabled = !any_enabled;
+ setDrawTextDisabled(!any_enabled);
setEnabled(TRUE);
}
@@ -3334,20 +3187,6 @@ LLPieMenu::LLPieMenu(const LLString& name)
setCanTearOff(FALSE);
}
-// virtual
-LLPieMenu::~LLPieMenu()
-{ }
-
-
-EWidgetType LLPieMenu::getWidgetType() const
-{
- return WIDGET_TYPE_PIE_MENU;
-}
-
-LLString LLPieMenu::getWidgetTag() const
-{
- return LL_PIE_MENU_TAG;
-}
void LLPieMenu::initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory)
{
@@ -3621,8 +3460,8 @@ void LLPieMenu::draw()
mHoverItem = NULL;
}
- F32 width = (F32) mRect.getWidth();
- F32 height = (F32) mRect.getHeight();
+ F32 width = (F32) getRect().getWidth();
+ F32 height = (F32) getRect().getHeight();
mCurRadius = PIE_SCALE_FACTOR * llmax( width/2, height/2 );
mOuterRingAlpha = mUseInfiniteRadius ? 0.f : 1.f;
@@ -3696,8 +3535,8 @@ void LLPieMenu::draw()
void LLPieMenu::drawBackground(LLMenuItemGL* itemp, LLColor4& color)
{
- F32 width = (F32) mRect.getWidth();
- F32 height = (F32) mRect.getHeight();
+ F32 width = (F32) getRect().getWidth();
+ F32 height = (F32) getRect().getHeight();
F32 center_x = width/2;
F32 center_y = height/2;
S32 steps = 100;
@@ -3790,7 +3629,8 @@ void LLPieMenu::arrange()
// TODO: Compute actual bounding rect for menu
- mRect.setOriginAndSize(mRect.mLeft, mRect.mBottom, rect_width, rect_height );
+ // HACK: casting away const. Should use setRect or some helper function instead.
+ const_cast<LLRect&>(getRect()).setOriginAndSize(getRect().mLeft, getRect().mBottom, rect_width, rect_height );
// place items around a circle, with item 0 at positive X,
// rotating counter-clockwise
@@ -3827,8 +3667,8 @@ LLMenuItemGL *LLPieMenu::pieItemFromXY(S32 x, S32 y)
// An arc of the pie menu is 45 degrees
const F32 ARC_DEG = 45.f;
- S32 delta_x = x - mRect.getWidth() / 2;
- S32 delta_y = y - mRect.getHeight() / 2;
+ S32 delta_x = x - getRect().getWidth() / 2;
+ S32 delta_y = y - getRect().getHeight() / 2;
// circle safe zone in the center
S32 dist_squared = delta_x*delta_x + delta_y*delta_y;
@@ -3838,7 +3678,7 @@ LLMenuItemGL *LLPieMenu::pieItemFromXY(S32 x, S32 y)
}
// infinite radius is only used with right clicks
- S32 radius = llmax( mRect.getWidth()/2, mRect.getHeight()/2 );
+ S32 radius = llmax( getRect().getWidth()/2, getRect().getHeight()/2 );
if (!(mUseInfiniteRadius && mRightMouseDown) && dist_squared > radius * radius)
{
return NULL;
@@ -3876,8 +3716,8 @@ S32 LLPieMenu::pieItemIndexFromXY(S32 x, S32 y)
// An arc of the pie menu is 45 degrees
const F32 ARC_DEG = 45.f;
// correct for non-square pixels
- S32 delta_x = x - mRect.getWidth() / 2;
- S32 delta_y = y - mRect.getHeight() / 2;
+ S32 delta_x = x - getRect().getWidth() / 2;
+ S32 delta_y = y - getRect().getHeight() / 2;
// circle safe zone in the center
if (delta_x*delta_x + delta_y*delta_y < PIE_CENTER_SIZE*PIE_CENTER_SIZE)
@@ -3900,8 +3740,8 @@ S32 LLPieMenu::pieItemIndexFromXY(S32 x, S32 y)
void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
{
- S32 width = mRect.getWidth();
- S32 height = mRect.getHeight();
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
@@ -3911,40 +3751,45 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
S32 local_x, local_y;
parent_view->screenPointToLocal(x, y, &local_x, &local_y);
- mRect.setCenterAndSize(local_x, local_y, width, height);
+ // HACK: casting away const. Should use setRect or some helper function instead.
+ const_cast<LLRect&>(getRect()).setCenterAndSize(local_x, local_y, width, height);
arrange();
// Adjust the pie rectangle to keep it on screen
- if (mRect.mLeft < menu_region_rect.mLeft)
+ if (getRect().mLeft < menu_region_rect.mLeft)
{
- //mShiftHoriz = menu_region_rect.mLeft - mRect.mLeft;
- //mRect.translate( mShiftHoriz, 0 );
- mRect.translate( menu_region_rect.mLeft - mRect.mLeft, 0 );
+ //mShiftHoriz = menu_region_rect.mLeft - getRect().mLeft;
+ //getRect().translate( mShiftHoriz, 0 );
+ // HACK: casting away const. Should use setRect or some helper function instead.
+ const_cast<LLRect&>(getRect()).translate( menu_region_rect.mLeft - getRect().mLeft, 0 );
moved = TRUE;
}
- if (mRect.mRight > menu_region_rect.mRight)
+ if (getRect().mRight > menu_region_rect.mRight)
{
- //mShiftHoriz = menu_region_rect.mRight - mRect.mRight;
- //mRect.translate( mShiftHoriz, 0);
- mRect.translate( menu_region_rect.mRight - mRect.mRight, 0 );
+ //mShiftHoriz = menu_region_rect.mRight - getRect().mRight;
+ //getRect().translate( mShiftHoriz, 0);
+ // HACK: casting away const. Should use setRect or some helper function instead.
+ const_cast<LLRect&>(getRect()).translate( menu_region_rect.mRight - getRect().mRight, 0 );
moved = TRUE;
}
- if (mRect.mBottom < menu_region_rect.mBottom)
+ if (getRect().mBottom < menu_region_rect.mBottom)
{
- //mShiftVert = menu_region_rect.mBottom - mRect.mBottom;
- //mRect.translate( 0, mShiftVert );
- mRect.translate( 0, menu_region_rect.mBottom - mRect.mBottom );
+ //mShiftVert = menu_region_rect.mBottom - getRect().mBottom;
+ //getRect().translate( 0, mShiftVert );
+ // HACK: casting away const. Should use setRect or some helper function instead.
+ const_cast<LLRect&>(getRect()).translate( 0, menu_region_rect.mBottom - getRect().mBottom );
moved = TRUE;
}
- if (mRect.mTop > menu_region_rect.mTop)
+ if (getRect().mTop > menu_region_rect.mTop)
{
- //mShiftVert = menu_region_rect.mTop - mRect.mTop;
- //mRect.translate( 0, mShiftVert );
- mRect.translate( 0, menu_region_rect.mTop - mRect.mTop );
+ //mShiftVert = menu_region_rect.mTop - getRect().mTop;
+ //getRect().translate( 0, mShiftVert );
+ // HACK: casting away const. Should use setRect or some helper function instead.
+ const_cast<LLRect&>(getRect()).translate( 0, menu_region_rect.mTop - getRect().mTop );
moved = TRUE;
}
@@ -3953,8 +3798,8 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
if (moved)
{
LLCoordGL center;
- center.mX = (mRect.mLeft + mRect.mRight) / 2;
- center.mY = (mRect.mTop + mRect.mBottom) / 2;
+ center.mX = (getRect().mLeft + getRect().mRight) / 2;
+ center.mY = (getRect().mTop + getRect().mBottom) / 2;
LLUI::setCursorPositionLocal(getParent(), center.mX, center.mY);
}
@@ -4066,7 +3911,7 @@ LLView* LLMenuBarGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
LLMenuBarGL *menubar = new LLMenuBarGL(name);
- LLViewHandle parent_handle = LLViewHandle::sDeadHandle;
+ LLHandle<LLFloater> parent_handle;
if (parent->getWidgetType() == WIDGET_TYPE_FLOATER)
{
parent_handle = ((LLFloater*)parent)->getHandle();
@@ -4246,7 +4091,7 @@ BOOL LLMenuBarGL::jumpKeysActive()
void LLMenuBarGL::arrange( void )
{
U32 pos = 0;
- LLRect rect( 0, mRect.getHeight(), 0, 0 );
+ LLRect rect( 0, getRect().getHeight(), 0, 0 );
item_list_t::const_iterator item_iter;
for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter)
{
@@ -4398,25 +4243,12 @@ LLMenuHolderGL::LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mo
mCanHide = TRUE;
}
-LLMenuHolderGL::~LLMenuHolderGL()
-{
-}
-
-EWidgetType LLMenuHolderGL::getWidgetType() const
-{
- return WIDGET_TYPE_MENU_HOLDER;
-}
-
-LLString LLMenuHolderGL::getWidgetTag() const
-{
- return LL_MENU_HOLDER_GL_TAG;
-}
void LLMenuHolderGL::draw()
{
LLView::draw();
// now draw last selected item as overlay
- LLMenuItemGL* selecteditem = (LLMenuItemGL*)LLView::getViewByHandle(sItemLastSelectedHandle);
+ LLMenuItemGL* selecteditem = (LLMenuItemGL*)sItemLastSelectedHandle.get();
if (selecteditem && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME)
{
// make sure toggle items, for example, show the proper state when fading out
@@ -4426,10 +4258,10 @@ void LLMenuHolderGL::draw()
selecteditem->localRectToOtherView(selecteditem->getLocalRect(), &item_rect, this);
F32 interpolant = sItemActivationTimer.getElapsedTimeF32() / ACTIVATE_HIGHLIGHT_TIME;
- F32 alpha = lerp(LLMenuItemGL::sHighlightBackground.mV[VALPHA], 0.f, interpolant);
- LLColor4 bg_color(LLMenuItemGL::sHighlightBackground.mV[VRED],
- LLMenuItemGL::sHighlightBackground.mV[VGREEN],
- LLMenuItemGL::sHighlightBackground.mV[VBLUE],
+ F32 alpha = lerp(LLMenuItemGL::getHighlightBGColor().mV[VALPHA], 0.f, interpolant);
+ LLColor4 bg_color(LLMenuItemGL::getHighlightBGColor().mV[VRED],
+ LLMenuItemGL::getHighlightBGColor().mV[VGREEN],
+ LLMenuItemGL::getHighlightBGColor().mV[VBLUE],
alpha);
LLUI::pushMatrix();
@@ -4466,7 +4298,7 @@ BOOL LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask )
void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- if (width != mRect.getWidth() || height != mRect.getHeight())
+ if (width != getRect().getWidth() || height != getRect().getHeight())
{
hideMenus();
}
@@ -4486,10 +4318,6 @@ BOOL LLMenuHolderGL::hasVisibleMenu() const
return FALSE;
}
-const LLRect LLMenuHolderGL::getMenuRect() const
-{
- return getLocalRect();
-}
BOOL LLMenuHolderGL::hideMenus()
{
@@ -4522,7 +4350,7 @@ BOOL LLMenuHolderGL::hideMenus()
void LLMenuHolderGL::setActivatedItem(LLMenuItemGL* item)
{
- sItemLastSelectedHandle = item->mViewHandle;
+ sItemLastSelectedHandle = item->getHandle();
sItemActivationTimer.start();
}
@@ -4532,20 +4360,24 @@ void LLMenuHolderGL::setActivatedItem(LLMenuItemGL* item)
LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) :
LLFloater(menup->getName(), LLRect(0, 100, 100, 0), menup->getLabel(), FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, FALSE)
{
+ // flag menu as being torn off
+ menup->setTornOff(TRUE);
+ // update menu layout as torn off menu (no spillover menus)
+ menup->arrange();
+
LLRect rect;
menup->localRectToOtherView(LLRect(-1, menup->getRect().getHeight(), menup->getRect().getWidth() + 3, 0), &rect, gFloaterView);
+ // make sure this floater is big enough for menu
mTargetHeight = (F32)(rect.getHeight() + LLFLOATER_HEADER_SIZE + 5);
reshape(rect.getWidth(), rect.getHeight());
setRect(rect);
- mOldParent = menup->getParent();
- mOldParent->removeChild(menup);
+ // attach menu to floater
menup->setFollowsAll();
+ mOldParent = menup->getParent();
addChild(menup);
menup->setVisible(TRUE);
menup->translate(-menup->getRect().mLeft + 1, -menup->getRect().mBottom + 1);
-
- menup->setTornOff(TRUE);
menup->setDropShadowed(FALSE);
mMenu = menup;
@@ -4554,19 +4386,16 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) :
mMenu->highlightNextItem(NULL);
}
-LLTearOffMenu::~LLTearOffMenu()
-{
-}
void LLTearOffMenu::draw()
{
- mMenu->setBackgroundVisible(mBgOpaque);
+ mMenu->setBackgroundVisible(isBackgroundOpaque());
mMenu->arrange();
- if (mRect.getHeight() != mTargetHeight)
+ if (getRect().getHeight() != mTargetHeight)
{
// animate towards target height
- reshape(mRect.getWidth(), llceil(lerp((F32)mRect.getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f))));
+ reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f))));
}
else
{
@@ -4667,23 +4496,3 @@ void LLTearOffMenu::onClose(bool app_quitting)
destroy();
}
-///============================================================================
-/// Class LLEditMenuHandlerMgr
-///============================================================================
-LLEditMenuHandlerMgr& LLEditMenuHandlerMgr::getInstance()
-{
- static LLEditMenuHandlerMgr instance;
- return instance;
-}
-
-LLEditMenuHandlerMgr::LLEditMenuHandlerMgr()
-{
-}
-
-LLEditMenuHandlerMgr::~LLEditMenuHandlerMgr()
-{
-}
-
-///============================================================================
-/// Local function definitions
-///============================================================================
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index ce33f8a379..e9b80e562b 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -44,8 +44,6 @@
#include "lluistring.h"
#include "llview.h"
-class LLMenuItemGL;
-class LLMenuHolderGL;
extern S32 MENU_BAR_HEIGHT;
extern S32 MENU_BAR_WIDTH;
@@ -77,13 +75,19 @@ typedef void (*label_callback)(LLString&,void*);
// The LLMenuItemGL represents a single menu item in a menu.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLFontGL;
-class LLMenuGL;
-
-
class LLMenuItemGL : public LLView
{
public:
+ // static functions to control the global color scheme.
+ static void setEnabledColor( const LLColor4& color ) { sEnabledColor = color; }
+ static const LLColor4& getEnabledColor() { return sEnabledColor; }
+ static void setDisabledColor( const LLColor4& color ) { sDisabledColor = color; }
+ static const LLColor4& getDisabledColor() { return sDisabledColor; }
+ static void setHighlightBGColor( const LLColor4& color ) { sHighlightBackground = color; }
+ static const LLColor4& getHighlightBGColor() { return sHighlightBackground; }
+ static void setHighlightFGColor( const LLColor4& color ) { sHighlightForeground = color; }
+ static const LLColor4& getHighlightFGColor() { return sHighlightForeground; }
+
LLMenuItemGL( const LLString& name, const LLString& label, KEY key = KEY_NONE, MASK = MASK_NONE );
virtual void setValue(const LLSD& value) { setLabel(value.asString()); }
@@ -99,44 +103,38 @@ public:
virtual BOOL handleAcceleratorKey(KEY key, MASK mask);
- BOOL getHighlight() const { return mHighlight; }
-
void setJumpKey(KEY key);
- KEY getJumpKey();
+ KEY getJumpKey() const { return mJumpKey; }
// set the font used by this item.
- void setFont(LLFontGL* font);
+ void setFont(const LLFontGL* font) { mFont = font; }
+ const LLFontGL* getFont() const { return mFont; }
void setFontStyle(U8 style) { mStyle = style; }
+ U8 getFontStyle() const { return mStyle; }
// returns the height in pixels for the current font.
- virtual U32 getNominalHeight( void );
-
- // functions to control the color scheme
- static void setEnabledColor( const LLColor4& color );
- static void setDisabledColor( const LLColor4& color );
- static void setHighlightBGColor( const LLColor4& color );
- static void setHighlightFGColor( const LLColor4& color );
+ virtual U32 getNominalHeight( void ) const;
// Marks item as not needing space for check marks or accelerator keys
- virtual void setBriefItem(BOOL brief);
+ virtual void setBriefItem(BOOL brief) { mBriefItem = brief; }
+ virtual BOOL isBriefItem() const { return mBriefItem; }
virtual BOOL addToAcceleratorList(std::list<LLKeyBinding*> *listp);
void setAllowKeyRepeat(BOOL allow) { mAllowKeyRepeat = allow; }
-
- // return the name label
- LLString getLabel( void ) const { return mLabel.getString(); }
+ BOOL getAllowKeyRepeat() const { return mAllowKeyRepeat; }
// change the label
- void setLabel( const LLStringExplicit& label );
+ void setLabel( const LLStringExplicit& label ) { mLabel = label; }
+ LLString getLabel( void ) const { return mLabel.getString(); }
virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
// Get the parent menu for this item
- virtual LLMenuGL* getMenu();
+ virtual class LLMenuGL* getMenu();
// returns the normal width of this control in pixels - this is
// used for calculating the widest item, as well as for horizontal
// arrangement.
- virtual U32 getNominalWidth( void );
+ virtual U32 getNominalWidth( void ) const;
// buildDrawLabel() - constructs the string used during the draw()
// function. This reduces the overall string manipulation, but can
@@ -155,14 +153,14 @@ public:
// doIt() - do the primary funcationality of the menu item.
virtual void doIt( void );
- // set the hover status (called by it's menu)
virtual void setHighlight( BOOL highlight );
+ virtual BOOL getHighlight() const { return mHighlight; }
// determine if this represents an active sub-menu
- virtual BOOL isActive( void ) const;
+ virtual BOOL isActive( void ) const { return FALSE; }
// determine if this represents an open sub-menu
- virtual BOOL isOpen( void ) const;
+ virtual BOOL isOpen( void ) const { return FALSE; }
virtual void setEnabledSubMenus(BOOL enable){};
@@ -172,24 +170,20 @@ public:
virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
virtual void draw( void );
- BOOL getHover() { return mGotHover; }
+ BOOL getHover() const { return mGotHover; }
+ void setDrawTextDisabled(BOOL disabled) { mDrawTextDisabled = disabled; }
BOOL getDrawTextDisabled() const { return mDrawTextDisabled; }
protected:
+ void setHover(BOOL hover) { mGotHover = hover; }
+
// This function appends the character string representation of
// the current accelerator key and mask to the provided string.
- void appendAcceleratorString( LLString& st );
-
-public:
- static LLColor4 sEnabledColor;
- static LLColor4 sDisabledColor;
- static LLColor4 sHighlightBackground;
- static LLColor4 sHighlightForeground;
-
-protected:
- static BOOL sDropShadowText;
+ void appendAcceleratorString( LLString& st ) const;
+ KEY mAcceleratorKey;
+ MASK mAcceleratorMask;
// mLabel contains the actual label specified by the user.
LLUIString mLabel;
@@ -200,12 +194,15 @@ protected:
LLUIString mDrawAccelLabel;
LLUIString mDrawBranchLabel;
+ BOOL mHighlight;
+private:
+ static LLColor4 sEnabledColor;
+ static LLColor4 sDisabledColor;
+ static LLColor4 sHighlightBackground;
+ static LLColor4 sHighlightForeground;
+
// Keyboard and mouse variables
- KEY mJumpKey;
- KEY mAcceleratorKey;
- MASK mAcceleratorMask;
BOOL mAllowKeyRepeat;
- BOOL mHighlight;
BOOL mGotHover;
// If true, suppress normal space for check marks on the left and accelerator
@@ -213,10 +210,11 @@ protected:
BOOL mBriefItem;
// Font for this item
- LLFontGL* mFont;
-
+ const LLFontGL* mFont;
U8 mStyle;
BOOL mDrawTextDisabled;
+
+ KEY mJumpKey;
};
@@ -229,14 +227,6 @@ protected:
class LLMenuItemCallGL : public LLMenuItemGL
{
-protected:
- menu_callback mCallback;
- // mEnabledCallback should return TRUE if the item should be enabled
- enabled_callback mEnabledCallback;
- label_callback mLabelCallback;
- void* mUserData;
- on_disabled_callback mOnDisabledCallback;
-
public:
// normal constructor
LLMenuItemCallGL( const LLString& name,
@@ -277,8 +267,8 @@ public:
virtual LLString getType() const { return "call"; }
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_CALL; }
+ virtual LLString getWidgetTag() const { return LL_MENU_ITEM_CALL_GL_TAG; }
void setEnabledControl(LLString enabled_control, LLView *context);
void setVisibleControl(LLString enabled_control, LLView *context);
@@ -302,6 +292,14 @@ public:
//virtual void draw();
virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
+
+private:
+ menu_callback mCallback;
+ // mEnabledCallback should return TRUE if the item should be enabled
+ enabled_callback mEnabledCallback;
+ label_callback mLabelCallback;
+ void* mUserData;
+ on_disabled_callback mOnDisabledCallback;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -310,17 +308,13 @@ public:
// The LLMenuItemCheckGL is an extension of the LLMenuItemCallGL
// class, by allowing another method to be specified which determines
// if the menu item should consider itself checked as true or not. Be
-// careful that the check callback provided - it needs to be VERY
+// careful that the provided callback is fast - it needs to be VERY
// FUCKING EFFICIENT, because it may need to be checked a lot.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLMenuItemCheckGL
: public LLMenuItemCallGL
{
-protected:
- check_callback mCheckCallback;
- BOOL mChecked;
-
public:
LLMenuItemCheckGL( const LLString& name,
const LLString& label,
@@ -348,8 +342,8 @@ public:
void setCheckedControl(LLString checked_control, LLView *context);
virtual void setValue(const LLSD& value) { mChecked = value.asBoolean(); }
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_CHECK; }
+ virtual LLString getWidgetTag() const { return LL_MENU_ITEM_CHECK_GL_TAG; }
virtual LLString getType() const { return "check"; }
@@ -358,8 +352,9 @@ public:
virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
- // LLView Functionality
- //virtual void draw( void );
+private:
+ check_callback mCheckCallback;
+ BOOL mChecked;
};
@@ -372,9 +367,6 @@ public:
class LLMenuItemToggleGL : public LLMenuItemGL
{
-protected:
- BOOL* mToggle;
-
public:
LLMenuItemToggleGL( const LLString& name, const LLString& label,
BOOL* toggle,
@@ -394,6 +386,9 @@ public:
// LLView Functionality
//virtual void draw( void );
+
+private:
+ BOOL* mToggle;
};
@@ -408,16 +403,14 @@ public:
// it in the appendMenu() method.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLMenuArrowGL;
-class LLMenuItemBranchGL;
-class LLMenuItemTearOffGL;
-
class LLMenuGL
: public LLUICtrl
+// TODO: The menu and menu item classes share a great deal of functionality and perhaps should be united.
+// I think it may make the most sense to make LLMenuGL be a subclass of LLMenuItemGL. -MG
{
public:
- LLMenuGL( const LLString& name, const LLString& label, LLViewHandle parent_floater = LLViewHandle::sDeadHandle );
- LLMenuGL( const LLString& label, LLViewHandle parent_floater = LLViewHandle::sDeadHandle );
+ LLMenuGL( const LLString& name, const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>());
+ LLMenuGL( const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>() );
virtual ~LLMenuGL( void );
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
@@ -446,11 +439,12 @@ public:
const LLString& getLabel( void ) const { return mLabel.getString(); }
void setLabel(const LLStringExplicit& label) { mLabel = label; }
- static void setDefaultBackgroundColor( const LLColor4& color );
- void setBackgroundColor( const LLColor4& color );
- LLColor4 getBackgroundColor();
+ // background colors
+ static void setDefaultBackgroundColor( const LLColor4& color ) { sDefaultBackgroundColor = color; }
+ void setBackgroundColor( const LLColor4& color ) { mBackgroundColor = color; }
+ const LLColor4& getBackgroundColor() const { return mBackgroundColor; }
void setBackgroundVisible( BOOL b ) { mBgVisible = b; }
- void setCanTearOff(BOOL tear_off, LLViewHandle parent_floater_handle = LLViewHandle::sDeadHandle);
+ void setCanTearOff(BOOL tear_off, LLHandle<LLFloater> parent_floater_handle = LLHandle<LLFloater>());
// Add the menu item to this menu.
virtual BOOL append( LLMenuItemGL* item );
@@ -524,7 +518,7 @@ public:
BOOL getCanTearOff() { return mTearOffItem != NULL; }
- KEY getJumpKey() { return mJumpKey; }
+ KEY getJumpKey() const { return mJumpKey; }
void setJumpKey(KEY key) { mJumpKey = key; }
static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; }
@@ -532,40 +526,42 @@ public:
static void onFocusLost(LLView* old_focus);
- static LLMenuHolderGL* sMenuContainer;
+ static class LLMenuHolderGL* sMenuContainer;
protected:
void createSpilloverBranch();
void cleanupSpilloverBranch();
-protected:
+ // TODO: create accessor methods for these?
+ typedef std::list< LLMenuItemGL* > item_list_t;
+ item_list_t mItems;
+ typedef std::map<KEY, LLMenuItemGL*> navigation_key_map_t;
+ navigation_key_map_t mJumpKeys;
+ S32 mLastMouseX;
+ S32 mLastMouseY;
+ S32 mMouseVelX;
+ S32 mMouseVelY;
+ BOOL mHorizontalLayout;
+ BOOL mKeepFixedSize;
+
+private:
static LLColor4 sDefaultBackgroundColor;
static BOOL sKeyboardMode;
LLColor4 mBackgroundColor;
BOOL mBgVisible;
- typedef std::list< LLMenuItemGL* > item_list_t;
- item_list_t mItems;
- typedef std::map<KEY, LLMenuItemGL*> navigation_key_map_t;
- navigation_key_map_t mJumpKeys;
LLMenuItemGL* mParentMenuItem;
LLUIString mLabel;
BOOL mDropShadowed; // Whether to drop shadow
- BOOL mHorizontalLayout;
- BOOL mKeepFixedSize;
BOOL mHasSelection;
LLFrameTimer mFadeTimer;
- S32 mLastMouseX;
- S32 mLastMouseY;
- S32 mMouseVelX;
- S32 mMouseVelY;
BOOL mTornOff;
- LLMenuItemTearOffGL* mTearOffItem;
- LLMenuItemBranchGL* mSpilloverBranch;
+ class LLMenuItemTearOffGL* mTearOffItem;
+ class LLMenuItemBranchGL* mSpilloverBranch;
LLMenuGL* mSpilloverMenu;
- LLViewHandle mParentFloaterHandle;
+ LLHandle<LLFloater> mParentFloaterHandle;
KEY mJumpKey;
-};
+}; // end class LLMenuGL
@@ -578,20 +574,15 @@ protected:
class LLMenuItemBranchGL : public LLMenuItemGL
{
-protected:
- LLMenuGL* mBranch;
-
public:
LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch,
KEY key = KEY_NONE, MASK mask = MASK_NONE );
virtual LLXMLNodePtr getXML(bool save_children = true) const;
- virtual LLView* getChildByName(const LLString& name, BOOL recurse) const;
-
- virtual LLString getType() const { return "menu"; }
+ virtual LLString getType() const { return "menu"; }
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_BRANCH; }
+ virtual LLString getWidgetTag() const { return LL_MENU_ITEM_BRANCH_GL_TAG; }
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
@@ -615,9 +606,9 @@ public:
virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
- virtual BOOL isActive() const;
+ virtual BOOL isActive() const { return isOpen() && mBranch->getHighlightedItem(); }
- virtual BOOL isOpen() const;
+ virtual BOOL isOpen() const { return mBranch->isOpen(); }
LLMenuGL *getBranch() const { return mBranch; }
@@ -628,11 +619,16 @@ public:
virtual void draw();
- virtual void setEnabledSubMenus(BOOL enabled);
+ virtual void setEnabledSubMenus(BOOL enabled) { mBranch->setEnabledSubMenus(enabled); }
virtual void openMenu();
-};
+protected:
+ virtual LLView* getChildByName(const LLString& name, BOOL recurse) const;
+
+private:
+ LLMenuGL* mBranch;
+}; // end class LLMenuItemBranchGL
@@ -647,10 +643,10 @@ class LLPieMenu
public:
LLPieMenu(const LLString& name, const LLString& label);
LLPieMenu(const LLString& name);
- virtual ~LLPieMenu();
+ virtual ~LLPieMenu() {}
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_PIE_MENU; }
+ virtual LLString getWidgetTag() const { return LL_PIE_MENU_TAG; }
void initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory);
@@ -682,11 +678,10 @@ public:
void show(S32 x, S32 y, BOOL mouse_down);
void hide(BOOL item_selected);
-protected:
+private:
LLMenuItemGL *pieItemFromXY(S32 x, S32 y);
S32 pieItemIndexFromXY(S32 x, S32 y);
-private:
// These cause menu items to be spuriously selected by right-clicks
// near the window edge at low frame rates. I don't think they are
// needed unless you shift the menu position in the draw() function. JC
@@ -703,6 +698,7 @@ private:
BOOL mRightMouseDown;
};
+
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLMenuBarGL
//
@@ -711,10 +707,6 @@ private:
class LLMenuBarGL : public LLMenuGL
{
-protected:
- std::list <LLKeyBinding*> mAccelerators;
- BOOL mAltKeyTrigger;
-
public:
LLMenuBarGL( const LLString& name );
virtual ~LLMenuBarGL();
@@ -748,9 +740,11 @@ public:
void resetMenuTrigger() { mAltKeyTrigger = FALSE; }
-protected:
+private:
void checkMenuTrigger();
+ std::list <LLKeyBinding*> mAccelerators;
+ BOOL mAltKeyTrigger;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -763,10 +757,10 @@ class LLMenuHolderGL : public LLPanel
public:
LLMenuHolderGL();
LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows = FOLLOWS_NONE);
- virtual ~LLMenuHolderGL();
+ virtual ~LLMenuHolderGL() {}
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_HOLDER; }
+ virtual LLString getWidgetTag() const { return LL_MENU_HOLDER_GL_TAG; }
virtual BOOL hideMenus();
void reshape(S32 width, S32 height, BOOL called_from_parent);
@@ -777,13 +771,13 @@ public:
virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
- virtual const LLRect getMenuRect() const;
+ virtual const LLRect getMenuRect() const { return getLocalRect(); }
virtual BOOL hasVisibleMenu() const;
static void setActivatedItem(LLMenuItemGL* item);
-protected:
- static LLViewHandle sItemLastSelectedHandle;
+private:
+ static LLHandle<LLView> sItemLastSelectedHandle;
static LLFrameTimer sItemActivationTimer;
BOOL mCanHide;
@@ -793,12 +787,13 @@ protected:
// Class LLTearOffMenu
//
// Floater that hosts a menu
+// https://wiki.lindenlab.com/mediawiki/index.php?title=LLTearOffMenu&oldid=81344
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTearOffMenu : public LLFloater
{
public:
static LLTearOffMenu* create(LLMenuGL* menup);
- virtual ~LLTearOffMenu();
+ virtual ~LLTearOffMenu() {}
virtual void onClose(bool app_quitting);
virtual void draw(void);
virtual void onFocusReceived();
@@ -807,10 +802,9 @@ public:
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
virtual void translate(S32 x, S32 y);
-protected:
+private:
LLTearOffMenu(LLMenuGL* menup);
-protected:
LLView* mOldParent;
LLMenuGL* mMenu;
F32 mTargetHeight;
@@ -825,19 +819,19 @@ protected:
class LLMenuItemTearOffGL : public LLMenuItemGL
{
public:
- LLMenuItemTearOffGL( LLViewHandle parent_floater_handle = (LLViewHandle)LLViewHandle::sDeadHandle );
+ LLMenuItemTearOffGL( LLHandle<LLFloater> parent_floater_handle = LLHandle<LLFloater>());
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEAROFF_MENU; }
+ virtual LLString getWidgetTag() const { return LL_MENU_ITEM_TEAR_OFF_GL_TAG; }
- virtual LLString getType() const { return "tearoff_menu"; }
+ virtual LLString getType() const { return "tearoff_menu"; }
virtual void doIt(void);
virtual void draw(void);
- virtual U32 getNominalHeight();
+ virtual U32 getNominalHeight() const;
-protected:
- LLViewHandle mParentHandle;
+private:
+ LLHandle<LLFloater> mParentHandle;
};
@@ -845,11 +839,13 @@ protected:
class LLEditMenuHandlerMgr
{
public:
- LLEditMenuHandlerMgr& getInstance();
- virtual ~LLEditMenuHandlerMgr();
-protected:
- LLEditMenuHandlerMgr();
-
+ LLEditMenuHandlerMgr& getInstance() {
+ static LLEditMenuHandlerMgr instance;
+ return instance;
+ }
+ virtual ~LLEditMenuHandlerMgr() {}
+private:
+ LLEditMenuHandlerMgr() {};
};
#endif // LL_LLMENUGL_H
diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp
index af14ec418f..a150d295e5 100644
--- a/indra/llui/llmodaldialog.cpp
+++ b/indra/llui/llmodaldialog.cpp
@@ -74,10 +74,10 @@ LLModalDialog::~LLModalDialog()
void LLModalDialog::open() /* Flawfinder: ignore */
{
// SJB: Hack! Make sure we don't ever host a modal dialog
- LLMultiFloater* thost = LLFloater::sHostp;
- LLFloater::sHostp = NULL;
+ LLMultiFloater* thost = LLFloater::getFloaterHost();
+ LLFloater::setFloaterHost(NULL);
LLFloater::open();
- LLFloater::sHostp = thost;
+ LLFloater::setFloaterHost(thost);
}
void LLModalDialog::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -157,14 +157,18 @@ void LLModalDialog::setVisible( BOOL visible )
BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if (!LLFloater::handleMouseDown(x, y, mask))
+ if (mModal)
{
- if (mModal)
+ if (!LLFloater::handleMouseDown(x, y, mask))
{
// Click was outside the panel
make_ui_sound("UISndInvalidOp");
}
}
+ else
+ {
+ LLFloater::handleMouseDown(x, y, mask);
+ }
return TRUE;
}
@@ -247,7 +251,7 @@ void LLModalDialog::draw()
LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow");
S32 shadow_lines = LLUI::sConfigGroup->getS32("DropShadowFloater");
- gl_drop_shadow( 0, mRect.getHeight(), mRect.getWidth(), 0,
+ gl_drop_shadow( 0, getRect().getHeight(), getRect().getWidth(), 0,
shadow_color, shadow_lines);
LLFloater::draw();
@@ -276,11 +280,7 @@ void LLModalDialog::draw()
void LLModalDialog::centerOnScreen()
{
LLVector2 window_size = LLUI::getWindowSize();
-
- S32 dialog_left = (llround(window_size.mV[VX]) - mRect.getWidth()) / 2;
- S32 dialog_bottom = (llround(window_size.mV[VY]) - mRect.getHeight()) / 2;
-
- translate( dialog_left - mRect.mLeft, dialog_bottom - mRect.mBottom );
+ centerWithin(LLRect(0, 0, llround(window_size.mV[VX]), llround(window_size.mV[VY])));
}
@@ -319,3 +319,4 @@ void LLModalDialog::onAppFocusGained()
}
+
diff --git a/indra/llui/llmodaldialog.h b/indra/llui/llmodaldialog.h
index dcd5644f60..f13e5c37b7 100644
--- a/indra/llui/llmodaldialog.h
+++ b/indra/llui/llmodaldialog.h
@@ -40,7 +40,7 @@ class LLModalDialog;
// By default, a ModalDialog is modal, i.e. no other window can have focus
// However, for the sake of code reuse and simplicity, if mModal == false,
// the dialog behaves like a normal floater
-
+// https://wiki.lindenlab.com/mediawiki/index.php?title=LLModalDialog&oldid=81385
class LLModalDialog : public LLFloater
{
public:
@@ -67,6 +67,8 @@ public:
/*virtual*/ void setVisible(BOOL visible);
/*virtual*/ void draw();
+ BOOL isModal() const { return mModal; }
+
static void onAppFocusLost();
static void onAppFocusGained();
@@ -75,9 +77,9 @@ public:
protected:
void centerOnScreen();
-protected:
+private:
LLFrameTimer mVisibleTime;
- BOOL mModal; // do not change this after creation!
+ const BOOL mModal;
static std::list<LLModalDialog*> sModalStack; // Top of stack is currently being displayed
};
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 07ebfb7979..6554a25dcf 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -60,10 +60,10 @@
#include "llresizebar.h"
#include "llcriticaldamp.h"
-LLPanel::panel_map_t LLPanel::sPanelMap;
LLPanel::alert_queue_t LLPanel::sAlertQueue;
const S32 RESIZE_BAR_OVERLAP = 1;
+const S32 RESIZE_BAR_HEIGHT = 3;
void LLPanel::init()
{
@@ -78,8 +78,7 @@ void LLPanel::init()
setIsChrome(FALSE); //is this a decorator to a live window or a form?
mLastTabGroup = 0;
- // add self to handle->panel map
- sPanelMap[mViewHandle] = this;
+ mPanelHandle.bind(this);
setTabStop(FALSE);
}
@@ -121,31 +120,11 @@ LLPanel::LLPanel(const LLString& name, const LLString& rect_control, BOOL border
}
}
-void LLPanel::addBorder(LLViewBorder::EBevel border_bevel,
- LLViewBorder::EStyle border_style, S32 border_thickness)
-{
- removeBorder();
- mBorder = new LLViewBorder( "panel border",
- LLRect(0, mRect.getHeight(), mRect.getWidth(), 0),
- border_bevel, border_style, border_thickness );
- mBorder->setSaveToXML(false);
- addChild( mBorder );
-}
-
-void LLPanel::removeBorder()
-{
- delete mBorder;
- mBorder = NULL;
-}
-
-
LLPanel::~LLPanel()
{
storeRectControl();
- sPanelMap.erase(mViewHandle);
}
-
// virtual
EWidgetType LLPanel::getWidgetType() const
{
@@ -159,7 +138,7 @@ LLString LLPanel::getWidgetTag() const
}
// virtual
-BOOL LLPanel::isPanel()
+BOOL LLPanel::isPanel() const
{
return TRUE;
}
@@ -170,6 +149,24 @@ BOOL LLPanel::postBuild()
return TRUE;
}
+void LLPanel::addBorder(LLViewBorder::EBevel border_bevel,
+ LLViewBorder::EStyle border_style, S32 border_thickness)
+{
+ removeBorder();
+ mBorder = new LLViewBorder( "panel border",
+ LLRect(0, getRect().getHeight(), getRect().getWidth(), 0),
+ border_bevel, border_style, border_thickness );
+ mBorder->setSaveToXML(false);
+ addChild( mBorder );
+}
+
+void LLPanel::removeBorder()
+{
+ delete mBorder;
+ mBorder = NULL;
+}
+
+
// virtual
void LLPanel::clearCtrls()
{
@@ -200,8 +197,8 @@ void LLPanel::draw()
{
//RN: I don't see the point of this
S32 left = 0;//LLPANEL_BORDER_WIDTH;
- S32 top = mRect.getHeight();// - LLPANEL_BORDER_WIDTH;
- S32 right = mRect.getWidth();// - LLPANEL_BORDER_WIDTH;
+ S32 top = getRect().getHeight();// - LLPANEL_BORDER_WIDTH;
+ S32 right = getRect().getWidth();// - LLPANEL_BORDER_WIDTH;
S32 bottom = 0;//LLPANEL_BORDER_WIDTH;
if (mBgOpaque )
@@ -272,13 +269,13 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
if( (mask == MASK_SHIFT) && (KEY_TAB == key))
{
//SHIFT-TAB
- LLView* cur_focus = gFocusMgr.getKeyboardFocus();
+ LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
if (cur_focus && gFocusMgr.childHasKeyboardFocus(this))
{
- LLView* focus_root = cur_focus;
- while(cur_focus->getParent())
+ LLUICtrl* focus_root = cur_focus;
+ while(cur_focus->getParentUICtrl())
{
- cur_focus = cur_focus->getParent();
+ cur_focus = cur_focus->getParentUICtrl();
if (cur_focus->isFocusRoot())
{
// this is the root-most focus root found so far
@@ -287,7 +284,7 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
}
handled = focus_root->focusPrevItem(FALSE);
}
- else if (!cur_focus && mIsFocusRoot)
+ else if (!cur_focus && isFocusRoot())
{
handled = focusLastItem();
if (!handled)
@@ -301,13 +298,13 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
if( (mask == MASK_NONE ) && (KEY_TAB == key))
{
//TAB
- LLView* cur_focus = gFocusMgr.getKeyboardFocus();
+ LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
if (cur_focus && gFocusMgr.childHasKeyboardFocus(this))
{
- LLView* focus_root = cur_focus;
- while(cur_focus->getParent())
+ LLUICtrl* focus_root = cur_focus;
+ while(cur_focus->getParentUICtrl())
{
- cur_focus = cur_focus->getParent();
+ cur_focus = cur_focus->getParentUICtrl();
if (cur_focus->isFocusRoot())
{
focus_root = cur_focus;
@@ -315,7 +312,7 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
}
handled = focus_root->focusNextItem(FALSE);
}
- else if (!cur_focus && mIsFocusRoot)
+ else if (!cur_focus && isFocusRoot())
{
handled = focusFirstItem();
if (!handled)
@@ -392,12 +389,12 @@ void LLPanel::requires(LLString name, EWidgetType type)
mRequirements[name] = type;
}
-BOOL LLPanel::checkRequirements()
+BOOL LLPanel::checkRequirements() const
{
BOOL retval = TRUE;
LLString message;
- for (requirements_map_t::iterator i = mRequirements.begin(); i != mRequirements.end(); ++i)
+ for (requirements_map_t::const_iterator i = mRequirements.begin(); i != mRequirements.end(); ++i)
{
if (!this->getCtrlByNameAndType(i->first, i->second))
{
@@ -473,21 +470,6 @@ void LLPanel::setFocus(BOOL b)
}
}
-void LLPanel::setBackgroundColor(const LLColor4& color)
-{
- mBgColorOpaque = color;
-}
-
-LLColor4 LLPanel::getBackgroundColor()
-{
- return mBgColorOpaque;
-}
-
-void LLPanel::setTransparentColor(const LLColor4& color)
-{
- mBgColorAlpha = color;
-}
-
void LLPanel::setBorderVisible(BOOL b)
{
if (mBorder)
@@ -496,18 +478,18 @@ void LLPanel::setBorderVisible(BOOL b)
}
}
-LLView* LLPanel::getCtrlByNameAndType(const LLString& name, EWidgetType type)
+LLUICtrl* LLPanel::getCtrlByNameAndType(const LLString& name, EWidgetType type) const
{
LLView* view = getChildByName(name, TRUE);
- if (view)
+ if (view && view->isCtrl())
{
if (type == WIDGET_TYPE_DONTCARE || view->getWidgetType() == type)
{
- return view;
+ return (LLUICtrl*)view;
}
else
{
- llwarns << "Widget " << name << " has improper type in panel " << mName << "\n"
+ llwarns << "Widget " << name << " has improper type in panel " << getName() << "\n"
<< "Is: \t\t" << view->getWidgetType() << "\n"
<< "Should be: \t" << type
<< llendl;
@@ -520,17 +502,6 @@ LLView* LLPanel::getCtrlByNameAndType(const LLString& name, EWidgetType type)
return NULL;
}
-// static
-LLPanel* LLPanel::getPanelByHandle(LLViewHandle handle)
-{
- if (!sPanelMap.count(handle))
- {
- return NULL;
- }
-
- return sPanelMap[handle];
-}
-
// virtual
LLXMLNodePtr LLPanel::getXML(bool save_children) const
{
@@ -718,7 +689,7 @@ void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parent)
setLabel(label);
}
-LLString LLPanel::getFormattedUIString(const LLString& name, const LLString::format_map_t& args) const
+LLString LLPanel::getString(const LLString& name, const LLString::format_map_t& args) const
{
ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
if (found_it != mUIStrings.end())
@@ -728,6 +699,7 @@ LLString LLPanel::getFormattedUIString(const LLString& name, const LLString::for
formatted_string.setArgList(args);
return formatted_string.getString();
}
+ llerrs << "Failed to find string " << name << " in panel " << getName() << llendl;
return LLString::null;
}
@@ -738,13 +710,14 @@ LLUIString LLPanel::getUIString(const LLString& name) const
{
return found_it->second;
}
+ llerrs << "Failed to find string " << name << " in panel " << getName() << llendl;
return LLUIString(LLString::null);
}
void LLPanel::childSetVisible(const LLString& id, bool visible)
{
- LLView* child = getChildByName(id, true);
+ LLView* child = getChild<LLView>(id);
if (child)
{
child->setVisible(visible);
@@ -753,7 +726,7 @@ void LLPanel::childSetVisible(const LLString& id, bool visible)
bool LLPanel::childIsVisible(const LLString& id) const
{
- LLView* child = getChildByName(id, true);
+ LLView* child = getChild<LLView>(id);
if (child)
{
return (bool)child->getVisible();
@@ -763,7 +736,7 @@ bool LLPanel::childIsVisible(const LLString& id) const
void LLPanel::childSetEnabled(const LLString& id, bool enabled)
{
- LLView* child = getChildByName(id, true);
+ LLView* child = getChild<LLView>(id);
if (child)
{
child->setEnabled(enabled);
@@ -772,7 +745,7 @@ void LLPanel::childSetEnabled(const LLString& id, bool enabled)
void LLPanel::childSetTentative(const LLString& id, bool tentative)
{
- LLView* child = getChildByName(id, true);
+ LLView* child = getChild<LLView>(id);
if (child)
{
child->setTentative(tentative);
@@ -781,7 +754,7 @@ void LLPanel::childSetTentative(const LLString& id, bool tentative)
bool LLPanel::childIsEnabled(const LLString& id) const
{
- LLView* child = getChildByName(id, true);
+ LLView* child = getChild<LLView>(id);
if (child)
{
return (bool)child->getEnabled();
@@ -792,7 +765,7 @@ bool LLPanel::childIsEnabled(const LLString& id) const
void LLPanel::childSetToolTip(const LLString& id, const LLString& msg)
{
- LLView* child = getChildByName(id, true);
+ LLView* child = getChild<LLView>(id);
if (child)
{
child->setToolTip(msg);
@@ -801,7 +774,7 @@ void LLPanel::childSetToolTip(const LLString& id, const LLString& msg)
void LLPanel::childSetRect(const LLString& id, const LLRect& rect)
{
- LLView* child = getChildByName(id, true);
+ LLView* child = getChild<LLView>(id);
if (child)
{
child->setRect(rect);
@@ -810,7 +783,7 @@ void LLPanel::childSetRect(const LLString& id, const LLRect& rect)
bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const
{
- LLView* child = getChildByName(id, true);
+ LLView* child = getChild<LLView>(id);
if (child)
{
rect = child->getRect();
@@ -821,7 +794,7 @@ bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const
void LLPanel::childSetFocus(const LLString& id, BOOL focus)
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
child->setFocus(focus);
@@ -830,7 +803,7 @@ void LLPanel::childSetFocus(const LLString& id, BOOL focus)
BOOL LLPanel::childHasFocus(const LLString& id)
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
return child->hasFocus();
@@ -845,7 +818,7 @@ BOOL LLPanel::childHasFocus(const LLString& id)
void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocusableElement*, void*), void* user_data)
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
child->setFocusChangedCallback(cb, user_data);
@@ -854,7 +827,7 @@ void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocu
void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, void*), void *userdata )
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
child->setCommitCallback(cb);
@@ -864,7 +837,7 @@ void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, v
void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*), void *userdata )
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
child->setDoubleClickCallback(cb);
@@ -877,7 +850,7 @@ void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*),
void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*))
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
child->setValidateBeforeCommit(cb);
@@ -886,7 +859,7 @@ void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*))
void LLPanel::childSetUserData(const LLString& id, void* userdata)
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
child->setCallbackUserData(userdata);
@@ -895,16 +868,16 @@ void LLPanel::childSetUserData(const LLString& id, void* userdata)
void LLPanel::childSetColor(const LLString& id, const LLColor4& color)
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
child->setColor(color);
}
}
-LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id)
+LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id) const
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
return child->getSelectionInterface();
@@ -912,9 +885,9 @@ LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id
return NULL;
}
-LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id)
+LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id) const
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
return child->getListInterface();
@@ -922,9 +895,9 @@ LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id)
return NULL;
}
-LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id)
+LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id) const
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
return child->getScrollInterface();
@@ -934,7 +907,7 @@ LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id)
void LLPanel::childSetValue(const LLString& id, LLSD value)
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLView* child = getChild<LLView>(id, true);
if (child)
{
child->setValue(value);
@@ -943,7 +916,7 @@ void LLPanel::childSetValue(const LLString& id, LLSD value)
LLSD LLPanel::childGetValue(const LLString& id) const
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLView* child = getChild<LLView>(id, true);
if (child)
{
return child->getValue();
@@ -954,7 +927,7 @@ LLSD LLPanel::childGetValue(const LLString& id) const
BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text)
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
return child->setTextArg(key, text);
@@ -964,7 +937,7 @@ BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLS
BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text)
{
- LLView* child = getChildByName(id, true);
+ LLView* child = getChild<LLView>(id);
if (child)
{
return child->setLabelArg(key, text);
@@ -984,7 +957,7 @@ BOOL LLPanel::childSetToolTipArg(const LLString& id, const LLString& key, const
void LLPanel::childSetMinValue(const LLString& id, LLSD min_value)
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
child->setMinValue(min_value);
@@ -993,7 +966,7 @@ void LLPanel::childSetMinValue(const LLString& id, LLSD min_value)
void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value)
{
- LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
+ LLUICtrl* child = getChild<LLUICtrl>(id, true);
if (child)
{
child->setMaxValue(max_value);
@@ -1002,16 +975,16 @@ void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value)
void LLPanel::childShowTab(const LLString& id, const LLString& tabname, bool visible)
{
- LLTabContainerCommon* child = LLUICtrlFactory::getTabContainerByName(this, id);
+ LLTabContainer* child = LLUICtrlFactory::getTabContainerByName(this, id);
if (child)
{
child->selectTabByName(tabname);
}
}
-LLPanel *LLPanel::childGetVisibleTab(const LLString& id)
+LLPanel *LLPanel::childGetVisibleTab(const LLString& id) const
{
- LLTabContainerCommon* child = LLUICtrlFactory::getTabContainerByName(this, id);
+ LLTabContainer* child = LLUICtrlFactory::getTabContainerByName(this, id);
if (child)
{
return child->getCurrentPanel();
@@ -1021,7 +994,7 @@ LLPanel *LLPanel::childGetVisibleTab(const LLString& id)
void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata)
{
- LLTabContainerCommon* child = LLUICtrlFactory::getTabContainerByName(this, id);
+ LLTabContainer* child = LLUICtrlFactory::getTabContainerByName(this, id);
if (child)
{
LLPanel *panel = child->getPanelByName(tabname);
@@ -1033,11 +1006,6 @@ void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabn
}
}
-void LLPanel::childSetText(const LLString& id, const LLStringExplicit& text)
-{
- childSetValue(id, LLSD(text));
-}
-
void LLPanel::childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data)
{
LLLineEditor* child = LLUICtrlFactory::getLineEditorByName(this, id);
@@ -1060,11 +1028,6 @@ void LLPanel::childSetPrevalidate(const LLString& id, BOOL (*func)(const LLWStri
}
}
-LLString LLPanel::childGetText(const LLString& id)
-{
- return childGetValue(id).asString();
-}
-
void LLPanel::childSetWrappedText(const LLString& id, const LLString& text, bool visible)
{
LLTextBox* child = (LLTextBox*)getCtrlByNameAndType(id, WIDGET_TYPE_TEXT_BOX);
@@ -1095,7 +1058,7 @@ void LLPanel::childSetActionTextbox(const LLString& id, void(*function)(void*))
void LLPanel::childSetControlName(const LLString& id, const LLString& control_name)
{
- LLView* view = getChildByName(id, TRUE);
+ LLView* view = getChild<LLView>(id);
if (view)
{
view->setControlName(control_name, NULL);
@@ -1145,7 +1108,7 @@ void LLPanel::storeRectControl()
{
if( !mRectControl.empty() )
{
- LLUI::sConfigGroup->setRect( mRectControl, mRect );
+ LLUI::sConfigGroup->setRect( mRectControl, getRect() );
}
}
@@ -1215,6 +1178,19 @@ LLLayoutStack::~LLLayoutStack()
std::for_each(mPanels.begin(), mPanels.end(), DeletePointer());
}
+// virtual
+EWidgetType LLLayoutStack::getWidgetType() const
+{
+ return WIDGET_TYPE_LAYOUT_STACK;
+}
+
+// virtual
+LLString LLLayoutStack::getWidgetTag() const
+{
+ return LL_LAYOUT_STACK_TAG;
+}
+
+
void LLLayoutStack::draw()
{
updateLayout();
@@ -1326,23 +1302,13 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor
return layout_stackp;
}
-S32 LLLayoutStack::getMinWidth()
-{
- return mMinWidth;
-}
-
-S32 LLLayoutStack::getMinHeight()
-{
- return mMinHeight;
-}
-
S32 LLLayoutStack::getDefaultHeight(S32 cur_height)
{
// if we are spanning our children (crude upward propagation of size)
// then don't enforce our size on our children
if (mOrientation == HORIZONTAL)
{
- cur_height = llmax(mMinHeight, mRect.getHeight());
+ cur_height = llmax(mMinHeight, getRect().getHeight());
}
return cur_height;
@@ -1354,7 +1320,7 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width)
// then don't enforce our size on our children
if (mOrientation == VERTICAL)
{
- cur_width = llmax(mMinWidth, mRect.getWidth());
+ cur_width = llmax(mMinWidth, getRect().getWidth());
}
return cur_width;
@@ -1476,15 +1442,15 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
S32 pixels_to_distribute;
if (mOrientation == HORIZONTAL)
{
- pixels_to_distribute = mRect.getWidth() - total_width;
+ pixels_to_distribute = getRect().getWidth() - total_width;
}
else //VERTICAL
{
- pixels_to_distribute = mRect.getHeight() - total_height;
+ pixels_to_distribute = getRect().getHeight() - total_height;
}
S32 cur_x = 0;
- S32 cur_y = mRect.getHeight();
+ S32 cur_y = getRect().getHeight();
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
@@ -1619,18 +1585,19 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
// not enough room to fit existing contents
if (!force_resize
&& ((cur_y != -mPanelSpacing)
- || (cur_x != mRect.getWidth() + mPanelSpacing)))
+ || (cur_x != getRect().getWidth() + mPanelSpacing)))
{
// do another layout pass with all stacked elements contributing
// even those that don't usually resize
llassert_always(force_resize == FALSE);
updateLayout(TRUE);
}
-}
+} // end LLLayoutStack::updateLayout
-LLLayoutStack::LLEmbeddedPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp)
+
+LLLayoutStack::LLEmbeddedPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
{
- e_panel_list_t::iterator panel_it;
+ e_panel_list_t::const_iterator panel_it;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
if ((*panel_it)->mPanel == panelp)
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 88b4ecb76b..2fdf95df58 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -33,10 +33,11 @@
#ifndef LL_LLPANEL_H
#define LL_LLPANEL_H
-// Opaque view with a background and a border. Can contain LLUICtrls.
#include "llcallbackmap.h"
#include "lluictrl.h"
+#include "llbutton.h"
+#include "lllineeditor.h"
#include "llviewborder.h"
#include "lluistring.h"
#include "v4color.h"
@@ -47,39 +48,26 @@ const S32 LLPANEL_BORDER_WIDTH = 1;
const BOOL BORDER_YES = TRUE;
const BOOL BORDER_NO = FALSE;
-class LLViewerImage;
-class LLUUID;
-class LLCheckBoxCtrl;
-class LLComboBox;
-class LLIconCtrl;
-class LLLineEditor;
-class LLRadioGroup;
-class LLScrollListCtrl;
-class LLSliderCtrl;
-class LLSpinCtrl;
-class LLTextBox;
-class LLTextEditor;
-
-class LLAlertInfo
+
+struct LLAlertInfo
{
-public:
LLString mLabel;
LLString::format_map_t mArgs;
- LLAlertInfo(LLString label, LLString::format_map_t args)
- : mLabel(label), mArgs(args) { }
-
- LLAlertInfo() { }
+ LLAlertInfo(LLString label, LLString::format_map_t args) : mLabel(label), mArgs(args) { }
+ LLAlertInfo(){}
};
-class LLPanel : public LLUICtrl
+
+/*
+ * General purpose concrete view base class.
+ * Transparent or opaque,
+ * With or without border,
+ * Can contain LLUICtrls.
+ */
+class LLPanel : public LLUICtrl
{
public:
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
-
- // defaults to TRUE
- virtual BOOL isPanel();
// minimal constructor for data-driven initialization
LLPanel();
@@ -89,71 +77,74 @@ public:
LLPanel(const LLString& name, const LLRect& rect, BOOL bordered = TRUE);
// Position and size are saved to rect_control
- LLPanel(const LLString& name, const LLString& rect_control, BOOL bordered = TRUE);
+ LLPanel(const LLString& name, const LLString& rect_control, BOOL bordered = TRUE);
+
+ /*virtual*/ ~LLPanel();
+
+ // LLView interface
+ /*virtual*/ EWidgetType getWidgetType() const;
+ /*virtual*/ LLString getWidgetTag() const;
+ /*virtual*/ BOOL isPanel() const;
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent );
+ /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent );
+ /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
+ // From LLFocusableElement
+ /*virtual*/ void setFocus( BOOL b );
+
+ // New virtuals
+ virtual void refresh(); // called in setFocus()
+ virtual BOOL postBuild();
+ virtual void clearCtrls(); // overridden in LLPanelObject and LLPanelVolume
+
+ // Border controls
void addBorder( LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_OUT,
LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE,
S32 border_thickness = LLPANEL_BORDER_WIDTH );
-
- void removeBorder();
-
- virtual ~LLPanel();
- virtual void draw();
- virtual void refresh(); // called in setFocus()
- virtual void setFocus( BOOL b );
- void setFocusRoot(BOOL b) { mIsFocusRoot = b; }
- virtual BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent );
- virtual BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent );
- virtual BOOL postBuild();
+ void removeBorder();
+ BOOL hasBorder() const { return mBorder != NULL; }
+ void setBorderVisible( BOOL b );
void requires(LLString name, EWidgetType type = WIDGET_TYPE_DONTCARE);
- BOOL checkRequirements();
-
- static void alertXml(LLString label, LLString::format_map_t args = LLString::format_map_t());
- static BOOL nextAlert(LLAlertInfo &alert);
+ BOOL checkRequirements() const;
- void setBackgroundColor( const LLColor4& color );
- LLColor4 getBackgroundColor();
- void setTransparentColor(const LLColor4& color);
+ void setBackgroundColor( const LLColor4& color ) { mBgColorOpaque = color; }
+ const LLColor4& getBackgroundColor() const { return mBgColorOpaque; }
+ void setTransparentColor(const LLColor4& color) { mBgColorAlpha = color; }
+ const LLColor4& getTransparentColor() const { return mBgColorAlpha; }
void setBackgroundVisible( BOOL b ) { mBgVisible = b; }
+ BOOL isBackgroundVisible() const { return mBgVisible; }
void setBackgroundOpaque(BOOL b) { mBgOpaque = b; }
+ BOOL isBackgroundOpaque() const { return mBgOpaque; }
void setDefaultBtn(LLButton* btn = NULL);
void setDefaultBtn(const LLString& id);
void setLabel(const LLStringExplicit& label) { mLabel = label; }
LLString getLabel() const { return mLabel; }
void setRectControl(const LLString& rect_control) { mRectControl.assign(rect_control); }
+ const LLString& getRectControl() const { return mRectControl; }
void storeRectControl();
-
- void setBorderVisible( BOOL b );
void setCtrlsEnabled(BOOL b);
- virtual void clearCtrls();
-
- LLViewHandle getHandle() { return mViewHandle; }
- S32 getLastTabGroup() { return mLastTabGroup; }
+ LLHandle<LLPanel> getHandle() const { return mPanelHandle; }
- LLView* getCtrlByNameAndType(const LLString& name, EWidgetType type);
+ S32 getLastTabGroup() const { return mLastTabGroup; }
- static LLPanel* getPanelByHandle(LLViewHandle handle);
+ LLUICtrl* getCtrlByNameAndType(const LLString& name, EWidgetType type) const;
- virtual const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; }
+ const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; }
- virtual LLXMLNodePtr getXML(bool save_children = true) const;
- static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory);
void setPanelParameters(LLXMLNodePtr node, LLView *parentp);
- LLString getFormattedUIString(const LLString& name, const LLString::format_map_t& args = LLUIString::sNullArgs) const;
+ LLString getString(const LLString& name, const LLString::format_map_t& args = LLUIString::sNullArgs) const;
LLUIString getUIString(const LLString& name) const;
// ** Wrappers for setting child properties by name ** -TomY
- // Override to set not found list
- virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
-
// LLView
void childSetVisible(const LLString& name, bool visible);
void childShow(const LLString& name) { childSetVisible(name, true); }
@@ -182,9 +173,9 @@ public:
void childSetColor(const LLString& id, const LLColor4& color);
- LLCtrlSelectionInterface* childGetSelectionInterface(const LLString& id);
- LLCtrlListInterface* childGetListInterface(const LLString& id);
- LLCtrlScrollInterface* childGetScrollInterface(const LLString& id);
+ LLCtrlSelectionInterface* childGetSelectionInterface(const LLString& id) const;
+ LLCtrlListInterface* childGetListInterface(const LLString& id) const;
+ LLCtrlScrollInterface* childGetScrollInterface(const LLString& id) const;
// This is the magic bullet for data-driven UI
void childSetValue(const LLString& id, LLSD value);
@@ -202,15 +193,15 @@ public:
// LLTabContainer
void childShowTab(const LLString& id, const LLString& tabname, bool visible = true);
- LLPanel *childGetVisibleTab(const LLString& id);
+ LLPanel *childGetVisibleTab(const LLString& id) const;
void childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata);
// LLTextBox
void childSetWrappedText(const LLString& id, const LLString& text, bool visible = true);
// LLTextBox/LLTextEditor/LLLineEditor
- void childSetText(const LLString& id, const LLStringExplicit& text);
- LLString childGetText(const LLString& id);
+ void childSetText(const LLString& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); }
+ LLString childGetText(const LLString& id) const { return childGetValue(id).asString(); }
// LLLineEditor
void childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data);
@@ -225,16 +216,23 @@ public:
void childNotFound(const LLString& id) const;
void childDisplayNotFound();
- typedef std::queue<LLAlertInfo> alert_queue_t;
- static alert_queue_t sAlertQueue;
+ static void alertXml(LLString label, LLString::format_map_t args = LLString::format_map_t());
+ static BOOL nextAlert(LLAlertInfo &alert);
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+
+protected:
+ // Override to set not found list
+ LLButton* getDefaultButton() { return mDefaultBtn; }
+ LLCallbackMap::map_t mFactoryMap;
- typedef std::map<LLString, LLUIString> ui_string_map_t;
+ // Override to set not found list:
+ virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
private:
- // common constructor
+ // common construction logic
void init();
-
-protected:
+
+ // From LLView
virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group );
virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
@@ -251,18 +249,20 @@ protected:
BOOL mBgOpaque;
LLViewBorder* mBorder;
LLButton* mDefaultBtn;
- LLCallbackMap::map_t mFactoryMap;
LLString mLabel;
S32 mLastTabGroup;
+ LLRootHandle<LLPanel> mPanelHandle;
+ typedef std::map<LLString, LLUIString> ui_string_map_t;
ui_string_map_t mUIStrings;
typedef std::map<LLString, EWidgetType> requirements_map_t;
requirements_map_t mRequirements;
- typedef std::map<LLViewHandle, LLPanel*> panel_map_t;
- static panel_map_t sPanelMap;
-};
+ typedef std::queue<LLAlertInfo> alert_queue_t;
+ static alert_queue_t sAlertQueue;
+}; // end class LLPanel
+
class LLLayoutStack : public LLView
{
@@ -280,37 +280,33 @@ public:
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
/*virtual*/ void removeCtrl(LLUICtrl* ctrl);
- virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_LAYOUT_STACK; }
- virtual LLString getWidgetTag() const { return LL_LAYOUT_STACK_TAG; }
+ virtual EWidgetType getWidgetType() const;
+ virtual LLString getWidgetTag() const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
- S32 getMinWidth();
- S32 getMinHeight();
+ S32 getMinWidth() const { return mMinWidth; }
+ S32 getMinHeight() const { return mMinHeight; }
void addPanel(LLPanel* panel, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize, S32 index = S32_MAX);
void removePanel(LLPanel* panel);
void updateLayout(BOOL force_resize = FALSE);
-protected:
- struct LLEmbeddedPanel;
-
- LLEmbeddedPanel* findEmbeddedPanel(LLPanel* panelp);
+private:
void calcMinExtents();
- S32 getMinStackSize();
- S32 getCurStackSize();
S32 getDefaultHeight(S32 cur_height);
S32 getDefaultWidth(S32 cur_width);
-protected:
- eLayoutOrientation mOrientation;
+ const eLayoutOrientation mOrientation;
+ struct LLEmbeddedPanel;
typedef std::vector<LLEmbeddedPanel*> e_panel_list_t;
e_panel_list_t mPanels;
+ LLEmbeddedPanel* findEmbeddedPanel(LLPanel* panelp) const;
S32 mMinWidth;
S32 mMinHeight;
S32 mPanelSpacing;
-};
+}; // end class LLLayoutStack
#endif
diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp
index 6fba415d35..8bda6780a2 100644
--- a/indra/llui/llradiogroup.cpp
+++ b/indra/llui/llradiogroup.cpp
@@ -29,9 +29,6 @@
* $/LicenseInfo$
*/
-// An invisible view containing multiple mutually exclusive toggling
-// buttons (usually radio buttons). Automatically handles the mutex
-// condition by highlighting only one button at a time.
#include "linden_common.h"
@@ -45,6 +42,7 @@
#include "llui.h"
#include "llfocusmgr.h"
+
LLRadioGroup::LLRadioGroup(const LLString& name, const LLRect& rect,
const LLString& control_name,
LLUICtrlCallback callback,
@@ -73,7 +71,7 @@ void LLRadioGroup::init(BOOL border)
if (border)
{
addChild( new LLViewBorder( "radio group border",
- LLRect(0, mRect.getHeight(), mRect.getWidth(), 0),
+ LLRect(0, getRect().getHeight(), getRect().getWidth(), 0),
LLViewBorder::BEVEL_NONE,
LLViewBorder::STYLE_LINE,
1 ) );
@@ -146,11 +144,6 @@ void LLRadioGroup::setIndexEnabled(S32 index, BOOL enabled)
}
}
-S32 LLRadioGroup::getSelectedIndex() const
-{
- return mSelectedIndex;
-}
-
BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event)
{
if (index < 0 || index >= (S32)mRadioButtons.size())
@@ -452,12 +445,12 @@ BOOL LLRadioGroup::setCurrentByID( const LLUUID& id )
return FALSE;
}
-LLUUID LLRadioGroup::getCurrentID()
+LLUUID LLRadioGroup::getCurrentID() const
{
return LLUUID::null;
}
-BOOL LLRadioGroup::setSelectedByValue(LLSD value, BOOL selected)
+BOOL LLRadioGroup::setSelectedByValue(const LLSD& value, BOOL selected)
{
S32 idx = 0;
std::string value_string = value.asString();
@@ -480,7 +473,7 @@ LLSD LLRadioGroup::getSelectedValue()
return getValue();
}
-BOOL LLRadioGroup::isSelected(LLSD value)
+BOOL LLRadioGroup::isSelected(const LLSD& value) const
{
S32 idx = 0;
std::string value_string = value.asString();
@@ -510,13 +503,6 @@ BOOL LLRadioGroup::operateOnAll(EOperation op)
}
-LLRadioCtrl::LLRadioCtrl(const LLString& name, const LLRect& rect, const LLString& label,
- const LLFontGL* font, void (*commit_callback)(LLUICtrl*, void*), void* callback_userdata) :
- LLCheckBoxCtrl(name, rect, label, font, commit_callback, callback_userdata, FALSE, RADIO_STYLE)
-{
- setTabStop(FALSE);
-}
-
LLRadioCtrl::~LLRadioCtrl()
{
}
diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h
index 5db1baeaec..d35bd741d7 100644
--- a/indra/llui/llradiogroup.h
+++ b/indra/llui/llradiogroup.h
@@ -29,10 +29,6 @@
* $/LicenseInfo$
*/
-// An invisible view containing multiple mutually exclusive toggling
-// buttons (usually radio buttons). Automatically handles the mutex
-// condition by highlighting only one button at a time.
-
#ifndef LL_LLRADIOGROUP_H
#define LL_LLRADIOGROUP_H
@@ -40,21 +36,30 @@
#include "llcheckboxctrl.h"
#include "llctrlselectioninterface.h"
-class LLFontGL;
-// Radio controls are checkbox controls with use_radio_style true
+/*
+ * A checkbox control with use_radio_style == true.
+ */
class LLRadioCtrl : public LLCheckBoxCtrl
{
public:
- LLRadioCtrl(const LLString& name, const LLRect& rect, const LLString& label,
- const LLFontGL* font = NULL,
- void (*commit_callback)(LLUICtrl*, void*) = NULL,
- void* callback_userdata = NULL);
+ LLRadioCtrl(const LLString& name, const LLRect& rect, const LLString& label, const LLFontGL* font = NULL,
+ void (*commit_callback)(LLUICtrl*, void*) = NULL, void* callback_userdata = NULL) :
+ LLCheckBoxCtrl(name, rect, label, font, commit_callback, callback_userdata, FALSE, RADIO_STYLE)
+ {
+ setTabStop(FALSE);
+ }
/*virtual*/ ~LLRadioCtrl();
/*virtual*/ void setValue(const LLSD& value);
};
+
+/*
+ * An invisible view containing multiple mutually exclusive toggling
+ * buttons (usually radio buttons). Automatically handles the mutex
+ * condition by highlighting only one button at a time.
+ */
class LLRadioGroup
: public LLUICtrl, public LLCtrlSelectionInterface
{
@@ -88,7 +93,7 @@ public:
void setIndexEnabled(S32 index, BOOL enabled);
// return the index value of the selected item
- S32 getSelectedIndex() const;
+ S32 getSelectedIndex() const { return mSelectedIndex; }
// set the index value programatically
BOOL setSelectedIndex(S32 index, BOOL from_event = FALSE);
@@ -97,8 +102,7 @@ public:
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
- // Draw the group, but also fix the highlighting based on the
- // control.
+ // Draw the group, but also fix the highlighting based on the control.
void draw();
// You must use this method to add buttons to a radio group.
@@ -106,8 +110,7 @@ public:
// correctly.
LLRadioCtrl* addRadioButton(const LLString& name, const LLString& label, const LLRect& rect, const LLFontGL* font);
LLRadioCtrl* getRadioButton(const S32& index) { return mRadioButtons[index]; }
- // Update the control as needed. Userdata must be a pointer to the
- // button.
+ // Update the control as needed. Userdata must be a pointer to the button.
static void onClickButton(LLUICtrl* radio, void* userdata);
//========================================================================
@@ -120,14 +123,14 @@ public:
/*virtual*/ BOOL selectNthItem( S32 index ) { return setSelectedIndex(index); }
/*virtual*/ S32 getFirstSelectedIndex() const { return getSelectedIndex(); }
/*virtual*/ BOOL setCurrentByID( const LLUUID& id );
- /*virtual*/ LLUUID getCurrentID(); // LLUUID::null if no items in menu
- /*virtual*/ BOOL setSelectedByValue(LLSD value, BOOL selected);
+ /*virtual*/ LLUUID getCurrentID() const; // LLUUID::null if no items in menu
+ /*virtual*/ BOOL setSelectedByValue(const LLSD& value, BOOL selected);
/*virtual*/ LLSD getSelectedValue();
- /*virtual*/ BOOL isSelected(LLSD value);
+ /*virtual*/ BOOL isSelected(const LLSD& value) const;
/*virtual*/ BOOL operateOnSelection(EOperation op);
/*virtual*/ BOOL operateOnAll(EOperation op);
-protected:
+private:
// protected function shared by the two constructors.
void init(BOOL border);
diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp
index ac8c47c91c..40346513cf 100644
--- a/indra/llui/llresizebar.cpp
+++ b/indra/llui/llresizebar.cpp
@@ -33,8 +33,6 @@
#include "llresizebar.h"
-//#include "llviewermenu.h"
-//#include "llviewerimagelist.h"
#include "llmath.h"
#include "llui.h"
#include "llmenugl.h"
@@ -87,7 +85,7 @@ LLResizeBar::LLResizeBar( const LLString& name, LLView* resizing_view, const LLR
BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask)
{
- if( mEnabled )
+ if( getEnabled() )
{
// 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.
@@ -119,15 +117,6 @@ BOOL LLResizeBar::handleMouseUp(S32 x, S32 y, MASK mask)
return handled;
}
-EWidgetType LLResizeBar::getWidgetType() const
-{
- return WIDGET_TYPE_RESIZE_BAR;
-}
-
-LLString LLResizeBar::getWidgetTag() const
-{
- return LL_RESIZE_BAR_TAG;
-}
BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
{
@@ -267,5 +256,34 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
}
return handled;
+} // end LLResizeBar::handleHover
+
+BOOL LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask)
+{
+ LLRect orig_rect = mResizingView->getRect();
+ LLRect scaled_rect = orig_rect;
+
+ if (mSnappingEnabled)
+ {
+ switch( mSide )
+ {
+ case LEFT:
+ mResizingView->findSnapEdge(scaled_rect.mLeft, LLCoordGL(0, 0), SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
+ break;
+ case TOP:
+ mResizingView->findSnapEdge(scaled_rect.mTop, LLCoordGL(0, 0), SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
+ break;
+ case RIGHT:
+ mResizingView->findSnapEdge(scaled_rect.mRight, LLCoordGL(0, 0), SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
+ break;
+ case BOTTOM:
+ mResizingView->findSnapEdge(scaled_rect.mBottom, LLCoordGL(0, 0), SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
+ break;
+ }
+ }
+
+ mResizingView->reshape(scaled_rect.getWidth(), scaled_rect.getHeight());
+ mResizingView->setOrigin(scaled_rect.mLeft, scaled_rect.mBottom);
+ return TRUE;
}
diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h
index d040a8b229..a3fef1a28c 100644
--- a/indra/llui/llresizebar.h
+++ b/indra/llui/llresizebar.h
@@ -42,18 +42,19 @@ public:
LLResizeBar(const LLString& name, LLView* resizing_view, const LLRect& rect, S32 min_size, S32 max_size, Side side );
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_RESIZE_BAR; }
+ virtual LLString getWidgetTag() const { return LL_RESIZE_BAR_TAG; }
// virtual void draw(); No appearance
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
void setResizeLimits( S32 min_size, S32 max_size ) { mMinSize = min_size; mMaxSize = max_size; }
void setEnableSnapping(BOOL enable) { mSnappingEnabled = enable; }
-protected:
+private:
S32 mDragLastScreenX;
S32 mDragLastScreenY;
S32 mLastMouseScreenX;
@@ -61,13 +62,11 @@ protected:
LLCoordGL mLastMouseDir;
S32 mMinSize;
S32 mMaxSize;
- Side mSide;
+ const Side mSide;
BOOL mSnappingEnabled;
LLView* mResizingView;
};
-const S32 RESIZE_BAR_HEIGHT = 3;
-
#endif // LL_RESIZEBAR_H
diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp
index 120323e7d1..36028a4513 100644
--- a/indra/llui/llresizehandle.cpp
+++ b/indra/llui/llresizehandle.cpp
@@ -75,23 +75,13 @@ LLResizeHandle::LLResizeHandle( const LLString& name, const LLRect& rect, S32 mi
setSaveToXML(FALSE);
}
-EWidgetType LLResizeHandle::getWidgetType() const
-{
- return WIDGET_TYPE_RESIZE_HANDLE;
-}
-
-LLString LLResizeHandle::getWidgetTag() const
-{
- return LL_RESIZE_HANDLE_TAG;
-}
-
BOOL LLResizeHandle::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = FALSE;
if( getVisible() && pointInHandle(x, y) )
{
handled = TRUE;
- if( mEnabled )
+ if( getEnabled() )
{
// 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.
@@ -292,10 +282,12 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
handled = TRUE;
}
- else
- if( getVisible() && pointInHandle( x, y ) )
+ else // don't have mouse capture
{
- handled = TRUE;
+ if( getVisible() && pointInHandle( x, y ) )
+ {
+ handled = TRUE;
+ }
}
if( handled )
@@ -314,7 +306,8 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
}
return handled;
-}
+} // end handleHover
+
// assumes GL state is set for 2D
void LLResizeHandle::draw()
@@ -330,8 +323,8 @@ BOOL LLResizeHandle::pointInHandle( S32 x, S32 y )
{
if( pointInView(x, y) )
{
- const S32 TOP_BORDER = (mRect.getHeight() - RESIZE_BORDER_WIDTH);
- const S32 RIGHT_BORDER = (mRect.getWidth() - RESIZE_BORDER_WIDTH);
+ const S32 TOP_BORDER = (getRect().getHeight() - RESIZE_BORDER_WIDTH);
+ const S32 RIGHT_BORDER = (getRect().getWidth() - RESIZE_BORDER_WIDTH);
switch( mCorner )
{
diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h
index 2701613192..34be319786 100644
--- a/indra/llui/llresizehandle.h
+++ b/indra/llui/llresizehandle.h
@@ -46,8 +46,8 @@ public:
LLResizeHandle(const LLString& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM );
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_RESIZE_HANDLE; }
+ virtual LLString getWidgetTag() const { return LL_RESIZE_HANDLE_TAG; }
virtual void draw();
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
@@ -56,10 +56,9 @@ public:
void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; }
-protected:
+private:
BOOL pointInHandle( S32 x, S32 y );
-protected:
S32 mDragLastScreenX;
S32 mDragLastScreenY;
S32 mLastMouseScreenX;
@@ -68,7 +67,7 @@ protected:
LLPointer<LLImageGL> mImage;
S32 mMinWidth;
S32 mMinHeight;
- ECorner mCorner;
+ const ECorner mCorner;
};
const S32 RESIZE_HANDLE_HEIGHT = 16;
diff --git a/indra/llui/llresmgr.h b/indra/llui/llresmgr.h
index be2a35513f..1a452f7381 100644
--- a/indra/llui/llresmgr.h
+++ b/indra/llui/llresmgr.h
@@ -29,8 +29,6 @@
* $/LicenseInfo$
*/
-// NOTE: this is a MINIMAL implementation. The interface will remain, but the implementation will
-// (when the time is right) become dynamic and probably use external files.
#ifndef LL_LLRESMGR_H
#define LL_LLRESMGR_H
@@ -157,11 +155,10 @@ public:
LLLocale(const LLString& locale_string);
virtual ~LLLocale();
-public:
static const LLString USER_LOCALE;
static const LLString SYSTEM_LOCALE;
-protected:
+private:
LLString mPrevLocaleString;
};
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index b106bb570d..056a94afb8 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -92,7 +92,7 @@ LLScrollbar::LLScrollbar(
if( LLScrollbar::VERTICAL == mOrientation )
{
- line_up_rect.setLeftTopAndSize( 0, mRect.getHeight(), SCROLLBAR_SIZE, SCROLLBAR_SIZE );
+ line_up_rect.setLeftTopAndSize( 0, getRect().getHeight(), SCROLLBAR_SIZE, SCROLLBAR_SIZE );
line_up_img="UIImgBtnScrollUpOutUUID";
line_up_selected_img="UIImgBtnScrollUpInUUID";
@@ -107,7 +107,7 @@ LLScrollbar::LLScrollbar(
line_up_img="UIImgBtnScrollLeftOutUUID";
line_up_selected_img="UIImgBtnScrollLeftInUUID";
- line_down_rect.setOriginAndSize( mRect.getWidth() - SCROLLBAR_SIZE, 0, SCROLLBAR_SIZE, SCROLLBAR_SIZE );
+ line_down_rect.setOriginAndSize( getRect().getWidth() - SCROLLBAR_SIZE, 0, SCROLLBAR_SIZE, SCROLLBAR_SIZE );
line_down_img="UIImgBtnScrollRightOutUUID";
line_down_selected_img="UIImgBtnScrollRightInUUID";
}
@@ -210,7 +210,7 @@ void LLScrollbar::updateThumbRect()
const S32 THUMB_MIN_LENGTH = 16;
- S32 window_length = (mOrientation == LLScrollbar::HORIZONTAL) ? mRect.getWidth() : mRect.getHeight();
+ S32 window_length = (mOrientation == LLScrollbar::HORIZONTAL) ? getRect().getWidth() : getRect().getHeight();
S32 thumb_bg_length = window_length - 2 * SCROLLBAR_SIZE;
S32 visible_lines = llmin( mDocSize, mPageSize );
S32 thumb_length = mDocSize ? llmax( visible_lines * thumb_bg_length / mDocSize, THUMB_MIN_LENGTH ) : thumb_bg_length;
@@ -300,8 +300,8 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
BOOL handled = FALSE;
if( hasMouseCapture() )
{
- S32 height = mRect.getHeight();
- S32 width = mRect.getWidth();
+ S32 height = getRect().getHeight();
+ S32 width = getRect().getWidth();
if( VERTICAL == mOrientation )
{
@@ -408,13 +408,13 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
mDocChanged = FALSE;
return handled;
-}
+} // end handleHover
BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
BOOL handled = FALSE;
- if( getVisible() && mRect.localPointInRect( x, y ) )
+ if( getVisible() && getRect().localPointInRect( x, y ) )
{
if( getEnabled() )
{
@@ -427,7 +427,7 @@ BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks)
}
BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type, void *carge_data, EAcceptance *accept, LLString &tooltip_msg)
+ EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, LLString &tooltip_msg)
{
// enable this to get drag and drop to control scrollbars
//if (!drop)
@@ -436,7 +436,7 @@ BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
// S32 variable_lines = getDocPosMax();
// S32 pos = (VERTICAL == mOrientation) ? y : x;
// S32 thumb_length = (VERTICAL == mOrientation) ? mThumbRect.getHeight() : mThumbRect.getWidth();
- // S32 thumb_track_length = (VERTICAL == mOrientation) ? (mRect.getHeight() - 2 * SCROLLBAR_SIZE) : (mRect.getWidth() - 2 * SCROLLBAR_SIZE);
+ // S32 thumb_track_length = (VERTICAL == mOrientation) ? (getRect().getHeight() - 2 * SCROLLBAR_SIZE) : (getRect().getWidth() - 2 * SCROLLBAR_SIZE);
// S32 usable_track_length = thumb_track_length - thumb_length;
// F32 ratio = (VERTICAL == mOrientation) ? F32(pos - SCROLLBAR_SIZE - thumb_length) / usable_track_length
// : F32(pos - SCROLLBAR_SIZE) / usable_track_length;
@@ -485,7 +485,7 @@ void LLScrollbar::draw()
screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &local_mouse_x, &local_mouse_y);
BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this;
- BOOL hovered = mEnabled && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
+ BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
if (hovered)
{
mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f));
@@ -504,8 +504,8 @@ void LLScrollbar::draw()
if (!rounded_rect_imagep)
{
gl_rect_2d(mOrientation == HORIZONTAL ? SCROLLBAR_SIZE : 0,
- mOrientation == VERTICAL ? mRect.getHeight() - 2 * SCROLLBAR_SIZE : mRect.getHeight(),
- mOrientation == HORIZONTAL ? mRect.getWidth() - 2 * SCROLLBAR_SIZE : mRect.getWidth(),
+ mOrientation == VERTICAL ? getRect().getHeight() - 2 * SCROLLBAR_SIZE : getRect().getHeight(),
+ mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * SCROLLBAR_SIZE : getRect().getWidth(),
mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0, mTrackColor, TRUE);
gl_rect_2d(mThumbRect, mThumbColor, TRUE);
@@ -518,8 +518,8 @@ void LLScrollbar::draw()
mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0,
16,
16,
- mOrientation == HORIZONTAL ? mRect.getWidth() - 2 * SCROLLBAR_SIZE : mRect.getWidth(),
- mOrientation == VERTICAL ? mRect.getHeight() - 2 * SCROLLBAR_SIZE : mRect.getHeight(),
+ mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * SCROLLBAR_SIZE : getRect().getWidth(),
+ mOrientation == VERTICAL ? getRect().getHeight() - 2 * SCROLLBAR_SIZE : getRect().getHeight(),
rounded_rect_imagep,
mTrackColor,
TRUE);
@@ -553,7 +553,8 @@ void LLScrollbar::draw()
// Draw children
LLView::draw();
}
-}
+} // end draw
+
void LLScrollbar::changeLine( S32 delta, BOOL update_thumb )
{
@@ -579,21 +580,12 @@ void LLScrollbar::setValue(const LLSD& value)
setDocPos((S32) value.asInteger());
}
-EWidgetType LLScrollbar::getWidgetType() const
-{
- return WIDGET_TYPE_SCROLLBAR;
-}
-
-LLString LLScrollbar::getWidgetTag() const
-{
- return LL_SCROLLBAR_TAG;
-}
BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
{
BOOL handled = FALSE;
- if( getVisible() && mEnabled && !called_from_parent )
+ if( getVisible() && getEnabled() && !called_from_parent )
{
switch( key )
{
@@ -661,3 +653,4 @@ void LLScrollbar::onLineDownBtnPressed( void* userdata )
self->changeLine( self->mStepSize, TRUE );
}
+
diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h
index 50aa3cafe9..ac0bd37e3a 100644
--- a/indra/llui/llscrollbar.h
+++ b/indra/llui/llscrollbar.h
@@ -61,8 +61,9 @@ public:
virtual ~LLScrollbar();
virtual void setValue(const LLSD& value);
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SCROLLBAR; }
+ virtual LLString getWidgetTag() const { return LL_SCROLLBAR_TAG; }
// Overrides from LLView
virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
@@ -71,32 +72,33 @@ public:
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type, void *carge_data, EAcceptance *accept, LLString &tooltip_msg);
+ EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, LLString &tooltip_msg);
virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
virtual void draw();
- void setDocParams( S32 size, S32 pos );
-
// How long the "document" is.
void setDocSize( S32 size );
- S32 getDocSize() { return mDocSize; }
+ S32 getDocSize() const { return mDocSize; }
// How many "lines" the "document" has scrolled.
// 0 <= DocPos <= DocSize - DocVisibile
void setDocPos( S32 pos );
- S32 getDocPos() { return mDocPos; }
+ S32 getDocPos() const { return mDocPos; }
BOOL isAtBeginning();
BOOL isAtEnd();
+ // Setting both at once.
+ void setDocParams( S32 size, S32 pos );
+
// How many "lines" of the "document" is can appear on a page.
void setPageSize( S32 page_size );
- S32 getPageSize() { return mPageSize; }
+ S32 getPageSize() const { return mPageSize; }
// The farthest the document can be scrolled (top of the last page).
- S32 getDocPosMax() { return llmax( 0, mDocSize - mPageSize); }
+ S32 getDocPosMax() const { return llmax( 0, mDocSize - mPageSize); }
void pageUp(S32 overlap);
void pageDown(S32 overlap);
@@ -110,15 +112,15 @@ public:
void setShadowColor( const LLColor4& color ) { mShadowColor = color; }
void setOnScrollEndCallback(void (*callback)(void*), void* userdata) { mOnScrollEndCallback = callback; mOnScrollEndData = userdata;}
-protected:
+
+private:
void updateThumbRect();
void changeLine(S32 delta, BOOL update_thumb );
-protected:
void (*mChangeCallback)( S32 new_pos, LLScrollbar* self, void* userdata );
void* mCallbackUserData;
- ORIENTATION mOrientation;
+ const ORIENTATION mOrientation;
S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize.
S32 mDocPos; // Position within the doc that the scrollbar is modeling, in "lines" (user size)
S32 mPageSize; // Maximum number of lines that can be seen at one time.
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index 34a29cef51..b9d5141eb7 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -29,14 +29,6 @@
* $/LicenseInfo$
*/
-//*****************************************************************************
-//
-// A view meant to encapsulate a clipped region which is
-// scrollable. It automatically takes care of pixel perfect scrolling
-// and cliipping, as well as turning the scrollbars on or off based on
-// the width and height of the view you're scrolling.
-//
-//*****************************************************************************
#include "linden_common.h"
@@ -112,11 +104,11 @@ LLScrollableContainerView::LLScrollableContainerView( const LLString& name, cons
void LLScrollableContainerView::init()
{
- LLRect border_rect( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
mBorder = new LLViewBorder( "scroll border", border_rect, LLViewBorder::BEVEL_IN );
addChild( mBorder );
- mInnerRect.set( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 );
mInnerRect.stretch( -mBorder->getBorderWidth() );
LLRect vertical_scroll_rect = mInnerRect;
@@ -165,25 +157,6 @@ LLScrollableContainerView::~LLScrollableContainerView( void )
mScrolledView = NULL;
}
-/*
-// scrollbar handlers
-void LLScrollableContainerView::horizontalChange( S32 new_pos,
- LLScrollbar* sb,
- void* user_data )
-{
- LLScrollableContainerView* cont = reinterpret_cast<LLScrollableContainerView*>(user_data);
-// cont->scrollHorizontal( new_pos );
-}
-
-
-void LLScrollableContainerView::verticalChange( S32 new_pos, LLScrollbar* sb,
- void* user_data )
-{
- LLScrollableContainerView* cont = reinterpret_cast<LLScrollableContainerView*>(user_data);
-// cont->scrollVertical( new_pos );
-}
-*/
-
// internal scrollbar handlers
// virtual
void LLScrollableContainerView::scrollHorizontal( S32 new_pos )
@@ -215,7 +188,7 @@ void LLScrollableContainerView::reshape(S32 width, S32 height,
{
LLUICtrl::reshape( width, height, called_from_parent );
- mInnerRect.set( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 );
mInnerRect.stretch( -mBorder->getBorderWidth() );
if (mScrolledView)
@@ -238,7 +211,7 @@ void LLScrollableContainerView::reshape(S32 width, S32 height,
BOOL LLScrollableContainerView::handleKey( KEY key, MASK mask, BOOL called_from_parent )
{
- if( getVisible() && mEnabled )
+ if( getVisible() && getEnabled() )
{
if( called_from_parent )
{
@@ -278,7 +251,7 @@ BOOL LLScrollableContainerView::handleKey( KEY key, MASK mask, BOOL called_from_
BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks )
{
- if( mEnabled )
+ if( getEnabled() )
{
for( S32 i = 0; i < SCROLLBAR_COUNT; i++ )
{
@@ -295,7 +268,8 @@ BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks )
// Opaque
return TRUE;
}
-BOOL LLScrollableContainerView::needsToScroll(S32 x, S32 y, LLScrollableContainerView::SCROLL_ORIENTATION axis)
+
+BOOL LLScrollableContainerView::needsToScroll(S32 x, S32 y, LLScrollableContainerView::SCROLL_ORIENTATION axis) const
{
if(mScrollbar[axis]->getVisible())
{
@@ -315,6 +289,7 @@ BOOL LLScrollableContainerView::needsToScroll(S32 x, S32 y, LLScrollableContaine
}
return FALSE;
}
+
BOOL LLScrollableContainerView::handleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop,
EDragAndDropType cargo_type,
@@ -419,19 +394,19 @@ BOOL LLScrollableContainerView::handleToolTip(S32 x, S32 y, LLString& msg, LLRec
return TRUE;
}
-void LLScrollableContainerView::calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar )
+void LLScrollableContainerView::calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const
{
const LLRect& rect = mScrolledView->getRect();
calcVisibleSize(rect, visible_width, visible_height, show_h_scrollbar, show_v_scrollbar);
}
-void LLScrollableContainerView::calcVisibleSize( const LLRect& doc_rect, S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar )
+void LLScrollableContainerView::calcVisibleSize( const LLRect& doc_rect, S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const
{
S32 doc_width = doc_rect.getWidth();
S32 doc_height = doc_rect.getHeight();
- *visible_width = mRect.getWidth() - 2 * mBorder->getBorderWidth();
- *visible_height = mRect.getHeight() - 2 * mBorder->getBorderWidth();
+ *visible_width = getRect().getWidth() - 2 * mBorder->getBorderWidth();
+ *visible_height = getRect().getHeight() - 2 * mBorder->getBorderWidth();
*show_v_scrollbar = FALSE;
if( *visible_height < doc_height )
@@ -544,7 +519,7 @@ void LLScrollableContainerView::draw()
drawDebugRect();
}
}
-}
+} // end draw
void LLScrollableContainerView::updateScroll()
{
@@ -560,9 +535,9 @@ void LLScrollableContainerView::updateScroll()
S32 border_width = mBorder->getBorderWidth();
if( show_v_scrollbar )
{
- if( doc_rect.mTop < mRect.getHeight() - border_width )
+ if( doc_rect.mTop < getRect().getHeight() - border_width )
{
- mScrolledView->translate( 0, mRect.getHeight() - border_width - doc_rect.mTop );
+ mScrolledView->translate( 0, getRect().getHeight() - border_width - doc_rect.mTop );
}
scrollVertical( mScrollbar[VERTICAL]->getDocPos() );
@@ -587,7 +562,7 @@ void LLScrollableContainerView::updateScroll()
}
else
{
- mScrolledView->translate( 0, mRect.getHeight() - border_width - doc_rect.mTop );
+ mScrolledView->translate( 0, getRect().getHeight() - border_width - doc_rect.mTop );
mScrollbar[VERTICAL]->setVisible( FALSE );
mScrollbar[VERTICAL]->setDocPos( 0 );
@@ -626,7 +601,7 @@ void LLScrollableContainerView::updateScroll()
mScrollbar[VERTICAL]->setDocSize( doc_height );
mScrollbar[VERTICAL]->setPageSize( visible_height );
-}
+} // end updateScroll
void LLScrollableContainerView::setBorderVisible(BOOL b)
{
@@ -723,7 +698,7 @@ void LLScrollableContainerView::goToBottom()
mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocSize());
}
-S32 LLScrollableContainerView::getBorderWidth()
+S32 LLScrollableContainerView::getBorderWidth() const
{
if (mBorder)
{
@@ -803,7 +778,3 @@ LLView* LLScrollableContainerView::fromXML(LLXMLNodePtr node, LLView *parent, LL
return ret;
}
-
-///----------------------------------------------------------------------------
-/// Local function definitions
-///----------------------------------------------------------------------------
diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h
index 9f1978be97..0bffd0438f 100644
--- a/indra/llui/llscrollcontainer.h
+++ b/indra/llui/llscrollcontainer.h
@@ -40,21 +40,18 @@
#include "llcoord.h"
#include "llscrollbar.h"
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLScrollableContainerView
-//
-// A view meant to encapsulate a clipped region which is
-// scrollable. It automatically takes care of pixel perfect scrolling
-// and cliipping, as well as turning the scrollbars on or off based on
-// the width and height of the view you're scrolling.
-//
-// This class is a decorator class.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLViewBorder;
class LLUICtrlFactory;
-
+/*****************************************************************************
+ *
+ * A decorator view class meant to encapsulate a clipped region which is
+ * scrollable. It automatically takes care of pixel perfect scrolling
+ * and cliipping, as well as turning the scrollbars on or off based on
+ * the width and height of the view you're scrolling.
+ *
+ *****************************************************************************/
class LLScrollableContainerView : public LLUICtrl
{
public:
@@ -70,32 +67,26 @@ public:
const LLColor4& bg_color = LLColor4(0,0,0,0) );
virtual ~LLScrollableContainerView( void );
- void init();
-
void setScrolledView(LLView* view) { mScrolledView = view; }
virtual void setValue(const LLSD& value) { mInnerRect.setValue(value); }
virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SCROLL_CONTAINER; }
virtual LLString getWidgetTag() const { return LL_SCROLLABLE_CONTAINER_VIEW_TAG; }
- // scrollbar handlers
- static void horizontalChange( S32 new_pos, LLScrollbar* sb, void* user_data );
- static void verticalChange( S32 new_pos, LLScrollbar* sb, void* user_data );
-
- void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar );
- void calcVisibleSize( const LLRect& doc_rect, S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar );
+ void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
+ void calcVisibleSize( const LLRect& doc_rect, S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
void setBorderVisible( BOOL b );
void scrollToShowRect( const LLRect& rect, const LLCoordGL& desired_offset );
void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
- const LLRect& getScrolledViewRect() { return mScrolledView->getRect(); }
+ const LLRect& getScrolledViewRect() const { return mScrolledView->getRect(); }
void pageUp(S32 overlap = 0);
void pageDown(S32 overlap = 0);
void goToTop();
void goToBottom();
- S32 getBorderWidth();
+ S32 getBorderWidth() const;
- BOOL needsToScroll(S32 x, S32 y, SCROLL_ORIENTATION axis);
+ BOOL needsToScroll(S32 x, S32 y, SCROLL_ORIENTATION axis) const;
// LLView functionality
virtual void reshape(S32 width, S32 height, BOOL called_from_parent);
@@ -113,7 +104,9 @@ public:
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
-protected:
+private:
+ void init();
+
// internal scrollbar handlers
virtual void scrollHorizontal( S32 new_pos );
virtual void scrollVertical( S32 new_pos );
diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp
index 76389e17b4..70309ba6bc 100644
--- a/indra/llui/llscrollingpanellist.cpp
+++ b/indra/llui/llscrollingpanellist.cpp
@@ -126,20 +126,6 @@ void LLScrollingPanelList::updatePanelVisiblilty()
}
}
-void LLScrollingPanelList::setValue(const LLSD& value)
-{
-
-}
-
-EWidgetType LLScrollingPanelList::getWidgetType() const
-{
- return WIDGET_TYPE_SCROLLING_PANEL_LIST;
-}
-
-LLString LLScrollingPanelList::getWidgetTag() const
-{
- return LL_SCROLLING_PANEL_LIST_TAG;
-}
void LLScrollingPanelList::draw()
{
@@ -165,9 +151,3 @@ LLView* LLScrollingPanelList::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtr
return scrolling_panel_list;
}
-// virtual
-LLXMLNodePtr LLScrollingPanelList::getXML(bool save_children) const
-{
- LLXMLNodePtr node = LLUICtrl::getXML();
- return node;
-}
diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h
index f697a99a06..cb832f4bec 100644
--- a/indra/llui/llscrollingpanellist.h
+++ b/indra/llui/llscrollingpanellist.h
@@ -35,30 +35,31 @@
#include "llview.h"
#include "llpanel.h"
-// virtual class for scrolling panels
+/*
+ * Pure virtual class represents a scrolling panel.
+ */
class LLScrollingPanel : public LLPanel
{
public:
- LLScrollingPanel(const LLString& name, const LLRect& rect)
- : LLPanel(name, rect)
- {
- }
+ LLScrollingPanel(const LLString& name, const LLRect& rect) : LLPanel(name, rect) { }
virtual void updatePanel(BOOL allow_modify) = 0;
-
};
-
-// A set of panels that are displayed in a vertical sequence inside a scroll container.
+
+
+/*
+ * A set of panels that are displayed in a vertical sequence inside a scroll container.
+ */
class LLScrollingPanelList : public LLUICtrl
{
public:
LLScrollingPanelList(const LLString& name, const LLRect& rect)
: LLUICtrl(name, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_BOTTOM ) {}
- virtual void setValue(const LLSD& value);
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual void setValue(const LLSD& value) {};
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SCROLLING_PANEL_LIST; }
+ virtual LLString getWidgetTag() const { return LL_SCROLLING_PANEL_LIST_TAG; }
- virtual LLXMLNodePtr getXML(bool save_children) const;
+ virtual LLXMLNodePtr getXML(bool save_children) const { return LLUICtrl::getXML(); }
virtual void draw();
@@ -68,9 +69,8 @@ public:
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
-protected:
+private:
void updatePanelVisiblilty();
-protected:
std::deque<LLScrollingPanel*> mPanelList;
};
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 9d38bd0dab..94053980e6 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -1,4 +1,4 @@
-/**
+ /**
* @file llscrolllistctrl.cpp
* @brief LLScrollListCtrl base class
*
@@ -126,7 +126,7 @@ LLScrollListIcon::~LLScrollListIcon()
{
}
-void LLScrollListIcon::setValue(LLSD value)
+void LLScrollListIcon::setValue(const LLSD& value)
{
mImageUUID = value.asUUID();
// don't use default image specified by LLUUID::null, use no image in that case
@@ -142,11 +142,11 @@ void LLScrollListIcon::setColor(const LLColor4& color)
S32 LLScrollListIcon::getWidth() const
{
// if no specified fix width, use width of icon
- if (mWidth == 0)
+ if (LLScrollListCell::getWidth() == 0)
{
return mIcon->getWidth();
}
- return mWidth;
+ return LLScrollListCell::getWidth();
}
@@ -170,11 +170,11 @@ LLScrollListCheck::LLScrollListCheck(LLCheckBoxCtrl* check_box, S32 width)
rect.mRight = rect.mLeft + width;
mCheckBox->setRect(rect);
- mWidth = width;
+ setWidth(width);
}
else
{
- mWidth = rect.getWidth(); //check_box->getWidth();
+ setWidth(rect.getWidth()); //check_box->getWidth();
}
}
@@ -271,6 +271,12 @@ void LLScrollListText::setText(const LLStringExplicit& text)
mText = text;
}
+//virtual
+void LLScrollListText::setValue(const LLSD& text)
+{
+ setText(text.asString());
+}
+
void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const
{
const LLColor4* display_color;
@@ -373,7 +379,7 @@ void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell )
}
}
-LLString LLScrollListItem::getContentsCSV()
+LLString LLScrollListItem::getContentsCSV() const
{
LLString ret;
@@ -547,8 +553,8 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
mItemListRect.setOriginAndSize(
mBorderThickness + LIST_BORDER_PAD,
mBorderThickness + LIST_BORDER_PAD,
- mRect.getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ),
- mRect.getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) );
+ getRect().getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ),
+ getRect().getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) );
updateLineHeight();
@@ -557,7 +563,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
// Init the scrollbar
LLRect scroll_rect;
scroll_rect.setOriginAndSize(
- mRect.getWidth() - mBorderThickness - SCROLLBAR_SIZE,
+ getRect().getWidth() - mBorderThickness - SCROLLBAR_SIZE,
mItemListRect.mBottom,
SCROLLBAR_SIZE,
mItemListRect.getHeight());
@@ -578,7 +584,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
// Border
if (show_border)
{
- LLRect border_rect( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
mBorder = new LLViewBorder( "dlg border", border_rect, LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, 1 );
addChild(mBorder);
}
@@ -745,8 +751,8 @@ void LLScrollListCtrl::updateLayout()
mItemListRect.setOriginAndSize(
mBorderThickness + LIST_BORDER_PAD,
mBorderThickness + LIST_BORDER_PAD,
- mRect.getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ),
- mRect.getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) - heading_size );
+ getRect().getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ),
+ getRect().getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) - heading_size );
// how many lines of content in a single "page"
mPageLines = mLineHeight? mItemListRect.getHeight() / mLineHeight : 0;
@@ -754,7 +760,7 @@ void LLScrollListCtrl::updateLayout()
if (scrollbar_visible)
{
// provide space on the right for scrollbar
- mItemListRect.mRight = mRect.getWidth() - ( mBorderThickness + LIST_BORDER_PAD ) - SCROLLBAR_SIZE;
+ mItemListRect.mRight = getRect().getWidth() - ( mBorderThickness + LIST_BORDER_PAD ) - SCROLLBAR_SIZE;
}
mScrollbar->reshape(SCROLLBAR_SIZE, mItemListRect.getHeight() + (mDisplayColumnHeaders ? mHeadingHeight : 0));
@@ -770,7 +776,7 @@ void LLScrollListCtrl::updateLayout()
void LLScrollListCtrl::fitContents(S32 max_width, S32 max_height)
{
S32 height = llmin( getRequiredRect().getHeight(), max_height );
- S32 width = mRect.getWidth();
+ S32 width = getRect().getWidth();
reshape( width, height );
}
@@ -782,7 +788,7 @@ LLRect LLScrollListCtrl::getRequiredRect()
S32 height = (mLineHeight * getItemCount())
+ (2 * ( mBorderThickness + LIST_BORDER_PAD ))
+ heading_size;
- S32 width = mRect.getWidth();
+ S32 width = getRect().getWidth();
return LLRect(0, height, width, 0);
}
@@ -1221,10 +1227,10 @@ S32 LLScrollListCtrl::selectMultiple( LLDynamicArray<LLUUID> ids )
return count;
}
-S32 LLScrollListCtrl::getItemIndex( LLScrollListItem* target_item )
+S32 LLScrollListCtrl::getItemIndex( LLScrollListItem* target_item ) const
{
S32 index = 0;
- item_list::iterator iter;
+ item_list::const_iterator iter;
for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{
LLScrollListItem *itemp = *iter;
@@ -1237,10 +1243,10 @@ S32 LLScrollListCtrl::getItemIndex( LLScrollListItem* target_item )
return -1;
}
-S32 LLScrollListCtrl::getItemIndex( LLUUID& target_id )
+S32 LLScrollListCtrl::getItemIndex( LLUUID& target_id ) const
{
S32 index = 0;
- item_list::iterator iter;
+ item_list::const_iterator iter;
for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{
LLScrollListItem *itemp = *iter;
@@ -1542,7 +1548,7 @@ BOOL LLScrollListCtrl::selectByID( const LLUUID& id )
return selectByValue( LLSD(id) );
}
-BOOL LLScrollListCtrl::setSelectedByValue(LLSD value, BOOL selected)
+BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected)
{
BOOL found = FALSE;
@@ -1575,9 +1581,9 @@ BOOL LLScrollListCtrl::setSelectedByValue(LLSD value, BOOL selected)
return found;
}
-BOOL LLScrollListCtrl::isSelected(LLSD value)
+BOOL LLScrollListCtrl::isSelected(const LLSD& value) const
{
- item_list::iterator iter;
+ item_list::const_iterator iter;
for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{
LLScrollListItem* item = *iter;
@@ -1589,7 +1595,7 @@ BOOL LLScrollListCtrl::isSelected(LLSD value)
return FALSE;
}
-LLUUID LLScrollListCtrl::getStringUUIDSelectedItem()
+LLUUID LLScrollListCtrl::getStringUUIDSelectedItem() const
{
LLScrollListItem* item = getFirstSelected();
@@ -1715,7 +1721,7 @@ void LLScrollListCtrl::draw()
scrollToShowSelected();
mNeedsScroll = FALSE;
}
- LLRect background(0, mRect.getHeight(), mRect.getWidth(), 0);
+ LLRect background(0, getRect().getHeight(), getRect().getWidth(), 0);
// Draw background
if (mBackgroundVisible)
{
@@ -2452,16 +2458,6 @@ void LLScrollListCtrl::commitIfChanged()
}
}
-void LLScrollListCtrl::setSorted(BOOL sorted)
-{
- mSorted = sorted;
-}
-
-BOOL LLScrollListCtrl::isSorted()
-{
- return mSorted;
-}
-
struct SameSortColumn
{
SameSortColumn(S32 column) : mColumn(column) {}
@@ -2538,7 +2534,7 @@ void LLScrollListCtrl::sortItems()
setSorted(TRUE);
}
-S32 LLScrollListCtrl::getScrollPos()
+S32 LLScrollListCtrl::getScrollPos() const
{
return mScrollbar->getDocPos();
}
@@ -2884,7 +2880,7 @@ void LLScrollListCtrl::copy()
}
// virtual
-BOOL LLScrollListCtrl::canCopy()
+BOOL LLScrollListCtrl::canCopy() const
{
return (getFirstSelected() != NULL);
}
@@ -2897,25 +2893,12 @@ void LLScrollListCtrl::cut()
}
// virtual
-BOOL LLScrollListCtrl::canCut()
+BOOL LLScrollListCtrl::canCut() const
{
return canCopy() && canDoDelete();
}
// virtual
-void LLScrollListCtrl::doDelete()
-{
- // Not yet implemented
-}
-
-// virtual
-BOOL LLScrollListCtrl::canDoDelete()
-{
- // Not yet implemented
- return FALSE;
-}
-
-// virtual
void LLScrollListCtrl::selectAll()
{
// Deselects all other items
@@ -2936,7 +2919,7 @@ void LLScrollListCtrl::selectAll()
}
// virtual
-BOOL LLScrollListCtrl::canSelectAll()
+BOOL LLScrollListCtrl::canSelectAll() const
{
return getCanSelect() && mAllowMultipleSelection && !(mMaxSelectable > 0 && mItemList.size() > mMaxSelectable);
}
@@ -2948,7 +2931,7 @@ void LLScrollListCtrl::deselect()
}
// virtual
-BOOL LLScrollListCtrl::canDeselect()
+BOOL LLScrollListCtrl::canDeselect() const
{
return getCanSelect();
}
@@ -3039,7 +3022,7 @@ void LLScrollListCtrl::onClickColumn(void *userdata)
LLScrollListCtrl *parent = info->mParentCtrl;
if (!parent) return;
- U32 column_index = info->mIndex;
+ S32 column_index = info->mIndex;
LLScrollListColumn* column = parent->mColumnsIndexed[info->mIndex];
bool ascending = column->mSortAscending;
@@ -3412,14 +3395,14 @@ LLColumnHeader::LLColumnHeader(const LLString& label, const LLRect &rect, LLScro
mAscendingText = "[LOW]...[HIGH](Ascending)";
mDescendingText = "[HIGH]...[LOW](Descending)";
- mList->reshape(llmax(mList->getRect().getWidth(), 110, mRect.getWidth()), mList->getRect().getHeight());
+ mList->reshape(llmax(mList->getRect().getWidth(), 110, getRect().getWidth()), mList->getRect().getHeight());
// resize handles on left and right
const S32 RESIZE_BAR_THICKNESS = 3;
mResizeBar = new LLResizeBar(
"resizebar",
this,
- LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0),
+ LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0),
MIN_COLUMN_WIDTH, S32_MAX, LLResizeBar::RIGHT );
addChild(mResizeBar);
@@ -3440,10 +3423,10 @@ void LLColumnHeader::draw()
mButton->setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, draw_arrow ? LLColor4::white : LLColor4::transparent);
mArrowImage = mButton->getImageOverlay()->getImage();
- //BOOL clip = mRect.mRight > mColumn->mParentCtrl->getItemListRect().getWidth();
+ //BOOL clip = getRect().mRight > mColumn->mParentCtrl->getItemListRect().getWidth();
//LLGLEnable scissor_test(clip ? GL_SCISSOR_TEST : GL_FALSE);
- //LLRect column_header_local_rect(-mRect.mLeft, mRect.getHeight(), mColumn->mParentCtrl->getItemListRect().getWidth() - mRect.mLeft, 0);
+ //LLRect column_header_local_rect(-getRect().mLeft, getRect().getHeight(), mColumn->mParentCtrl->getItemListRect().getWidth() - getRect().mLeft, 0);
//LLUI::setScissorRegionLocal(column_header_local_rect);
// Draw children
@@ -3587,13 +3570,13 @@ void LLColumnHeader::showList()
S32 text_width = LLFontGL::sSansSerifSmall->getWidth(ascending_string);
text_width = llmax(text_width, LLFontGL::sSansSerifSmall->getWidth(descending_string)) + 10;
- text_width = llmax(text_width, mRect.getWidth() - 30);
+ text_width = llmax(text_width, getRect().getWidth() - 30);
mList->getColumn(0)->mWidth = text_width;
((LLScrollListText*)mList->getFirstData()->getColumn(0))->setText(ascending_string);
((LLScrollListText*)mList->getLastData()->getColumn(0))->setText(descending_string);
- mList->reshape(llmax(text_width + 30, 110, mRect.getWidth()), mList->getRect().getHeight());
+ mList->reshape(llmax(text_width + 30, 110, getRect().getWidth()), mList->getRect().getHeight());
LLComboBox::showList();
}
@@ -3666,7 +3649,7 @@ LLView* LLColumnHeader::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_d
void LLColumnHeader::userSetShape(const LLRect& new_rect)
{
S32 new_width = new_rect.getWidth();
- S32 delta_width = new_width - (mRect.getWidth() + mColumn->mParentCtrl->getColumnPadding());
+ S32 delta_width = new_width - getRect().getWidth();
if (delta_width != 0)
{
@@ -3726,7 +3709,7 @@ void LLColumnHeader::userSetShape(const LLRect& new_rect)
}
// propagate constrained delta_width to new width for this column
- new_width = mRect.getWidth() + delta_width - mColumn->mParentCtrl->getColumnPadding();
+ new_width = getRect().getWidth() + delta_width - mColumn->mParentCtrl->getColumnPadding();
// use requested width
mColumn->mWidth = new_width;
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index aa0af7dcd8..d889512ee6 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -1,6 +1,5 @@
/**
* @file llscrolllistctrl.h
- * @brief LLScrollListCtrl base class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -43,16 +42,20 @@
#include "llstring.h"
#include "llimagegl.h"
#include "lleditmenuhandler.h"
-#include "llviewborder.h"
#include "llframetimer.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
+#include "llscrollbar.h"
+#include "llresizebar.h"
-class LLScrollbar;
-class LLScrollListCtrl;
-class LLColumnHeader;
-class LLResizeBar;
-
+/*
+ * Represents a cell in a scrollable table.
+ *
+ * Sub-classes must return height and other properties
+ * though width accessors are implemented by the base class.
+ * It is therefore important for sub-class constructors to call
+ * setWidth() with realistic values.
+ */
class LLScrollListCell
{
public:
@@ -63,21 +66,24 @@ public:
virtual S32 getContentWidth() const { return 0; }
virtual S32 getHeight() const = 0;
virtual const LLSD getValue() const { return LLString::null; }
- virtual void setValue(LLSD value) { }
+ virtual void setValue(const LLSD& value) { }
virtual BOOL getVisible() const { return TRUE; }
virtual void setWidth(S32 width) { mWidth = width; }
virtual void highlightText(S32 offset, S32 num_chars) {}
- virtual BOOL isText() = 0;
+ virtual BOOL isText() const = 0;
virtual void setColor(const LLColor4&) {}
virtual void onCommit() {};
- virtual BOOL handleClick() { return FALSE; }
- virtual void setEnabled(BOOL enable) { }
+ virtual BOOL handleClick() { return FALSE; }
+ virtual void setEnabled(BOOL enable) { }
-protected:
+private:
S32 mWidth;
};
+/*
+ * Draws a horizontal line.
+ */
class LLScrollListSeparator : public LLScrollListCell
{
public:
@@ -85,9 +91,12 @@ public:
virtual ~LLScrollListSeparator() {};
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; // truncate to given width, if possible
virtual S32 getHeight() const { return 5; };
- virtual BOOL isText() { return FALSE; }
+ virtual BOOL isText() const { return FALSE; }
};
+/*
+ * Cell displaying a text label.
+ */
class LLScrollListText : public LLScrollListCell
{
public:
@@ -97,12 +106,13 @@ public:
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const;
virtual S32 getContentWidth() const;
virtual S32 getHeight() const { return llround(mFont->getLineHeight()); }
- virtual const LLSD getValue() const { return LLSD(mText.getString()); }
+ virtual void setValue(const LLSD& value);
+ virtual const LLSD getValue() const { return LLSD(mText.getString()); }
virtual BOOL getVisible() const { return mVisible; }
virtual void highlightText(S32 offset, S32 num_chars) {mHighlightOffset = offset; mHighlightCount = num_chars;}
virtual void setColor(const LLColor4&);
- virtual BOOL isText() { return TRUE; }
+ virtual BOOL isText() const { return TRUE; }
void setText(const LLStringExplicit& text);
void setFontStyle(const U8 font_style) { mFontStyle = font_style; }
@@ -122,6 +132,9 @@ private:
static U32 sCount;
};
+/*
+ * Cell displaying an image.
+ */
class LLScrollListIcon : public LLScrollListCell
{
public:
@@ -133,8 +146,8 @@ public:
// used as sort criterion
virtual const LLSD getValue() const { return LLSD(mImageUUID); }
virtual void setColor(const LLColor4&);
- virtual BOOL isText() { return FALSE; }
- virtual void setValue(LLSD value);
+ virtual BOOL isText()const { return FALSE; }
+ virtual void setValue(const LLSD& value);
private:
LLPointer<LLImageGL> mIcon;
@@ -142,6 +155,9 @@ private:
LLColor4 mColor;
};
+/*
+ * An interactive cell containing a check box.
+ */
class LLScrollListCheck : public LLScrollListCell
{
public:
@@ -150,19 +166,22 @@ public:
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const;
virtual S32 getHeight() const { return 0; }
virtual const LLSD getValue() const { return mCheckBox->getValue(); }
- virtual void setValue(LLSD value) { mCheckBox->setValue(value); }
+ virtual void setValue(const LLSD& value) { mCheckBox->setValue(value); }
virtual void onCommit() { mCheckBox->onCommit(); }
virtual BOOL handleClick();
virtual void setEnabled(BOOL enable) { mCheckBox->setEnabled(enable); }
LLCheckBoxCtrl* getCheckBox() { return mCheckBox; }
- virtual BOOL isText() { return FALSE; }
+ virtual BOOL isText() const { return FALSE; }
private:
LLCheckBoxCtrl* mCheckBox;
};
+/*
+ * A simple data class describing a column within a scroll list.
+ */
class LLScrollListColumn
{
public:
@@ -243,6 +262,9 @@ public:
mHeader = NULL;
}
+ // Public data is fine so long as this remains a simple struct-like data class.
+ // If it ever gets any smarter than that, these should all become private
+ // with protected or public accessor methods added as needed. -MG
LLString mName;
LLString mSortingColumn;
BOOL mSortAscending;
@@ -253,7 +275,7 @@ public:
S32 mMaxContentWidth;
S32 mIndex;
LLScrollListCtrl* mParentCtrl;
- LLColumnHeader* mHeader;
+ class LLColumnHeader* mHeader;
LLFontGL::HAlign mFontAlignment;
};
@@ -282,7 +304,7 @@ public:
static void onMouseDown(void* user_data);
static void onHeldDown(void* user_data);
-protected:
+private:
LLScrollListColumn* mColumn;
LLResizeBar* mResizeBar;
LLString mOrigLabel;
@@ -329,11 +351,11 @@ public:
void setColumn( S32 column, LLScrollListCell *cell );
- S32 getNumColumns() const { return mColumns.size(); }
+ S32 getNumColumns() const { return mColumns.size(); }
LLScrollListCell *getColumn(const S32 i) const { if (0 <= i && i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; }
- LLString getContentsCSV();
+ LLString getContentsCSV() const;
virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding);
@@ -345,6 +367,11 @@ private:
std::vector<LLScrollListCell *> mColumns;
};
+/*
+ * A graphical control representing a scrollable table.
+ * Cells in the table can be simple text or more complicated things
+ * such as icons or even interactive elements like check boxes.
+ */
class LLScrollListItemComment : public LLScrollListItem
{
public:
@@ -419,7 +446,7 @@ public:
// DEPRECATED: Use setSelectedByValue() below.
BOOL setCurrentByID( const LLUUID& id ) { return selectByID(id); }
- virtual LLUUID getCurrentID() { return getStringUUIDSelectedItem(); }
+ virtual LLUUID getCurrentID() const { return getStringUUIDSelectedItem(); }
BOOL operateOnSelection(EOperation op);
BOOL operateOnAll(EOperation op);
@@ -431,11 +458,11 @@ public:
// Match item by value.asString(), which should work for string, integer, uuid.
// Returns FALSE if not found.
- BOOL setSelectedByValue(LLSD value, BOOL selected);
+ BOOL setSelectedByValue(const LLSD& value, BOOL selected);
- BOOL isSorted();
+ BOOL isSorted() const { return mSorted; }
- virtual BOOL isSelected(LLSD value);
+ virtual BOOL isSelected(const LLSD& value) const;
BOOL handleClick(S32 x, S32 y, MASK mask);
BOOL selectFirstItem();
@@ -458,8 +485,8 @@ public:
void setCanSelect(BOOL can_select) { mCanSelect = can_select; }
virtual BOOL getCanSelect() const { return mCanSelect; }
- S32 getItemIndex( LLScrollListItem* item );
- S32 getItemIndex( LLUUID& item_id );
+ S32 getItemIndex( LLScrollListItem* item ) const;
+ S32 getItemIndex( LLUUID& item_id ) const;
LLScrollListItem* addCommentText( const LLString& comment_text, EAddPosition pos = ADD_BOTTOM);
LLScrollListItem* addSeparator(EAddPosition pos);
@@ -479,12 +506,11 @@ public:
// "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which
// has an associated, unique UUID, and only one of which can be selected at a time.
LLScrollListItem* addStringUUIDItem(const LLString& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, S32 column_width = 0);
- LLUUID getStringUUIDSelectedItem();
+ LLUUID getStringUUIDSelectedItem() const;
LLScrollListItem* getFirstSelected() const;
virtual S32 getFirstSelectedIndex() const;
std::vector<LLScrollListItem*> getAllSelected() const;
-
LLScrollListItem* getLastSelectedItem() const { return mLastSelected; }
// iterate over all items
@@ -517,7 +543,7 @@ public:
S32 getMaxSelectable() { return mMaxSelectable; }
- virtual S32 getScrollPos();
+ virtual S32 getScrollPos() const;
virtual void setScrollPos( S32 pos );
S32 getSearchColumn() { return mSearchColumn; }
@@ -573,19 +599,13 @@ public:
// LLEditMenuHandler functions
virtual void copy();
- virtual BOOL canCopy();
-
+ virtual BOOL canCopy() const;
virtual void cut();
- virtual BOOL canCut();
-
- virtual void doDelete();
- virtual BOOL canDoDelete();
-
+ virtual BOOL canCut() const;
virtual void selectAll();
- virtual BOOL canSelectAll();
-
+ virtual BOOL canSelectAll() const;
virtual void deselect();
- virtual BOOL canDeselect();
+ virtual BOOL canDeselect() const;
void setNumDynamicColumns(int num) { mNumDynamicWidthColumns = num; }
void setTotalStaticColumnWidth(int width) { mTotalStaticColumnWidth = width; }
@@ -611,9 +631,14 @@ protected:
// The LLScrollListCtrl owns its items and is responsible for deleting them
// (except in the case that the addItem() call fails, in which case it is up
// to the caller to delete the item)
-
+ //
// returns FALSE if item faile to be added to list, does NOT delete 'item'
BOOL addItem( LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM, BOOL requires_column = TRUE );
+
+ typedef std::deque<LLScrollListItem *> item_list;
+ item_list& getItemList() { return mItemList; }
+
+private:
void selectPrevItem(BOOL extend_selection);
void selectNextItem(BOOL extend_selection);
void drawItems();
@@ -624,10 +649,10 @@ protected:
void selectItem(LLScrollListItem* itemp, BOOL single_select = TRUE);
void deselectItem(LLScrollListItem* itemp);
void commitIfChanged();
- void setSorted(BOOL sorted);
+ void setSorted(BOOL sorted) { mSorted = sorted; }
BOOL setSort(S32 column, BOOL ascending);
-protected:
+
S32 mCurIndex; // For get[First/Next]Data
S32 mCurSelectedIndex; // For get[First/Next]Selected
@@ -646,7 +671,6 @@ protected:
BOOL mCanSelect;
BOOL mDisplayColumnHeaders;
- typedef std::deque<LLScrollListItem *> item_list;
item_list mItemList;
LLScrollListItem *mLastSelected;
@@ -675,7 +699,7 @@ protected:
void (*mOnSortChangedCallback)(void* userdata);
S32 mHighlightedItem;
- LLViewBorder* mBorder;
+ class LLViewBorder* mBorder;
LLWString mSearchString;
LLFrameTimer mSearchTimer;
@@ -697,15 +721,9 @@ protected:
typedef std::pair<S32, BOOL> sort_column_t;
std::vector<sort_column_t> mSortColumns;
-public:
// HACK: Did we draw one selected item this frame?
BOOL mDrewSelected;
-};
-
-const BOOL MULTIPLE_SELECT_YES = TRUE;
-const BOOL MULTIPLE_SELECT_NO = FALSE;
+}; // end class LLScrollListCtrl
-const BOOL SHOW_BORDER_YES = TRUE;
-const BOOL SHOW_BORDER_NO = FALSE;
#endif // LL_SCROLLLISTCTRL_H
diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp
index bd91d562aa..8b5bb1f3f6 100644
--- a/indra/llui/llslider.cpp
+++ b/indra/llui/llslider.cpp
@@ -82,15 +82,6 @@ LLSlider::LLSlider(
mDragStartThumbRect = mThumbRect;
}
-EWidgetType LLSlider::getWidgetType() const
-{
- return WIDGET_TYPE_SLIDER_BAR;
-}
-
-LLString LLSlider::getWidgetTag() const
-{
- return LL_SLIDER_TAG;
-}
void LLSlider::setValue(F32 value, BOOL from_event)
{
@@ -118,7 +109,7 @@ void LLSlider::updateThumbRect()
S32 thumb_width = mThumbImage->getWidth();
S32 thumb_height = mThumbImage->getHeight();
S32 left_edge = (thumb_width / 2);
- S32 right_edge = mRect.getWidth() - (thumb_width / 2);
+ S32 right_edge = getRect().getWidth() - (thumb_width / 2);
S32 x = left_edge + S32( t * (right_edge - left_edge) );
mThumbRect.mLeft = x - (thumb_width / 2);
@@ -140,18 +131,13 @@ void LLSlider::setValueAndCommit(F32 value)
}
-F32 LLSlider::getValueF32() const
-{
- return mValue;
-}
-
BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask)
{
if( hasMouseCapture() )
{
S32 thumb_half_width = mThumbImage->getWidth()/2;
S32 left_edge = thumb_half_width;
- S32 right_edge = mRect.getWidth() - (thumb_half_width);
+ S32 right_edge = getRect().getWidth() - (thumb_half_width);
x += mMouseOffset;
x = llclamp( x, left_edge, right_edge );
@@ -231,10 +217,10 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask)
return TRUE;
}
-BOOL LLSlider::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
+BOOL LLSlider::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
{
BOOL handled = FALSE;
- if( getVisible() && mEnabled && !called_from_parent )
+ if( getVisible() && getEnabled() && !called_from_parent )
{
switch(key)
{
@@ -272,14 +258,14 @@ void LLSlider::draw()
LLRect rect(mDragStartThumbRect);
- F32 opacity = mEnabled ? 1.f : 0.3f;
+ F32 opacity = getEnabled() ? 1.f : 0.3f;
LLColor4 center_color = (mThumbCenterColor % opacity);
LLColor4 track_color = (mTrackColor % opacity);
// Track
LLRect track_rect(mThumbImage->getWidth() / 2,
getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2),
- mRect.getWidth() - mThumbImage->getWidth() / 2,
+ getRect().getWidth() - mThumbImage->getWidth() / 2,
getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) );
gl_draw_scaled_image_with_border(track_rect.mLeft, track_rect.mBottom, 3, 3, track_rect.getWidth(), track_rect.getHeight(),
@@ -334,14 +320,14 @@ LLXMLNodePtr LLSlider::getXML(bool save_children) const
node->createChild("min_val", TRUE)->setFloatValue(getMinValue());
node->createChild("max_val", TRUE)->setFloatValue(getMaxValue());
node->createChild("increment", TRUE)->setFloatValue(getIncrement());
- node->createChild("volume", TRUE)->setBoolValue(getVolumeSlider());
+ node->createChild("volume", TRUE)->setBoolValue(mVolumeSlider);
return node;
}
//static
-LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
+LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory)
{
LLString name("slider_bar");
node->getAttributeString("name", name);
diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h
index 55be2afbcc..6b1acfeaaa 100644
--- a/indra/llui/llslider.h
+++ b/indra/llui/llslider.h
@@ -35,7 +35,6 @@
#include "lluictrl.h"
#include "v4color.h"
-class LLUICtrlFactory;
class LLImageGL;
class LLSlider : public LLUICtrl
@@ -50,16 +49,16 @@ public:
F32 min_value,
F32 max_value,
F32 increment,
- BOOL volume,
+ BOOL volume, //TODO: create a "volume" slider sub-class or just use image art, no? -MG
const LLString& control_name = LLString::null );
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SLIDER_BAR; }
+ virtual LLString getWidgetTag() const { return LL_SLIDER_TAG; }
virtual LLXMLNodePtr getXML(bool save_children = true) const;
- static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
void setValue( F32 value, BOOL from_event = FALSE );
- F32 getValueF32() const;
+ F32 getValueF32() const { return mValue; }
virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); }
virtual LLSD getValue() const { return LLSD(getValueF32()); }
@@ -71,7 +70,6 @@ public:
F32 getMinValue() const { return mMinValue; }
F32 getMaxValue() const { return mMaxValue; }
F32 getIncrement() const { return mIncrement; }
- BOOL getVolumeSlider() const { return mVolumeSlider; }
void setMinValue(F32 min_value) {mMinValue = min_value;}
void setMaxValue(F32 max_value) {mMaxValue = max_value;}
void setIncrement(F32 increment) {mIncrement = increment;}
@@ -84,11 +82,10 @@ public:
virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
virtual void draw();
-protected:
+private:
void setValueAndCommit(F32 value);
void updateThumbRect();
-protected:
F32 mValue;
F32 mInitialValue;
F32 mMinValue;
diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp
index 3ff3a4f884..763be1d7e3 100644
--- a/indra/llui/llsliderctrl.cpp
+++ b/indra/llui/llsliderctrl.cpp
@@ -81,7 +81,7 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect,
mSliderMouseUpCallback( NULL ),
mSliderMouseDownCallback( NULL )
{
- S32 top = mRect.getHeight();
+ S32 top = getRect().getHeight();
S32 bottom = 0;
S32 left = 0;
@@ -97,7 +97,7 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect,
addChild(mLabelBox);
}
- S32 slider_right = mRect.getWidth();
+ S32 slider_right = getRect().getWidth();
if( show_text )
{
slider_right = text_left - SLIDERCTRL_SPACING;
@@ -115,7 +115,7 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect,
if( show_text )
{
- LLRect text_rect( text_left, top, mRect.getWidth(), bottom );
+ LLRect text_rect( text_left, top, getRect().getWidth(), bottom );
if( can_edit_text )
{
mEditor = new LLLineEditor( "SliderCtrl Editor", text_rect,
@@ -144,10 +144,6 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect,
updateText();
}
-LLSliderCtrl::~LLSliderCtrl()
-{
- // Children all cleaned up by default view destructor.
-}
// static
void LLSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata )
@@ -158,10 +154,6 @@ void LLSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata
self->onFocusReceived();
}
-F32 LLSliderCtrl::getValueF32() const
-{
- return mSlider->getValueF32();
-}
void LLSliderCtrl::setValue(F32 v, BOOL from_event)
{
@@ -209,11 +201,6 @@ void LLSliderCtrl::clear()
}
-BOOL LLSliderCtrl::isMouseHeldDown()
-{
- return mSlider->hasMouseCapture();
-}
-
void LLSliderCtrl::updateText()
{
if( mEditor || mTextBox )
@@ -427,18 +414,6 @@ void LLSliderCtrl::reportInvalidData()
make_ui_sound("UISndBadKeystroke");
}
-//virtual
-LLString LLSliderCtrl::getControlName() const
-{
- return mSlider->getControlName();
-}
-
-// virtual
-void LLSliderCtrl::setControlName(const LLString& control_name, LLView* context)
-{
- mSlider->setControlName(control_name, context);
-}
-
// virtual
LLXMLNodePtr LLSliderCtrl::getXML(bool save_children) const
{
diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h
index de1c09639c..f154c230f4 100644
--- a/indra/llui/llsliderctrl.h
+++ b/indra/llui/llsliderctrl.h
@@ -1,6 +1,6 @@
/**
* @file llsliderctrl.h
- * @brief LLSliderCtrl base class
+ * @brief Decorated wrapper for a LLSlider.
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
@@ -44,13 +44,6 @@
const S32 SLIDERCTRL_SPACING = 4; // space between label, slider, and text
const S32 SLIDERCTRL_HEIGHT = 16;
-//
-// Classes
-//
-class LLFontGL;
-class LLLineEditor;
-class LLSlider;
-
class LLSliderCtrl : public LLUICtrl
{
@@ -63,41 +56,41 @@ public:
S32 text_left,
BOOL show_text,
BOOL can_edit_text,
- BOOL volume,
+ BOOL volume, //TODO: create a "volume" slider sub-class or just use image art, no? -MG
void (*commit_callback)(LLUICtrl*, void*),
void* callback_userdata,
F32 initial_value, F32 min_value, F32 max_value, F32 increment,
const LLString& control_which = LLString::null );
- virtual ~LLSliderCtrl();
+ virtual ~LLSliderCtrl() {} // Children all cleaned up by default view destructor.
virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SLIDER; }
virtual LLString getWidgetTag() const { return LL_SLIDER_CTRL_TAG; }
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
- F32 getValueF32() const;
+ F32 getValueF32() const { return mSlider->getValueF32(); }
void setValue(F32 v, BOOL from_event = FALSE);
- virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); }
- virtual LLSD getValue() const { return LLSD(getValueF32()); }
+ virtual void setValue(const LLSD& value) { setValue((F32)value.asReal(), TRUE); }
+ virtual LLSD getValue() const { return LLSD(getValueF32()); }
virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
- virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
+ virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
- BOOL isMouseHeldDown();
+ BOOL isMouseHeldDown() const { return mSlider->hasMouseCapture(); }
virtual void setEnabled( BOOL b );
virtual void clear();
virtual void setPrecision(S32 precision);
- void setMinValue(F32 min_value) {mSlider->setMinValue(min_value);}
- void setMaxValue(F32 max_value) {mSlider->setMaxValue(max_value);}
- void setIncrement(F32 increment) {mSlider->setIncrement(increment);}
+ void setMinValue(F32 min_value) { mSlider->setMinValue(min_value); }
+ void setMaxValue(F32 max_value) { mSlider->setMaxValue(max_value); }
+ void setIncrement(F32 increment) { mSlider->setIncrement(increment); }
F32 getMinValue() { return mSlider->getMinValue(); }
F32 getMaxValue() { return mSlider->getMaxValue(); }
- void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); }
+ void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); }
void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
@@ -109,8 +102,8 @@ public:
virtual void setTentative(BOOL b); // marks value as tentative
virtual void onCommit(); // mark not tentative, then commit
- virtual void setControlName(const LLString& control_name, LLView* context);
- virtual LLString getControlName() const;
+ virtual void setControlName(const LLString& control_name, LLView* context) { mSlider->setControlName(control_name, context); }
+ virtual LLString getControlName() const { return mSlider->getControlName(); }
static void onSliderCommit(LLUICtrl* caller, void* userdata);
static void onSliderMouseDown(LLUICtrl* caller,void* userdata);
@@ -124,7 +117,6 @@ private:
void updateText();
void reportInvalidData();
-private:
const LLFontGL* mFont;
BOOL mShowText;
BOOL mCanEditText;
@@ -136,7 +128,7 @@ private:
F32 mValue;
LLSlider* mSlider;
- LLLineEditor* mEditor;
+ class LLLineEditor* mEditor;
LLTextBox* mTextBox;
LLColor4 mTextEnabledColor;
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index c4b7de768a..36f801c2e6 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -72,7 +72,7 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString
mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
mbHasBeenSet( FALSE )
{
- S32 top = mRect.getHeight();
+ S32 top = getRect().getHeight();
S32 bottom = top - 2 * SPINCTRL_BTN_HEIGHT;
S32 centered_top = top;
S32 centered_bottom = bottom;
@@ -121,7 +121,7 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString
mDownBtn->setTabStop(FALSE);
addChild(mDownBtn);
- LLRect editor_rect( btn_right + 1, centered_top, mRect.getWidth(), centered_bottom );
+ LLRect editor_rect( btn_right + 1, centered_top, getRect().getWidth(), centered_bottom );
mEditor = new LLLineEditor( "SpinCtrl Editor", editor_rect, "", font,
MAX_STRING_LENGTH,
&LLSpinCtrl::onEditorCommit, NULL, NULL, this,
@@ -140,11 +140,6 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString
setUseBoundingRect( TRUE );
}
-LLSpinCtrl::~LLSpinCtrl()
-{
- // Children all cleaned up by default view destructor.
-}
-
F32 clamp_precision(F32 value, S32 decimal_precision)
{
@@ -253,10 +248,6 @@ void LLSpinCtrl::setValue(const LLSD& value )
}
}
-LLSD LLSpinCtrl::getValue() const
-{
- return mValue;
-}
void LLSpinCtrl::clear()
{
@@ -356,7 +347,7 @@ void LLSpinCtrl::setTentative(BOOL b)
}
-BOOL LLSpinCtrl::isMouseHeldDown()
+BOOL LLSpinCtrl::isMouseHeldDown() const
{
return
mDownBtn->hasMouseCapture()
@@ -366,9 +357,7 @@ BOOL LLSpinCtrl::isMouseHeldDown()
void LLSpinCtrl::onCommit()
{
setTentative(FALSE);
-
setControlValue(mValue);
-
LLUICtrl::onCommit();
}
@@ -412,7 +401,7 @@ void LLSpinCtrl::draw()
{
if( mLabelBox )
{
- mLabelBox->setColor( mEnabled ? mTextEnabledColor : mTextDisabledColor );
+ mLabelBox->setColor( getEnabled() ? mTextEnabledColor : mTextDisabledColor );
}
LLUICtrl::draw();
}
@@ -420,7 +409,7 @@ void LLSpinCtrl::draw()
BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
- if( mEnabled )
+ if( getEnabled() )
{
if( clicks > 0 )
{
@@ -551,7 +540,3 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
return spinner;
}
-BOOL LLSpinCtrl::isDirty() const
-{
- return( mValue != mInitialValue );
-}
diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h
index 5fc3ccdcc1..77a91f80c1 100644
--- a/indra/llui/llspinctrl.h
+++ b/indra/llui/llspinctrl.h
@@ -1,6 +1,6 @@
/**
* @file llspinctrl.h
- * @brief LLSpinCtrl base class
+ * @brief Typical spinner with "up" and "down" arrow buttons.
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
@@ -47,15 +47,6 @@ const S32 SPINCTRL_SPACING = 2; // space between label right and button
const S32 SPINCTRL_HEIGHT = 2 * SPINCTRL_BTN_HEIGHT;
const S32 SPINCTRL_DEFAULT_LABEL_WIDTH = 10;
-//
-// Classes
-//
-class LLFontGL;
-class LLButton;
-class LLTextBox;
-class LLLineEditor;
-class LLUICtrlFactory;
-
class LLSpinCtrl
: public LLUICtrl
@@ -70,26 +61,26 @@ public:
const LLString& control_name = LLString(),
S32 label_width = SPINCTRL_DEFAULT_LABEL_WIDTH );
- virtual ~LLSpinCtrl();
+ virtual ~LLSpinCtrl() {} // Children all cleaned up by default view destructor.
virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SPINNER; }
virtual LLString getWidgetTag() const { return LL_SPIN_CTRL_TAG; }
virtual LLXMLNodePtr getXML(bool save_children = true) const;
- static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
virtual void setValue(const LLSD& value );
- virtual LLSD getValue() const;
- F32 get() { return (F32)getValue().asReal(); }
+ virtual LLSD getValue() const { return mValue; }
+ F32 get() const { return (F32)getValue().asReal(); }
void set(F32 value) { setValue(value); mInitialValue = value; }
virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
- BOOL isMouseHeldDown();
+ BOOL isMouseHeldDown() const;
virtual void setEnabled( BOOL b );
virtual void setFocus( BOOL b );
virtual void clear();
- virtual BOOL isDirty() const;
+ virtual BOOL isDirty() const { return( mValue != mInitialValue ); }
virtual void setPrecision(S32 precision);
virtual void setMinValue(F32 min) { mMinValue = min; }
@@ -119,12 +110,10 @@ public:
static void onUpBtn(void *userdata);
static void onDownBtn(void *userdata);
-protected:
+private:
void updateEditor();
void reportInvalidData();
-protected:
-
F32 mValue;
F32 mInitialValue;
F32 mMaxValue;
@@ -132,14 +121,14 @@ protected:
F32 mIncrement;
S32 mPrecision;
- LLTextBox* mLabelBox;
+ class LLTextBox* mLabelBox;
- LLLineEditor* mEditor;
+ class LLLineEditor* mEditor;
LLColor4 mTextEnabledColor;
LLColor4 mTextDisabledColor;
- LLButton* mUpBtn;
- LLButton* mDownBtn;
+ class LLButton* mUpBtn;
+ class LLButton* mDownBtn;
BOOL mbHasBeenSet;
};
diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp
index 2d3534e7be..695dd2a16f 100644
--- a/indra/llui/llstyle.cpp
+++ b/indra/llui/llstyle.cpp
@@ -71,11 +71,6 @@ LLStyle::LLStyle(BOOL is_visible, const LLColor4 &color, const LLString& font_na
init(is_visible, color, font_name);
}
-LLStyle::~LLStyle()
-{
- free();
-}
-
void LLStyle::init(BOOL is_visible, const LLColor4 &color, const LLString& font_name)
{
mVisible = is_visible;
@@ -91,14 +86,6 @@ void LLStyle::init(BOOL is_visible, const LLColor4 &color, const LLString& font_
mIsEmbeddedItem = FALSE;
}
-void LLStyle::free()
-{
-}
-
-LLFONT_ID LLStyle::getFontID() const
-{
- return mFontID;
-}
// Copy assignment
LLStyle &LLStyle::operator=(const LLStyle &rhs)
@@ -122,48 +109,6 @@ LLStyle &LLStyle::operator=(const LLStyle &rhs)
return *this;
}
-// Compare
-bool LLStyle::operator==(const LLStyle &rhs) const
-{
- if ((mVisible != rhs.isVisible())
- || (mColor != rhs.getColor())
- || (mFontName != rhs.getFontString())
- || (mLink != rhs.getLinkHREF())
- || (mImagep != rhs.mImagep)
- || (mImageHeight != rhs.mImageHeight)
- || (mImageWidth != rhs.mImageWidth)
- || (mItalic != rhs.mItalic)
- || (mBold != rhs.mBold)
- || (mUnderline != rhs.mUnderline)
- || (mDropShadow != rhs.mDropShadow)
- || (mIsEmbeddedItem != rhs.mIsEmbeddedItem)
- )
- {
- return FALSE;
- }
- return TRUE;
-}
-
-bool LLStyle::operator!=(const LLStyle& rhs) const
-{
- return !(*this == rhs);
-}
-
-
-const LLColor4& LLStyle::getColor() const
-{
- return(mColor);
-}
-
-void LLStyle::setColor(const LLColor4 &color)
-{
- mColor = color;
-}
-
-const LLString& LLStyle::getFontString() const
-{
- return mFontName;
-}
void LLStyle::setFontName(const LLString& fontname)
{
@@ -192,52 +137,15 @@ void LLStyle::setFontName(const LLString& fontname)
}
}
-const LLString& LLStyle::getLinkHREF() const
-{
- return mLink;
-}
-
-void LLStyle::setLinkHREF(const LLString& href)
-{
- mLink = href;
-}
-
-BOOL LLStyle::isLink() const
-{
- return mLink.size();
-}
-
-BOOL LLStyle::isVisible() const
-{
- return mVisible;
-}
-
-void LLStyle::setVisible(BOOL is_visible)
-{
- mVisible = is_visible;
-}
-
-LLImageGL *LLStyle::getImage() const
-{
- return mImagep;
-}
void LLStyle::setImage(const LLString& src)
{
- if (src.size() < UUID_STR_LENGTH - 1)
- {
- return;
- }
- else
+ if (src.size() >= UUID_STR_LENGTH - 1)
{
mImagep = LLUI::sImageProvider->getImageByID(LLUUID(src));
}
}
-BOOL LLStyle::isImage() const
-{
- return ((mImageWidth != 0) && (mImageHeight != 0));
-}
void LLStyle::setImageSize(S32 width, S32 height)
{
diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h
index 809253fd9b..b425640a36 100644
--- a/indra/llui/llstyle.h
+++ b/indra/llui/llstyle.h
@@ -46,36 +46,52 @@ public:
LLStyle &operator=(const LLStyle &rhs);
- virtual ~LLStyle();
+ virtual ~LLStyle() { }
virtual void init (BOOL is_visible, const LLColor4 &color, const LLString& font_name);
- virtual void free ();
- bool operator==(const LLStyle &rhs) const;
- bool operator!=(const LLStyle &rhs) const;
+ virtual const LLColor4& getColor() const { return mColor; }
+ virtual void setColor(const LLColor4 &color) { mColor = color; }
- virtual const LLColor4& getColor() const;
- virtual void setColor(const LLColor4 &color);
+ virtual BOOL isVisible() const { return mVisible; }
+ virtual void setVisible(BOOL is_visible) { mVisible = is_visible; }
- virtual BOOL isVisible() const;
- virtual void setVisible(BOOL is_visible);
-
- virtual const LLString& getFontString() const;
+ virtual const LLString& getFontString() const { return mFontName; }
virtual void setFontName(const LLString& fontname);
- virtual LLFONT_ID getFontID() const;
+ virtual LLFONT_ID getFontID() const { return mFontID; }
- virtual const LLString& getLinkHREF() const;
- virtual void setLinkHREF(const LLString& fontname);
- virtual BOOL isLink() const;
+ virtual const LLString& getLinkHREF() const { return mLink; }
+ virtual void setLinkHREF(const LLString& href) { mLink = href; }
+ virtual BOOL isLink() const { return mLink.size(); }
- virtual LLImageGL *getImage() const;
+ virtual LLImageGL *getImage() const { return mImagep; }
virtual void setImage(const LLString& src);
- virtual BOOL isImage() const;
+ virtual BOOL isImage() const { return ((mImageWidth != 0) && (mImageHeight != 0)); }
virtual void setImageSize(S32 width, S32 height);
BOOL getIsEmbeddedItem() const { return mIsEmbeddedItem; }
void setIsEmbeddedItem( BOOL b ) { mIsEmbeddedItem = b; }
+ // inlined here to make it easier to compare to member data below. -MG
+ bool operator==(const LLStyle &rhs) const
+ {
+ return
+ mVisible == rhs.isVisible()
+ && mColor == rhs.getColor()
+ && mFontName == rhs.getFontString()
+ && mLink == rhs.getLinkHREF()
+ && mImagep == rhs.mImagep
+ && mImageHeight == rhs.mImageHeight
+ && mImageWidth == rhs.mImageWidth
+ && mItalic == rhs.mItalic
+ && mBold == rhs.mBold
+ && mUnderline == rhs.mUnderline
+ && mDropShadow == rhs.mDropShadow
+ && mIsEmbeddedItem == rhs.mIsEmbeddedItem;
+ }
+
+ bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); }
+
public:
BOOL mItalic;
BOOL mBold;
@@ -84,14 +100,13 @@ public:
S32 mImageWidth;
S32 mImageHeight;
-protected:
+private:
BOOL mVisible;
LLColor4 mColor;
LLString mFontName;
LLFONT_ID mFontID;
LLString mLink;
LLPointer<LLImageGL> mImagep;
-
BOOL mIsEmbeddedItem;
};
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 148060359f..4568ebac29 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1,6 +1,6 @@
/**
* @file lltabcontainer.cpp
- * @brief LLTabContainerCommon base class
+ * @brief LLTabContainer class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -30,33 +30,23 @@
*/
#include "linden_common.h"
-
#include "lltabcontainer.h"
-
#include "llfocusmgr.h"
-#include "llfontgl.h"
-#include "llgl.h"
-
#include "llbutton.h"
#include "llrect.h"
-#include "llpanel.h"
#include "llresmgr.h"
-#include "llkeyboard.h"
#include "llresizehandle.h"
-#include "llui.h"
#include "lltextbox.h"
-#include "llcontrol.h"
#include "llcriticaldamp.h"
#include "lluictrlfactory.h"
-
#include "lltabcontainervertical.h"
-#include "llglheaders.h"
const F32 SCROLL_STEP_TIME = 0.4f;
const F32 SCROLL_DELAY_TIME = 0.5f;
const S32 TAB_PADDING = 15;
const S32 TABCNTR_TAB_MIN_WIDTH = 60;
+const S32 TABCNTR_VERT_TAB_MIN_WIDTH = 100;
const S32 TABCNTR_TAB_MAX_WIDTH = 150;
const S32 TABCNTR_TAB_PARTIAL_WIDTH = 12; // When tabs are parially obscured, how much can you still see.
const S32 TABCNTR_TAB_HEIGHT = 16;
@@ -64,12 +54,19 @@ const S32 TABCNTR_ARROW_BTN_SIZE = 16;
const S32 TABCNTR_BUTTON_PANEL_OVERLAP = 1; // how many pixels the tab buttons and tab panels overlap.
const S32 TABCNTR_TAB_H_PAD = 4;
+const S32 TABCNTR_CLOSE_BTN_SIZE = 16;
+const S32 TABCNTR_HEADER_HEIGHT = LLPANEL_BORDER_WIDTH + TABCNTR_CLOSE_BTN_SIZE;
+
+const S32 TABCNTRV_CLOSE_BTN_SIZE = 16;
+const S32 TABCNTRV_HEADER_HEIGHT = LLPANEL_BORDER_WIDTH + TABCNTRV_CLOSE_BTN_SIZE;
+//const S32 TABCNTRV_TAB_WIDTH = 100;
+const S32 TABCNTRV_ARROW_BTN_SIZE = 16;
+const S32 TABCNTRV_PAD = 0;
+
-LLTabContainerCommon::LLTabContainerCommon(
- const LLString& name, const LLRect& rect,
- TabPosition pos,
- void(*close_callback)(void*), void* callback_userdata,
- BOOL bordered )
+
+LLTabContainer::LLTabContainer(const LLString& name, const LLRect& rect, TabPosition pos,
+ BOOL bordered, BOOL is_vertical )
:
LLPanel(name, rect, bordered),
mCurrentTabIdx(-1),
@@ -78,50 +75,65 @@ LLTabContainerCommon::LLTabContainerCommon(
mScrollPos(0),
mScrollPosPixels(0),
mMaxScrollPos(0),
- mCloseCallback( close_callback ),
- mCallbackUserdata( callback_userdata ),
+ mCloseCallback( NULL ),
+ mCallbackUserdata( NULL ),
mTitleBox(NULL),
mTopBorderHeight(LLPANEL_BORDER_WIDTH),
mTabPosition(pos),
- mLockedTabCount(0)
+ mLockedTabCount(0),
+ mMinTabWidth(TABCNTR_TAB_MIN_WIDTH),
+ mMaxTabWidth(TABCNTR_TAB_MAX_WIDTH),
+ mPrevArrowBtn(NULL),
+ mNextArrowBtn(NULL),
+ mIsVertical(is_vertical),
+ // Horizontal Specific
+ mJumpPrevArrowBtn(NULL),
+ mJumpNextArrowBtn(NULL),
+ mRightTabBtnOffset(0),
+ mTotalTabWidth(0)
{
+ //RN: HACK to support default min width for legacy vertical tab containers
+ if (mIsVertical)
+ {
+ mMinTabWidth = TABCNTR_VERT_TAB_MIN_WIDTH;
+ }
setMouseOpaque(FALSE);
+ initButtons( );
mDragAndDropDelayTimer.stop();
}
+LLTabContainer::~LLTabContainer()
+{
+ std::for_each(mTabList.begin(), mTabList.end(), DeletePointer());
+}
-LLTabContainerCommon::LLTabContainerCommon(
- const LLString& name,
- const LLString& rect_control,
- TabPosition pos,
- void(*close_callback)(void*), void* callback_userdata,
- BOOL bordered )
- :
- LLPanel(name, rect_control, bordered),
- mCurrentTabIdx(-1),
- mTabsHidden(FALSE),
- mScrolled(FALSE),
- mScrollPos(0),
- mScrollPosPixels(0),
- mMaxScrollPos(0),
- mCloseCallback( close_callback ),
- mCallbackUserdata( callback_userdata ),
- mTitleBox(NULL),
- mTopBorderHeight(LLPANEL_BORDER_WIDTH),
- mTabPosition(pos),
- mLockedTabCount(0)
+//virtual
+void LLTabContainer::setValue(const LLSD& value)
{
- setMouseOpaque(FALSE);
- mDragAndDropDelayTimer.stop();
+ selectTab((S32) value.asInteger());
}
+//virtual
+EWidgetType LLTabContainer::getWidgetType() const
+{
+ return WIDGET_TYPE_TAB_CONTAINER;
+}
-LLTabContainerCommon::~LLTabContainerCommon()
+//virtual
+LLString LLTabContainer::getWidgetTag() const
{
- std::for_each(mTabList.begin(), mTabList.end(), DeletePointer());
+ return LL_TAB_CONTAINER_COMMON_TAG;
}
-LLView* LLTabContainerCommon::getChildByName(const LLString& name, BOOL recurse) const
+//virtual
+void LLTabContainer::reshape(S32 width, S32 height, BOOL called_from_parent)
+{
+ LLPanel::reshape( width, height, called_from_parent );
+ updateMaxScrollPos();
+}
+
+//virtual
+LLView* LLTabContainer::getChildByName(const LLString& name, BOOL recurse) const
{
tuple_list_t::const_iterator itor;
for (itor = mTabList.begin(); itor != mTabList.end(); ++itor)
@@ -137,7 +149,7 @@ LLView* LLTabContainerCommon::getChildByName(const LLString& name, BOOL recurse)
for (itor = mTabList.begin(); itor != mTabList.end(); ++itor)
{
LLPanel *panel = (*itor)->mTabPanel;
- LLView *child = panel->getChildByName(name, recurse);
+ LLView *child = panel->getChild<LLView>(name, recurse);
if (child)
{
return child;
@@ -147,25 +159,750 @@ LLView* LLTabContainerCommon::getChildByName(const LLString& name, BOOL recurse)
return LLView::getChildByName(name, recurse);
}
-void LLTabContainerCommon::addPlaceholder(LLPanel* child, const LLString& label)
+// virtual
+void LLTabContainer::draw()
{
- addTabPanel(child, label, FALSE, NULL, NULL, 0, TRUE);
+ S32 target_pixel_scroll = 0;
+ S32 cur_scroll_pos = mIsVertical ? 0 : getScrollPos();
+ if (cur_scroll_pos > 0)
+ {
+ S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
+ for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ {
+ if (cur_scroll_pos == 0)
+ {
+ break;
+ }
+ target_pixel_scroll += (*iter)->mButton->getRect().getWidth();
+ cur_scroll_pos--;
+ }
+
+ // Show part of the tab to the left of what is fully visible
+ target_pixel_scroll -= TABCNTR_TAB_PARTIAL_WIDTH;
+ // clamp so that rightmost tab never leaves right side of screen
+ target_pixel_scroll = llmin(mTotalTabWidth - available_width_with_arrows, target_pixel_scroll);
+ }
+
+ setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
+ if( getVisible() )
+ {
+ BOOL has_scroll_arrows = (mMaxScrollPos > 0) || (mScrollPosPixels > 0);
+ if (!mIsVertical)
+ {
+ mJumpPrevArrowBtn->setVisible( has_scroll_arrows );
+ mJumpNextArrowBtn->setVisible( has_scroll_arrows );
+ }
+ mPrevArrowBtn->setVisible( has_scroll_arrows );
+ mNextArrowBtn->setVisible( has_scroll_arrows );
+
+ S32 left = 0, top = 0;
+ if (mIsVertical)
+ {
+ top = getRect().getHeight() - getTopBorderHeight() - LLPANEL_BORDER_WIDTH - 1 - (has_scroll_arrows ? TABCNTRV_ARROW_BTN_SIZE : 0);
+ top += getScrollPosPixels();
+ }
+ else
+ {
+ // Set the leftmost position of the tab buttons.
+ left = LLPANEL_BORDER_WIDTH + (has_scroll_arrows ? (TABCNTR_ARROW_BTN_SIZE * 2) : TABCNTR_TAB_H_PAD);
+ left -= getScrollPosPixels();
+ }
+
+ // Hide all the buttons
+ for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ {
+ LLTabTuple* tuple = *iter;
+ tuple->mButton->setVisible( FALSE );
+ }
+
+ LLPanel::draw();
+
+ // if tabs are hidden, don't draw them and leave them in the invisible state
+ if (!getTabsHidden())
+ {
+ // Show all the buttons
+ for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ {
+ LLTabTuple* tuple = *iter;
+ tuple->mButton->setVisible( TRUE );
+ }
+
+ // Draw some of the buttons...
+ LLRect clip_rect = getLocalRect();
+ if (has_scroll_arrows)
+ {
+ // ...but clip them.
+ if (mIsVertical)
+ {
+ clip_rect.mBottom = mNextArrowBtn->getRect().mTop + 3*TABCNTRV_PAD;
+ clip_rect.mTop = mPrevArrowBtn->getRect().mBottom - 3*TABCNTRV_PAD;
+ }
+ else
+ {
+ clip_rect.mLeft = mPrevArrowBtn->getRect().mRight;
+ clip_rect.mRight = mNextArrowBtn->getRect().mLeft;
+ }
+ }
+ LLLocalClipRect clip(clip_rect);
+
+ S32 max_scroll_visible = getTabCount() - getMaxScrollPos() + getScrollPos();
+ S32 idx = 0;
+ for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ {
+ LLTabTuple* tuple = *iter;
+
+ tuple->mButton->translate( left ? left - tuple->mButton->getRect().mLeft : 0,
+ top ? top - tuple->mButton->getRect().mTop : 0 );
+ if (top) top -= BTN_HEIGHT + TABCNTRV_PAD;
+ if (left) left += tuple->mButton->getRect().getWidth();
+
+ if (!mIsVertical)
+ {
+ if( idx < getScrollPos() )
+ {
+ if( tuple->mButton->getFlashing() )
+ {
+ mPrevArrowBtn->setFlashing( TRUE );
+ }
+ }
+ else if( max_scroll_visible < idx )
+ {
+ if( tuple->mButton->getFlashing() )
+ {
+ mNextArrowBtn->setFlashing( TRUE );
+ }
+ }
+ }
+ LLUI::pushMatrix();
+ {
+ LLUI::translate((F32)tuple->mButton->getRect().mLeft, (F32)tuple->mButton->getRect().mBottom, 0.f);
+ tuple->mButton->draw();
+ }
+ LLUI::popMatrix();
+
+ idx++;
+ }
+
+
+ if( mIsVertical && has_scroll_arrows )
+ {
+ // Redraw the arrows so that they appears on top.
+ glPushMatrix();
+ glTranslatef((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f);
+ mPrevArrowBtn->draw();
+ glPopMatrix();
+
+ glPushMatrix();
+ glTranslatef((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f);
+ mNextArrowBtn->draw();
+ glPopMatrix();
+ }
+ }
+
+ mPrevArrowBtn->setFlashing(FALSE);
+ mNextArrowBtn->setFlashing(FALSE);
+ }
}
-void LLTabContainerCommon::lockTabs(S32 num_tabs)
+
+// virtual
+BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask )
{
- // count current tabs or use supplied value and ensure no new tabs get
- // inserted between them
- mLockedTabCount = num_tabs > 0 ? llmin(getTabCount(), num_tabs) : getTabCount();
+ BOOL handled = FALSE;
+ BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
+
+ 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;
+ handled = mJumpPrevArrowBtn->handleMouseDown(local_x, local_y, mask);
+ }
+ else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
+ {
+ S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft;
+ S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom;
+ handled = mJumpNextArrowBtn->handleMouseDown(local_x, local_y, mask);
+ }
+ else if (mPrevArrowBtn && mPrevArrowBtn->getRect().pointInRect(x, y))
+ {
+ S32 local_x = x - mPrevArrowBtn->getRect().mLeft;
+ S32 local_y = y - mPrevArrowBtn->getRect().mBottom;
+ handled = mPrevArrowBtn->handleMouseDown(local_x, local_y, mask);
+ }
+ else if (mNextArrowBtn && mNextArrowBtn->getRect().pointInRect(x, y))
+ {
+ S32 local_x = x - mNextArrowBtn->getRect().mLeft;
+ S32 local_y = y - mNextArrowBtn->getRect().mBottom;
+ handled = mNextArrowBtn->handleMouseDown(local_x, local_y, mask);
+ }
+ }
+ if (!handled)
+ {
+ handled = LLPanel::handleMouseDown( x, y, mask );
+ }
+
+ if (getTabCount() > 0)
+ {
+ LLTabTuple* firsttuple = getTab(0);
+ LLRect tab_rect;
+ if (mIsVertical)
+ {
+ tab_rect = LLRect(firsttuple->mButton->getRect().mLeft,
+ has_scroll_arrows ? mPrevArrowBtn->getRect().mBottom - TABCNTRV_PAD : mPrevArrowBtn->getRect().mTop,
+ firsttuple->mButton->getRect().mRight,
+ has_scroll_arrows ? mNextArrowBtn->getRect().mTop + TABCNTRV_PAD : mNextArrowBtn->getRect().mBottom );
+ }
+ else
+ {
+ tab_rect = LLRect(has_scroll_arrows ? mPrevArrowBtn->getRect().mRight : mJumpPrevArrowBtn->getRect().mLeft,
+ firsttuple->mButton->getRect().mTop,
+ has_scroll_arrows ? mNextArrowBtn->getRect().mLeft : mJumpNextArrowBtn->getRect().mRight,
+ firsttuple->mButton->getRect().mBottom );
+ }
+ if( tab_rect.pointInRect( x, y ) )
+ {
+ LLButton* tab_button = getTab(getCurrentPanelIndex())->mButton;
+ gFocusMgr.setMouseCapture(this);
+ gFocusMgr.setKeyboardFocus(tab_button);
+ }
+ }
+ return handled;
+}
+
+// virtual
+BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask )
+{
+ BOOL handled = FALSE;
+ BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
+
+ 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;
+ handled = mJumpPrevArrowBtn->handleHover(local_x, local_y, mask);
+ }
+ else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
+ {
+ S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft;
+ S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom;
+ handled = mJumpNextArrowBtn->handleHover(local_x, local_y, mask);
+ }
+ else if (mPrevArrowBtn && mPrevArrowBtn->getRect().pointInRect(x, y))
+ {
+ S32 local_x = x - mPrevArrowBtn->getRect().mLeft;
+ S32 local_y = y - mPrevArrowBtn->getRect().mBottom;
+ handled = mPrevArrowBtn->handleHover(local_x, local_y, mask);
+ }
+ else if (mNextArrowBtn && mNextArrowBtn->getRect().pointInRect(x, y))
+ {
+ S32 local_x = x - mNextArrowBtn->getRect().mLeft;
+ S32 local_y = y - mNextArrowBtn->getRect().mBottom;
+ handled = mNextArrowBtn->handleHover(local_x, local_y, mask);
+ }
+ }
+ if (!handled)
+ {
+ handled = LLPanel::handleHover(x, y, mask);
+ }
+
+ commitHoveredButton(x, y);
+ return handled;
}
-void LLTabContainerCommon::unlockTabs()
+// virtual
+BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask )
{
- mLockedTabCount = 0;
+ BOOL handled = FALSE;
+ BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
+
+ 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;
+ handled = mJumpPrevArrowBtn->handleMouseUp(local_x, local_y, mask);
+ }
+ else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
+ {
+ S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft;
+ S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom;
+ handled = mJumpNextArrowBtn->handleMouseUp(local_x, local_y, mask);
+ }
+ else if (mPrevArrowBtn && mPrevArrowBtn->getRect().pointInRect(x, y))
+ {
+ S32 local_x = x - mPrevArrowBtn->getRect().mLeft;
+ S32 local_y = y - mPrevArrowBtn->getRect().mBottom;
+ handled = mPrevArrowBtn->handleMouseUp(local_x, local_y, mask);
+ }
+ else if (mNextArrowBtn && mNextArrowBtn->getRect().pointInRect(x, y))
+ {
+ S32 local_x = x - mNextArrowBtn->getRect().mLeft;
+ S32 local_y = y - mNextArrowBtn->getRect().mBottom;
+ handled = mNextArrowBtn->handleMouseUp(local_x, local_y, mask);
+ }
+ }
+ if (!handled)
+ {
+ handled = LLPanel::handleMouseUp( x, y, mask );
+ }
+
+ commitHoveredButton(x, y);
+ LLPanel* cur_panel = getCurrentPanel();
+ if (hasMouseCapture())
+ {
+ if (cur_panel)
+ {
+ if (!cur_panel->focusFirstItem(FALSE))
+ {
+ // if nothing in the panel gets focus, make sure the new tab does
+ // otherwise the last tab might keep focus
+ getTab(getCurrentPanelIndex())->mButton->setFocus(TRUE);
+ }
+ }
+ gFocusMgr.setMouseCapture(NULL);
+ }
+ return handled;
+}
+
+// virtual
+BOOL LLTabContainer::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect )
+{
+ BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect );
+ if (!handled && getTabCount() > 0)
+ {
+ LLTabTuple* firsttuple = getTab(0);
+
+ BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
+ LLRect clip;
+ if (mIsVertical)
+ {
+ clip = LLRect(firsttuple->mButton->getRect().mLeft,
+ has_scroll_arrows ? mPrevArrowBtn->getRect().mBottom - TABCNTRV_PAD : mPrevArrowBtn->getRect().mTop,
+ firsttuple->mButton->getRect().mRight,
+ has_scroll_arrows ? mNextArrowBtn->getRect().mTop + TABCNTRV_PAD : mNextArrowBtn->getRect().mBottom );
+ }
+ else
+ {
+ clip = LLRect(has_scroll_arrows ? mPrevArrowBtn->getRect().mRight : mJumpPrevArrowBtn->getRect().mLeft,
+ firsttuple->mButton->getRect().mTop,
+ has_scroll_arrows ? mNextArrowBtn->getRect().mLeft : mJumpNextArrowBtn->getRect().mRight,
+ firsttuple->mButton->getRect().mBottom );
+ }
+
+ if( clip.pointInRect( x, y ) )
+ {
+ 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;
+ handled = tuple->mButton->handleToolTip( local_x, local_y, msg, sticky_rect );
+ if( handled )
+ {
+ break;
+ }
+ }
+ }
+
+ for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ {
+ LLTabTuple* tuple = *iter;
+ tuple->mButton->setVisible( FALSE );
+ }
+ }
+ return handled;
+}
+
+// virtual
+BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
+{
+ if (!getEnabled()) return FALSE;
+
+ if (!gFocusMgr.childHasKeyboardFocus(this)) return FALSE;
+
+ BOOL handled = FALSE;
+ if (key == KEY_LEFT && mask == MASK_ALT)
+ {
+ selectPrevTab();
+ handled = TRUE;
+ }
+ else if (key == KEY_RIGHT && mask == MASK_ALT)
+ {
+ selectNextTab();
+ handled = TRUE;
+ }
+
+ if (handled)
+ {
+ if (getCurrentPanel())
+ {
+ getCurrentPanel()->setFocus(TRUE);
+ }
+ }
+
+ if (!gFocusMgr.childHasKeyboardFocus(getCurrentPanel()))
+ {
+ // if child has focus, but not the current panel, focus is on a button
+ if (mIsVertical)
+ {
+ switch(key)
+ {
+ case KEY_UP:
+ selectPrevTab();
+ handled = TRUE;
+ break;
+ case KEY_DOWN:
+ selectNextTab();
+ handled = TRUE;
+ break;
+ case KEY_LEFT:
+ handled = TRUE;
+ break;
+ case KEY_RIGHT:
+ if (getTabPosition() == LEFT && getCurrentPanel())
+ {
+ getCurrentPanel()->setFocus(TRUE);
+ }
+ handled = TRUE;
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(key)
+ {
+ case KEY_UP:
+ if (getTabPosition() == BOTTOM && getCurrentPanel())
+ {
+ getCurrentPanel()->setFocus(TRUE);
+ }
+ handled = TRUE;
+ break;
+ case KEY_DOWN:
+ if (getTabPosition() == TOP && getCurrentPanel())
+ {
+ getCurrentPanel()->setFocus(TRUE);
+ }
+ handled = TRUE;
+ break;
+ case KEY_LEFT:
+ selectPrevTab();
+ handled = TRUE;
+ break;
+ case KEY_RIGHT:
+ selectNextTab();
+ handled = TRUE;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ return handled;
+}
+
+// virtual
+LLXMLNodePtr LLTabContainer::getXML(bool save_children) const
+{
+ LLXMLNodePtr node = LLPanel::getXML();
+ node->createChild("tab_position", TRUE)->setStringValue((getTabPosition() == TOP ? "top" : "bottom"));
+ return node;
+}
+
+// virtual
+BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, LLString &tooltip)
+{
+ BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
+
+ if( mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME )
+ {
+ if (has_scroll_arrows)
+ {
+ if (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->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();
+ mDragAndDropDelayTimer.stop();
+ }
+ }
+ }
+
+ return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip);
}
-void LLTabContainerCommon::removeTabPanel(LLPanel* child)
+void LLTabContainer::addTabPanel(LLPanel* child,
+ const LLString& label,
+ BOOL select,
+ void (*on_tab_clicked)(void*, bool),
+ void* userdata,
+ S32 indent,
+ BOOL placeholder,
+ eInsertionPoint insertion_point)
{
+ if (child->getParent() == this)
+ {
+ // already a child of mine
+ return;
+ }
+ const LLFontGL* font = gResMgr->getRes( mIsVertical ? LLFONT_SANSSERIF : LLFONT_SANSSERIF_SMALL );
+
+ // Store the original label for possible xml export.
+ child->setLabel(label);
+ LLString trimmed_label = label;
+ LLString::trim(trimmed_label);
+
+ S32 button_width = mMinTabWidth;
+ if (!mIsVertical)
+ {
+ button_width = llclamp(font->getWidth(trimmed_label) + TAB_PADDING, mMinTabWidth, mMaxTabWidth);
+ }
+
+ // Tab panel
+ S32 tab_panel_top;
+ S32 tab_panel_bottom;
+ if( getTabPosition() == LLTabContainer::TOP )
+ {
+ S32 tab_height = mIsVertical ? BTN_HEIGHT : TABCNTR_TAB_HEIGHT;
+ tab_panel_top = getRect().getHeight() - getTopBorderHeight() - (tab_height - TABCNTR_BUTTON_PANEL_OVERLAP);
+ tab_panel_bottom = LLPANEL_BORDER_WIDTH;
+ }
+ else
+ {
+ tab_panel_top = getRect().getHeight() - getTopBorderHeight();
+ tab_panel_bottom = (TABCNTR_TAB_HEIGHT - TABCNTR_BUTTON_PANEL_OVERLAP); // Run to the edge, covering up the border
+ }
+
+ LLRect tab_panel_rect;
+ if (mIsVertical)
+ {
+ tab_panel_rect = LLRect(mMinTabWidth + (LLPANEL_BORDER_WIDTH * 2) + TABCNTRV_PAD,
+ getRect().getHeight() - LLPANEL_BORDER_WIDTH,
+ getRect().getWidth() - LLPANEL_BORDER_WIDTH,
+ LLPANEL_BORDER_WIDTH);
+ }
+ else
+ {
+ tab_panel_rect = LLRect(LLPANEL_BORDER_WIDTH,
+ tab_panel_top,
+ getRect().getWidth()-LLPANEL_BORDER_WIDTH,
+ tab_panel_bottom );
+ }
+ child->setFollowsAll();
+ child->translate( tab_panel_rect.mLeft - child->getRect().mLeft, tab_panel_rect.mBottom - child->getRect().mBottom);
+ child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE );
+ child->setBackgroundVisible( FALSE ); // No need to overdraw
+ // add this child later
+
+ child->setVisible( FALSE ); // Will be made visible when selected
+
+ mTotalTabWidth += button_width;
+
+ // Tab button
+ LLRect btn_rect; // Note: btn_rect.mLeft is just a dummy. Will be updated in draw().
+ LLString tab_img;
+ LLString tab_selected_img;
+ S32 tab_fudge = 1; // To make new tab art look better, nudge buttons up 1 pel
+
+ if (mIsVertical)
+ {
+ btn_rect.setLeftTopAndSize(TABCNTRV_PAD + LLPANEL_BORDER_WIDTH + 2, // JC - Fudge factor
+ (getRect().getHeight() - getTopBorderHeight() - LLPANEL_BORDER_WIDTH - 1) - ((BTN_HEIGHT + TABCNTRV_PAD) * getTabCount()),
+ mMinTabWidth,
+ BTN_HEIGHT);
+ }
+ else if( getTabPosition() == LLTabContainer::TOP )
+ {
+ btn_rect.setLeftTopAndSize( 0, getRect().getHeight() - getTopBorderHeight() + tab_fudge, button_width, TABCNTR_TAB_HEIGHT );
+ tab_img = "tab_top_blue.tga";
+ tab_selected_img = "tab_top_selected_blue.tga";
+ }
+ else
+ {
+ btn_rect.setOriginAndSize( 0, 0 + tab_fudge, button_width, TABCNTR_TAB_HEIGHT );
+ tab_img = "tab_bottom_blue.tga";
+ tab_selected_img = "tab_bottom_selected_blue.tga";
+ }
+
+ LLTextBox* textbox = NULL;
+ LLButton* btn = NULL;
+
+ if (placeholder)
+ {
+ btn_rect.translate(0, -LLBUTTON_V_PAD-2);
+ textbox = new LLTextBox(trimmed_label, btn_rect, trimmed_label, font);
+
+ btn = new LLButton("", LLRect(0,0,0,0));
+ }
+ else
+ {
+ if (mIsVertical)
+ {
+ btn = new LLButton("vert tab button",
+ btn_rect,
+ "",
+ "",
+ "",
+ &LLTabContainer::onTabBtn, NULL,
+ font,
+ trimmed_label, trimmed_label);
+ btn->setImages("tab_left.tga", "tab_left_selected.tga");
+ btn->setScaleImage(TRUE);
+ btn->setHAlign(LLFontGL::LEFT);
+ btn->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
+ btn->setTabStop(FALSE);
+ if (indent)
+ {
+ btn->setLeftHPad(indent);
+ }
+ }
+ else
+ {
+ LLString tooltip = trimmed_label;
+ tooltip += "\nAlt-Left arrow for previous tab";
+ tooltip += "\nAlt-Right arrow for next tab";
+
+ btn = new LLButton(LLString(child->getName()) + " tab",
+ btn_rect,
+ "", "", "",
+ &LLTabContainer::onTabBtn, NULL, // set userdata below
+ font,
+ trimmed_label, trimmed_label );
+ btn->setVisible( FALSE );
+ btn->setToolTip( tooltip );
+ btn->setScaleImage(TRUE);
+ btn->setImages(tab_img, tab_selected_img);
+
+ // Try to squeeze in a bit more text
+ btn->setLeftHPad( 4 );
+ btn->setRightHPad( 2 );
+ btn->setHAlign(LLFontGL::LEFT);
+ btn->setTabStop(FALSE);
+ if (indent)
+ {
+ btn->setLeftHPad(indent);
+ }
+
+ if( getTabPosition() == TOP )
+ {
+ btn->setFollowsTop();
+ }
+ else
+ {
+ btn->setFollowsBottom();
+ }
+ }
+ }
+
+ LLTabTuple* tuple = new LLTabTuple( this, child, btn, on_tab_clicked, userdata, textbox );
+ insertTuple( tuple, insertion_point );
+
+ if (textbox)
+ {
+ textbox->setSaveToXML(false);
+ addChild( textbox, 0 );
+ }
+ if (btn)
+ {
+ btn->setSaveToXML(false);
+ btn->setCallbackUserData( tuple );
+ addChild( btn, 0 );
+ }
+ if (child)
+ {
+ addChild(child, 1);
+ }
+
+ if( select )
+ {
+ selectLastTab();
+ }
+
+ updateMaxScrollPos();
+}
+
+void LLTabContainer::addPlaceholder(LLPanel* child, const LLString& label)
+{
+ addTabPanel(child, label, FALSE, NULL, NULL, 0, TRUE);
+}
+
+void LLTabContainer::removeTabPanel(LLPanel* child)
+{
+ if (mIsVertical)
+ {
+ // Fix-up button sizes
+ S32 tab_count = 0;
+ for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ {
+ LLTabTuple* tuple = *iter;
+ LLRect rect;
+ rect.setLeftTopAndSize(TABCNTRV_PAD + LLPANEL_BORDER_WIDTH + 2, // JC - Fudge factor
+ (getRect().getHeight() - LLPANEL_BORDER_WIDTH - 1) - ((BTN_HEIGHT + TABCNTRV_PAD) * (tab_count)),
+ mMinTabWidth,
+ BTN_HEIGHT);
+ if (tuple->mPlaceholderText)
+ {
+ tuple->mPlaceholderText->setRect(rect);
+ }
+ else
+ {
+ tuple->mButton->setRect(rect);
+ }
+ tab_count++;
+ }
+ }
+ else
+ {
+ // Adjust the total tab width.
+ for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ {
+ LLTabTuple* tuple = *iter;
+ if( tuple->mTabPanel == child )
+ {
+ mTotalTabWidth -= tuple->mButton->getRect().getWidth();
+ break;
+ }
+ }
+ }
+
BOOL has_focus = gFocusMgr.childHasKeyboardFocus(this);
// If the tab being deleted is the selected one, select a different tab.
@@ -207,7 +944,27 @@ void LLTabContainerCommon::removeTabPanel(LLPanel* child)
updateMaxScrollPos();
}
-void LLTabContainerCommon::deleteAllTabs()
+void LLTabContainer::lockTabs(S32 num_tabs)
+{
+ // count current tabs or use supplied value and ensure no new tabs get
+ // inserted between them
+ mLockedTabCount = num_tabs > 0 ? llmin(getTabCount(), num_tabs) : getTabCount();
+}
+
+void LLTabContainer::unlockTabs()
+{
+ mLockedTabCount = 0;
+}
+
+void LLTabContainer::enableTabButton(S32 which, BOOL enable)
+{
+ if (which >= 0 && which < (S32)mTabList.size())
+ {
+ mTabList[which]->mButton->setEnabled(enable);
+ }
+}
+
+void LLTabContainer::deleteAllTabs()
{
// Remove all the tab buttons and delete them. Also, unlink all the child panels.
for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
@@ -229,56 +986,26 @@ void LLTabContainerCommon::deleteAllTabs()
mCurrentTabIdx = -1;
}
-
-LLPanel* LLTabContainerCommon::getCurrentPanel()
+LLPanel* LLTabContainer::getCurrentPanel()
{
- if (mCurrentTabIdx < 0 || mCurrentTabIdx >= (S32) mTabList.size()) return NULL;
-
- return mTabList[mCurrentTabIdx]->mTabPanel;
-}
-
-LLTabContainerCommon::LLTabTuple* LLTabContainerCommon::getTabByPanel(LLPanel* child)
-{
- for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ if (mCurrentTabIdx >= 0 && mCurrentTabIdx < (S32) mTabList.size())
{
- LLTabTuple* tuple = *iter;
- if( tuple->mTabPanel == child )
- {
- return tuple;
- }
+ return mTabList[mCurrentTabIdx]->mTabPanel;
}
return NULL;
}
-void LLTabContainerCommon::setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*, bool))
-{
- LLTabTuple* tuplep = getTabByPanel(tab);
- if (tuplep)
- {
- tuplep->mOnChangeCallback = on_tab_clicked;
- }
-}
-
-void LLTabContainerCommon::setTabUserData(LLPanel* tab, void* userdata)
-{
- LLTabTuple* tuplep = getTabByPanel(tab);
- if (tuplep)
- {
- tuplep->mUserData = userdata;
- }
-}
-
-S32 LLTabContainerCommon::getCurrentPanelIndex()
+S32 LLTabContainer::getCurrentPanelIndex()
{
return mCurrentTabIdx;
}
-S32 LLTabContainerCommon::getTabCount()
+S32 LLTabContainer::getTabCount()
{
return mTabList.size();
}
-LLPanel* LLTabContainerCommon::getPanelByIndex(S32 index)
+LLPanel* LLTabContainer::getPanelByIndex(S32 index)
{
if (index >= 0 && index < (S32)mTabList.size())
{
@@ -287,7 +1014,7 @@ LLPanel* LLTabContainerCommon::getPanelByIndex(S32 index)
return NULL;
}
-S32 LLTabContainerCommon::getIndexForPanel(LLPanel* panel)
+S32 LLTabContainer::getIndexForPanel(LLPanel* panel)
{
for (S32 index = 0; index < (S32)mTabList.size(); index++)
{
@@ -299,7 +1026,7 @@ S32 LLTabContainerCommon::getIndexForPanel(LLPanel* panel)
return -1;
}
-S32 LLTabContainerCommon::getPanelIndexByTitle(const LLString& title)
+S32 LLTabContainer::getPanelIndexByTitle(const LLString& title)
{
for (S32 index = 0 ; index < (S32)mTabList.size(); index++)
{
@@ -311,7 +1038,7 @@ S32 LLTabContainerCommon::getPanelIndexByTitle(const LLString& title)
return -1;
}
-LLPanel *LLTabContainerCommon::getPanelByName(const LLString& name)
+LLPanel *LLTabContainer::getPanelByName(const LLString& name)
{
for (S32 index = 0 ; index < (S32)mTabList.size(); index++)
{
@@ -324,34 +1051,71 @@ LLPanel *LLTabContainerCommon::getPanelByName(const LLString& name)
return NULL;
}
+// Change the name of the button for the current tab.
+void LLTabContainer::setCurrentTabName(const LLString& name)
+{
+ // Might not have a tab selected
+ if (mCurrentTabIdx < 0) return;
+
+ mTabList[mCurrentTabIdx]->mButton->setLabelSelected(name);
+ mTabList[mCurrentTabIdx]->mButton->setLabelUnselected(name);
+}
-void LLTabContainerCommon::scrollNext()
+void LLTabContainer::selectFirstTab()
{
- // No wrap
- if( mScrollPos < mMaxScrollPos )
- {
- mScrollPos++;
- }
+ selectTab( 0 );
}
-void LLTabContainerCommon::scrollPrev()
+
+void LLTabContainer::selectLastTab()
{
- // No wrap
- if( mScrollPos > 0 )
+ selectTab( mTabList.size()-1 );
+}
+
+void LLTabContainer::selectNextTab()
+{
+ BOOL tab_has_focus = FALSE;
+ if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus())
+ {
+ tab_has_focus = TRUE;
+ }
+ S32 idx = mCurrentTabIdx+1;
+ if (idx >= (S32)mTabList.size())
+ idx = 0;
+ while (!selectTab(idx) && idx != mCurrentTabIdx)
{
- mScrollPos--;
+ idx = (idx + 1 ) % (S32)mTabList.size();
+ }
+
+ if (tab_has_focus)
+ {
+ mTabList[idx]->mButton->setFocus(TRUE);
}
}
-void LLTabContainerCommon::enableTabButton(S32 which, BOOL enable)
+void LLTabContainer::selectPrevTab()
{
- if (which >= 0 && which < (S32)mTabList.size())
+ BOOL tab_has_focus = FALSE;
+ if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus())
{
- mTabList[which]->mButton->setEnabled(enable);
+ tab_has_focus = TRUE;
}
-}
+ S32 idx = mCurrentTabIdx-1;
+ if (idx < 0)
+ idx = mTabList.size()-1;
+ while (!selectTab(idx) && idx != mCurrentTabIdx)
+ {
+ idx = idx - 1;
+ if (idx < 0)
+ idx = mTabList.size()-1;
+ }
+ if (tab_has_focus)
+ {
+ mTabList[idx]->mButton->setFocus(TRUE);
+ }
+}
-BOOL LLTabContainerCommon::selectTabPanel(LLPanel* child)
+BOOL LLTabContainer::selectTabPanel(LLPanel* child)
{
S32 idx = 0;
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
@@ -366,12 +1130,108 @@ BOOL LLTabContainerCommon::selectTabPanel(LLPanel* child)
return FALSE;
}
-BOOL LLTabContainerCommon::selectTabByName(const LLString& name)
+BOOL LLTabContainer::selectTab(S32 which)
+{
+ if (which >= getTabCount()) return FALSE;
+ if (which < 0) return FALSE;
+
+ //if( gFocusMgr.childHasKeyboardFocus( this ) )
+ //{
+ // gFocusMgr.setKeyboardFocus( NULL );
+ //}
+
+ LLTabTuple* selected_tuple = getTab(which);
+ if (!selected_tuple)
+ {
+ return FALSE;
+ }
+
+ BOOL is_visible = FALSE;
+ if (getTab(which)->mButton->getEnabled())
+ {
+ setCurrentPanelIndex(which);
+
+ S32 i = 0;
+ for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ {
+ LLTabTuple* tuple = *iter;
+ BOOL is_selected = ( tuple == selected_tuple );
+ tuple->mTabPanel->setVisible( is_selected );
+// tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here.
+ tuple->mButton->setToggleState( is_selected );
+ // RN: this limits tab-stops to active button only, which would require arrow keys to switch tabs
+ tuple->mButton->setTabStop( is_selected );
+
+ if( is_selected && (mIsVertical || (getMaxScrollPos() > 0)))
+ {
+ // Make sure selected tab is within scroll region
+ if (mIsVertical)
+ {
+ S32 num_visible = getTabCount() - getMaxScrollPos();
+ if( i >= getScrollPos() && i <= getScrollPos() + num_visible)
+ {
+ setCurrentPanelIndex(which);
+ is_visible = TRUE;
+ }
+ else
+ {
+ is_visible = FALSE;
+ }
+ }
+ else
+ {
+ if( i < getScrollPos() )
+ {
+ setScrollPos(i);
+ }
+ else
+ {
+ S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
+ S32 running_tab_width = tuple->mButton->getRect().getWidth();
+ S32 j = i - 1;
+ S32 min_scroll_pos = i;
+ if (running_tab_width < available_width_with_arrows)
+ {
+ while (j >= 0)
+ {
+ LLTabTuple* other_tuple = getTab(j);
+ running_tab_width += other_tuple->mButton->getRect().getWidth();
+ if (running_tab_width > available_width_with_arrows)
+ {
+ break;
+ }
+ j--;
+ }
+ min_scroll_pos = j + 1;
+ }
+ setScrollPos(llclamp(getScrollPos(), min_scroll_pos, i));
+ setScrollPos(llmin(getScrollPos(), getMaxScrollPos()));
+ }
+ is_visible = TRUE;
+ }
+ }
+ i++;
+ }
+ if( selected_tuple->mOnChangeCallback )
+ {
+ selected_tuple->mOnChangeCallback( selected_tuple->mUserData, false );
+ }
+ }
+ if (mIsVertical && getCurrentPanelIndex() >= 0)
+ {
+ LLTabTuple* tuple = getTab(getCurrentPanelIndex());
+ tuple->mTabPanel->setVisible( TRUE );
+ tuple->mButton->setToggleState( TRUE );
+ }
+ return is_visible;
+}
+
+BOOL LLTabContainer::selectTabByName(const LLString& name)
{
LLPanel* panel = getPanelByName(name);
if (!panel)
{
- llwarns << "LLTabContainerCommon::selectTabByName("
+ llwarns << "LLTabContainer::selectTabByName("
<< name << ") failed" << llendl;
return FALSE;
}
@@ -380,74 +1240,131 @@ BOOL LLTabContainerCommon::selectTabByName(const LLString& name)
return result;
}
-
-void LLTabContainerCommon::selectFirstTab()
+BOOL LLTabContainer::getTabPanelFlashing(LLPanel *child)
{
- selectTab( 0 );
+ LLTabTuple* tuple = getTabByPanel(child);
+ if( tuple )
+ {
+ return tuple->mButton->getFlashing();
+ }
+ return FALSE;
}
-
-void LLTabContainerCommon::selectLastTab()
+void LLTabContainer::setTabPanelFlashing(LLPanel* child, BOOL state )
{
- selectTab( mTabList.size()-1 );
+ LLTabTuple* tuple = getTabByPanel(child);
+ if( tuple )
+ {
+ tuple->mButton->setFlashing( state );
+ }
}
-
-void LLTabContainerCommon::selectNextTab()
+void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const LLColor4& color)
{
- BOOL tab_has_focus = FALSE;
- if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus())
- {
- tab_has_focus = TRUE;
- }
- S32 idx = mCurrentTabIdx+1;
- if (idx >= (S32)mTabList.size())
- idx = 0;
- while (!selectTab(idx) && idx != mCurrentTabIdx)
+ LLTabTuple* tuple = getTabByPanel(child);
+ if( tuple )
{
- idx = (idx + 1 ) % (S32)mTabList.size();
+ tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT, color);
+
+ if (!mIsVertical)
+ {
+ const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
+ // remove current width from total tab strip width
+ mTotalTabWidth -= tuple->mButton->getRect().getWidth();
+
+ S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ?
+ tuple->mButton->getImageOverlay()->getImage()->getWidth(0) :
+ 0;
+
+ tuple->mPadding = image_overlay_width;
+
+ tuple->mButton->setRightHPad(6);
+ tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth),
+ tuple->mButton->getRect().getHeight());
+ // add back in button width to total tab strip width
+ mTotalTabWidth += tuple->mButton->getRect().getWidth();
+
+ // tabs have changed size, might need to scroll to see current tab
+ updateMaxScrollPos();
+ }
}
+}
- if (tab_has_focus)
+void LLTabContainer::setTitle(const LLString& title)
+{
+ if (mTitleBox)
{
- mTabList[idx]->mButton->setFocus(TRUE);
+ mTitleBox->setText( title );
}
}
-void LLTabContainerCommon::selectPrevTab()
+const LLString LLTabContainer::getPanelTitle(S32 index)
{
- BOOL tab_has_focus = FALSE;
- if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus())
+ if (index >= 0 && index < (S32)mTabList.size())
{
- tab_has_focus = TRUE;
+ LLButton* tab_button = mTabList[index]->mButton;
+ return tab_button->getLabelSelected();
}
- S32 idx = mCurrentTabIdx-1;
- if (idx < 0)
- idx = mTabList.size()-1;
- while (!selectTab(idx) && idx != mCurrentTabIdx)
+ return LLString::null;
+}
+
+void LLTabContainer::setTopBorderHeight(S32 height)
+{
+ mTopBorderHeight = height;
+}
+
+S32 LLTabContainer::getTopBorderHeight() const
+{
+ return mTopBorderHeight;
+}
+
+void LLTabContainer::setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*, bool))
+{
+ LLTabTuple* tuplep = getTabByPanel(tab);
+ if (tuplep)
{
- idx = idx - 1;
- if (idx < 0)
- idx = mTabList.size()-1;
+ tuplep->mOnChangeCallback = on_tab_clicked;
}
- if (tab_has_focus)
+}
+
+void LLTabContainer::setTabUserData(LLPanel* tab, void* userdata)
+{
+ LLTabTuple* tuplep = getTabByPanel(tab);
+ if (tuplep)
{
- mTabList[idx]->mButton->setFocus(TRUE);
+ tuplep->mUserData = userdata;
}
-}
+}
+void LLTabContainer::setRightTabBtnOffset(S32 offset)
+{
+ mNextArrowBtn->translate( -offset - mRightTabBtnOffset, 0 );
+ mRightTabBtnOffset = offset;
+ updateMaxScrollPos();
+}
-void LLTabContainerCommon::reshape(S32 width, S32 height, BOOL called_from_parent)
+void LLTabContainer::setPanelTitle(S32 index, const LLString& title)
{
- LLPanel::reshape( width, height, called_from_parent );
+ if (index >= 0 && index < getTabCount())
+ {
+ LLTabTuple* tuple = getTab(index);
+ LLButton* tab_button = tuple->mButton;
+ const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
+ mTotalTabWidth -= tab_button->getRect().getWidth();
+ tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
+ mTotalTabWidth += tab_button->getRect().getWidth();
+ tab_button->setLabelSelected(title);
+ tab_button->setLabelUnselected(title);
+ }
updateMaxScrollPos();
}
+
// static
-void LLTabContainerCommon::onTabBtn( void* userdata )
+void LLTabContainer::onTabBtn( void* userdata )
{
LLTabTuple* tuple = (LLTabTuple*) userdata;
- LLTabContainerCommon* self = tuple->mTabContainer;
+ LLTabContainer* self = tuple->mTabContainer;
self->selectTabPanel( tuple->mTabPanel );
if( tuple->mOnChangeCallback )
@@ -459,7 +1376,7 @@ void LLTabContainerCommon::onTabBtn( void* userdata )
}
// static
-void LLTabContainerCommon::onCloseBtn( void* userdata )
+void LLTabContainer::onCloseBtn( void* userdata )
{
LLTabContainer* self = (LLTabContainer*) userdata;
if( self->mCloseCallback )
@@ -469,7 +1386,7 @@ void LLTabContainerCommon::onCloseBtn( void* userdata )
}
// static
-void LLTabContainerCommon::onNextBtn( void* userdata )
+void LLTabContainer::onNextBtn( void* userdata )
{
// Scroll tabs to the left
LLTabContainer* self = (LLTabContainer*) userdata;
@@ -481,7 +1398,7 @@ void LLTabContainerCommon::onNextBtn( void* userdata )
}
// static
-void LLTabContainerCommon::onNextBtnHeld( void* userdata )
+void LLTabContainer::onNextBtnHeld( void* userdata )
{
LLTabContainer* self = (LLTabContainer*) userdata;
if (self->mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME)
@@ -493,7 +1410,7 @@ void LLTabContainerCommon::onNextBtnHeld( void* userdata )
}
// static
-void LLTabContainerCommon::onPrevBtn( void* userdata )
+void LLTabContainer::onPrevBtn( void* userdata )
{
LLTabContainer* self = (LLTabContainer*) userdata;
if (!self->mScrolled)
@@ -503,26 +1420,22 @@ void LLTabContainerCommon::onPrevBtn( void* userdata )
self->mScrolled = FALSE;
}
-
-void LLTabContainerCommon::onJumpFirstBtn( void* userdata )
+// static
+void LLTabContainer::onJumpFirstBtn( void* userdata )
{
LLTabContainer* self = (LLTabContainer*) userdata;
-
self->mScrollPos = 0;
-
}
-
-void LLTabContainerCommon::onJumpLastBtn( void* userdata )
+// static
+void LLTabContainer::onJumpLastBtn( void* userdata )
{
LLTabContainer* self = (LLTabContainer*) userdata;
-
self->mScrollPos = self->mMaxScrollPos;
}
-
// static
-void LLTabContainerCommon::onPrevBtnHeld( void* userdata )
+void LLTabContainer::onPrevBtnHeld( void* userdata )
{
LLTabContainer* self = (LLTabContainer*) userdata;
if (self->mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME)
@@ -533,68 +1446,8 @@ void LLTabContainerCommon::onPrevBtnHeld( void* userdata )
}
}
-BOOL LLTabContainerCommon::getTabPanelFlashing(LLPanel *child)
-{
- LLTabTuple* tuple = getTabByPanel(child);
- if( tuple )
- {
- return tuple->mButton->getFlashing();
- }
- return FALSE;
-}
-
-void LLTabContainerCommon::setTabPanelFlashing(LLPanel* child, BOOL state )
-{
- LLTabTuple* tuple = getTabByPanel(child);
- if( tuple )
- {
- tuple->mButton->setFlashing( state );
- }
-}
-
-void LLTabContainerCommon::setTabImage(LLPanel* child, std::string img_name, const LLColor4& color)
-{
- LLTabTuple* tuple = getTabByPanel(child);
- if( tuple )
- {
- tuple->mButton->setImageOverlay(img_name, LLFontGL::RIGHT, color);
- }
-}
-
-void LLTabContainerCommon::setTitle(const LLString& title)
-{
- if (mTitleBox)
- {
- mTitleBox->setText( title );
- }
-}
-
-const LLString LLTabContainerCommon::getPanelTitle(S32 index)
-{
- if (index >= 0 && index < (S32)mTabList.size())
- {
- LLButton* tab_button = mTabList[index]->mButton;
- return tab_button->getLabelSelected();
- }
- return LLString::null;
-}
-
-void LLTabContainerCommon::setTopBorderHeight(S32 height)
-{
- mTopBorderHeight = height;
-}
-
-// Change the name of the button for the current tab.
-void LLTabContainerCommon::setCurrentTabName(const LLString& name)
-{
- // Might not have a tab selected
- if (mCurrentTabIdx < 0) return;
-
- mTabList[mCurrentTabIdx]->mButton->setLabelSelected(name);
- mTabList[mCurrentTabIdx]->mButton->setLabelUnselected(name);
-}
-
-LLView* LLTabContainerCommon::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
+// static
+LLView* LLTabContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
LLString name("tab_container");
node->getAttributeString("name", name);
@@ -626,58 +1479,30 @@ LLView* LLTabContainerCommon::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtr
BOOL border = FALSE;
node->getAttributeBOOL("border", border);
- // Create the correct container type.
- LLTabContainerCommon* tab_container = NULL;
-
- if (is_vertical)
+ LLTabContainer* tab_container = new LLTabContainer(name, LLRect::null, tab_position, border, is_vertical);
+
+ S32 tab_min_width = tab_container->mMinTabWidth;
+ if (node->hasAttribute("tab_width"))
{
- // Vertical tabs can specify tab width
- U32 tab_width = TABCNTRV_TAB_WIDTH;
- if (node->hasAttribute("tab_width"))
- {
- node->getAttributeU32("tab_width", tab_width);
- }
-
- tab_container = new LLTabContainerVertical(name,
- LLRect::null,
- NULL,
- NULL,
- tab_width,
- border);
-
+ node->getAttributeS32("tab_width", tab_min_width);
}
- else // horizontal tab container
+ else if( node->hasAttribute("tab_min_width"))
{
- // Horizontal tabs can have a title (?)
- LLString title(LLString::null);
- if (node->hasAttribute("title"))
- {
- node->getAttributeString("title", title);
- }
+ node->getAttributeS32("tab_min_width", tab_min_width);
+ }
- tab_container = new LLTabContainer(name,
- LLRect::null,
- tab_position,
- NULL,
- NULL,
- title,
- border);
-
- if(node->hasAttribute("tab_min_width"))
- {
- S32 minTabWidth=0;
- node->getAttributeS32("tab_min_width",minTabWidth);
- ((LLTabContainer*)tab_container)->setMinTabWidth(minTabWidth);
- }
- if(node->hasAttribute("tab_max_width"))
- {
- S32 maxTabWidth=0;
- node->getAttributeS32("tab_max_width",maxTabWidth);
- ((LLTabContainer*)tab_container)->setMaxTabWidth(maxTabWidth);
- }
+ S32 tab_max_width = tab_container->mMaxTabWidth;
+ if (node->hasAttribute("tab_max_width"))
+ {
+ node->getAttributeS32("tab_max_width", tab_max_width);
}
+
+ tab_container->setMinTabWidth(tab_min_width);
+ tab_container->setMaxTabWidth(tab_max_width);
- node->getAttributeBOOL("hide_tabs", tab_container->mTabsHidden);
+ BOOL hidden(tab_container->getTabsHidden());
+ node->getAttributeBOOL("hide_tabs", hidden);
+ tab_container->setTabsHidden(hidden);
tab_container->setPanelParameters(node, parent);
@@ -718,76 +1543,12 @@ LLView* LLTabContainerCommon::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtr
return tab_container;
}
-void LLTabContainerCommon::insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point)
-{
- switch(insertion_point)
- {
- case START:
- // insert the new tab in the front of the list
- mTabList.insert(mTabList.begin() + mLockedTabCount, tuple);
- break;
- case LEFT_OF_CURRENT:
- // insert the new tab before the current tab (but not before mLockedTabCount)
- {
- tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx);
- mTabList.insert(current_iter, tuple);
- }
- break;
-
- case RIGHT_OF_CURRENT:
- // insert the new tab after the current tab (but not before mLockedTabCount)
- {
- tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx + 1);
- mTabList.insert(current_iter, tuple);
- }
- break;
- case END:
- default:
- mTabList.push_back( tuple );
- }
-}
-
-
-LLTabContainer::LLTabContainer(
- const LLString& name, const LLRect& rect, TabPosition pos,
- void(*close_callback)(void*), void* callback_userdata,
- const LLString& title, BOOL bordered )
- :
- LLTabContainerCommon(name, rect, pos, close_callback, callback_userdata, bordered),
- mLeftArrowBtn(NULL),
- mJumpLeftArrowBtn(NULL),
- mRightArrowBtn(NULL),
- mJumpRightArrowBtn(NULL),
- mRightTabBtnOffset(0),
- mMinTabWidth(TABCNTR_TAB_MIN_WIDTH),
- mMaxTabWidth(TABCNTR_TAB_MAX_WIDTH),
- mTotalTabWidth(0)
-{
- initButtons( );
-}
-
-LLTabContainer::LLTabContainer(
- const LLString& name, const LLString& rect_control, TabPosition pos,
- void(*close_callback)(void*), void* callback_userdata,
- const LLString& title, BOOL bordered )
- :
- LLTabContainerCommon(name, rect_control, pos, close_callback, callback_userdata, bordered),
- mLeftArrowBtn(NULL),
- mJumpLeftArrowBtn(NULL),
- mRightArrowBtn(NULL),
- mJumpRightArrowBtn(NULL),
- mRightTabBtnOffset(0),
- mMinTabWidth(TABCNTR_TAB_MIN_WIDTH),
- mMaxTabWidth(TABCNTR_TAB_MAX_WIDTH),
- mTotalTabWidth(0)
-{
- initButtons( );
-}
+// private
void LLTabContainer::initButtons()
{
// Hack:
- if (mRect.getHeight() == 0 || mLeftArrowBtn)
+ if (getRect().getHeight() == 0 || mPrevArrowBtn)
{
return; // Don't have a rect yet or already got called
}
@@ -795,881 +1556,255 @@ void LLTabContainer::initButtons()
LLString out_id;
LLString in_id;
- S32 arrow_fudge = 1; // match new art better
-
- // tabs on bottom reserve room for resize handle (just in case)
- if (mTabPosition == BOTTOM)
+ if (mIsVertical)
{
- mRightTabBtnOffset = RESIZE_HANDLE_WIDTH;
- }
-
- // Left and right scroll arrows (for when there are too many tabs to show all at once).
- S32 btn_top = (mTabPosition == TOP ) ? mRect.getHeight() - mTopBorderHeight : TABCNTR_ARROW_BTN_SIZE + 1;
-
- LLRect left_arrow_btn_rect;
- left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1+TABCNTR_ARROW_BTN_SIZE, btn_top + arrow_fudge, TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
-
- LLRect jump_left_arrow_btn_rect;
- jump_left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1, btn_top + arrow_fudge, TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
-
- S32 right_pad = TABCNTR_ARROW_BTN_SIZE + LLPANEL_BORDER_WIDTH + 1;
-
- LLRect right_arrow_btn_rect;
- right_arrow_btn_rect.setLeftTopAndSize( mRect.getWidth() - mRightTabBtnOffset - right_pad - TABCNTR_ARROW_BTN_SIZE,
- btn_top + arrow_fudge,
- TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
+ // Left and right scroll arrows (for when there are too many tabs to show all at once).
+ S32 btn_top = getRect().getHeight();
+ S32 btn_top_lower = getRect().mBottom+TABCNTRV_ARROW_BTN_SIZE;
+ LLRect up_arrow_btn_rect;
+ up_arrow_btn_rect.setLeftTopAndSize( mMinTabWidth/2 , btn_top, TABCNTRV_ARROW_BTN_SIZE, TABCNTRV_ARROW_BTN_SIZE );
- LLRect jump_right_arrow_btn_rect;
- jump_right_arrow_btn_rect.setLeftTopAndSize( mRect.getWidth() - mRightTabBtnOffset - right_pad,
- btn_top + arrow_fudge,
- TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
+ LLRect down_arrow_btn_rect;
+ down_arrow_btn_rect.setLeftTopAndSize( mMinTabWidth/2 , btn_top_lower, TABCNTRV_ARROW_BTN_SIZE, TABCNTRV_ARROW_BTN_SIZE );
- out_id = "UIImgBtnJumpLeftOutUUID";
- in_id = "UIImgBtnJumpLeftInUUID";
- mJumpLeftArrowBtn = new LLButton(
- "Jump Left Arrow", jump_left_arrow_btn_rect,
- out_id, in_id, "",
- &LLTabContainer::onJumpFirstBtn, this, LLFontGL::sSansSerif );
- mJumpLeftArrowBtn->setFollowsLeft();
- mJumpLeftArrowBtn->setSaveToXML(false);
- mJumpLeftArrowBtn->setTabStop(FALSE);
- addChild(mJumpLeftArrowBtn);
+ out_id = "UIImgBtnScrollUpOutUUID";
+ in_id = "UIImgBtnScrollUpInUUID";
+ mPrevArrowBtn = new LLButton("Up Arrow", up_arrow_btn_rect,
+ out_id, in_id, "",
+ &onPrevBtn, this, NULL );
+ mPrevArrowBtn->setFollowsTop();
+ mPrevArrowBtn->setFollowsLeft();
- out_id = "UIImgBtnScrollLeftOutUUID";
- in_id = "UIImgBtnScrollLeftInUUID";
- mLeftArrowBtn = new LLButton(
- "Left Arrow", left_arrow_btn_rect,
- out_id, in_id, "",
- &LLTabContainer::onPrevBtn, this, LLFontGL::sSansSerif );
- mLeftArrowBtn->setHeldDownCallback(onPrevBtnHeld);
- mLeftArrowBtn->setFollowsLeft();
- mLeftArrowBtn->setSaveToXML(false);
- mLeftArrowBtn->setTabStop(FALSE);
- addChild(mLeftArrowBtn);
-
- out_id = "UIImgBtnJumpRightOutUUID";
- in_id = "UIImgBtnJumpRightInUUID";
- mJumpRightArrowBtn = new LLButton(
- "Jump Right Arrow", jump_right_arrow_btn_rect,
- out_id, in_id, "",
- &LLTabContainer::onJumpLastBtn, this,
- LLFontGL::sSansSerif);
- mJumpRightArrowBtn->setFollowsRight();
- mJumpRightArrowBtn->setSaveToXML(false);
- mJumpRightArrowBtn->setTabStop(FALSE);
- addChild(mJumpRightArrowBtn);
-
- out_id = "UIImgBtnScrollRightOutUUID";
- in_id = "UIImgBtnScrollRightInUUID";
- mRightArrowBtn = new LLButton(
- "Right Arrow", right_arrow_btn_rect,
- out_id, in_id, "",
- &LLTabContainer::onNextBtn, this,
- LLFontGL::sSansSerif);
- mRightArrowBtn->setFollowsRight();
- mRightArrowBtn->setHeldDownCallback(onNextBtnHeld);
- mRightArrowBtn->setSaveToXML(false);
- mRightArrowBtn->setTabStop(FALSE);
- addChild(mRightArrowBtn);
-
-
- if( mTabPosition == TOP )
- {
- mRightArrowBtn->setFollowsTop();
- mLeftArrowBtn->setFollowsTop();
- mJumpLeftArrowBtn->setFollowsTop();
- mJumpRightArrowBtn->setFollowsTop();
+ out_id = "UIImgBtnScrollDownOutUUID";
+ in_id = "UIImgBtnScrollDownInUUID";
+ mNextArrowBtn = new LLButton("Down Arrow", down_arrow_btn_rect,
+ out_id, in_id, "",
+ &onNextBtn, this, NULL );
+ mNextArrowBtn->setFollowsBottom();
+ mNextArrowBtn->setFollowsLeft();
}
- else
+ else // Horizontal
{
- mRightArrowBtn->setFollowsBottom();
- mLeftArrowBtn->setFollowsBottom();
- mJumpLeftArrowBtn->setFollowsBottom();
- mJumpRightArrowBtn->setFollowsBottom();
- }
-
- // set default tab group to be panel contents
- mDefaultTabGroup = 1;
-}
+ S32 arrow_fudge = 1; // match new art better
-LLTabContainer::~LLTabContainer()
-{
-}
-
-void LLTabContainer::addTabPanel(LLPanel* child,
- const LLString& label,
- BOOL select,
- void (*on_tab_clicked)(void*, bool),
- void* userdata,
- S32 indent,
- BOOL placeholder,
- eInsertionPoint insertion_point)
-{
- if (child->getParent() == this)
- {
- // already a child of mine
- return;
- }
- const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
+ // tabs on bottom reserve room for resize handle (just in case)
+ if (getTabPosition() == BOTTOM)
+ {
+ mRightTabBtnOffset = RESIZE_HANDLE_WIDTH;
+ }
- // Store the original label for possible xml export.
- child->setLabel(label);
- LLString trimmed_label = label;
- LLString::trim(trimmed_label);
+ // Left and right scroll arrows (for when there are too many tabs to show all at once).
+ S32 btn_top = (getTabPosition() == TOP ) ? getRect().getHeight() - getTopBorderHeight() : TABCNTR_ARROW_BTN_SIZE + 1;
- S32 button_width = llclamp(font->getWidth(trimmed_label) + TAB_PADDING, mMinTabWidth, mMaxTabWidth);
+ LLRect left_arrow_btn_rect;
+ left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1+TABCNTR_ARROW_BTN_SIZE, btn_top + arrow_fudge, TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
- // Tab panel
- S32 tab_panel_top;
- S32 tab_panel_bottom;
- if( LLTabContainer::TOP == mTabPosition )
- {
- tab_panel_top = mRect.getHeight() - mTopBorderHeight - (TABCNTR_TAB_HEIGHT - TABCNTR_BUTTON_PANEL_OVERLAP);
- tab_panel_bottom = LLPANEL_BORDER_WIDTH;
- }
- else
- {
- tab_panel_top = mRect.getHeight() - mTopBorderHeight;
- tab_panel_bottom = (TABCNTR_TAB_HEIGHT - TABCNTR_BUTTON_PANEL_OVERLAP); // Run to the edge, covering up the border
- }
-
- LLRect tab_panel_rect(
- LLPANEL_BORDER_WIDTH,
- tab_panel_top,
- mRect.getWidth()-LLPANEL_BORDER_WIDTH,
- tab_panel_bottom );
+ LLRect jump_left_arrow_btn_rect;
+ jump_left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1, btn_top + arrow_fudge, TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
- child->setFollowsAll();
- child->translate( tab_panel_rect.mLeft - child->getRect().mLeft, tab_panel_rect.mBottom - child->getRect().mBottom);
- child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE );
- child->setBackgroundVisible( FALSE ); // No need to overdraw
- // add this child later
+ S32 right_pad = TABCNTR_ARROW_BTN_SIZE + LLPANEL_BORDER_WIDTH + 1;
- child->setVisible( FALSE ); // Will be made visible when selected
+ LLRect right_arrow_btn_rect;
+ right_arrow_btn_rect.setLeftTopAndSize( getRect().getWidth() - mRightTabBtnOffset - right_pad - TABCNTR_ARROW_BTN_SIZE,
+ btn_top + arrow_fudge,
+ TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
- mTotalTabWidth += button_width;
- // Tab button
- LLRect btn_rect; // Note: btn_rect.mLeft is just a dummy. Will be updated in draw().
- LLString tab_img;
- LLString tab_selected_img;
- S32 tab_fudge = 1; // To make new tab art look better, nudge buttons up 1 pel
+ LLRect jump_right_arrow_btn_rect;
+ jump_right_arrow_btn_rect.setLeftTopAndSize( getRect().getWidth() - mRightTabBtnOffset - right_pad,
+ btn_top + arrow_fudge,
+ TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
- if( LLTabContainer::TOP == mTabPosition )
- {
- btn_rect.setLeftTopAndSize( 0, mRect.getHeight() - mTopBorderHeight + tab_fudge, button_width, TABCNTR_TAB_HEIGHT );
- tab_img = "tab_top_blue.tga";
- tab_selected_img = "tab_top_selected_blue.tga";
- }
- else
- {
- btn_rect.setOriginAndSize( 0, 0 + tab_fudge, button_width, TABCNTR_TAB_HEIGHT );
- tab_img = "tab_bottom_blue.tga";
- tab_selected_img = "tab_bottom_selected_blue.tga";
- }
+ out_id = "UIImgBtnJumpLeftOutUUID";
+ in_id = "UIImgBtnJumpLeftInUUID";
+ mJumpPrevArrowBtn = new LLButton("Jump Left Arrow", jump_left_arrow_btn_rect,
+ out_id, in_id, "",
+ &LLTabContainer::onJumpFirstBtn, this, LLFontGL::sSansSerif );
+ mJumpPrevArrowBtn->setFollowsLeft();
- if (placeholder)
- {
- // *FIX: wont work for horizontal tabs
- btn_rect.translate(0, -LLBUTTON_V_PAD-2);
- LLString box_label = trimmed_label;
- LLTextBox* text = new LLTextBox(box_label, btn_rect, box_label, font);
- addChild( text, 0 );
-
- LLButton* btn = new LLButton("", LLRect(0,0,0,0));
- LLTabTuple* tuple = new LLTabTuple( this, child, btn, on_tab_clicked, userdata, text );
- addChild( btn, 0 );
- addChild( child, 1 );
- insertTuple(tuple, insertion_point);
- }
- else
- {
- LLString tooltip = trimmed_label;
- tooltip += "\nAlt-Left arrow for previous tab";
- tooltip += "\nAlt-Right arrow for next tab";
-
- LLButton* btn = new LLButton(
- LLString(child->getName()) + " tab",
- btn_rect,
- "", "", "",
- &LLTabContainer::onTabBtn, NULL, // set userdata below
- font,
- trimmed_label, trimmed_label );
- btn->setSaveToXML(false);
- btn->setVisible( FALSE );
- btn->setToolTip( tooltip );
- btn->setScaleImage(TRUE);
- btn->setImages(tab_img, tab_selected_img);
-
- // Try to squeeze in a bit more text
- btn->setLeftHPad( 4 );
- btn->setRightHPad( 2 );
- btn->setHAlign(LLFontGL::LEFT);
- btn->setTabStop(FALSE);
- if (indent)
- {
- btn->setLeftHPad(indent);
- }
-
- if( mTabPosition == TOP )
+ out_id = "UIImgBtnScrollLeftOutUUID";
+ in_id = "UIImgBtnScrollLeftInUUID";
+ mPrevArrowBtn = new LLButton("Left Arrow", left_arrow_btn_rect,
+ out_id, in_id, "",
+ &LLTabContainer::onPrevBtn, this, LLFontGL::sSansSerif );
+ mPrevArrowBtn->setHeldDownCallback(onPrevBtnHeld);
+ mPrevArrowBtn->setFollowsLeft();
+
+ out_id = "UIImgBtnJumpRightOutUUID";
+ in_id = "UIImgBtnJumpRightInUUID";
+ mJumpNextArrowBtn = new LLButton("Jump Right Arrow", jump_right_arrow_btn_rect,
+ out_id, in_id, "",
+ &LLTabContainer::onJumpLastBtn, this,
+ LLFontGL::sSansSerif);
+ mJumpNextArrowBtn->setFollowsRight();
+
+ out_id = "UIImgBtnScrollRightOutUUID";
+ in_id = "UIImgBtnScrollRightInUUID";
+ mNextArrowBtn = new LLButton("Right Arrow", right_arrow_btn_rect,
+ out_id, in_id, "",
+ &LLTabContainer::onNextBtn, this,
+ LLFontGL::sSansSerif);
+ mNextArrowBtn->setFollowsRight();
+
+ if( getTabPosition() == TOP )
{
- btn->setFollowsTop();
+ mNextArrowBtn->setFollowsTop();
+ mPrevArrowBtn->setFollowsTop();
+ mJumpPrevArrowBtn->setFollowsTop();
+ mJumpNextArrowBtn->setFollowsTop();
}
else
{
- btn->setFollowsBottom();
+ mNextArrowBtn->setFollowsBottom();
+ mPrevArrowBtn->setFollowsBottom();
+ mJumpPrevArrowBtn->setFollowsBottom();
+ mJumpNextArrowBtn->setFollowsBottom();
}
-
- LLTabTuple* tuple = new LLTabTuple( this, child, btn, on_tab_clicked, userdata );
- btn->setCallbackUserData( tuple );
- addChild( btn, 0 );
- addChild( child, 1 );
- insertTuple(tuple, insertion_point);
}
- updateMaxScrollPos();
+ mPrevArrowBtn->setHeldDownCallback(onPrevBtnHeld);
+ mPrevArrowBtn->setSaveToXML(false);
+ mPrevArrowBtn->setTabStop(FALSE);
+ addChild(mPrevArrowBtn);
- if( select )
+ mNextArrowBtn->setHeldDownCallback(onNextBtnHeld);
+ mNextArrowBtn->setSaveToXML(false);
+ mNextArrowBtn->setTabStop(FALSE);
+ addChild(mNextArrowBtn);
+
+ if (mJumpPrevArrowBtn)
{
- selectLastTab();
+ mJumpPrevArrowBtn->setSaveToXML(false);
+ mJumpPrevArrowBtn->setTabStop(FALSE);
+ addChild(mJumpPrevArrowBtn);
}
+
+ if (mJumpNextArrowBtn)
+ {
+ mJumpNextArrowBtn->setSaveToXML(false);
+ mJumpNextArrowBtn->setTabStop(FALSE);
+ addChild(mJumpNextArrowBtn);
+ }
+
+ // set default tab group to be panel contents
+ setDefaultTabGroup(1);
}
-void LLTabContainer::removeTabPanel(LLPanel* child)
+LLTabContainer::LLTabTuple* LLTabContainer::getTabByPanel(LLPanel* child)
{
- // Adjust the total tab width.
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
if( tuple->mTabPanel == child )
{
- mTotalTabWidth -= tuple->mButton->getRect().getWidth();
- break;
+ return tuple;
}
}
-
- LLTabContainerCommon::removeTabPanel(child);
-}
-
-void LLTabContainer::setPanelTitle(S32 index, const LLString& title)
-{
- if (index >= 0 && index < (S32)mTabList.size())
- {
- LLTabTuple* tuple = mTabList[index];
- LLButton* tab_button = tuple->mButton;
- const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
- mTotalTabWidth -= tab_button->getRect().getWidth();
- tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
- mTotalTabWidth += tab_button->getRect().getWidth();
- tab_button->setLabelSelected(title);
- tab_button->setLabelUnselected(title);
- }
- updateMaxScrollPos();
+ return NULL;
}
-
-void LLTabContainer::updateMaxScrollPos()
+void LLTabContainer::insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point)
{
- S32 tab_space = 0;
- S32 available_space = 0;
- tab_space = mTotalTabWidth;
- available_space = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_TAB_H_PAD);
-
- if( tab_space > available_space )
+ switch(insertion_point)
{
- S32 available_width_with_arrows = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
- // subtract off reserved portion on left
- available_width_with_arrows -= TABCNTR_TAB_PARTIAL_WIDTH;
-
- S32 running_tab_width = 0;
- mMaxScrollPos = mTabList.size();
- for(tuple_list_t::reverse_iterator tab_it = mTabList.rbegin(); tab_it != mTabList.rend(); ++tab_it)
+ case START:
+ // insert the new tab in the front of the list
+ mTabList.insert(mTabList.begin() + mLockedTabCount, tuple);
+ break;
+ case LEFT_OF_CURRENT:
+ // insert the new tab before the current tab (but not before mLockedTabCount)
{
- running_tab_width += (*tab_it)->mButton->getRect().getWidth();
- if (running_tab_width > available_width_with_arrows)
- {
- break;
- }
- mMaxScrollPos--;
+ tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx);
+ mTabList.insert(current_iter, tuple);
}
- // in case last tab doesn't actually fit on screen, make it the last scrolling position
- mMaxScrollPos = llmin(mMaxScrollPos, (S32)mTabList.size() - 1);
- }
- else
- {
- mMaxScrollPos = 0;
- mScrollPos = 0;
- }
- if (mScrollPos > mMaxScrollPos)
- {
- mScrollPos = mMaxScrollPos;
- }
-}
+ break;
-void LLTabContainer::commitHoveredButton(S32 x, S32 y)
-{
- if (hasMouseCapture())
- {
- for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ case RIGHT_OF_CURRENT:
+ // insert the new tab after the current tab (but not before mLockedTabCount)
{
- 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();
- }
+ tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx + 1);
+ mTabList.insert(current_iter, tuple);
}
+ break;
+ case END:
+ default:
+ mTabList.push_back( tuple );
}
}
-void LLTabContainer::setMinTabWidth(S32 width)
-{
- mMinTabWidth = width;
-}
-
-void LLTabContainer::setMaxTabWidth(S32 width)
-{
- mMaxTabWidth = width;
-}
-
-S32 LLTabContainer::getMinTabWidth() const
-{
- return mMinTabWidth;
-}
-S32 LLTabContainer::getMaxTabWidth() const
-{
- return mMaxTabWidth;
-}
-BOOL LLTabContainer::selectTab(S32 which)
+void LLTabContainer::updateMaxScrollPos()
{
- if (which >= (S32)mTabList.size()) return FALSE;
- if (which < 0) return FALSE;
-
- //if( gFocusMgr.childHasKeyboardFocus( this ) )
- //{
- // gFocusMgr.setKeyboardFocus( NULL );
- //}
-
- LLTabTuple* selected_tuple = mTabList[which];
- if (!selected_tuple)
- {
- return FALSE;
- }
-
- if (mTabList[which]->mButton->getEnabled())
+ BOOL no_scroll = TRUE;
+ if (mIsVertical)
{
- mCurrentTabIdx = which;
-
- S32 i = 0;
- for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ S32 tab_total_height = (BTN_HEIGHT + TABCNTRV_PAD) * getTabCount();
+ S32 available_height = getRect().getHeight() - getTopBorderHeight();
+ if( tab_total_height > available_height )
{
- LLTabTuple* tuple = *iter;
- BOOL is_selected = ( tuple == selected_tuple );
- tuple->mTabPanel->setVisible( is_selected );
-// tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here.
- tuple->mButton->setToggleState( is_selected );
- // RN: this limits tab-stops to active button only, which would require arrow keys to switch tabs
- tuple->mButton->setTabStop( is_selected );
-
- if( is_selected && mMaxScrollPos > 0)
- {
- // Make sure selected tab is within scroll region
- if( i < mScrollPos )
- {
- mScrollPos = i;
- }
- else
- {
- S32 available_width_with_arrows = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
- S32 running_tab_width = tuple->mButton->getRect().getWidth();
- S32 j = i - 1;
- S32 min_scroll_pos = i;
- if (running_tab_width < available_width_with_arrows)
- {
- while (j >= 0)
- {
- LLTabTuple* other_tuple = mTabList[j];
- running_tab_width += other_tuple->mButton->getRect().getWidth();
- if (running_tab_width > available_width_with_arrows)
- {
- break;
- }
- j--;
- }
- min_scroll_pos = j + 1;
- }
- mScrollPos = llclamp(mScrollPos, min_scroll_pos, i);
- mScrollPos = llmin(mScrollPos, mMaxScrollPos);
- }
- }
- i++;
- }
- if( selected_tuple->mOnChangeCallback )
- {
- selected_tuple->mOnChangeCallback( selected_tuple->mUserData, false );
+ S32 available_height_with_arrows = getRect().getHeight() - 2*(TABCNTRV_ARROW_BTN_SIZE + 3*TABCNTRV_PAD);
+ S32 additional_needed = tab_total_height - available_height_with_arrows;
+ setMaxScrollPos((S32) ceil(additional_needed / float(BTN_HEIGHT) ) );
+ no_scroll = FALSE;
}
- return TRUE;
}
else
{
- return FALSE;
- }
-}
+ S32 tab_space = 0;
+ S32 available_space = 0;
+ tab_space = mTotalTabWidth;
+ available_space = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_TAB_H_PAD);
-void LLTabContainer::draw()
-{
- S32 target_pixel_scroll = 0;
- S32 cur_scroll_pos = mScrollPos;
- if (cur_scroll_pos > 0)
- {
- S32 available_width_with_arrows = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
- for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
+ if( tab_space > available_space )
{
- if (cur_scroll_pos == 0)
- {
- break;
- }
- target_pixel_scroll += (*iter)->mButton->getRect().getWidth();
- cur_scroll_pos--;
- }
+ S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
+ // subtract off reserved portion on left
+ available_width_with_arrows -= TABCNTR_TAB_PARTIAL_WIDTH;
- // Show part of the tab to the left of what is fully visible
- target_pixel_scroll -= TABCNTR_TAB_PARTIAL_WIDTH;
- // clamp so that rightmost tab never leaves right side of screen
- target_pixel_scroll = llmin(mTotalTabWidth - available_width_with_arrows, target_pixel_scroll);
- }
-
- mScrollPosPixels = (S32)lerp((F32)mScrollPosPixels, (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f));
- if( getVisible() )
- {
- BOOL has_scroll_arrows = (mMaxScrollPos > 0) || (mScrollPosPixels > 0);
- mJumpLeftArrowBtn->setVisible( has_scroll_arrows );
- mJumpRightArrowBtn->setVisible( has_scroll_arrows );
- mLeftArrowBtn->setVisible( has_scroll_arrows );
- mRightArrowBtn->setVisible( has_scroll_arrows );
-
- // Set the leftmost position of the tab buttons.
- S32 left = LLPANEL_BORDER_WIDTH + (has_scroll_arrows ? (TABCNTR_ARROW_BTN_SIZE * 2) : TABCNTR_TAB_H_PAD);
- left -= mScrollPosPixels;
-
- // Hide all the buttons
- for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
- {
- LLTabTuple* tuple = *iter;
- tuple->mButton->setVisible( FALSE );
- }
-
- LLPanel::draw();
-
- // if tabs are hidden, don't draw them and leave them in the invisible state
- if (!mTabsHidden)
- {
- // Show all the buttons
- for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
- {
- LLTabTuple* tuple = *iter;
- tuple->mButton->setVisible( TRUE );
- }
-
- // Draw some of the buttons...
- LLRect clip_rect = getLocalRect();
- if (has_scroll_arrows)
+ S32 running_tab_width = 0;
+ setMaxScrollPos(getTabCount());
+ for(tuple_list_t::reverse_iterator tab_it = mTabList.rbegin(); tab_it != mTabList.rend(); ++tab_it)
{
- // ...but clip them.
- clip_rect.mLeft = mLeftArrowBtn->getRect().mRight;
- clip_rect.mRight = mRightArrowBtn->getRect().mLeft;
- }
- LLLocalClipRect clip(clip_rect);
-
- S32 max_scroll_visible = mTabList.size() - mMaxScrollPos + mScrollPos;
- S32 idx = 0;
- for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
- {
- LLTabTuple* tuple = *iter;
-
- tuple->mButton->translate( left - tuple->mButton->getRect().mLeft, 0 );
- left += tuple->mButton->getRect().getWidth();
-
- if( idx < mScrollPos )
- {
- if( tuple->mButton->getFlashing() )
- {
- mLeftArrowBtn->setFlashing( TRUE );
- }
- }
- else
- if( max_scroll_visible < idx )
+ running_tab_width += (*tab_it)->mButton->getRect().getWidth();
+ if (running_tab_width > available_width_with_arrows)
{
- if( tuple->mButton->getFlashing() )
- {
- mRightArrowBtn->setFlashing( TRUE );
- }
- }
-
- LLUI::pushMatrix();
- {
- LLUI::translate((F32)tuple->mButton->getRect().mLeft, (F32)tuple->mButton->getRect().mBottom, 0.f);
- tuple->mButton->draw();
+ break;
}
- LLUI::popMatrix();
-
- idx++;
+ setMaxScrollPos(getMaxScrollPos()-1);
}
+ // in case last tab doesn't actually fit on screen, make it the last scrolling position
+ setMaxScrollPos(llmin(getMaxScrollPos(), getTabCount() - 1));
+ no_scroll = FALSE;
}
-
- mLeftArrowBtn->setFlashing(FALSE);
- mRightArrowBtn->setFlashing(FALSE);
}
-}
-
-
-void LLTabContainer::setRightTabBtnOffset(S32 offset)
-{
- mRightArrowBtn->translate( -offset - mRightTabBtnOffset, 0 );
- mRightTabBtnOffset = offset;
- updateMaxScrollPos();
-}
-
-BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask )
-{
- BOOL handled = FALSE;
- BOOL has_scroll_arrows = (mMaxScrollPos > 0);
-
- if (has_scroll_arrows)
- {
- if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
- S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
- handled = mJumpLeftArrowBtn->handleMouseDown(local_x, local_y, mask);
- }
- if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
- S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
- handled = mJumpRightArrowBtn->handleMouseDown(local_x, local_y, mask);
- }
- if (mLeftArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
- S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
- handled = mLeftArrowBtn->handleMouseDown(local_x, local_y, mask);
- }
- else if (mRightArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mRightArrowBtn->getRect().mLeft;
- S32 local_y = y - mRightArrowBtn->getRect().mBottom;
- handled = mRightArrowBtn->handleMouseDown(local_x, local_y, mask);
- }
- }
- if (!handled)
+ if (no_scroll)
{
- handled = LLPanel::handleMouseDown( x, y, mask );
- }
-
- if (mTabList.size() > 0)
- {
- LLTabTuple* firsttuple = mTabList[0];
- LLRect tab_rect(has_scroll_arrows ? mLeftArrowBtn->getRect().mRight : mJumpLeftArrowBtn->getRect().mLeft,
- firsttuple->mButton->getRect().mTop,
- has_scroll_arrows ? mRightArrowBtn->getRect().mLeft : mJumpRightArrowBtn->getRect().mRight,
- firsttuple->mButton->getRect().mBottom );
- if( tab_rect.pointInRect( x, y ) )
- {
- LLButton* tab_button = mTabList[getCurrentPanelIndex()]->mButton;
- gFocusMgr.setMouseCapture(this);
- gFocusMgr.setKeyboardFocus(tab_button);
- }
- }
- return handled;
-}
-
-BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask )
-{
- BOOL handled = FALSE;
- BOOL has_scroll_arrows = (mMaxScrollPos > 0);
-
- if (has_scroll_arrows)
- {
- if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
- S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
- handled = mJumpLeftArrowBtn->handleHover(local_x, local_y, mask);
- }
- if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
- S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
- handled = mJumpRightArrowBtn->handleHover(local_x, local_y, mask);
- }
- if (mLeftArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
- S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
- handled = mLeftArrowBtn->handleHover(local_x, local_y, mask);
- }
- else if (mRightArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mRightArrowBtn->getRect().mLeft;
- S32 local_y = y - mRightArrowBtn->getRect().mBottom;
- handled = mRightArrowBtn->handleHover(local_x, local_y, mask);
- }
+ setMaxScrollPos(0);
+ setScrollPos(0);
}
- if (!handled)
+ if (getScrollPos() > getMaxScrollPos())
{
- handled = LLPanel::handleHover(x, y, mask);
+ setScrollPos(getMaxScrollPos()); // maybe just enforce this via limits in setScrollPos instead?
}
-
- commitHoveredButton(x, y);
- return handled;
}
-BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask )
+void LLTabContainer::commitHoveredButton(S32 x, S32 y)
{
- BOOL handled = FALSE;
- BOOL has_scroll_arrows = (mMaxScrollPos > 0);
-
- if (has_scroll_arrows)
- {
- if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
- S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
- handled = mJumpLeftArrowBtn->handleMouseUp(local_x, local_y, mask);
- }
- if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
- S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
- handled = mJumpRightArrowBtn->handleMouseUp(local_x, local_y, mask);
- }
- if (mLeftArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
- S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
- handled = mLeftArrowBtn->handleMouseUp(local_x, local_y, mask);
- }
- else if (mRightArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mRightArrowBtn->getRect().mLeft;
- S32 local_y = y - mRightArrowBtn->getRect().mBottom;
- handled = mRightArrowBtn->handleMouseUp(local_x, local_y, mask);
- }
- }
- if (!handled)
- {
- handled = LLPanel::handleMouseUp( x, y, mask );
- }
-
- commitHoveredButton(x, y);
- LLPanel* cur_panel = getCurrentPanel();
if (hasMouseCapture())
{
- if (cur_panel)
- {
- if (!cur_panel->focusFirstItem(FALSE))
- {
- // if nothing in the panel gets focus, make sure the new tab does
- // otherwise the last tab might keep focus
- mTabList[getCurrentPanelIndex()]->mButton->setFocus(TRUE);
- }
- }
- gFocusMgr.setMouseCapture(NULL);
- }
- return handled;
-}
-
-BOOL LLTabContainer::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect )
-{
- BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect );
- if (!handled && mTabList.size() > 0)
- {
- LLTabTuple* firsttuple = mTabList[0];
-
- BOOL has_scroll_arrows = (mMaxScrollPos > 0);
- LLRect clip(
- has_scroll_arrows ? mJumpLeftArrowBtn->getRect().mRight : mJumpLeftArrowBtn->getRect().mLeft,
- firsttuple->mButton->getRect().mTop,
- has_scroll_arrows ? mRightArrowBtn->getRect().mLeft : mRightArrowBtn->getRect().mRight,
- 0 );
- if( clip.pointInRect( x, y ) )
- {
- 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;
- handled = tuple->mButton->handleToolTip( local_x, local_y, msg, sticky_rect );
- if( handled )
- {
- break;
- }
- }
- }
-
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
- tuple->mButton->setVisible( FALSE );
- }
- }
- return handled;
-}
-
-BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
-{
- if (!getEnabled()) return FALSE;
-
- if (!gFocusMgr.childHasKeyboardFocus(this)) return FALSE;
-
- BOOL handled = FALSE;
- if (key == KEY_LEFT && mask == MASK_ALT)
- {
- selectPrevTab();
- handled = TRUE;
- }
- else if (key == KEY_RIGHT && mask == MASK_ALT)
- {
- selectNextTab();
- handled = TRUE;
- }
-
- if (handled)
- {
- if (getCurrentPanel())
- {
- getCurrentPanel()->setFocus(TRUE);
- }
- }
-
- if (!gFocusMgr.childHasKeyboardFocus(getCurrentPanel()))
- {
- // if child has focus, but not the current panel, focus
- // is on a button
- switch(key)
- {
- case KEY_UP:
- if (getTabPosition() == BOTTOM && getCurrentPanel())
- {
- getCurrentPanel()->setFocus(TRUE);
- }
- handled = TRUE;
- break;
- case KEY_DOWN:
- if (getTabPosition() == TOP && getCurrentPanel())
- {
- getCurrentPanel()->setFocus(TRUE);
- }
- handled = TRUE;
- break;
- case KEY_LEFT:
- selectPrevTab();
- handled = TRUE;
- break;
- case KEY_RIGHT:
- selectNextTab();
- handled = TRUE;
- break;
- default:
- break;
- }
- }
- return handled;
-}
-
-// virtual
-LLXMLNodePtr LLTabContainer::getXML(bool save_children) const
-{
- LLXMLNodePtr node = LLTabContainerCommon::getXML();
-
- node->createChild("tab_position", TRUE)->setStringValue((mTabPosition == TOP ? "top" : "bottom"));
-
- return node;
-}
-
-BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, LLString &tooltip)
-{
- BOOL has_scroll_arrows = (mMaxScrollPos > 0);
-
- if( mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME )
- {
-
- if (has_scroll_arrows)
- {
- if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
- S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
- mJumpLeftArrowBtn->handleHover(local_x, local_y, mask);
- }
- if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
- S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
- mJumpRightArrowBtn->handleHover(local_x, local_y, mask);
- }
- if (mLeftArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
- S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
- mLeftArrowBtn->handleHover(local_x, local_y, mask);
- }
- else if (mRightArrowBtn->getRect().pointInRect(x, y))
- {
- S32 local_x = x - mRightArrowBtn->getRect().mLeft;
- S32 local_y = y - mRightArrowBtn->getRect().mBottom;
- mRightArrowBtn->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->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();
- mDragAndDropDelayTimer.stop();
}
}
}
-
- return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip);
}
-void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const LLColor4& color)
-{
- LLTabTuple* tuple = getTabByPanel(child);
- if( tuple )
- {
- tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT, color);
-
- const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
- // remove current width from total tab strip width
- mTotalTabWidth -= tuple->mButton->getRect().getWidth();
-
- S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ?
- tuple->mButton->getImageOverlay()->getImage()->getWidth(0) :
- 0;
-
- tuple->mPadding = image_overlay_width;
-
- tuple->mButton->setRightHPad(6);
- tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth),
- tuple->mButton->getRect().getHeight());
- // add back in button width to total tab strip width
- mTotalTabWidth += tuple->mButton->getRect().getWidth();
-
- // tabs have changed size, might need to scroll to see current tab
- updateMaxScrollPos();
- }
-}
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index b72ecb8126..7c0463ee5b 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -1,6 +1,6 @@
/**
* @file lltabcontainer.h
- * @brief LLTabContainerCommon base class
+ * @brief LLTabContainer class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -29,19 +29,16 @@
* $/LicenseInfo$
*/
-// Fear my script-fu!
-
#ifndef LL_TABCONTAINER_H
#define LL_TABCONTAINER_H
#include "llpanel.h"
+#include "lltextbox.h"
#include "llframetimer.h"
-class LLButton;
-class LLTextBox;
-
+extern const S32 TABCNTR_HEADER_HEIGHT;
-class LLTabContainerCommon : public LLPanel
+class LLTabContainer : public LLPanel
{
public:
enum TabPosition
@@ -58,81 +55,82 @@ public:
RIGHT_OF_CURRENT
} eInsertionPoint;
- LLTabContainerCommon( const LLString& name,
- const LLRect& rect,
- TabPosition pos,
- void(*close_callback)(void*), void* callback_userdata,
- BOOL bordered = TRUE);
-
- LLTabContainerCommon( const LLString& name,
- const LLString& rect_control,
- TabPosition pos,
- void(*close_callback)(void*), void* callback_userdata,
- BOOL bordered = TRUE);
+ LLTabContainer( const LLString& name, const LLRect& rect, TabPosition pos,
+ BOOL bordered, BOOL is_vertical);
- virtual ~LLTabContainerCommon();
+ /*virtual*/ ~LLTabContainer();
- virtual void initButtons() = 0;
-
- virtual void setValue(const LLSD& value) { selectTab((S32) value.asInteger()); }
- virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TAB_CONTAINER; }
- virtual LLString getWidgetTag() const { return LL_TAB_CONTAINER_COMMON_TAG; }
-
- virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
-
- static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
-
- virtual void addTabPanel(LLPanel* child,
- const LLString& label,
- BOOL select = FALSE,
- void (*on_tab_clicked)(void*, bool) = NULL,
- void* userdata = NULL,
- S32 indent = 0,
- BOOL placeholder = FALSE,
- eInsertionPoint insertion_point = END) = 0;
- virtual void addPlaceholder(LLPanel* child, const LLString& label);
- virtual void lockTabs(S32 num_tabs = 0);
- virtual void unlockTabs();
- S32 getNumLockedTabs() { return mLockedTabCount; }
-
- virtual void enableTabButton(S32 which, BOOL enable);
-
- virtual void removeTabPanel( LLPanel* child );
- virtual void deleteAllTabs();
- virtual LLPanel* getCurrentPanel();
- virtual S32 getCurrentPanelIndex();
- virtual S32 getTabCount();
- virtual S32 getPanelIndexByTitle(const LLString& title);
- virtual LLPanel* getPanelByIndex(S32 index);
- virtual LLPanel* getPanelByName(const LLString& name);
- virtual S32 getIndexForPanel(LLPanel* panel);
-
- virtual void setCurrentTabName(const LLString& name);
-
-
- virtual void selectFirstTab();
- virtual void selectLastTab();
- virtual BOOL selectTabPanel( LLPanel* child );
- virtual BOOL selectTab(S32 which) = 0;
- virtual BOOL selectTabByName(const LLString& title);
- virtual void selectNextTab();
- virtual void selectPrevTab();
+ // from LLView
+ /*virtual*/ void setValue(const LLSD& value);
+ /*virtual*/ EWidgetType getWidgetType() const;
+ /*virtual*/ LLString getWidgetTag() const;
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
+ /*virtual*/ void draw();
+ /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask );
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect );
+ /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
+ /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType type, void* cargo_data,
+ EAcceptance* accept, LLString& tooltip);
+ /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
+
+ void addTabPanel(LLPanel* child,
+ const LLString& label,
+ BOOL select = FALSE,
+ void (*on_tab_clicked)(void*, bool) = NULL,
+ void* userdata = NULL,
+ S32 indent = 0,
+ BOOL placeholder = FALSE,
+ eInsertionPoint insertion_point = END);
+ void addPlaceholder(LLPanel* child, const LLString& label);
+ void removeTabPanel( LLPanel* child );
+ void lockTabs(S32 num_tabs = 0);
+ void unlockTabs();
+ S32 getNumLockedTabs() { return mLockedTabCount; }
+ void enableTabButton(S32 which, BOOL enable);
+ void deleteAllTabs();
+ LLPanel* getCurrentPanel();
+ S32 getCurrentPanelIndex();
+ S32 getTabCount();
+ LLPanel* getPanelByIndex(S32 index);
+ S32 getIndexForPanel(LLPanel* panel);
+ S32 getPanelIndexByTitle(const LLString& title);
+ LLPanel* getPanelByName(const LLString& name);
+ void setCurrentTabName(const LLString& name);
+
+ void selectFirstTab();
+ void selectLastTab();
+ void selectNextTab();
+ void selectPrevTab();
+ BOOL selectTabPanel( LLPanel* child );
+ BOOL selectTab(S32 which);
+ BOOL selectTabByName(const LLString& title);
BOOL getTabPanelFlashing(LLPanel* child);
void setTabPanelFlashing(LLPanel* child, BOOL state);
- virtual void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white);
+ void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white);
void setTitle( const LLString& title );
const LLString getPanelTitle(S32 index);
- void setDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); }
-
- virtual void setTopBorderHeight(S32 height);
+ void setTopBorderHeight(S32 height);
+ S32 getTopBorderHeight() const;
- virtual void setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*,bool));
- virtual void setTabUserData(LLPanel* tab, void* userdata);
+ void setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*,bool));
+ void setTabUserData(LLPanel* tab, void* userdata);
- virtual void reshape(S32 width, S32 height, BOOL called_from_parent);
+ void setRightTabBtnOffset( S32 offset );
+ void setPanelTitle(S32 index, const LLString& title);
+ TabPosition getTabPosition() const { return mTabPosition; }
+ void setMinTabWidth(S32 width) { mMinTabWidth = width; }
+ void setMaxTabWidth(S32 width) { mMaxTabWidth = width; }
+ S32 getMinTabWidth() const { return mMinTabWidth; }
+ S32 getMaxTabWidth() const { return mMaxTabWidth; }
+
+ void startDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); }
+
static void onCloseBtn(void* userdata);
static void onTabBtn(void* userdata);
static void onNextBtn(void* userdata);
@@ -142,17 +140,17 @@ public:
static void onJumpFirstBtn( void* userdata );
static void onJumpLastBtn( void* userdata );
- virtual void setRightTabBtnOffset( S32 offset ) { }
- virtual void setPanelTitle(S32 index, const LLString& title) { }
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
- virtual TabPosition getTabPosition() { return mTabPosition; }
+protected:
+ /*virtual*/ LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
-protected:
+private:
// Structure used to map tab buttons to and from tab panels
struct LLTabTuple
{
- LLTabTuple( LLTabContainerCommon* c, LLPanel* p, LLButton* b,
+ LLTabTuple( LLTabContainer* c, LLPanel* p, LLButton* b,
void (*cb)(void*,bool), void* userdata, LLTextBox* placeholder = NULL )
:
mTabContainer(c),
@@ -165,7 +163,7 @@ protected:
mPadding(0)
{}
- LLTabContainerCommon* mTabContainer;
+ LLTabContainer* mTabContainer;
LLPanel* mTabPanel;
LLButton* mButton;
void (*mOnChangeCallback)(void*, bool);
@@ -175,8 +173,35 @@ protected:
S32 mPadding;
};
+ void initButtons();
+
+ LLTabTuple* getTab(S32 index) { return mTabList[index]; }
+ LLTabTuple* getTabByPanel(LLPanel* child);
+ void insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point);
+
+ S32 getScrollPos() const { return mScrollPos; }
+ void setScrollPos(S32 pos) { mScrollPos = pos; }
+ S32 getMaxScrollPos() const { return mMaxScrollPos; }
+ void setMaxScrollPos(S32 pos) { mMaxScrollPos = pos; }
+ S32 getScrollPosPixels() const { return mScrollPosPixels; }
+ void setScrollPosPixels(S32 pixels) { mScrollPosPixels = pixels; }
+
+ void setTabsHidden(BOOL hidden) { mTabsHidden = hidden; }
+ BOOL getTabsHidden() const { return mTabsHidden; }
+
+ void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; }
+
+ void scrollPrev() { mScrollPos = llmax(0, mScrollPos-1); } // No wrap
+ void scrollNext() { mScrollPos = llmin(mScrollPos+1, mMaxScrollPos); } // No wrap
+
+ void updateMaxScrollPos();
+ void commitHoveredButton(S32 x, S32 y);
+
+ // Variables
+
typedef std::vector<LLTabTuple*> tuple_list_t;
tuple_list_t mTabList;
+
S32 mCurrentTabIdx;
BOOL mTabsHidden;
@@ -186,8 +211,6 @@ protected:
S32 mScrollPosPixels;
S32 mMaxScrollPos;
- LLFrameTimer mDragAndDropDelayTimer;
-
void (*mCloseCallback)(void*);
void* mCallbackUserdata;
@@ -196,87 +219,23 @@ protected:
S32 mTopBorderHeight;
TabPosition mTabPosition;
S32 mLockedTabCount;
+ S32 mMinTabWidth;
+ LLButton* mPrevArrowBtn;
+ LLButton* mNextArrowBtn;
-protected:
- void scrollPrev();
- void scrollNext();
-
- virtual void updateMaxScrollPos() = 0;
- virtual void commitHoveredButton(S32 x, S32 y) = 0;
- LLTabTuple* getTabByPanel(LLPanel* child);
- void insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point);
-};
-
-class LLTabContainer : public LLTabContainerCommon
-{
-public:
- LLTabContainer( const LLString& name, const LLRect& rect, TabPosition pos,
- void(*close_callback)(void*), void* callback_userdata,
- const LLString& title=LLString::null, BOOL bordered = TRUE );
-
- LLTabContainer( const LLString& name, const LLString& rect_control, TabPosition pos,
- void(*close_callback)(void*), void* callback_userdata,
- const LLString& title=LLString::null, BOOL bordered = TRUE );
-
- ~LLTabContainer();
-
- /*virtual*/ void initButtons();
-
- /*virtual*/ void draw();
-
- /*virtual*/ void addTabPanel(LLPanel* child,
- const LLString& label,
- BOOL select = FALSE,
- void (*on_tab_clicked)(void*, bool) = NULL,
- void* userdata = NULL,
- S32 indent = 0,
- BOOL placeholder = FALSE,
- eInsertionPoint insertion_point = END);
-
- /*virtual*/ BOOL selectTab(S32 which);
- /*virtual*/ void removeTabPanel( LLPanel* child );
-
- /*virtual*/ void setPanelTitle(S32 index, const LLString& title);
- /*virtual*/ void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white);
- /*virtual*/ void setRightTabBtnOffset( S32 offset );
-
- /*virtual*/ void setMinTabWidth(S32 width);
- /*virtual*/ void setMaxTabWidth(S32 width);
-
- /*virtual*/ S32 getMinTabWidth() const;
- /*virtual*/ S32 getMaxTabWidth() const;
-
- /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
- /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask );
- /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask );
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect );
- /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType type, void* cargo_data,
- EAcceptance* accept, LLString& tooltip);
-
- virtual LLXMLNodePtr getXML(bool save_children = true) const;
-
+ BOOL mIsVertical;
-protected:
-
- LLButton* mLeftArrowBtn;
- LLButton* mJumpLeftArrowBtn;
- LLButton* mRightArrowBtn;
- LLButton* mJumpRightArrowBtn;
+ // Horizontal specific
+ LLButton* mJumpPrevArrowBtn;
+ LLButton* mJumpNextArrowBtn;
S32 mRightTabBtnOffset; // Extra room to the right of the tab buttons.
-protected:
- virtual void updateMaxScrollPos();
- virtual void commitHoveredButton(S32 x, S32 y);
-
- S32 mMinTabWidth;
S32 mMaxTabWidth;
S32 mTotalTabWidth;
+
+ LLFrameTimer mDragAndDropDelayTimer;
};
-const S32 TABCNTR_CLOSE_BTN_SIZE = 16;
-const S32 TABCNTR_HEADER_HEIGHT = LLPANEL_BORDER_WIDTH + TABCNTR_CLOSE_BTN_SIZE;
#endif // LL_TABCONTAINER_H
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 3b15e3a25f..0c5bc2da81 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -30,21 +30,14 @@
*/
#include "linden_common.h"
-
#include "lltextbox.h"
-
-#include "llerror.h"
-#include "llgl.h"
-#include "llui.h"
#include "lluictrlfactory.h"
-#include "llcontrol.h"
#include "llfocusmgr.h"
-#include "llstl.h"
-#include <boost/tokenizer.hpp>
LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& 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" ) ),
@@ -64,9 +57,7 @@ LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& t
mClickedCallback(NULL),
mCallbackUserData(NULL)
{
- // TomY TODO Nuke this eventually
- setText( !text.empty() ? text : name );
- mFontGL = font ? font : LLFontGL::sSansSerifSmall;
+ setText( text );
setTabStop(FALSE);
}
@@ -93,25 +84,54 @@ LLTextBox::LLTextBox(const LLString& name, const LLString& text, F32 max_width,
mClickedCallback(NULL),
mCallbackUserData(NULL)
{
- setWrappedText(!text.empty() ? text : name, max_width);
+ setWrappedText(text, max_width);
reshapeToFitText();
setTabStop(FALSE);
}
-LLTextBox::~LLTextBox()
-{
-}
-
-// virtual
-EWidgetType LLTextBox::getWidgetType() const
+LLTextBox::LLTextBox(const LLString& 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)
{
- return WIDGET_TYPE_TEXT_BOX;
+ setText( name_and_label );
+ setTabStop(FALSE);
}
-// virtual
-LLString LLTextBox::getWidgetTag() const
+LLTextBox::LLTextBox(const LLString& 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)
{
- return LL_TEXT_BOX_TAG;
+ setWrappedText(name_and_label);
+ reshapeToFitText();
+ setTabStop(FALSE);
}
BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -127,7 +147,7 @@ BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask)
// Route future Mouse messages here preemptively. (Release on mouse up.)
gFocusMgr.setMouseCapture( this );
- if (mSoundFlags & MOUSE_DOWN)
+ if (getSoundFlags() & MOUSE_DOWN)
{
make_ui_sound("UISndClick");
}
@@ -153,7 +173,7 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask)
// Release the mouse
gFocusMgr.setMouseCapture( NULL );
- if (mSoundFlags & MOUSE_UP)
+ if (getSoundFlags() & MOUSE_UP)
{
make_ui_sound("UISndClickRelease");
}
@@ -294,16 +314,6 @@ S32 LLTextBox::getTextPixelHeight()
}
-void LLTextBox::setValue(const LLSD& value )
-{
- setText(value.asString());
-}
-
-LLSD LLTextBox::getValue() const
-{
- return LLSD(getText());
-}
-
BOOL LLTextBox::setTextArg( const LLString& key, const LLStringExplicit& text )
{
mText.setArg(key, text);
@@ -324,13 +334,13 @@ void LLTextBox::draw()
{
static LLColor4 color_drop_shadow = LLUI::sColorsGroup->getColor("ColorDropShadow");
static S32 drop_shadow_tooltip = LLUI::sConfigGroup->getS32("DropShadowTooltip");
- gl_drop_shadow(0, mRect.getHeight(), mRect.getWidth(), 0,
+ gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
color_drop_shadow, drop_shadow_tooltip);
}
if (mBackgroundVisible)
{
- LLRect r( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ LLRect r( 0, getRect().getHeight(), getRect().getWidth(), 0 );
gl_rect_2d( r, mBackgroundColor );
}
@@ -341,14 +351,14 @@ void LLTextBox::draw()
text_x = mHPad;
break;
case LLFontGL::HCENTER:
- text_x = mRect.getWidth() / 2;
+ text_x = getRect().getWidth() / 2;
break;
case LLFontGL::RIGHT:
- text_x = mRect.getWidth() - mHPad;
+ text_x = getRect().getWidth() - mHPad;
break;
}
- S32 text_y = mRect.getHeight() - mVPad;
+ S32 text_y = getRect().getHeight() - mVPad;
if ( getEnabled() )
{
@@ -360,7 +370,6 @@ void LLTextBox::draw()
{
drawText( text_x, text_y, mTextColor );
}
-
}
else
{
@@ -385,7 +394,14 @@ void LLTextBox::reshape(S32 width, S32 height, BOOL called_from_parent)
void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color )
{
- if( !mLineLengthList.empty() )
+ if( mLineLengthList.empty() )
+ {
+ mFontGL->render(mText.getWString(), 0, (F32)x, (F32)y, color,
+ mHAlign, mVAlign,
+ mFontStyle,
+ S32_MAX, getRect().getWidth(), NULL, TRUE, mUseEllipses);
+ }
+ else
{
S32 cur_pos = 0;
for (std::vector<S32>::iterator iter = mLineLengthList.begin();
@@ -395,21 +411,13 @@ void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color )
mFontGL->render(mText.getWString(), cur_pos, (F32)x, (F32)y, color,
mHAlign, mVAlign,
mFontStyle,
- line_length, mRect.getWidth(), NULL, TRUE, mUseEllipses );
+ line_length, getRect().getWidth(), NULL, TRUE, mUseEllipses );
cur_pos += line_length + 1;
y -= llfloor(mFontGL->getLineHeight());
}
}
- else
- {
- mFontGL->render(mText.getWString(), 0, (F32)x, (F32)y, color,
- mHAlign, mVAlign,
- mFontStyle,
- S32_MAX, mRect.getWidth(), NULL, TRUE, mUseEllipses);
- }
}
-
void LLTextBox::reshapeToFitText()
{
S32 width = getTextPixelWidth();
@@ -423,28 +431,19 @@ LLXMLNodePtr LLTextBox::getXML(bool save_children) const
LLXMLNodePtr node = LLUICtrl::getXML();
// Attributes
-
node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mFontGL));
-
node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign));
-
addColorXML(node, mTextColor, "text_color", "LabelTextColor");
addColorXML(node, mDisabledColor, "disabled_color", "LabelDisabledColor");
addColorXML(node, mBackgroundColor, "bg_color", "DefaultBackgroundColor");
addColorXML(node, mBorderColor, "border_color", "DefaultHighlightLight");
-
node->createChild("bg_visible", TRUE)->setBoolValue(mBackgroundVisible);
-
node->createChild("border_visible", TRUE)->setBoolValue(mBorderVisible);
-
node->createChild("border_drop_shadow_visible", TRUE)->setBoolValue(mBorderDropShadowVisible);
-
node->createChild("h_pad", TRUE)->setIntValue(mHPad);
-
node->createChild("v_pad", TRUE)->setIntValue(mVPad);
// Contents
-
node->setStringValue(mText);
return node;
@@ -459,12 +458,6 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
LLString text = node->getTextContents();
- // TomY Yes I know this is a hack, but insert a space to make a blank text field
- if (text == "")
- {
- text = " ";
- }
-
LLTextBox* text_box = new LLTextBox(name,
LLRect(),
text,
@@ -510,6 +503,5 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
text_box->setHoverActive(hover_active);
}
-
return text_box;
}
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index d25452b941..ce3a9bb12e 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -35,11 +35,8 @@
#include "lluictrl.h"
#include "v4color.h"
#include "llstring.h"
-#include "llfontgl.h"
#include "lluistring.h"
-class LLUICtrlFactory;
-
class LLTextBox
: public LLUICtrl
@@ -48,18 +45,22 @@ public:
// By default, follows top and left and is mouse-opaque.
// If no text, text = name.
// If no font, uses default system font.
- LLTextBox(const LLString& name, const LLRect& rect, const LLString& text = LLString::null,
+ LLTextBox(const LLString& name, const LLRect& rect, const LLString& text,
const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE );
// Construct a textbox which handles word wrapping for us.
LLTextBox(const LLString& name, const LLString& text, F32 max_width = 200,
const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE );
- virtual ~LLTextBox();
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ // "Simple" constructors for text boxes that have the same name and label *TO BE DEPRECATED*
+ LLTextBox(const LLString& name_and_label, const LLRect& rect);
+ LLTextBox(const LLString& name_and_label);
+
+ virtual ~LLTextBox() {}
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEXT_BOX; }
+ virtual LLString getWidgetTag() const { return LL_TEXT_BOX_TAG; }
virtual LLXMLNodePtr getXML(bool save_children = true) const;
- static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
virtual void draw();
virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
@@ -77,8 +78,7 @@ public:
void setHoverActive( BOOL active ) { mHoverActive = active; }
void setText( const LLStringExplicit& text );
- void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0);
- // default width means use existing control width
+ void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0); // -1 means use existing control width
void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; }
void setBackgroundVisible(BOOL visible) { mBackgroundVisible = visible; }
@@ -90,7 +90,7 @@ public:
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 setCallbackUserData( void* data ) { mCallbackUserData = data; }
const LLFontGL* getFont() const { return mFontGL; }
@@ -100,16 +100,14 @@ public:
S32 getTextPixelWidth();
S32 getTextPixelHeight();
-
- virtual void setValue(const LLSD& value );
- virtual LLSD getValue() const;
+ virtual void setValue(const LLSD& value ) { setText(value.asString()); }
+ virtual LLSD getValue() const { return LLSD(getText()); }
virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
-protected:
+private:
void setLineLengths();
void drawText(S32 x, S32 y, const LLColor4& color );
-protected:
LLUIString mText;
const LLFontGL* mFontGL;
LLColor4 mTextColor;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 7cd164ec14..540283c3fe 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -63,15 +63,12 @@
//
// Globals
//
-
BOOL gDebugTextEditorTips = FALSE;
//
// Constants
//
-
const S32 UI_TEXTEDITOR_BUFFER_BLOCK_SIZE = 512;
-
const S32 UI_TEXTEDITOR_BORDER = 1;
const S32 UI_TEXTEDITOR_H_PAD = 4;
const S32 UI_TEXTEDITOR_V_PAD_TOP = 4;
@@ -93,67 +90,33 @@ void (* LLTextEditor::mURLcallback)(const char*) = NULL;
bool (* LLTextEditor::mSecondlifeURLcallback)(const std::string&) = NULL;
bool (* LLTextEditor::mSecondlifeURLcallbackRightClick)(const std::string&) = NULL;
-///////////////////////////////////////////////////////////////////
-//virtuals
-BOOL LLTextCmd::canExtend(S32 pos)
-{
- return FALSE;
-}
-
-void LLTextCmd::blockExtensions()
-{
-}
-
-BOOL LLTextCmd::extendAndExecute( LLTextEditor* editor, S32 pos, llwchar c, S32* delta )
-{
- llassert(0);
- return 0;
-}
-
-BOOL LLTextCmd::hasExtCharValue( llwchar value )
-{
- return FALSE;
-}
-
-// Utility funcs
-S32 LLTextCmd::insert(LLTextEditor* editor, S32 pos, const LLWString &wstr)
-{
- return editor->insertStringNoUndo( pos, wstr );
-}
-S32 LLTextCmd::remove(LLTextEditor* editor, S32 pos, S32 length)
-{
- return editor->removeStringNoUndo( pos, length );
-}
-S32 LLTextCmd::overwrite(LLTextEditor* editor, S32 pos, llwchar wc)
-{
- return editor->overwriteCharNoUndo(pos, wc);
-}
///////////////////////////////////////////////////////////////////
-class LLTextCmdInsert : public LLTextCmd
+class LLTextEditor::LLTextCmdInsert : public LLTextEditor::LLTextCmd
{
public:
LLTextCmdInsert(S32 pos, BOOL group_with_next, const LLWString &ws)
: LLTextCmd(pos, group_with_next), mWString(ws)
{
}
+ virtual ~LLTextCmdInsert() {}
virtual BOOL execute( LLTextEditor* editor, S32* delta )
{
- *delta = insert(editor, mPos, mWString );
+ *delta = insert(editor, getPosition(), mWString );
LLWString::truncate(mWString, *delta);
//mWString = wstring_truncate(mWString, *delta);
return (*delta != 0);
}
virtual S32 undo( LLTextEditor* editor )
{
- remove(editor, mPos, mWString.length() );
- return mPos;
+ remove(editor, getPosition(), mWString.length() );
+ return getPosition();
}
virtual S32 redo( LLTextEditor* editor )
{
- insert(editor, mPos, mWString );
- return mPos + mWString.length();
+ insert(editor, getPosition(), mWString );
+ return getPosition() + mWString.length();
}
private:
@@ -161,8 +124,7 @@ private:
};
///////////////////////////////////////////////////////////////////
-
-class LLTextCmdAddChar : public LLTextCmd
+class LLTextEditor::LLTextCmdAddChar : public LLTextEditor::LLTextCmd
{
public:
LLTextCmdAddChar( S32 pos, BOOL group_with_next, llwchar wc)
@@ -173,13 +135,13 @@ public:
{
mBlockExtensions = TRUE;
}
- virtual BOOL canExtend(S32 pos)
+ virtual BOOL canExtend(S32 pos) const
{
- return !mBlockExtensions && (pos == mPos + (S32)mWString.length());
+ return !mBlockExtensions && (pos == getPosition() + (S32)mWString.length());
}
virtual BOOL execute( LLTextEditor* editor, S32* delta )
{
- *delta = insert(editor, mPos, mWString);
+ *delta = insert(editor, getPosition(), mWString);
LLWString::truncate(mWString, *delta);
//mWString = wstring_truncate(mWString, *delta);
return (*delta != 0);
@@ -198,13 +160,13 @@ public:
}
virtual S32 undo( LLTextEditor* editor )
{
- remove(editor, mPos, mWString.length() );
- return mPos;
+ remove(editor, getPosition(), mWString.length() );
+ return getPosition();
}
virtual S32 redo( LLTextEditor* editor )
{
- insert(editor, mPos, mWString );
- return mPos + mWString.length();
+ insert(editor, getPosition(), mWString );
+ return getPosition() + mWString.length();
}
private:
@@ -215,7 +177,7 @@ private:
///////////////////////////////////////////////////////////////////
-class LLTextCmdOverwriteChar : public LLTextCmd
+class LLTextEditor::LLTextCmdOverwriteChar : public LLTextEditor::LLTextCmd
{
public:
LLTextCmdOverwriteChar( S32 pos, BOOL group_with_next, llwchar wc)
@@ -223,20 +185,20 @@ public:
virtual BOOL execute( LLTextEditor* editor, S32* delta )
{
- mOldChar = editor->getWChar(mPos);
- overwrite(editor, mPos, mChar);
+ mOldChar = editor->getWChar(getPosition());
+ overwrite(editor, getPosition(), mChar);
*delta = 0;
return TRUE;
}
virtual S32 undo( LLTextEditor* editor )
{
- overwrite(editor, mPos, mOldChar);
- return mPos;
+ overwrite(editor, getPosition(), mOldChar);
+ return getPosition();
}
virtual S32 redo( LLTextEditor* editor )
{
- overwrite(editor, mPos, mChar);
- return mPos+1;
+ overwrite(editor, getPosition(), mChar);
+ return getPosition()+1;
}
private:
@@ -246,7 +208,7 @@ private:
///////////////////////////////////////////////////////////////////
-class LLTextCmdRemove : public LLTextCmd
+class LLTextEditor::LLTextCmdRemove : public LLTextEditor::LLTextCmd
{
public:
LLTextCmdRemove( S32 pos, BOOL group_with_next, S32 len ) :
@@ -255,30 +217,27 @@ public:
}
virtual BOOL execute( LLTextEditor* editor, S32* delta )
{
- mWString = editor->getWSubString(mPos, mLen);
- *delta = remove(editor, mPos, mLen );
+ mWString = editor->getWSubString(getPosition(), mLen);
+ *delta = remove(editor, getPosition(), mLen );
return (*delta != 0);
}
virtual S32 undo( LLTextEditor* editor )
{
- insert(editor, mPos, mWString );
- return mPos + mWString.length();
+ insert(editor, getPosition(), mWString );
+ return getPosition() + mWString.length();
}
virtual S32 redo( LLTextEditor* editor )
{
- remove(editor, mPos, mLen );
- return mPos;
+ remove(editor, getPosition(), mLen );
+ return getPosition();
}
private:
LLWString mWString;
S32 mLen;
};
-///////////////////////////////////////////////////////////////////
-//
-// Member functions
-//
+///////////////////////////////////////////////////////////////////
LLTextEditor::LLTextEditor(
const LLString& name,
@@ -309,7 +268,7 @@ LLTextEditor::LLTextEditor(
mFocusBgColor( LLUI::sColorsGroup->getColor( "TextBgFocusColor" ) ),
mReadOnly(FALSE),
mWordWrap( FALSE ),
- mTabToNextField( TRUE ),
+ mTabsToNextField( TRUE ),
mCommitOnFocusLost( FALSE ),
mHideScrollbarForShortDocs( FALSE ),
mTakesNonScrollClicks( TRUE ),
@@ -344,10 +303,10 @@ LLTextEditor::LLTextEditor(
// Init the scrollbar
LLRect scroll_rect;
scroll_rect.setOriginAndSize(
- mRect.getWidth() - UI_TEXTEDITOR_BORDER - SCROLLBAR_SIZE,
+ getRect().getWidth() - UI_TEXTEDITOR_BORDER - SCROLLBAR_SIZE,
UI_TEXTEDITOR_BORDER,
SCROLLBAR_SIZE,
- mRect.getHeight() - 2 * UI_TEXTEDITOR_BORDER );
+ getRect().getHeight() - 2 * UI_TEXTEDITOR_BORDER );
S32 lines_in_doc = getLineCount();
mScrollbar = new LLScrollbar( "Scrollbar", scroll_rect,
LLScrollbar::VERTICAL,
@@ -363,7 +322,7 @@ LLTextEditor::LLTextEditor(
mScrollbar->setOnScrollEndCallback(mOnScrollEndCallback, mOnScrollEndData);
addChild(mScrollbar);
- mBorder = new LLViewBorder( "text ed border", LLRect(0, mRect.getHeight(), mRect.getWidth(), 0), LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, UI_TEXTEDITOR_BORDER );
+ mBorder = new LLViewBorder( "text ed border", LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, UI_TEXTEDITOR_BORDER );
addChild( mBorder );
appendText(default_text, FALSE, FALSE);
@@ -392,12 +351,6 @@ LLTextEditor::~LLTextEditor()
std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
}
-//virtual
-LLString LLTextEditor::getWidgetTag() const
-{
- return LL_TEXT_EDITOR_TAG;
-}
-
void LLTextEditor::setTrackColor( const LLColor4& color )
{
mScrollbar->setTrackColor(color);
@@ -422,7 +375,7 @@ void LLTextEditor::updateLineStartList(S32 startpos)
{
updateSegments();
- bindEmbeddedChars( mGLFont );
+ bindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
S32 seg_num = mSegments.size();
S32 seg_idx = 0;
@@ -499,7 +452,7 @@ void LLTextEditor::updateLineStartList(S32 startpos)
}
}
- unbindEmbeddedChars(mGLFont);
+ unbindEmbeddedChars(const_cast<LLFontGL*>(mGLFont));
mScrollbar->setDocSize( getLineCount() );
@@ -515,11 +468,6 @@ void LLTextEditor::updateLineStartList(S32 startpos)
// LLTextEditor
// Public methods
-//static
-BOOL LLTextEditor::isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); }
-
-
-
BOOL LLTextEditor::truncate()
{
BOOL did_truncate = FALSE;
@@ -581,6 +529,7 @@ void LLTextEditor::setWText(const LLWString &wtext)
resetDirty();
}
+// virtual
void LLTextEditor::setValue(const LLSD& value)
{
setText(value.asString());
@@ -600,6 +549,7 @@ const LLString& LLTextEditor::getText() const
return mUTF8Text;
}
+// virtual
LLSD LLTextEditor::getValue() const
{
return LLSD(getText());
@@ -622,7 +572,10 @@ void LLTextEditor::setBorderVisible(BOOL b)
mBorder->setVisible(b);
}
-
+BOOL LLTextEditor::isBorderVisible() const
+{
+ return mBorder->getVisible();
+}
void LLTextEditor::setHideScrollbarForShortDocs(BOOL b)
{
@@ -734,12 +687,6 @@ void LLTextEditor::replaceTextAll(const LLString& search_text, const LLString& r
mScrollbar->setDocPos(cur_pos);
}
-void LLTextEditor::setTakesNonScrollClicks(BOOL b)
-{
- mTakesNonScrollClicks = b;
-}
-
-
// Picks a new cursor position based on the screen size of text being drawn.
void LLTextEditor::setCursorAtLocalPos( S32 local_x, S32 local_y, BOOL round )
{
@@ -774,11 +721,6 @@ S32 LLTextEditor::nextWordPos(S32 cursorPos) const
return cursorPos;
}
-S32 LLTextEditor::getLineCount() const
-{
- return mLineStartList.size();
-}
-
S32 LLTextEditor::getLineStart( S32 line ) const
{
S32 num_lines = getLineCount();
@@ -796,7 +738,7 @@ S32 LLTextEditor::getLineStart( S32 line ) const
}
// Given an offset into text (pos), find the corresponding line (from the start of the doc) and an offset into the line.
-void LLTextEditor::getLineAndOffset( S32 startpos, S32* linep, S32* offsetp )
+void LLTextEditor::getLineAndOffset( S32 startpos, S32* linep, S32* offsetp ) const
{
if (mLineStartList.empty())
{
@@ -809,7 +751,7 @@ void LLTextEditor::getLineAndOffset( S32 startpos, S32* linep, S32* offsetp )
getSegmentAndOffset( startpos, &seg_idx, &seg_offset );
line_info tline(seg_idx, seg_offset);
- line_list_t::iterator iter = std::upper_bound(mLineStartList.begin(), mLineStartList.end(), tline, line_info_compare());
+ line_list_t::const_iterator iter = std::upper_bound(mLineStartList.begin(), mLineStartList.end(), tline, line_info_compare());
if (iter != mLineStartList.begin()) --iter;
*linep = iter - mLineStartList.begin();
S32 line_start = mSegments[iter->mSegment]->getStart() + iter->mOffset;
@@ -817,7 +759,7 @@ void LLTextEditor::getLineAndOffset( S32 startpos, S32* linep, S32* offsetp )
}
}
-void LLTextEditor::getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp )
+void LLTextEditor::getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp ) const
{
if (mSegments.empty())
{
@@ -826,46 +768,21 @@ void LLTextEditor::getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp
}
LLTextSegment tseg(startpos);
- segment_list_t::iterator seg_iter;
+ segment_list_t::const_iterator seg_iter;
seg_iter = std::upper_bound(mSegments.begin(), mSegments.end(), &tseg, LLTextSegment::compare());
if (seg_iter != mSegments.begin()) --seg_iter;
*segidxp = seg_iter - mSegments.begin();
*offsetp = startpos - (*seg_iter)->getStart();
}
-const LLWString& LLTextEditor::getWText() const
-{
- return mWText;
-}
-
-S32 LLTextEditor::getLength() const
-{
- return mWText.length();
-}
-
-llwchar LLTextEditor::getWChar(S32 pos)
-{
- return mWText[pos];
-}
-
-LLWString LLTextEditor::getWSubString(S32 pos, S32 len)
-{
- return mWText.substr(pos, len);
-}
-
-LLTextSegment* LLTextEditor::getCurrentSegment()
-{
- return getSegmentAtOffset(mCursorPos);
-}
-
-LLTextSegment* LLTextEditor::getPreviousSegment()
+const LLTextSegment* LLTextEditor::getPreviousSegment()
{
// find segment index at character to left of cursor (or rightmost edge of selection)
S32 idx = llmax(0, getSegmentIdxAtOffset(mCursorPos) - 1);
return idx >= 0 ? mSegments[idx] : NULL;
}
-void LLTextEditor::getSelectedSegments(std::vector<LLTextSegment*>& segments)
+void LLTextEditor::getSelectedSegments(std::vector<const LLTextSegment*>& segments)
{
S32 left = hasSelection() ? llmin(mSelectionStart, mSelectionEnd) : mCursorPos;
S32 right = hasSelection() ? llmax(mSelectionStart, mSelectionEnd) : mCursorPos;
@@ -878,7 +795,7 @@ void LLTextEditor::getSelectedSegments(std::vector<LLTextSegment*>& segments)
}
}
-S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round )
+S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const
{
// If round is true, if the position is on the right half of a character, the cursor
// will be put to its right. If round is false, the cursor will always be put to the
@@ -916,13 +833,13 @@ S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL rou
if (mAllowEmbeddedItems)
{
// Figure out which character we're nearest to.
- bindEmbeddedChars(mGLFont);
+ bindEmbeddedChars(const_cast<LLFontGL*>(mGLFont));
pos = mGLFont->charFromPixelOffset(mWText.c_str(), line_start,
(F32)(local_x - mTextRect.mLeft),
(F32)(mTextRect.getWidth()),
line_len,
round, TRUE);
- unbindEmbeddedChars(mGLFont);
+ unbindEmbeddedChars(const_cast<LLFontGL*>(mGLFont));
}
else
{
@@ -958,8 +875,8 @@ void LLTextEditor::setCursorPos(S32 offset)
mDesiredXPixel = -1;
}
-
-BOOL LLTextEditor::canDeselect()
+// virtual
+BOOL LLTextEditor::canDeselect() const
{
return hasSelection();
}
@@ -1126,12 +1043,13 @@ void LLTextEditor::indentSelectedLines( S32 spaces )
}
}
-
-BOOL LLTextEditor::canSelectAll()
+//virtual
+BOOL LLTextEditor::canSelectAll() const
{
return TRUE;
}
+// virtual
void LLTextEditor::selectAll()
{
mSelectionStart = getLength();
@@ -1143,7 +1061,7 @@ void LLTextEditor::selectAll()
BOOL LLTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen)
{
for ( child_list_const_iter_t child_it = getChildList()->begin();
- child_it != getChildList()->end(); ++child_it)
+ child_it != getChildList()->end(); ++child_it)
{
LLView* viewp = *child_it;
S32 local_x = x - viewp->getRect().mLeft;
@@ -1159,7 +1077,7 @@ BOOL LLTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rec
return TRUE;
}
- LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
+ const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
if( cur_segment )
{
BOOL has_tool_tip = FALSE;
@@ -1267,7 +1185,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
}
// Delay cursor flashing
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
return handled;
}
@@ -1320,7 +1238,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
if( handled )
{
// Delay cursor flashing
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
}
// Opaque
@@ -1329,7 +1247,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
// Check to see if we're over an HTML-style link
if( !mSegments.empty() )
{
- LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
+ const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
if( cur_segment )
{
if(cur_segment->getStyle().isLink())
@@ -1353,7 +1271,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
if( !handled )
{
lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl;
- if (!mScrollbar->getVisible() || x < mRect.getWidth() - SCROLLBAR_SIZE)
+ if (!mScrollbar->getVisible() || x < getRect().getWidth() - SCROLLBAR_SIZE)
{
getWindow()->setCursor(UI_CURSOR_IBEAM);
}
@@ -1411,7 +1329,7 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
}
// Delay cursor flashing
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
if( hasMouseCapture() )
{
@@ -1467,7 +1385,7 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
mIsSelecting = FALSE;
// delay cursor flashing
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
handled = TRUE;
}
@@ -1548,50 +1466,51 @@ S32 LLTextEditor::overwriteChar(S32 pos, llwchar wc)
// a pseudo-tab (up to for spaces in a row)
void LLTextEditor::removeCharOrTab()
{
- if( getEnabled() )
+ if( !getEnabled() )
{
- if( mCursorPos > 0 )
- {
- S32 chars_to_remove = 1;
+ return;
+ }
+ if( mCursorPos > 0 )
+ {
+ S32 chars_to_remove = 1;
- const LLWString &text = mWText;
- if (text[mCursorPos - 1] == ' ')
+ const LLWString &text = mWText;
+ if (text[mCursorPos - 1] == ' ')
+ {
+ // Try to remove a "tab"
+ S32 line, offset;
+ getLineAndOffset(mCursorPos, &line, &offset);
+ if (offset > 0)
{
- // Try to remove a "tab"
- S32 line, offset;
- getLineAndOffset(mCursorPos, &line, &offset);
- if (offset > 0)
+ chars_to_remove = offset % SPACES_PER_TAB;
+ if( chars_to_remove == 0 )
{
- chars_to_remove = offset % SPACES_PER_TAB;
- if( chars_to_remove == 0 )
- {
- chars_to_remove = SPACES_PER_TAB;
- }
+ chars_to_remove = SPACES_PER_TAB;
+ }
- for( S32 i = 0; i < chars_to_remove; i++ )
+ for( S32 i = 0; i < chars_to_remove; i++ )
+ {
+ if (text[ mCursorPos - i - 1] != ' ')
{
- if (text[ mCursorPos - i - 1] != ' ')
- {
- // Fewer than a full tab's worth of spaces, so
- // just delete a single character.
- chars_to_remove = 1;
- break;
- }
+ // Fewer than a full tab's worth of spaces, so
+ // just delete a single character.
+ chars_to_remove = 1;
+ break;
}
}
}
-
- for (S32 i = 0; i < chars_to_remove; i++)
- {
- setCursorPos(mCursorPos - 1);
- remove( mCursorPos, 1, FALSE );
- }
}
- else
+
+ for (S32 i = 0; i < chars_to_remove; i++)
{
- reportBadKeystroke();
+ setCursorPos(mCursorPos - 1);
+ remove( mCursorPos, 1, FALSE );
}
}
+ else
+ {
+ reportBadKeystroke();
+ }
}
// Remove a single character from the text
@@ -1602,17 +1521,18 @@ S32 LLTextEditor::removeChar(S32 pos)
void LLTextEditor::removeChar()
{
- if (getEnabled())
+ if (!getEnabled())
{
- if (mCursorPos > 0)
- {
- setCursorPos(mCursorPos - 1);
- removeChar(mCursorPos);
- }
- else
- {
- reportBadKeystroke();
- }
+ return;
+ }
+ if (mCursorPos > 0)
+ {
+ setCursorPos(mCursorPos - 1);
+ removeChar(mCursorPos);
+ }
+ else
+ {
+ reportBadKeystroke();
}
}
@@ -1639,19 +1559,20 @@ S32 LLTextEditor::addChar(S32 pos, llwchar wc)
void LLTextEditor::addChar(llwchar wc)
{
- if( getEnabled() )
+ if( !getEnabled() )
{
- if( hasSelection() )
- {
- deleteSelection(TRUE);
- }
- else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
- {
- removeChar(mCursorPos);
- }
-
- setCursorPos(mCursorPos + addChar( mCursorPos, wc ));
+ return;
}
+ if( hasSelection() )
+ {
+ deleteSelection(TRUE);
+ }
+ else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
+ {
+ removeChar(mCursorPos);
+ }
+
+ setCursorPos(mCursorPos + addChar( mCursorPos, wc ));
}
@@ -1747,7 +1668,6 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
}
}
-
if( !handled && mHandleEditKeysDirectly )
{
if( (MASK_CONTROL & mask) && ('A' == key) )
@@ -1900,7 +1820,8 @@ void LLTextEditor::deleteSelection(BOOL group_with_next_op )
}
}
-BOOL LLTextEditor::canCut()
+// virtual
+BOOL LLTextEditor::canCut() const
{
return !mReadOnly && hasSelection();
}
@@ -1908,36 +1829,37 @@ BOOL LLTextEditor::canCut()
// cut selection to clipboard
void LLTextEditor::cut()
{
- if( canCut() )
+ if( !canCut() )
{
- S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
- S32 length = abs( mSelectionStart - mSelectionEnd );
- gClipboard.copyFromSubstring( mWText, left_pos, length, mSourceID );
- deleteSelection( FALSE );
-
- updateLineStartList();
- updateScrollFromCursor();
+ return;
}
+ S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
+ S32 length = abs( mSelectionStart - mSelectionEnd );
+ gClipboard.copyFromSubstring( mWText, left_pos, length, mSourceID );
+ deleteSelection( FALSE );
+
+ updateLineStartList();
+ updateScrollFromCursor();
}
-BOOL LLTextEditor::canCopy()
+BOOL LLTextEditor::canCopy() const
{
return hasSelection();
}
-
// copy selection to clipboard
void LLTextEditor::copy()
{
- if( canCopy() )
+ if( !canCopy() )
{
- S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
- S32 length = abs( mSelectionStart - mSelectionEnd );
- gClipboard.copyFromSubstring(mWText, left_pos, length, mSourceID);
+ return;
}
+ S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
+ S32 length = abs( mSelectionStart - mSelectionEnd );
+ gClipboard.copyFromSubstring(mWText, left_pos, length, mSourceID);
}
-BOOL LLTextEditor::canPaste()
+BOOL LLTextEditor::canPaste() const
{
return !mReadOnly && gClipboard.canPasteString();
}
@@ -1946,47 +1868,49 @@ BOOL LLTextEditor::canPaste()
// paste from clipboard
void LLTextEditor::paste()
{
- if (canPaste())
+ if (!canPaste())
+ {
+ return;
+ }
+ LLUUID source_id;
+ LLWString paste = gClipboard.getPasteWString(&source_id);
+ if (paste.empty())
{
- LLUUID source_id;
- LLWString paste = gClipboard.getPasteWString(&source_id);
- if (!paste.empty())
+ return;
+ }
+ // Delete any selected characters (the paste replaces them)
+ if( hasSelection() )
+ {
+ deleteSelection(TRUE);
+ }
+
+ // Clean up string (replace tabs and remove characters that our fonts don't support).
+ LLWString clean_string(paste);
+ LLWString::replaceTabsWithSpaces(clean_string, SPACES_PER_TAB);
+ if( mAllowEmbeddedItems )
+ {
+ const llwchar LF = 10;
+ S32 len = clean_string.length();
+ for( S32 i = 0; i < len; i++ )
{
- // Delete any selected characters (the paste replaces them)
- if( hasSelection() )
+ llwchar wc = clean_string[i];
+ if( (wc < LLFont::FIRST_CHAR) && (wc != LF) )
{
- deleteSelection(TRUE);
+ clean_string[i] = LL_UNKNOWN_CHAR;
}
-
- // Clean up string (replace tabs and remove characters that our fonts don't support).
- LLWString clean_string(paste);
- LLWString::replaceTabsWithSpaces(clean_string, SPACES_PER_TAB);
- if( mAllowEmbeddedItems )
+ else if (wc >= FIRST_EMBEDDED_CHAR && wc <= LAST_EMBEDDED_CHAR)
{
- const llwchar LF = 10;
- S32 len = clean_string.length();
- for( S32 i = 0; i < len; i++ )
- {
- llwchar wc = clean_string[i];
- if( (wc < LLFont::FIRST_CHAR) && (wc != LF) )
- {
- clean_string[i] = LL_UNKNOWN_CHAR;
- }
- else if (wc >= FIRST_EMBEDDED_CHAR && wc <= LAST_EMBEDDED_CHAR)
- {
- clean_string[i] = pasteEmbeddedItem(wc);
- }
- }
+ clean_string[i] = pasteEmbeddedItem(wc);
}
-
- // Insert the new text into the existing text.
- setCursorPos(mCursorPos + insert(mCursorPos, clean_string, FALSE));
- deselect();
-
- updateLineStartList();
- updateScrollFromCursor();
}
}
+
+ // Insert the new text into the existing text.
+ setCursorPos(mCursorPos + insert(mCursorPos, clean_string, FALSE));
+ deselect();
+
+ updateLineStartList();
+ updateScrollFromCursor();
}
@@ -2240,7 +2164,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent )
{
// Special case for TAB. If want to move to next field, report
// not handled and let the parent take care of field movement.
- if (KEY_TAB == key && mTabToNextField)
+ if (KEY_TAB == key && mTabsToNextField)
{
return FALSE;
}
@@ -2296,7 +2220,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent )
if( handled )
{
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
// Most keystrokes will make the selection box go away, but not all will.
if( !selection_modified &&
@@ -2350,7 +2274,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare
if( handled )
{
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
// Most keystrokes will make the selection box go away, but not all will.
deselect();
@@ -2364,58 +2288,58 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare
}
-
-BOOL LLTextEditor::canDoDelete()
+// virtual
+BOOL LLTextEditor::canDoDelete() const
{
return !mReadOnly && ( hasSelection() || (mCursorPos < getLength()) );
}
void LLTextEditor::doDelete()
{
- if( canDoDelete() )
+ if( !canDoDelete() )
{
- if( hasSelection() )
+ return;
+ }
+ if( hasSelection() )
+ {
+ deleteSelection(FALSE);
+ }
+ else
+ if( mCursorPos < getLength() )
+ {
+ S32 i;
+ S32 chars_to_remove = 1;
+ const LLWString &text = mWText;
+ if( (text[ mCursorPos ] == ' ') && (mCursorPos + SPACES_PER_TAB < getLength()) )
{
- deleteSelection(FALSE);
- }
- else
- if( mCursorPos < getLength() )
- {
- S32 i;
- S32 chars_to_remove = 1;
- const LLWString &text = mWText;
- if( (text[ mCursorPos ] == ' ') && (mCursorPos + SPACES_PER_TAB < getLength()) )
+ // Try to remove a full tab's worth of spaces
+ S32 line, offset;
+ getLineAndOffset( mCursorPos, &line, &offset );
+ chars_to_remove = SPACES_PER_TAB - (offset % SPACES_PER_TAB);
+ if( chars_to_remove == 0 )
{
- // Try to remove a full tab's worth of spaces
- S32 line, offset;
- getLineAndOffset( mCursorPos, &line, &offset );
- chars_to_remove = SPACES_PER_TAB - (offset % SPACES_PER_TAB);
- if( chars_to_remove == 0 )
- {
- chars_to_remove = SPACES_PER_TAB;
- }
-
- for( i = 0; i < chars_to_remove; i++ )
- {
- if( text[mCursorPos + i] != ' ' )
- {
- chars_to_remove = 1;
- break;
- }
- }
+ chars_to_remove = SPACES_PER_TAB;
}
-
for( i = 0; i < chars_to_remove; i++ )
{
- setCursorPos(mCursorPos + 1);
- removeChar();
+ if( text[mCursorPos + i] != ' ' )
+ {
+ chars_to_remove = 1;
+ break;
+ }
}
}
- updateLineStartList();
- updateScrollFromCursor();
+ for( i = 0; i < chars_to_remove; i++ )
+ {
+ setCursorPos(mCursorPos + 1);
+ removeChar();
+ }
}
+
+ updateLineStartList();
+ updateScrollFromCursor();
}
//----------------------------------------------------------------------------
@@ -2429,65 +2353,66 @@ void LLTextEditor::blockUndo()
mUndoStack.clear();
}
-
-BOOL LLTextEditor::canUndo()
+// virtual
+BOOL LLTextEditor::canUndo() const
{
return !mReadOnly && mLastCmd != NULL;
}
void LLTextEditor::undo()
{
- if( canUndo() )
+ if( !canUndo() )
{
- deselect();
-
- S32 pos = 0;
- do
- {
- pos = mLastCmd->undo(this);
- undo_stack_t::iterator iter = std::find(mUndoStack.begin(), mUndoStack.end(), mLastCmd);
- if (iter != mUndoStack.end())
- ++iter;
- if (iter != mUndoStack.end())
- mLastCmd = *iter;
- else
- mLastCmd = NULL;
+ return;
+ }
+ deselect();
+ S32 pos = 0;
+ do
+ {
+ pos = mLastCmd->undo(this);
+ undo_stack_t::iterator iter = std::find(mUndoStack.begin(), mUndoStack.end(), mLastCmd);
+ if (iter != mUndoStack.end())
+ ++iter;
+ if (iter != mUndoStack.end())
+ mLastCmd = *iter;
+ else
+ mLastCmd = NULL;
} while( mLastCmd && mLastCmd->groupWithNext() );
setCursorPos(pos);
- updateLineStartList();
- updateScrollFromCursor();
- }
+ updateLineStartList();
+ updateScrollFromCursor();
}
-BOOL LLTextEditor::canRedo()
+BOOL LLTextEditor::canRedo() const
{
return !mReadOnly && (mUndoStack.size() > 0) && (mLastCmd != mUndoStack.front());
}
void LLTextEditor::redo()
{
- if( canRedo() )
+ if( !canRedo() )
{
- deselect();
-
- S32 pos = 0;
- do
+ return;
+ }
+ deselect();
+ S32 pos = 0;
+ do
+ {
+ if( !mLastCmd )
{
- if( !mLastCmd )
- {
- mLastCmd = mUndoStack.back();
- }
+ mLastCmd = mUndoStack.back();
+ }
+ else
+ {
+ undo_stack_t::iterator iter = std::find(mUndoStack.begin(), mUndoStack.end(), mLastCmd);
+ if (iter != mUndoStack.begin())
+ mLastCmd = *(--iter);
else
- {
- undo_stack_t::iterator iter = std::find(mUndoStack.begin(), mUndoStack.end(), mLastCmd);
- if (iter != mUndoStack.begin())
- mLastCmd = *(--iter);
- else
- mLastCmd = NULL;
- }
+ mLastCmd = NULL;
+ }
if( mLastCmd )
{
@@ -2500,9 +2425,8 @@ void LLTextEditor::redo()
setCursorPos(pos);
- updateLineStartList();
- updateScrollFromCursor();
- }
+ updateLineStartList();
+ updateScrollFromCursor();
}
void LLTextEditor::onFocusReceived()
@@ -2548,8 +2472,8 @@ void LLTextEditor::setEnabled(BOOL enabled)
void LLTextEditor::drawBackground()
{
S32 left = 0;
- S32 top = mRect.getHeight();
- S32 right = mRect.getWidth();
+ S32 top = getRect().getHeight();
+ S32 right = getRect().getWidth();
S32 bottom = 0;
LLColor4 bg_color = mReadOnlyBgColor;
@@ -2812,7 +2736,7 @@ void LLTextEditor::drawCursor()
if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection() && text[mCursorPos] != '\n')
{
- LLTextSegment* segmentp = getSegmentAtOffset(mCursorPos);
+ const LLTextSegment* segmentp = getSegmentAtOffset(mCursorPos);
LLColor4 text_color;
if (segmentp)
{
@@ -2945,122 +2869,118 @@ void LLTextEditor::drawText()
{
const LLWString &text = mWText;
const S32 text_len = getLength();
+ if( text_len <= 0 )
+ {
+ return;
+ }
+ S32 selection_left = -1;
+ S32 selection_right = -1;
+ // Draw selection even if we don't have keyboard focus for search/replace
+ if( hasSelection())
+ {
+ selection_left = llmin( mSelectionStart, mSelectionEnd );
+ selection_right = llmax( mSelectionStart, mSelectionEnd );
+ }
- if( text_len > 0 )
+ LLGLSUIDefault gls_ui;
+
+ S32 cur_line = mScrollbar->getDocPos();
+ S32 num_lines = getLineCount();
+ if (cur_line >= num_lines)
+ {
+ return;
+ }
+
+ S32 line_start = getLineStart(cur_line);
+ LLTextSegment t(line_start);
+ segment_list_t::iterator seg_iter;
+ seg_iter = std::upper_bound(mSegments.begin(), mSegments.end(), &t, LLTextSegment::compare());
+ if (seg_iter == mSegments.end() || (*seg_iter)->getStart() > line_start) --seg_iter;
+ LLTextSegment* cur_segment = *seg_iter;
+
+ S32 line_height = llround( mGLFont->getLineHeight() );
+ F32 text_y = (F32)(mTextRect.mTop - line_height);
+ while((mTextRect.mBottom <= text_y) && (cur_line < num_lines))
{
- S32 selection_left = -1;
- S32 selection_right = -1;
- // Draw selection even if we don't have keyboard focus for search/replace
- if( hasSelection())
+ S32 next_start = -1;
+ S32 line_end = text_len;
+
+ if ((cur_line + 1) < num_lines)
{
- selection_left = llmin( mSelectionStart, mSelectionEnd );
- selection_right = llmax( mSelectionStart, mSelectionEnd );
+ next_start = getLineStart(cur_line + 1);
+ line_end = next_start;
}
-
- LLGLSUIDefault gls_ui;
-
- S32 cur_line = mScrollbar->getDocPos();
- S32 num_lines = getLineCount();
- if (cur_line >= num_lines)
+ if ( text[line_end-1] == '\n' )
{
- return;
+ --line_end;
}
- S32 line_start = getLineStart(cur_line);
- LLTextSegment t(line_start);
- segment_list_t::iterator seg_iter;
- seg_iter = std::upper_bound(mSegments.begin(), mSegments.end(), &t, LLTextSegment::compare());
- if (seg_iter == mSegments.end() || (*seg_iter)->getStart() > line_start) --seg_iter;
- LLTextSegment* cur_segment = *seg_iter;
-
- S32 line_height = llround( mGLFont->getLineHeight() );
- F32 text_y = (F32)(mTextRect.mTop - line_height);
- while((mTextRect.mBottom <= text_y) && (cur_line < num_lines))
- {
- S32 next_start = -1;
- S32 line_end = text_len;
+ F32 text_x = (F32)mTextRect.mLeft;
- if ((cur_line + 1) < num_lines)
- {
- next_start = getLineStart(cur_line + 1);
- line_end = next_start;
- }
- if ( text[line_end-1] == '\n' )
+ S32 seg_start = line_start;
+ while( seg_start < line_end )
+ {
+ while( cur_segment->getEnd() <= seg_start )
{
- --line_end;
+ seg_iter++;
+ if (seg_iter == mSegments.end())
+ {
+ llwarns << "Ran off the segmentation end!" << llendl;
+ return;
+ }
+ cur_segment = *seg_iter;
}
- F32 text_x = (F32)mTextRect.mLeft;
-
- S32 seg_start = line_start;
- while( seg_start < line_end )
+ // Draw a segment within the line
+ S32 clipped_end = llmin( line_end, cur_segment->getEnd() );
+ S32 clipped_len = clipped_end - seg_start;
+ if( clipped_len > 0 )
{
- while( cur_segment->getEnd() <= seg_start )
+ LLStyle style = cur_segment->getStyle();
+ if ( style.isImage() && (cur_segment->getStart() >= seg_start) && (cur_segment->getStart() <= clipped_end))
{
- seg_iter++;
- if (seg_iter == mSegments.end())
- {
- llwarns << "Ran off the segmentation end!" << llendl;
- return;
- }
- cur_segment = *seg_iter;
+ LLImageGL *image = style.getImage();
+ gl_draw_scaled_image( llround(text_x), llround(text_y)+line_height-style.mImageHeight, style.mImageWidth, style.mImageHeight, image, LLColor4::white );
}
-
- // Draw a segment within the line
- S32 clipped_end = llmin( line_end, cur_segment->getEnd() );
- S32 clipped_len = clipped_end - seg_start;
- if( clipped_len > 0 )
- {
- LLStyle style = cur_segment->getStyle();
- if ( style.isImage() && (cur_segment->getStart() >= seg_start) && (cur_segment->getStart() <= clipped_end))
- {
- LLImageGL *image = style.getImage();
-
- gl_draw_scaled_image( llround(text_x), llround(text_y)+line_height-style.mImageHeight, style.mImageWidth, style.mImageHeight, image, LLColor4::white );
-
- }
- if (cur_segment == mHoverSegment && style.getIsEmbeddedItem())
- {
- style.mUnderline = TRUE;
- }
+ if (cur_segment == mHoverSegment && style.getIsEmbeddedItem())
+ {
+ style.mUnderline = TRUE;
+ }
- S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
-
- if ( (mParseHTML) && (left_pos > seg_start) && (left_pos < clipped_end) && mIsSelecting && (mSelectionStart == mSelectionEnd) )
- {
- mHTML = style.getLinkHREF();
- }
+ S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
+
+ if ( (mParseHTML) && (left_pos > seg_start) && (left_pos < clipped_end) && mIsSelecting && (mSelectionStart == mSelectionEnd) )
+ {
+ mHTML = style.getLinkHREF();
+ }
- drawClippedSegment( text, seg_start, clipped_end, text_x, text_y, selection_left, selection_right, style, &text_x );
+ drawClippedSegment( text, seg_start, clipped_end, text_x, text_y, selection_left, selection_right, style, &text_x );
- // Note: text_x is incremented by drawClippedSegment()
- seg_start += clipped_len;
- }
+ // Note: text_x is incremented by drawClippedSegment()
+ seg_start += clipped_len;
}
+ }
// move down one line
text_y -= (F32)line_height;
- line_start = next_start;
- cur_line++;
- }
+ line_start = next_start;
+ cur_line++;
}
}
// Draws a single text segment, reversing the color for selection if needed.
void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyle& style, F32* right_x )
{
- const LLFontGL* font = mGLFont;
-
- LLColor4 color;
-
if (!style.isVisible())
{
return;
}
- color = style.getColor();
+ const LLFontGL* font = mGLFont;
+
+ LLColor4 color = style.getColor();
if ( style.getFontString()[0] )
{
@@ -3131,12 +3051,14 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
void LLTextEditor::draw()
{
- if( getVisible() )
+ if( !getVisible() )
{
- {
- LLLocalClipRect clip(LLRect(0, mRect.getHeight(), mRect.getWidth() - (mScrollbar->getVisible() ? SCROLLBAR_SIZE : 0), 0));
+ return;
+ }
+ {
+ LLLocalClipRect clip(LLRect(0, getRect().getHeight(), getRect().getWidth() - (mScrollbar->getVisible() ? SCROLLBAR_SIZE : 0), 0));
- bindEmbeddedChars( mGLFont );
+ bindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
drawBackground();
drawSelectionBackground();
@@ -3144,34 +3066,30 @@ void LLTextEditor::draw()
drawText();
drawCursor();
- unbindEmbeddedChars( mGLFont );
+ unbindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
- //RN: the decision was made to always show the orange border for keyboard focus but do not put an insertion caret
- // when in readonly mode
- mBorder->setKeyboardFocusHighlight( gFocusMgr.getKeyboardFocus() == this);// && !mReadOnly);
- }
- LLView::draw(); // Draw children (scrollbar and border)
+ //RN: the decision was made to always show the orange border for keyboard focus but do not put an insertion caret
+ // when in readonly mode
+ mBorder->setKeyboardFocusHighlight( gFocusMgr.getKeyboardFocus() == this);// && !mReadOnly);
}
// remember if we are supposed to be at the bottom of the buffer
mScrolledToBottom = isScrolledToBottom();
-}
-void LLTextEditor::reportBadKeystroke()
-{
- make_ui_sound("UISndBadKeystroke");
+ LLView::draw(); // Draw children (scrollbar and border)
}
void LLTextEditor::onTabInto()
{
// selecting all on tabInto causes users to hit tab twice and replace their text with a tab character
- // theoretically, one could selectAll if mTabToNextField is true, but we couldn't think of a use case
+ // theoretically, one could selectAll if mTabsToNextField is true, but we couldn't think of a use case
// where you'd want to select all anyway
// preserve insertion point when returning to the editor
//selectAll();
}
+// virtual
void LLTextEditor::clear()
{
setText(LLString::null);
@@ -3200,7 +3118,7 @@ void LLTextEditor::setFocus( BOOL new_state )
gEditMenuHandler = this;
// Don't start the cursor flashing right away
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
}
else
{
@@ -3214,6 +3132,7 @@ void LLTextEditor::setFocus( BOOL new_state )
}
}
+// virtual
BOOL LLTextEditor::acceptsTextInput() const
{
return !mReadOnly;
@@ -3268,7 +3187,7 @@ void LLTextEditor::changePage( S32 delta )
void LLTextEditor::changeLine( S32 delta )
{
- bindEmbeddedChars( mGLFont );
+ bindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
S32 line, offset;
getLineAndOffset( mCursorPos, &line, &offset );
@@ -3295,7 +3214,7 @@ void LLTextEditor::changeLine( S32 delta )
}
else
{
- unbindEmbeddedChars( mGLFont );
+ unbindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
return;
}
@@ -3320,7 +3239,7 @@ void LLTextEditor::changeLine( S32 delta )
// put desired position into remember-buffer after setCursorPos()
mDesiredXPixel = desired_x_pixel;
- unbindEmbeddedChars( mGLFont );
+ unbindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
}
BOOL LLTextEditor::isScrolledToTop()
@@ -3768,20 +3687,14 @@ BOOL LLTextEditor::tryToRevertToPristineState()
return isPristine(); // TRUE => success
}
-// virtual Return TRUE if changes have been made
-BOOL LLTextEditor::isDirty() const
-{
- return( mLastCmd != NULL || (mPristineCmd && (mPristineCmd != mLastCmd)) );
-}
-
void LLTextEditor::updateTextRect()
{
mTextRect.setOriginAndSize(
UI_TEXTEDITOR_BORDER + UI_TEXTEDITOR_H_PAD,
UI_TEXTEDITOR_BORDER,
- mRect.getWidth() - SCROLLBAR_SIZE - 2 * (UI_TEXTEDITOR_BORDER + UI_TEXTEDITOR_H_PAD),
- mRect.getHeight() - 2 * UI_TEXTEDITOR_BORDER - UI_TEXTEDITOR_V_PAD_TOP );
+ getRect().getWidth() - SCROLLBAR_SIZE - 2 * (UI_TEXTEDITOR_BORDER + UI_TEXTEDITOR_H_PAD),
+ getRect().getHeight() - 2 * UI_TEXTEDITOR_BORDER - UI_TEXTEDITOR_V_PAD_TOP );
}
void LLTextEditor::loadKeywords(const LLString& filename,
@@ -3862,8 +3775,7 @@ void LLTextEditor::pruneSegments()
}
else
{
- llwarns << "Tried to erase end of empty LLTextEditor"
- << llendl;
+ llwarns << "Tried to erase end of empty LLTextEditor" << llendl;
}
}
@@ -3949,21 +3861,9 @@ BOOL LLTextEditor::handleMouseUpOverSegment(S32 x, S32 y, MASK mask)
return FALSE;
}
-llwchar LLTextEditor::pasteEmbeddedItem(llwchar ext_char)
-{
- return ext_char;
-}
-
-void LLTextEditor::bindEmbeddedChars(const LLFontGL* font)
-{
-}
-
-void LLTextEditor::unbindEmbeddedChars(const LLFontGL* font)
-{
-}
// Finds the text segment (if any) at the give local screen position
-LLTextSegment* LLTextEditor::getSegmentAtLocalPos( S32 x, S32 y )
+const LLTextSegment* LLTextEditor::getSegmentAtLocalPos( S32 x, S32 y ) const
{
// Find the cursor position at the requested local screen position
S32 offset = getCursorPosFromLocalCoord( x, y, FALSE );
@@ -3971,13 +3871,13 @@ LLTextSegment* LLTextEditor::getSegmentAtLocalPos( S32 x, S32 y )
return idx >= 0 ? mSegments[idx] : NULL;
}
-LLTextSegment* LLTextEditor::getSegmentAtOffset(S32 offset)
+const LLTextSegment* LLTextEditor::getSegmentAtOffset(S32 offset) const
{
S32 idx = getSegmentIdxAtOffset(offset);
return idx >= 0 ? mSegments[idx] : NULL;
}
-S32 LLTextEditor::getSegmentIdxAtOffset(S32 offset)
+S32 LLTextEditor::getSegmentIdxAtOffset(S32 offset) const
{
if (mSegments.empty() || offset < 0 || offset >= getLength())
{
@@ -4149,7 +4049,7 @@ LLTextSegment::LLTextSegment( const LLColor3& color, S32 start, S32 end ) :
{
}
-BOOL LLTextSegment::getToolTip(LLString& msg)
+BOOL LLTextSegment::getToolTip(LLString& msg) const
{
if (mToken && !mToken->getToolTip().empty())
{
@@ -4162,7 +4062,7 @@ BOOL LLTextSegment::getToolTip(LLString& msg)
-void LLTextSegment::dump()
+void LLTextSegment::dump() const
{
llinfos << "Segment [" <<
// mColor.mV[VX] << ", " <<
@@ -4182,13 +4082,9 @@ LLXMLNodePtr LLTextEditor::getXML(bool save_children) const
// Attributes
node->createChild("max_length", TRUE)->setIntValue(getMaxLength());
-
node->createChild("embedded_items", TRUE)->setBoolValue(mAllowEmbeddedItems);
-
node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont));
-
node->createChild("word_wrap", TRUE)->setBoolValue(mWordWrap);
-
node->createChild("hide_scrollbar", TRUE)->setBoolValue(mHideScrollbarForShortDocs);
addColorXML(node, mCursorColor, "cursor_color", "TextCursorColor");
@@ -4274,7 +4170,7 @@ void LLTextEditor::setTextEditorParameters(LLXMLNodePtr node)
}
///////////////////////////////////////////////////////////////////
-S32 LLTextEditor::findHTMLToken(const LLString &line, S32 pos, BOOL reverse)
+S32 LLTextEditor::findHTMLToken(const LLString &line, S32 pos, BOOL reverse) const
{
LLString openers=" \t('\"[{<>";
LLString closers=" \t)'\"]}><;";
@@ -4311,7 +4207,7 @@ S32 LLTextEditor::findHTMLToken(const LLString &line, S32 pos, BOOL reverse)
return retval;
}
-BOOL LLTextEditor::findHTML(const LLString &line, S32 *begin, S32 *end)
+BOOL LLTextEditor::findHTML(const LLString &line, S32 *begin, S32 *end) const
{
S32 m1,m2,m3;
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 838154655c..7055e98a76 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -52,24 +52,16 @@ class LLKeywordToken;
class LLTextCmd;
class LLUICtrlFactory;
-//
-// Constants
-//
-
-const llwchar FIRST_EMBEDDED_CHAR = 0x100000;
-const llwchar LAST_EMBEDDED_CHAR = 0x10ffff;
-const S32 MAX_EMBEDDED_ITEMS = LAST_EMBEDDED_CHAR - FIRST_EMBEDDED_CHAR + 1;
-
-//
-// Classes
-//
-class LLTextSegment;
-class LLTextCmd;
-
class LLTextEditor : public LLUICtrl, LLEditMenuHandler, protected LLPreeditor
{
- friend class LLTextCmd;
public:
+ //
+ // Constants
+ //
+ static const llwchar FIRST_EMBEDDED_CHAR = 0x100000;
+ static const llwchar LAST_EMBEDDED_CHAR = 0x10ffff;
+ static const S32 MAX_EMBEDDED_ITEMS = LAST_EMBEDDED_CHAR - FIRST_EMBEDDED_CHAR + 1;
+
LLTextEditor(const LLString& name,
const LLRect& rect,
S32 max_length,
@@ -80,10 +72,10 @@ public:
virtual ~LLTextEditor();
virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEXT_EDITOR; }
- virtual LLString getWidgetTag() const;
+ virtual LLString getWidgetTag() const { return LL_TEXT_EDITOR_TAG; }
virtual LLXMLNodePtr getXML(bool save_children = true) const;
- static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
void setTextEditorParameters(LLXMLNodePtr node);
void setParseHTML(BOOL parsing) {mParseHTML=parsing;}
@@ -102,7 +94,6 @@ public:
EAcceptance *accept, LLString& tooltip_msg);
virtual void onMouseCaptureLost();
-
// view overrides
virtual void reshape(S32 width, S32 height, BOOL called_from_parent);
virtual void draw();
@@ -115,32 +106,25 @@ public:
virtual void clear();
virtual void setFocus( BOOL b );
virtual BOOL acceptsTextInput() const;
- virtual BOOL isDirty() const;
+ virtual BOOL isDirty() const { return( mLastCmd != NULL || (mPristineCmd && (mPristineCmd != mLastCmd)) ); }
// LLEditMenuHandler interface
virtual void undo();
- virtual BOOL canUndo();
-
+ virtual BOOL canUndo() const;
virtual void redo();
- virtual BOOL canRedo();
-
+ virtual BOOL canRedo() const;
virtual void cut();
- virtual BOOL canCut();
-
+ virtual BOOL canCut() const;
virtual void copy();
- virtual BOOL canCopy();
-
+ virtual BOOL canCopy() const;
virtual void paste();
- virtual BOOL canPaste();
-
+ virtual BOOL canPaste() const;
virtual void doDelete();
- virtual BOOL canDoDelete();
-
+ virtual BOOL canDoDelete() const;
virtual void selectAll();
- virtual BOOL canSelectAll();
-
+ virtual BOOL canSelectAll() const;
virtual void deselect();
- virtual BOOL canDeselect();
+ virtual BOOL canDeselect() const;
void selectNext(const LLString& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE);
BOOL replaceText(const LLString& search_text, const LLString& replace_text, BOOL case_insensitive, BOOL wrap = TRUE);
@@ -152,6 +136,7 @@ public:
// Text editing
virtual void makePristine();
BOOL isPristine() const;
+ BOOL allowsEmbeddedItems() const { return mAllowEmbeddedItems; }
// inserts text at cursor
void insertText(const LLString &text);
@@ -180,18 +165,21 @@ public:
void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap );
+ // Keywords support
void loadKeywords(const LLString& filename,
const LLDynamicArray<const char*>& funcs,
const LLDynamicArray<const char*>& tooltips,
const LLColor3& func_color);
+ LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); }
+ LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); }
+ // Color support
void setCursorColor(const LLColor4& c) { mCursorColor = c; }
void setFgColor( const LLColor4& c ) { mFgColor = c; }
void setTextDefaultColor( const LLColor4& c ) { mDefaultColor = c; }
void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; }
void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; }
void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; }
-
void setTrackColor( const LLColor4& color );
void setThumbColor( const LLColor4& color );
void setHighlightColor( const LLColor4& color );
@@ -200,11 +188,13 @@ public:
// Hacky methods to make it into a word-wrapping, potentially scrolling,
// read-only text box.
void setBorderVisible(BOOL b);
- void setTakesNonScrollClicks(BOOL b);
+ BOOL isBorderVisible() const;
+ void setTakesNonScrollClicks(BOOL b) { mTakesNonScrollClicks = b; }
void setHideScrollbarForShortDocs(BOOL b);
void setWordWrap( BOOL b );
- void setTabToNextField(BOOL b) { mTabToNextField = b; }
+ void setTabsToNextField(BOOL b) { mTabsToNextField = b; }
+ BOOL tabsToNextField() const { return mTabsToNextField; }
void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; }
// Hack to handle Notecards
@@ -215,7 +205,9 @@ public:
void setTakesFocus(BOOL b) { mTakesFocus = b; }
void setSourceID(const LLUUID& id) { mSourceID = id; }
+ const LLUUID& getSourceID() const { return mSourceID; }
void setAcceptCallingCardNames(BOOL enable) { mAcceptCallingCardNames = enable; }
+ BOOL acceptsCallingCardNames() const { return mAcceptCallingCardNames; }
void setHandleEditKeysDirectly( BOOL b ) { mHandleEditKeysDirectly = b; }
@@ -250,49 +242,46 @@ public:
BOOL isScrolledToBottom();
// Getters
- const LLWString& getWText() const;
- llwchar getWChar(S32 pos);
- LLWString getWSubString(S32 pos, S32 len);
+ const LLWString& getWText() const { return mWText; }
+ llwchar getWChar(S32 pos) const { return mWText[pos]; }
+ LLWString getWSubString(S32 pos, S32 len) const { return mWText.substr(pos, len); }
- LLTextSegment* getCurrentSegment();
- LLTextSegment* getPreviousSegment();
- void getSelectedSegments(std::vector<LLTextSegment*>& segments);
+ const LLTextSegment* getCurrentSegment() { return getSegmentAtOffset(mCursorPos); }
+ const LLTextSegment* getPreviousSegment();
+ void getSelectedSegments(std::vector<const LLTextSegment*>& segments);
protected:
- S32 getLength() const;
- void getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp );
+ //
+ // Methods
+ //
- void drawBackground();
- void drawSelectionBackground();
- void drawCursor();
- void drawText();
- void drawClippedSegment(const LLWString &wtext, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyle& color, F32* right_x);
+ S32 getLength() const { return mWText.length(); }
+ void getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp ) const;
void drawPreeditMarker();
void updateLineStartList(S32 startpos = 0);
void updateScrollFromCursor();
void updateTextRect();
- void updateSegments();
- void pruneSegments();
+ const LLRect& getTextRect() const { return mTextRect; }
void assignEmbedded(const LLString &s);
BOOL truncate(); // Returns true if truncation occurs
- static BOOL isPartOfWord(llwchar c);
+ static BOOL isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); }
void removeCharOrTab();
void setCursorAtLocalPos(S32 x, S32 y, BOOL round);
- S32 getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round );
+ S32 getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const;
void indentSelectedLines( S32 spaces );
S32 indentLine( S32 pos, S32 spaces );
void unindentLineBeforeCloseBrace();
- S32 getSegmentIdxAtOffset(S32 offset);
- LLTextSegment* getSegmentAtLocalPos(S32 x, S32 y);
- LLTextSegment* getSegmentAtOffset(S32 offset);
+ S32 getSegmentIdxAtOffset(S32 offset) const;
+ const LLTextSegment* getSegmentAtLocalPos(S32 x, S32 y) const;
+ const LLTextSegment* getSegmentAtOffset(S32 offset) const;
- void reportBadKeystroke();
+ void reportBadKeystroke() { make_ui_sound("UISndBadKeystroke"); }
BOOL handleNavigationKey(const KEY key, const MASK mask);
BOOL handleSpecialKey(const KEY key, const MASK mask, BOOL* return_key_hit);
@@ -309,29 +298,58 @@ protected:
S32 prevWordPos(S32 cursorPos) const;
S32 nextWordPos(S32 cursorPos) const;
- S32 getLineCount() const;
+ S32 getLineCount() const { return mLineStartList.size(); }
S32 getLineStart( S32 line ) const;
- void getLineAndOffset(S32 pos, S32* linep, S32* offsetp);
+ void getLineAndOffset(S32 pos, S32* linep, S32* offsetp) const;
S32 getPos(S32 line, S32 offset);
void changePage(S32 delta);
void changeLine(S32 delta);
void autoIndent();
-
- S32 execute(LLTextCmd* cmd);
void findEmbeddedItemSegments();
virtual BOOL handleMouseUpOverSegment(S32 x, S32 y, MASK mask);
- virtual llwchar pasteEmbeddedItem(llwchar ext_char);
- virtual void bindEmbeddedChars(const LLFontGL* font);
- virtual void unbindEmbeddedChars(const LLFontGL* font);
+
+ virtual llwchar pasteEmbeddedItem(llwchar ext_char) { return ext_char; }
+ virtual void bindEmbeddedChars(LLFontGL* font) const {}
+ virtual void unbindEmbeddedChars(LLFontGL* font) const {}
- S32 findHTMLToken(const LLString &line, S32 pos, BOOL reverse);
- BOOL findHTML(const LLString &line, S32 *begin, S32 *end);
+ S32 findHTMLToken(const LLString &line, S32 pos, BOOL reverse) const;
+ BOOL findHTML(const LLString &line, S32 *begin, S32 *end) const;
+
+ // Abstract inner base class representing an undoable editor command.
+ // Concrete sub-classes can be defined for operations such as insert, remove, etc.
+ // Used as arguments to the execute() method below.
+ class LLTextCmd
+ {
+ public:
+ LLTextCmd( S32 pos, BOOL group_with_next ) : mPos(pos), mGroupWithNext(group_with_next) {}
+ virtual ~LLTextCmd() {}
+ virtual BOOL execute(LLTextEditor* editor, S32* delta) = 0;
+ virtual S32 undo(LLTextEditor* editor) = 0;
+ virtual S32 redo(LLTextEditor* editor) = 0;
+ virtual BOOL canExtend(S32 pos) const { return FALSE; }
+ virtual void blockExtensions() {}
+ virtual BOOL extendAndExecute( LLTextEditor* editor, S32 pos, llwchar c, S32* delta ) { llassert(0); return 0; }
+ virtual BOOL hasExtCharValue( llwchar value ) const { return FALSE; }
+
+ // Defined here so they can access protected LLTextEditor editing methods
+ S32 insert(LLTextEditor* editor, S32 pos, const LLWString &wstr) { return editor->insertStringNoUndo( pos, wstr ); }
+ S32 remove(LLTextEditor* editor, S32 pos, S32 length) { return editor->removeStringNoUndo( pos, length ); }
+ S32 overwrite(LLTextEditor* editor, S32 pos, llwchar wc) { return editor->overwriteCharNoUndo(pos, wc); }
+
+ S32 getPosition() const { return mPos; }
+ BOOL groupWithNext() const { return mGroupWithNext; }
+
+ private:
+ const S32 mPos;
+ BOOL mGroupWithNext;
+ };
+ // Here's the method that takes and applies text commands.
+ S32 execute(LLTextCmd* cmd);
-protected:
// Undoable operations
void addChar(llwchar c); // at mCursorPos
S32 addChar(S32 pos, llwchar wc);
@@ -342,12 +360,13 @@ protected:
S32 remove(const S32 pos, const S32 length, const BOOL group_with_next_op);
S32 append(const LLWString &wstr, const BOOL group_with_next_op);
- // direct operations
+ // Direct operations
S32 insertStringNoUndo(S32 pos, const LLWString &wstr); // returns num of chars actually inserted
S32 removeStringNoUndo(S32 pos, S32 length);
S32 overwriteCharNoUndo(S32 pos, llwchar wc);
-
-protected:
+
+ void resetKeystrokeTimer() { mKeystrokeTimer.reset(); }
+
void updateAllowingLanguageInput();
BOOL hasPreeditString() const;
@@ -360,14 +379,76 @@ protected:
virtual void getSelectionRange(S32 *position, S32 *length) const;
virtual BOOL getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const;
virtual S32 getPreeditFontSize() const;
+ //
+ // Protected data
+ //
+ // Probably deserves serious thought to hiding as many of these
+ // as possible behind protected accessor methods.
+ //
-public:
+ // I-beam is just after the mCursorPos-th character.
+ S32 mCursorPos;
+
+ // Use these to determine if a click on an embedded item is a drag or not.
+ S32 mMouseDownX;
+ S32 mMouseDownY;
+
+ // Are we in the middle of a drag-select? To figure out if there is a current
+ // selection, call hasSelection().
+ BOOL mIsSelecting;
+ S32 mSelectionStart;
+ S32 mSelectionEnd;
+ S32 mLastSelectionX;
+ S32 mLastSelectionY;
+
+ BOOL mParseHTML;
+ LLString mHTML;
+
+ typedef std::vector<LLTextSegment *> segment_list_t;
+ segment_list_t mSegments;
+ const LLTextSegment* mHoverSegment;
+
+ // Scrollbar data
+ class LLScrollbar* mScrollbar;
+ BOOL mHideScrollbarForShortDocs;
+ BOOL mTakesNonScrollClicks;
+ void (*mOnScrollEndCallback)(void*);
+ void *mOnScrollEndData;
+
+ LLWString mPreeditWString;
+ LLWString mPreeditOverwrittenWString;
+ std::vector<S32> mPreeditPositions;
+ std::vector<BOOL> mPreeditStandouts;
+
+private:
+
+ //
+ // Methods
+ //
+ void updateSegments();
+ void pruneSegments();
+
+ void drawBackground();
+ void drawSelectionBackground();
+ void drawCursor();
+ void drawText();
+ void drawClippedSegment(const LLWString &wtext, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyle& color, F32* right_x);
+
+ //
+ // Data
+ //
LLKeywords mKeywords;
static LLColor4 mLinkColor;
static void (*mURLcallback) (const char* url);
static bool (*mSecondlifeURLcallback) (const std::string& url);
static bool (*mSecondlifeURLcallbackRightClick) (const std::string& url);
-protected:
+
+ // Concrete LLTextCmd sub-classes used by the LLTextEditor base class
+ class LLTextCmdInsert;
+ class LLTextCmdAddChar;
+ class LLTextCmdOverwriteChar;
+ class LLTextCmdRemove;
+
LLWString mWText;
mutable LLString mUTF8Text;
mutable BOOL mTextIsUpToDate;
@@ -376,8 +457,7 @@ protected:
const LLFontGL* mGLFont;
- LLScrollbar* mScrollbar;
- LLViewBorder* mBorder;
+ class LLViewBorder* mBorder;
BOOL mBaseDocIsPristine;
LLTextCmd* mPristineCmd;
@@ -387,7 +467,6 @@ protected:
typedef std::deque<LLTextCmd*> undo_stack_t;
undo_stack_t mUndoStack;
- S32 mCursorPos; // I-beam is just after the mCursorPos-th character.
S32 mDesiredXPixel; // X pixel position where the user wants the cursor to be
LLRect mTextRect; // The rect in which text is drawn. Excludes borders.
// List of offsets and segment index of the start of each line. Always has at least one node (0).
@@ -411,20 +490,7 @@ protected:
};
typedef std::vector<line_info> line_list_t;
line_list_t mLineStartList;
-
- // Are we in the middle of a drag-select? To figure out if there is a current
- // selection, call hasSelection().
- BOOL mIsSelecting;
-
- S32 mSelectionStart;
- S32 mSelectionEnd;
-
- void (*mOnScrollEndCallback)(void*);
- void *mOnScrollEndData;
- typedef std::vector<LLTextSegment *> segment_list_t;
- segment_list_t mSegments;
- LLTextSegment* mHoverSegment;
LLFrameTimer mKeystrokeTimer;
LLColor4 mCursorColor;
@@ -439,11 +505,9 @@ protected:
BOOL mReadOnly;
BOOL mWordWrap;
- BOOL mTabToNextField; // if true, tab moves focus to next field, else inserts spaces
+ BOOL mTabsToNextField; // if true, tab moves focus to next field, else inserts spaces
BOOL mCommitOnFocusLost;
BOOL mTakesFocus;
- BOOL mHideScrollbarForShortDocs;
- BOOL mTakesNonScrollClicks;
BOOL mTrackBottom; // if true, keeps scroll position at bottom during resize
BOOL mScrolledToBottom;
@@ -453,24 +517,14 @@ protected:
LLUUID mSourceID;
- BOOL mHandleEditKeysDirectly; // If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system
+ // If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here
+ //instead of routed by the menu system
+ BOOL mHandleEditKeysDirectly;
- // Use these to determine if a click on an embedded item is a drag
- // or not.
- S32 mMouseDownX;
- S32 mMouseDownY;
+ LLCoordGL mLastIMEPosition; // Last position of the IME editor
+}; // end class LLTextEditor
- S32 mLastSelectionX;
- S32 mLastSelectionY;
- BOOL mParseHTML;
- LLString mHTML;
-
- LLWString mPreeditWString;
- LLWString mPreeditOverwrittenWString;
- std::vector<S32> mPreeditPositions;
- std::vector<BOOL> mPreeditStandouts;
-};
class LLTextSegment
{
@@ -482,21 +536,20 @@ public:
LLTextSegment( const LLColor4& color, S32 start, S32 end );
LLTextSegment( const LLColor3& color, S32 start, S32 end );
- S32 getStart() { return mStart; }
- S32 getEnd() { return mEnd; }
+ S32 getStart() const { return mStart; }
+ S32 getEnd() const { return mEnd; }
void setEnd( S32 end ) { mEnd = end; }
- const LLColor4& getColor() { return mStyle.getColor(); }
+ const LLColor4& getColor() const { return mStyle.getColor(); }
void setColor(const LLColor4 &color) { mStyle.setColor(color); }
- const LLStyle& getStyle() { return mStyle; }
+ const LLStyle& getStyle() const { return mStyle; }
void setStyle(const LLStyle &style) { mStyle = style; }
void setIsDefault(BOOL b) { mIsDefault = b; }
- BOOL getIsDefault() { return mIsDefault; }
-
+ BOOL getIsDefault() const { return mIsDefault; }
void setToken( LLKeywordToken* token ) { mToken = token; }
- LLKeywordToken* getToken() { return mToken; }
- BOOL getToolTip( LLString& msg );
+ LLKeywordToken* getToken() const { return mToken; }
+ BOOL getToolTip( LLString& msg ) const;
- void dump();
+ void dump() const;
struct compare
{
@@ -514,34 +567,5 @@ private:
BOOL mIsDefault;
};
-class LLTextCmd
-{
-public:
- LLTextCmd( S32 pos, BOOL group_with_next )
- : mPos(pos),
- mGroupWithNext(group_with_next)
- {
- }
- virtual ~LLTextCmd() {}
- virtual BOOL execute(LLTextEditor* editor, S32* delta) = 0;
- virtual S32 undo(LLTextEditor* editor) = 0;
- virtual S32 redo(LLTextEditor* editor) = 0;
- virtual BOOL canExtend(S32 pos);
- virtual void blockExtensions();
- virtual BOOL extendAndExecute( LLTextEditor* editor, S32 pos, llwchar c, S32* delta );
- virtual BOOL hasExtCharValue( llwchar value );
-
- // Define these here so they can access LLTextEditor through the friend relationship
- S32 insert(LLTextEditor* editor, S32 pos, const LLWString &wstr);
- S32 remove(LLTextEditor* editor, S32 pos, S32 length);
- S32 overwrite(LLTextEditor* editor, S32 pos, llwchar wc);
-
- BOOL groupWithNext() { return mGroupWithNext; }
-
-protected:
- S32 mPos;
- BOOL mGroupWithNext;
-};
-
#endif // LL_TEXTEDITOR_
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 7561fe8b48..ad523db78b 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1644,7 +1644,7 @@ void LLUI::setCursorPositionScreen(S32 x, S32 y)
}
//static
-void LLUI::setCursorPositionLocal(LLView* viewp, S32 x, S32 y)
+void LLUI::setCursorPositionLocal(const LLView* viewp, S32 x, S32 y)
{
S32 screen_x, screen_y;
viewp->localPointToScreen(x, y, &screen_x, &screen_y);
@@ -1847,12 +1847,12 @@ void LLUIImage::setScaleRegion(const LLRectf& region)
}
//TODO: move drawing implementation inside class
-void LLUIImage::draw(S32 x, S32 y, const LLColor4& color)
+void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const
{
gl_draw_image(x, y, mImage, color, mClipRegion);
}
-void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color)
+void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
{
if (mUniformScaling)
{
@@ -1871,7 +1871,7 @@ void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color)
}
}
-void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color)
+void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
{
gl_draw_scaled_image_with_border(
x, y,
@@ -1883,7 +1883,7 @@ void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& c
mScaleRegion);
}
-void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color)
+void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color) const
{
gl_draw_scaled_image_with_border(
x, y,
@@ -1895,12 +1895,12 @@ void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color)
mScaleRegion);
}
-S32 LLUIImage::getWidth()
+S32 LLUIImage::getWidth() const
{
return mImage->getWidth(0);
}
-S32 LLUIImage::getHeight()
+S32 LLUIImage::getHeight() const
{
return mImage->getHeight(0);
}
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 05982aa9e2..b5b15eef23 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -1,6 +1,6 @@
/**
* @file llui.h
- * @brief UI implementation
+ * @brief GL function declarations and other general static UI services.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -43,7 +43,10 @@
#include <stack>
#include "llimagegl.h"
-class LLColor4;
+// LLUIFactory
+#include "llsd.h"
+
+class LLColor4;
class LLVector3;
class LLVector2;
class LLUUID;
@@ -147,11 +150,15 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL
extern BOOL gShowTextEditCursor;
class LLImageProviderInterface;
+
typedef void (*LLUIAudioCallback)(const LLUUID& uuid);
class LLUI
{
public:
+ //
+ // Methods
+ //
static void initClass(LLControlGroup* config,
LLControlGroup* colors,
LLControlGroup* assets,
@@ -169,10 +176,10 @@ public:
//helper functions (should probably move free standing rendering helper functions here)
static LLString locateSkin(const LLString& filename);
static void setCursorPositionScreen(S32 x, S32 y);
- static void setCursorPositionLocal(LLView* viewp, S32 x, S32 y);
+ static void setCursorPositionLocal(const LLView* viewp, S32 x, S32 y);
static void setScaleFactor(const LLVector2& scale_factor);
static void setLineWidth(F32 width);
- static LLUUID findAssetUUIDByName(const LLString& name);
+ static LLUUID findAssetUUIDByName(const LLString& name);
static LLUIImage* getUIImageByName(const LLString& name);
static LLVector2 getWindowSize();
static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y);
@@ -181,7 +188,9 @@ public:
static void glRectToScreen(const LLRect& gl, LLRect *screen);
static void setHtmlHelp(LLHtmlHelp* html_help);
-public:
+ //
+ // Data
+ //
static LLControlGroup* sConfigGroup;
static LLControlGroup* sColorsGroup;
static LLControlGroup* sAssetsGroup;
@@ -287,93 +296,179 @@ typedef enum e_widget_type
WIDGET_TYPE_COUNT
} EWidgetType;
-// Manages generation of UI elements by LLSD, such that there is
-// only one instance per uniquely identified LLSD parameter
-// Class T is the instance type being managed, and INSTANCE_ADDAPTOR
-// wraps an instance of the class with handlers for show/hide semantics, etc.
-template <class T, class INSTANCE_ADAPTOR = T>
-class LLUIInstanceMgr
+// FactoryPolicy is a static class that controls the creation and lookup of UI elements,
+// such as floaters.
+// The key parameter is used to provide a unique identifier and/or associated construction
+// parameters for a given UI instance
+//
+// Specialize this traits for different types, or provide a class with an identical interface
+// in the place of the traits parameter
+//
+// For example:
+//
+// template <>
+// class FactoryPolicy<MyClass> /* FactoryPolicy specialized for MyClass */
+// {
+// public:
+// static MyClass* findInstance(const LLSD& key = LLSD())
+// {
+// /* return instance of MyClass associated with key */
+// }
+//
+// static MyClass* createInstance(const LLSD& key = LLSD())
+// {
+// /* create new instance of MyClass using key for construction parameters */
+// }
+// }
+//
+// class MyClass : public LLUIFactory<MyClass>
+// {
+// /* uses FactoryPolicy<MyClass> by default */
+// }
+
+template <class T>
+class FactoryPolicy
+{
+public:
+ // basic factory methods
+ static T* findInstance(const LLSD& key); // unimplemented, provide specialiation
+ static T* createInstance(const LLSD& key); // unimplemented, provide specialiation
+};
+
+// VisibilityPolicy controls the visibility of UI elements, such as floaters.
+// The key parameter is used to store the unique identifier of a given UI instance
+//
+// Specialize this traits for different types, or duplicate this interface for specific instances
+// (see above)
+
+template <class T>
+class VisibilityPolicy
+{
+public:
+ // visibility methods
+ static bool visible(T* instance, const LLSD& key); // unimplemented, provide specialiation
+ static void show(T* instance, const LLSD& key); // unimplemented, provide specialiation
+ static void hide(T* instance, const LLSD& key); // unimplemented, provide specialiation
+};
+
+// Manages generation of UI elements by LLSD, such that (generally) there is
+// a unique instance per distinct LLSD parameter
+// Class T is the instance type being managed, and the FACTORY_POLICY and VISIBILITY_POLICY
+// classes provide static methods for creating, accessing, showing and hiding the associated
+// element T
+template <class T, class FACTORY_POLICY = FactoryPolicy<T>, class VISIBILITY_POLICY = VisibilityPolicy<T> >
+class LLUIFactory
{
public:
- LLUIInstanceMgr()
+ // give names to the template parameters so derived classes can refer to them
+ // except this doesn't work in gcc
+ typedef FACTORY_POLICY factory_policy_t;
+ typedef VISIBILITY_POLICY visibility_policy_t;
+
+ LLUIFactory()
{
}
- virtual ~LLUIInstanceMgr()
+ virtual ~LLUIFactory()
{
}
// default show and hide methods
- static T* showInstance(const LLSD& seed = LLSD())
+ static T* showInstance(const LLSD& key = LLSD())
{
- T* instance = INSTANCE_ADAPTOR::getInstance(seed);
- INSTANCE_ADAPTOR::show(instance);
+ T* instance = getInstance(key);
+ if (instance != NULL)
+ {
+ VISIBILITY_POLICY::show(instance, key);
+ }
return instance;
}
- static void hideInstance(const LLSD& seed = LLSD())
+ static void hideInstance(const LLSD& key = LLSD())
{
- T* instance = INSTANCE_ADAPTOR::getInstance(seed);
- INSTANCE_ADAPTOR::hide(instance);
+ T* instance = getInstance(key);
+ if (instance != NULL)
+ {
+ VISIBILITY_POLICY::hide(instance, key);
+ }
}
- static void toggleInstance(const LLSD& seed = LLSD())
+ static void toggleInstance(const LLSD& key = LLSD())
{
- if (INSTANCE_ADAPTOR::instanceVisible(seed))
+ if (instanceVisible(key))
{
- INSTANCE_ADAPTOR::hideInstance(seed);
+ hideInstance(key);
}
else
{
- INSTANCE_ADAPTOR::showInstance(seed);
+ showInstance(key);
}
}
- static BOOL instanceVisible(const LLSD& seed = LLSD())
+ static bool instanceVisible(const LLSD& key = LLSD())
{
- T* instance = INSTANCE_ADAPTOR::findInstance(seed);
- return instance != NULL && INSTANCE_ADAPTOR::visible(instance);
+ T* instance = FACTORY_POLICY::findInstance(key);
+ return instance != NULL && VISIBILITY_POLICY::visible(instance, key);
}
- static T* getInstance(const LLSD& seed = LLSD())
+ static T* getInstance(const LLSD& key = LLSD())
{
- T* instance = INSTANCE_ADAPTOR::findInstance(seed);
+ T* instance = FACTORY_POLICY::findInstance(key);
if (instance == NULL)
{
- instance = INSTANCE_ADAPTOR::createInstance(seed);
+ instance = FACTORY_POLICY::createInstance(key);
}
return instance;
}
};
-// Creates a UI singleton by ignoring the identifying parameter
-// and always generating the same instance via the LLUIInstanceMgr interface.
-// Note that since UI elements can be destroyed by their hierarchy, this singleton
-// pattern uses a static pointer to an instance that will be re-created as needed.
-template <class T, class INSTANCE_ADAPTOR = T>
-class LLUISingleton: public LLUIInstanceMgr<T, INSTANCE_ADAPTOR>
+
+// Creates a UI singleton by ignoring the identifying parameter
+// and always generating the same instance via the LLUIFactory interface.
+// Note that since UI elements can be destroyed by their hierarchy, this singleton
+// pattern uses a static pointer to an instance that will be re-created as needed.
+//
+// Usage Pattern:
+//
+// class LLFloaterFoo : public LLFloater, public LLUISingleton<LLFloaterFoo>
+// {
+// friend class LLUISingleton<LLFloaterFoo>;
+// private:
+// LLFloaterFoo(const LLSD& key);
+// };
+//
+// Note that LLUISingleton takes an option VisibilityPolicy parameter that defines
+// how showInstance(), hideInstance(), etc. work.
+//
+// https://wiki.lindenlab.com/mediawiki/index.php?title=LLUISingleton&oldid=79352
+
+template <class T, class VISIBILITY_POLICY = VisibilityPolicy<T> >
+class LLUISingleton: public LLUIFactory<T, LLUISingleton<T, VISIBILITY_POLICY>, VISIBILITY_POLICY>
{
-public:
- // default constructor assumes T is derived from LLUISingleton (a true singleton)
- LLUISingleton() : LLUIInstanceMgr<T, INSTANCE_ADAPTOR>() { sInstance = (T*)this; }
+protected:
+
+ // T must derive from LLUISingleton<T>
+ LLUISingleton() { sInstance = static_cast<T*>(this); }
+
~LLUISingleton() { sInstance = NULL; }
- static T* findInstance(const LLSD& seed = LLSD())
+public:
+ static T* findInstance(const LLSD& key = LLSD())
{
return sInstance;
}
-
- static T* createInstance(const LLSD& seed = LLSD())
+
+ static T* createInstance(const LLSD& key = LLSD())
{
if (sInstance == NULL)
{
- sInstance = new T(seed);
+ sInstance = new T(key);
}
return sInstance;
}
-protected:
+private:
static T* sInstance;
};
@@ -412,14 +507,15 @@ public:
void setScaleRegion(const LLRectf& region);
LLPointer<LLImageGL> getImage() { return mImage; }
+ const LLPointer<LLImageGL>& getImage() const { return mImage; }
- void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR);
- void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR);
- void drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color);
- void drawSolid(S32 x, S32 y, const LLColor4& color);
+ void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR) const;
+ void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR) const;
+ void drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const;
+ void drawSolid(S32 x, S32 y, const LLColor4& color) const;
- S32 getWidth();
- S32 getHeight();
+ S32 getWidth() const;
+ S32 getHeight() const;
protected:
LLRectf mScaleRegion;
@@ -429,6 +525,140 @@ protected:
BOOL mNoClip;
};
+
+template <typename T>
+class LLTombStone : public LLRefCount
+{
+public:
+ LLTombStone(T* target = NULL) : mTarget(target) {}
+
+ void setTarget(T* target) { mTarget = target; }
+ T* getTarget() const { return mTarget; }
+private:
+ T* mTarget;
+};
+
+// LLHandles are used to refer to objects whose lifetime you do not control or influence.
+// Calling get() on a handle will return a pointer to the referenced object or NULL,
+// if the object no longer exists. Note that during the lifetime of the returned pointer,
+// you are assuming that the object will not be deleted by any action you perform,
+// or any other thread, as normal when using pointers, so avoid using that pointer outside of
+// the local code block.
+//
+// https://wiki.lindenlab.com/mediawiki/index.php?title=LLHandle&oldid=79669
+
+template <typename T>
+class LLHandle
+{
+public:
+ LLHandle() : mTombStone(sDefaultTombStone) {}
+ const LLHandle<T>& operator =(const LLHandle<T>& other)
+ {
+ mTombStone = other.mTombStone;
+ return *this;
+ }
+
+ bool isDead() const
+ {
+ return mTombStone->getTarget() == NULL;
+ }
+
+ void markDead()
+ {
+ mTombStone = sDefaultTombStone;
+ }
+
+ T* get() const
+ {
+ return mTombStone->getTarget();
+ }
+
+ friend bool operator== (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
+ {
+ return lhs.mTombStone == rhs.mTombStone;
+ }
+ friend bool operator!= (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
+ {
+ return !(lhs == rhs);
+ }
+ friend bool operator< (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
+ {
+ return lhs.mTombStone < rhs.mTombStone;
+ }
+ friend bool operator> (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
+ {
+ return lhs.mTombStone > rhs.mTombStone;
+ }
+protected:
+
+protected:
+ LLPointer<LLTombStone<T> > mTombStone;
+
+private:
+ static LLPointer<LLTombStone<T> > sDefaultTombStone;
+};
+
+// initialize static "empty" tombstone pointer
+template <typename T> LLPointer<LLTombStone<T> > LLHandle<T>::sDefaultTombStone = new LLTombStone<T>();
+
+
+template <typename T>
+class LLRootHandle : public LLHandle<T>
+{
+public:
+ LLRootHandle(T* object) { bind(object); }
+ LLRootHandle() {};
+ ~LLRootHandle() { unbind(); }
+
+ // this is redundant, since a LLRootHandle *is* an LLHandle
+ LLHandle<T> getHandle() { return LLHandle<T>(*this); }
+
+ void bind(T* object)
+ {
+ // unbind existing tombstone
+ if (LLHandle<T>::mTombStone.notNull())
+ {
+ if (LLHandle<T>::mTombStone->getTarget() == object) return;
+ LLHandle<T>::mTombStone->setTarget(NULL);
+ }
+ // tombstone reference counted, so no paired delete
+ LLHandle<T>::mTombStone = new LLTombStone<T>(object);
+ }
+
+ void unbind()
+ {
+ LLHandle<T>::mTombStone->setTarget(NULL);
+ }
+
+ //don't allow copying of root handles, since there should only be one
+private:
+ LLRootHandle(const LLRootHandle& other) {};
+};
+
+// Use this as a mixin for simple classes that need handles and when you don't
+// want handles at multiple points of the inheritance hierarchy
+template <typename T>
+class LLHandleProvider
+{
+protected:
+ typedef LLHandle<T> handle_type_t;
+ LLHandleProvider()
+ {
+ // provided here to enforce T deriving from LLHandleProvider<T>
+ }
+
+ LLHandle<T> getHandle()
+ {
+ // perform lazy binding to avoid small tombstone allocations for handle
+ // providers whose handles are never referenced
+ mHandle.bind(static_cast<T*>(this));
+ return mHandle;
+ }
+
+private:
+ LLRootHandle<T> mHandle;
+};
+
//RN: maybe this needs to moved elsewhere?
class LLImageProviderInterface
{
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index ee6176fff6..ade301a32e 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -32,20 +32,9 @@
//#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
-
#include "lluictrl.h"
-
-#include "llgl.h"
-#include "llui.h"
-#include "lluiconstants.h"
#include "llfocusmgr.h"
-#include "v3color.h"
-
-#include "llstring.h"
-#include "llfontgl.h"
-#include "llkeyboard.h"
-const U32 MAX_STRING_LENGTH = 10;
LLFocusableElement::LLFocusableElement()
: mFocusLostCallback(NULL),
@@ -55,6 +44,11 @@ LLFocusableElement::LLFocusableElement()
{
}
+//virtual
+LLFocusableElement::~LLFocusableElement()
+{
+}
+
void LLFocusableElement::onFocusReceived()
{
if( mFocusReceivedCallback )
@@ -138,6 +132,18 @@ void LLUICtrl::onCommit()
}
}
+//virtual
+BOOL LLUICtrl::isCtrl() const
+{
+ return TRUE;
+}
+
+//virtual
+LLSD LLUICtrl::getValue() const
+{
+ return LLSD();
+}
+
// virtual
BOOL LLUICtrl::setTextArg( const LLString& key, const LLStringExplicit& text )
{
@@ -176,7 +182,7 @@ BOOL LLUICtrl::hasFocus() const
void LLUICtrl::setFocus(BOOL b)
{
// focus NEVER goes to ui ctrls that are disabled!
- if (!mEnabled)
+ if (!getEnabled())
{
return;
}
@@ -266,6 +272,17 @@ BOOL LLUICtrl::acceptsTextInput() const
return FALSE;
}
+//virtual
+BOOL LLUICtrl::isDirty() const
+{
+ return FALSE;
+};
+
+//virtual
+void LLUICtrl::resetDirty()
+{
+}
+
// virtual
void LLUICtrl::onTabInto()
{
@@ -315,7 +332,7 @@ public:
CompareByDefaultTabGroup(LLView::child_tab_order_t order, S32 default_tab_group):
LLCompareByTabOrder(order),
mDefaultTabGroup(default_tab_group) {}
-protected:
+private:
/*virtual*/ bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const
{
S32 ag = a.first; // tab group for a
@@ -329,8 +346,10 @@ protected:
S32 mDefaultTabGroup;
};
-// sorter for plugging into the query
-class DefaultTabGroupFirstSorter : public LLQuerySorter, public LLSingleton<DefaultTabGroupFirstSorter>
+
+// Sorter for plugging into the query.
+// I'd have defined it local to the one method that uses it but that broke the VS 05 compiler. -MG
+class LLUICtrl::DefaultTabGroupFirstSorter : public LLQuerySorter, public LLSingleton<DefaultTabGroupFirstSorter>
{
public:
/*virtual*/ void operator() (LLView * parent, viewList_t &children) const
@@ -339,14 +358,13 @@ public:
}
};
-
BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash)
{
// try to select default tab group child
- LLCtrlQuery query = LLView::getTabOrderQuery();
+ LLCtrlQuery query = getTabOrderQuery();
// sort things such that the default tab group is at the front
query.setSorter(DefaultTabGroupFirstSorter::getInstance());
- LLView::child_list_t result = query(this);
+ child_list_t result = query(this);
if(result.size() > 0)
{
LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
@@ -361,10 +379,116 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash)
}
return TRUE;
}
- // fall back on default behavior if we didn't find anything
- return LLView::focusFirstItem(prefer_text_fields);
+ // search for text field first
+ if(prefer_text_fields)
+ {
+ LLCtrlQuery query = getTabOrderQuery();
+ query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
+ child_list_t result = query(this);
+ if(result.size() > 0)
+ {
+ LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
+ if(!ctrl->hasFocus())
+ {
+ ctrl->setFocus(TRUE);
+ ctrl->onTabInto();
+ gFocusMgr.triggerFocusFlash();
+ }
+ return TRUE;
+ }
+ }
+ // no text field found, or we don't care about text fields
+ result = getTabOrderQuery().run(this);
+ if(result.size() > 0)
+ {
+ LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
+ if(!ctrl->hasFocus())
+ {
+ ctrl->setFocus(TRUE);
+ ctrl->onTabInto();
+ gFocusMgr.triggerFocusFlash();
+ }
+ return TRUE;
+ }
+ return FALSE;
}
+BOOL LLUICtrl::focusLastItem(BOOL prefer_text_fields)
+{
+ // search for text field first
+ if(prefer_text_fields)
+ {
+ LLCtrlQuery query = getTabOrderQuery();
+ query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
+ child_list_t result = query(this);
+ if(result.size() > 0)
+ {
+ LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back());
+ if(!ctrl->hasFocus())
+ {
+ ctrl->setFocus(TRUE);
+ ctrl->onTabInto();
+ gFocusMgr.triggerFocusFlash();
+ }
+ return TRUE;
+ }
+ }
+ // no text field found, or we don't care about text fields
+ child_list_t result = getTabOrderQuery().run(this);
+ if(result.size() > 0)
+ {
+ LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back());
+ if(!ctrl->hasFocus())
+ {
+ ctrl->setFocus(TRUE);
+ ctrl->onTabInto();
+ gFocusMgr.triggerFocusFlash();
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL LLUICtrl::focusNextItem(BOOL text_fields_only)
+{
+ // this assumes that this method is called on the focus root.
+ LLCtrlQuery query = getTabOrderQuery();
+ if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly"))
+ {
+ query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
+ }
+ child_list_t result = query(this);
+ return focusNext(result);
+}
+
+BOOL LLUICtrl::focusPrevItem(BOOL text_fields_only)
+{
+ // this assumes that this method is called on the focus root.
+ LLCtrlQuery query = getTabOrderQuery();
+ if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly"))
+ {
+ query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
+ }
+ child_list_t result = query(this);
+ return focusPrev(result);
+}
+
+const LLUICtrl* LLUICtrl::findRootMostFocusRoot() const
+{
+ const LLUICtrl* focus_root = NULL;
+ const LLUICtrl* next_view = this;
+ while(next_view)
+ {
+ if (next_view->isFocusRoot())
+ {
+ focus_root = next_view;
+ }
+ next_view = next_view->getParentUICtrl();
+ }
+ return focus_root;
+}
+
+
/*
// Don't let the children handle the tool tip. Handle it here instead.
BOOL LLUICtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen)
@@ -381,7 +505,7 @@ BOOL LLUICtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_sc
0, 0,
&(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
localPointToScreen(
- mRect.getWidth(), mRect.getHeight(),
+ getRect().getWidth(), getRect().getHeight(),
&(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) );
handled = TRUE;
@@ -425,7 +549,26 @@ LLPanel* LLUICtrl::getParentPanel() const
{
parent = parent->getParent();
}
- return reinterpret_cast<LLPanel*>(parent);
+ 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
+{
+ LLView* parent = getParent();
+ while (parent)
+ {
+ if (parent->isCtrl())
+ {
+ return (LLUICtrl*)(parent);
+ }
+ else
+ {
+ parent = parent->getParent();
+ }
+ }
+ return NULL;
}
// virtual
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index e47ee318be..81b00d4ec3 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -37,28 +37,13 @@
#include "llrect.h"
#include "llsd.h"
-//
-// Classes
-//
-class LLFontGL;
-class LLButton;
-class LLTextBox;
-class LLLineEditor;
-class LLUICtrl;
-class LLPanel;
-class LLCtrlSelectionInterface;
-class LLCtrlListInterface;
-class LLCtrlScrollInterface;
-
-typedef void (*LLUICtrlCallback)(LLUICtrl* ctrl, void* userdata);
-typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata);
class LLFocusableElement
{
friend class LLFocusMgr; // allow access to focus change handlers
public:
LLFocusableElement();
- virtual ~LLFocusableElement() {};
+ virtual ~LLFocusableElement();
virtual void setFocus( BOOL b );
virtual BOOL hasFocus() const;
@@ -80,63 +65,74 @@ class LLUICtrl
: public LLView, public LLFocusableElement
{
public:
+ typedef void (*LLUICtrlCallback)(LLUICtrl* ctrl, void* userdata);
+ typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata);
+
LLUICtrl();
LLUICtrl( const LLString& name, const LLRect& rect, BOOL mouse_opaque,
LLUICtrlCallback callback,
void* callback_userdata,
U32 reshape=FOLLOWS_NONE);
- virtual ~LLUICtrl();
+ /*virtual*/ ~LLUICtrl();
// LLView interface
- //virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect);
- virtual void initFromXML(LLXMLNodePtr node, LLView* parent);
- virtual LLXMLNodePtr getXML(bool save_children = true) const;
-
- virtual LLSD getValue() const { return LLSD(); }
-
- // Defaults to no-op
- virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
-
- // Defaults to no-op
- virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
+ /*virtual*/ void initFromXML(LLXMLNodePtr node, LLView* parent);
+ /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
+ /*virtual*/ BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
+ /*virtual*/ void onFocusReceived();
+ /*virtual*/ void onFocusLost();
+ /*virtual*/ BOOL isCtrl() const;
+ /*virtual*/ void setTentative(BOOL b);
+ /*virtual*/ BOOL getTentative() const;
+
+ // From LLFocusableElement
+ /*virtual*/ void setFocus( BOOL b );
+ /*virtual*/ BOOL hasFocus() const;
+
+ // New virtuals
- // Defaults to return NULL
- virtual LLCtrlSelectionInterface* getSelectionInterface();
- virtual LLCtrlListInterface* getListInterface();
- virtual LLCtrlScrollInterface* getScrollInterface();
+ // Return NULL by default (overrride if the class has the appropriate interface)
+ virtual class LLCtrlSelectionInterface* getSelectionInterface();
+ virtual class LLCtrlListInterface* getListInterface();
+ virtual class LLCtrlScrollInterface* getScrollInterface();
- virtual void setFocus( BOOL b );
- virtual BOOL hasFocus() const;
+ virtual LLSD getValue() const;
+ virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
+ virtual void setIsChrome(BOOL is_chrome);
- virtual void onFocusReceived();
- virtual void onFocusLost();
+ virtual BOOL acceptsTextInput() const; // Defaults to false
+ // A control is dirty if the user has modified its value.
+ // Editable controls should override this.
+ virtual BOOL isDirty() const; // Defauls to false
+ virtual void resetDirty(); //Defaults to no-op
+
+ // Call appropriate callbacks
virtual void onLostTop(); // called when registered as top ctrl and user clicks elsewhere
-
- virtual void setTabStop( BOOL b );
- virtual BOOL hasTabStop() const;
-
- // Defaults to false
- virtual BOOL acceptsTextInput() const;
-
- // Default to no-op
+ virtual void onCommit();
+
+ // Default to no-op:
virtual void onTabInto();
virtual void clear();
+ virtual void setDoubleClickCallback( void (*cb)(void*) );
+ virtual void setColor(const LLColor4& color);
+ virtual void setMinValue(LLSD min_value);
+ virtual void setMaxValue(LLSD max_value);
- virtual void setIsChrome(BOOL is_chrome);
- virtual BOOL getIsChrome() const;
-
- virtual void onCommit();
+ BOOL focusNextItem(BOOL text_entry_only);
+ BOOL focusPrevItem(BOOL text_entry_only);
+ BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
+ BOOL focusLastItem(BOOL prefer_text_fields = FALSE);
- virtual BOOL isCtrl() const { return TRUE; }
- // "Tentative" controls have a proposed value, but haven't committed
- // it yet. This is used when multiple objects are selected and we
- // want to display a parameter that differs between the objects.
- virtual void setTentative(BOOL b);
- virtual BOOL getTentative() const;
+ // Non Virtuals
+ BOOL getIsChrome() const;
+
+ void setTabStop( BOOL b );
+ BOOL hasTabStop() const;
// Returns containing panel/floater or NULL if none found.
- LLPanel* getParentPanel() const;
+ class LLPanel* getParentPanel() const;
+ class LLUICtrl* getParentUICtrl() const;
void* getCallbackUserData() const { return mCallbackUserData; }
void setCallbackUserData( void* data ) { mCallbackUserData = data; }
@@ -144,18 +140,8 @@ public:
void setCommitCallback( void (*cb)(LLUICtrl*, void*) ) { mCommitCallback = cb; }
void setValidateBeforeCommit( BOOL(*cb)(LLUICtrl*, void*) ) { mValidateCallback = cb; }
void setLostTopCallback( void (*cb)(LLUICtrl*, void*) ) { mLostTopCallback = cb; }
-
- // Defaults to no-op!
- virtual void setDoubleClickCallback( void (*cb)(void*) );
-
- // Defaults to no-op
- virtual void setColor(const LLColor4& color);
-
- // Defaults to no-op
- virtual void setMinValue(LLSD min_value);
- virtual void setMaxValue(LLSD max_value);
-
- /*virtual*/ BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
+
+ const LLUICtrl* findRootMostFocusRoot() const;
class LLTextInputFilter : public LLQueryFilter, public LLSingleton<LLTextInputFilter>
{
@@ -165,11 +151,6 @@ public:
}
};
- // Returns TRUE if the user has modified this control. Editable controls should override this.
- virtual BOOL isDirty() const { return FALSE; };
- // Clear the dirty state
- virtual void resetDirty() {};
-
protected:
void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata );
@@ -177,13 +158,14 @@ protected:
BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata );
void* mCallbackUserData;
- BOOL mTentative;
- BOOL mTabStop;
private:
- BOOL mIsChrome;
+ BOOL mTabStop;
+ BOOL mIsChrome;
+ BOOL mTentative;
+ class DefaultTabGroupFirstSorter;
};
#endif // LL_LLUICTRL_H
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 1e8798e7f7..47919408ab 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -67,7 +67,6 @@
#include "llui.h"
#include "llviewborder.h"
-
const char XML_HEADER[] = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n";
// *NOTE: If you add a new class derived from LLPanel, add a check for its
@@ -214,7 +213,7 @@ LLUICtrlFactory::LLUICtrlFactory()
LLUICtrlCreator<LLUICtrlLocate>::registerCreator(LL_UI_CTRL_LOCATE_TAG, this);
LLUICtrlCreator<LLUICtrlLocate>::registerCreator(LL_PAD_TAG, this);
LLUICtrlCreator<LLViewBorder>::registerCreator(LL_VIEW_BORDER_TAG, this);
- LLUICtrlCreator<LLTabContainerCommon>::registerCreator(LL_TAB_CONTAINER_COMMON_TAG, this);
+ LLUICtrlCreator<LLTabContainer>::registerCreator(LL_TAB_CONTAINER_COMMON_TAG, this);
LLUICtrlCreator<LLScrollableContainerView>::registerCreator(LL_SCROLLABLE_CONTAINER_VIEW_TAG, this);
LLUICtrlCreator<LLPanel>::registerCreator(LL_PANEL_TAG, this);
LLUICtrlCreator<LLMenuGL>::registerCreator(LL_MENU_GL_TAG, this);
@@ -223,7 +222,6 @@ LLUICtrlFactory::LLUICtrlFactory()
LLUICtrlCreator<LLLayoutStack>::registerCreator(LL_LAYOUT_STACK_TAG, this);
setupPaths();
-
}
void LLUICtrlFactory::setupPaths()
@@ -234,14 +232,7 @@ void LLUICtrlFactory::setupPaths()
BOOL success = LLXMLNode::parseFile(filename, root, NULL);
mXUIPaths.clear();
- if (!success)
- {
- LLString slash = gDirUtilp->getDirDelimiter();
- LLString dir = gDirUtilp->getAppRODataDir() + slash + "skins" + slash + "xui" + slash + "en-us" + slash;
- llwarns << "XUI::config file unable to open." << llendl;
- mXUIPaths.push_back(dir);
- }
- else
+ if (success)
{
LLXMLNodePtr path;
LLString app_dir = gDirUtilp->getAppRODataDir();
@@ -267,16 +258,15 @@ void LLUICtrlFactory::setupPaths()
}
}
}
-
-
+ else // parsing failed
+ {
+ LLString slash = gDirUtilp->getDirDelimiter();
+ LLString dir = gDirUtilp->getAppRODataDir() + slash + "skins" + slash + "xui" + slash + "en-us" + slash;
+ llwarns << "XUI::config file unable to open." << llendl;
+ mXUIPaths.push_back(dir);
+ }
}
-//-----------------------------------------------------------------------------
-// ~LLUICtrlFactory()
-//-----------------------------------------------------------------------------
-LLUICtrlFactory::~LLUICtrlFactory()
-{
-}
//-----------------------------------------------------------------------------
@@ -284,7 +274,6 @@ LLUICtrlFactory::~LLUICtrlFactory()
//-----------------------------------------------------------------------------
bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& root)
{
-
if (!LLXMLNode::parseFile(mXUIPaths.front() + filename, root, NULL))
{
if (!LLXMLNode::parseFile(filename, root, NULL))
@@ -347,7 +336,7 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename
if (LLUI::sShowXUINames)
{
- floaterp->mToolTipMsg = filename;
+ floaterp->setToolTip(filename);
}
if (factory_map)
@@ -355,7 +344,7 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename
mFactoryStack.pop_front();
}
- LLViewHandle handle = floaterp->getHandle();
+ LLHandle<LLFloater> handle = floaterp->getHandle();
mBuiltFloaters[handle] = filename;
}
@@ -411,10 +400,10 @@ BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const LLString &filename,
if (LLUI::sShowXUINames)
{
- panelp->mToolTipMsg = filename;
+ panelp->setToolTip(filename);
}
- LLViewHandle handle = panelp->getHandle();
+ LLHandle<LLPanel> handle = panelp->getHandle();
mBuiltPanels[handle] = filename;
if (factory_map)
@@ -446,8 +435,6 @@ LLMenuGL *LLUICtrlFactory::buildMenu(const LLString &filename, LLView* parentp)
return NULL;
}
-
-
if (root->hasName("menu"))
{
menu = (LLMenuGL*)LLMenuGL::fromXML(root, parentp, this);
@@ -459,7 +446,7 @@ LLMenuGL *LLUICtrlFactory::buildMenu(const LLString &filename, LLView* parentp)
if (LLUI::sShowXUINames)
{
- menu->mToolTipMsg = filename;
+ menu->setToolTip(filename);
}
return menu;
@@ -470,7 +457,6 @@ LLMenuGL *LLUICtrlFactory::buildMenu(const LLString &filename, LLView* parentp)
//-----------------------------------------------------------------------------
LLPieMenu *LLUICtrlFactory::buildPieMenu(const LLString &filename, LLView* parentp)
{
-
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
@@ -494,29 +480,13 @@ LLPieMenu *LLUICtrlFactory::buildPieMenu(const LLString &filename, LLView* paren
if (LLUI::sShowXUINames)
{
- menu->mToolTipMsg = filename;
+ menu->setToolTip(filename);
}
return menu;
}
//-----------------------------------------------------------------------------
-// removePanel()
-//-----------------------------------------------------------------------------
-void LLUICtrlFactory::removePanel(LLPanel* panelp)
-{
- mBuiltPanels.erase(panelp->getHandle());
-}
-
-//-----------------------------------------------------------------------------
-// removeFloater()
-//-----------------------------------------------------------------------------
-void LLUICtrlFactory::removeFloater(LLFloater* floaterp)
-{
- mBuiltFloaters.erase(floaterp->getHandle());
-}
-
-//-----------------------------------------------------------------------------
// rebuild()
//-----------------------------------------------------------------------------
void LLUICtrlFactory::rebuild()
@@ -525,48 +495,48 @@ void LLUICtrlFactory::rebuild()
for (built_panel_it = mBuiltPanels.begin();
built_panel_it != mBuiltPanels.end();
++built_panel_it)
+ {
+ LLString filename = built_panel_it->second;
+ LLPanel* panelp = built_panel_it->first.get();
+ if (!panelp)
{
- LLString filename = built_panel_it->second;
- LLPanel* panelp = LLPanel::getPanelByHandle(built_panel_it->first);
- if (!panelp)
- {
- continue;
- }
- llinfos << "Rebuilding UI panel " << panelp->getName()
- << " from " << filename
- << llendl;
- BOOL visible = panelp->getVisible();
- panelp->setVisible(FALSE);
- panelp->setFocus(FALSE);
- panelp->deleteAllChildren();
-
- buildPanel(panelp, filename.c_str(), &panelp->getFactoryMap());
- panelp->setVisible(visible);
+ continue;
}
+ llinfos << "Rebuilding UI panel " << panelp->getName()
+ << " from " << filename
+ << llendl;
+ BOOL visible = panelp->getVisible();
+ panelp->setVisible(FALSE);
+ panelp->setFocus(FALSE);
+ panelp->deleteAllChildren();
+
+ buildPanel(panelp, filename.c_str(), &panelp->getFactoryMap());
+ panelp->setVisible(visible);
+ }
built_floater_t::iterator built_floater_it;
for (built_floater_it = mBuiltFloaters.begin();
built_floater_it != mBuiltFloaters.end();
++built_floater_it)
+ {
+ LLFloater* floaterp = built_floater_it->first.get();
+ if (!floaterp)
{
- LLFloater* floaterp = LLFloater::getFloaterByHandle(built_floater_it->first);
- if (!floaterp)
- {
- continue;
- }
- LLString filename = built_floater_it->second;
- llinfos << "Rebuilding UI floater " << floaterp->getName()
- << " from " << filename
- << llendl;
- BOOL visible = floaterp->getVisible();
- floaterp->setVisible(FALSE);
- floaterp->setFocus(FALSE);
- floaterp->deleteAllChildren();
-
- gFloaterView->removeChild(floaterp);
- buildFloater(floaterp, filename, &floaterp->getFactoryMap());
- floaterp->setVisible(visible);
+ continue;
}
+ LLString filename = built_floater_it->second;
+ llinfos << "Rebuilding UI floater " << floaterp->getName()
+ << " from " << filename
+ << llendl;
+ BOOL visible = floaterp->getVisible();
+ floaterp->setVisible(FALSE);
+ floaterp->setFocus(FALSE);
+ floaterp->deleteAllChildren();
+
+ gFloaterView->removeChild(floaterp);
+ buildFloater(floaterp, filename, &floaterp->getFactoryMap());
+ floaterp->setVisible(visible);
+ }
}
//-----------------------------------------------------------------------------
@@ -674,113 +644,93 @@ BOOL LLUICtrlFactory::getAttributeColor(LLXMLNodePtr node, const LLString& name,
//============================================================================
-LLButton* LLUICtrlFactory::getButtonByName(LLPanel* panelp, const LLString& name)
+LLButton* LLUICtrlFactory::getButtonByName(const LLPanel* panelp, const LLString& name)
{
- return (LLButton*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_BUTTON);
+ return panelp->getChild<LLButton>(name);
}
-LLCheckBoxCtrl* LLUICtrlFactory::getCheckBoxByName(LLPanel* panelp, const LLString& name)
+LLCheckBoxCtrl* LLUICtrlFactory::getCheckBoxByName(const LLPanel* panelp, const LLString& name)
{
- return (LLCheckBoxCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_CHECKBOX);
+ return panelp->getChild<LLCheckBoxCtrl>(name);
}
-LLComboBox* LLUICtrlFactory::getComboBoxByName(LLPanel* panelp, const LLString& name)
+LLComboBox* LLUICtrlFactory::getComboBoxByName(const LLPanel* panelp, const LLString& name)
{
- return (LLComboBox*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_COMBO_BOX);
+ return panelp->getChild<LLComboBox>(name);
}
-LLIconCtrl* LLUICtrlFactory::getIconByName(LLPanel* panelp, const LLString& name)
+LLIconCtrl* LLUICtrlFactory::getIconByName(const LLPanel* panelp, const LLString& name)
{
- return (LLIconCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_ICON);
+ return panelp->getChild<LLIconCtrl>(name);
}
-LLLineEditor* LLUICtrlFactory::getLineEditorByName(LLPanel* panelp, const LLString& name)
+LLLineEditor* LLUICtrlFactory::getLineEditorByName(const LLPanel* panelp, const LLString& name)
{
- return (LLLineEditor*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_LINE_EDITOR);
+ return panelp->getChild<LLLineEditor>(name);
}
-LLNameListCtrl* LLUICtrlFactory::getNameListByName(LLPanel* panelp, const LLString& name)
+LLRadioGroup* LLUICtrlFactory::getRadioGroupByName(const LLPanel* panelp, const LLString& name)
{
- return (LLNameListCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_NAME_LIST);
+ return panelp->getChild<LLRadioGroup>(name);
}
-LLRadioGroup* LLUICtrlFactory::getRadioGroupByName(LLPanel* panelp, const LLString& name)
+LLScrollListCtrl* LLUICtrlFactory::getScrollListByName(const LLPanel* panelp, const LLString& name)
{
- return (LLRadioGroup*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_RADIO_GROUP);
+ return panelp->getChild<LLScrollListCtrl>(name);
}
-LLScrollListCtrl* LLUICtrlFactory::getScrollListByName(LLPanel* panelp, const LLString& name)
+LLSliderCtrl* LLUICtrlFactory::getSliderByName(const LLPanel* panelp, const LLString& name)
{
- return (LLScrollListCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SCROLL_LIST);
+ return panelp->getChild<LLSliderCtrl>(name);
}
-LLSliderCtrl* LLUICtrlFactory::getSliderByName(LLPanel* panelp, const LLString& name)
+LLSlider* LLUICtrlFactory::getSliderBarByName(const LLPanel* panelp, const LLString& name)
{
- return (LLSliderCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SLIDER);
+ return panelp->getChild<LLSlider>(name);
}
-LLSlider* LLUICtrlFactory::getSliderBarByName(LLPanel* panelp, const LLString& name)
+LLSpinCtrl* LLUICtrlFactory::getSpinnerByName(const LLPanel* panelp, const LLString& name)
{
- return (LLSlider*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SLIDER_BAR);
+ return panelp->getChild<LLSpinCtrl>(name);
}
-LLSpinCtrl* LLUICtrlFactory::getSpinnerByName(LLPanel* panelp, const LLString& name)
+LLTextBox* LLUICtrlFactory::getTextBoxByName(const LLPanel* panelp, const LLString& name)
{
- return (LLSpinCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SPINNER);
+ return panelp->getChild<LLTextBox>(name);
}
-LLTextBox* LLUICtrlFactory::getTextBoxByName(LLPanel* panelp, const LLString& name)
+LLTextEditor* LLUICtrlFactory::getTextEditorByName(const LLPanel* panelp, const LLString& name)
{
- return (LLTextBox*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_TEXT_BOX);
+ return panelp->getChild<LLTextEditor>(name);
}
-LLTextEditor* LLUICtrlFactory::getTextEditorByName(LLPanel* panelp, const LLString& name)
+LLTabContainer* LLUICtrlFactory::getTabContainerByName(const LLPanel* panelp, const LLString& name)
{
- return (LLTextEditor*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_TEXT_EDITOR);
-}
-
-LLTabContainerCommon* LLUICtrlFactory::getTabContainerByName(LLPanel* panelp, const LLString& name)
-{
- return (LLTabContainerCommon*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_TAB_CONTAINER);
-}
-
-LLScrollableContainerView* LLUICtrlFactory::getScrollableContainerByName(LLPanel* panelp, const LLString& name)
-{
- return (LLScrollableContainerView*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SCROLL_CONTAINER);
+ return panelp->getChild<LLTabContainer>(name);
}
-LLTextureCtrl* LLUICtrlFactory::getTexturePickerByName(LLPanel* panelp, const LLString& name)
+LLScrollableContainerView* LLUICtrlFactory::getScrollableContainerByName(const LLPanel* panelp, const LLString& name)
{
- return (LLTextureCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_TEXTURE_PICKER);
-}
-
-LLPanel* LLUICtrlFactory::getPanelByName(LLPanel* panelp, const LLString& name)
-{
- return (LLPanel*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_PANEL);
-}
-
-LLColorSwatchCtrl* LLUICtrlFactory::getColorSwatchByName(LLPanel* panelp, const LLString& name)
-{
- return (LLColorSwatchCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_COLOR_SWATCH);
+ return panelp->getChild<LLScrollableContainerView>(name);
}
-LLWebBrowserCtrl* LLUICtrlFactory::getWebBrowserCtrlByName(LLPanel* panelp, const LLString& name)
+LLPanel* LLUICtrlFactory::getPanelByName(const LLPanel* panelp, const LLString& name)
{
- return (LLWebBrowserCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_WEBBROWSER);
+ return panelp->getChild<LLPanel>(name);
}
-LLMenuItemCallGL* LLUICtrlFactory::getMenuItemCallByName(LLPanel* panelp, const LLString& name)
+LLMenuItemCallGL* LLUICtrlFactory::getMenuItemCallByName(const LLPanel* panelp, const LLString& name)
{
- return (LLMenuItemCallGL*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_MENU_ITEM_CALL);
+ return panelp->getChild<LLMenuItemCallGL>(name);
}
-LLScrollingPanelList* LLUICtrlFactory::getScrollingPanelList(LLPanel* panelp, const LLString& name)
+LLScrollingPanelList* LLUICtrlFactory::getScrollingPanelList(const LLPanel* panelp, const LLString& name)
{
- return (LLScrollingPanelList*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SCROLLING_PANEL_LIST);
+ return panelp->getChild<LLScrollingPanelList>(name);
}
-LLCtrlListInterface* LLUICtrlFactory::getListInterfaceByName(LLPanel* panelp, const LLString& name)
+LLCtrlListInterface* LLUICtrlFactory::getListInterfaceByName(const LLPanel* panelp, const LLString& name)
{
LLView* viewp = panelp->getCtrlByNameAndType(name, WIDGET_TYPE_DONTCARE);
if (viewp && viewp->isCtrl())
@@ -790,7 +740,7 @@ LLCtrlListInterface* LLUICtrlFactory::getListInterfaceByName(LLPanel* panelp, co
return NULL;
}
-LLCtrlSelectionInterface* LLUICtrlFactory::getSelectionInterfaceByName(LLPanel* panelp, const LLString& name)
+LLCtrlSelectionInterface* LLUICtrlFactory::getSelectionInterfaceByName(const LLPanel* panelp, const LLString& name)
{
LLView* viewp = panelp->getCtrlByNameAndType(name, WIDGET_TYPE_DONTCARE);
if (viewp && viewp->isCtrl())
@@ -800,7 +750,7 @@ LLCtrlSelectionInterface* LLUICtrlFactory::getSelectionInterfaceByName(LLPanel*
return NULL;
}
-LLCtrlScrollInterface* LLUICtrlFactory::getScrollInterfaceByName(LLPanel* panelp, const LLString& name)
+LLCtrlScrollInterface* LLUICtrlFactory::getScrollInterfaceByName(const LLPanel* panelp, const LLString& name)
{
LLView* viewp = panelp->getCtrlByNameAndType(name, WIDGET_TYPE_DONTCARE);
if (viewp && viewp->isCtrl())
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 486ed12721..1b90e64322 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -38,68 +38,35 @@
#include "llcallbackmap.h"
#include "llfloater.h"
-class LLControlGroup;
class LLView;
-class LLFontGL;
-
-class LLFloater;
class LLPanel;
-class LLButton;
-class LLCheckBoxCtrl;
-class LLComboBox;
-class LLIconCtrl;
-class LLLineEditor;
-class LLMenuGL;
-class LLMenuBarGL;
-class LLMenuItemCallGL;
-class LLNameListCtrl;
-class LLPieMenu;
-class LLRadioGroup;
-class LLSearchEditor;
-class LLScrollableContainerView;
-class LLScrollListCtrl;
-class LLSlider;
-class LLSliderCtrl;
-class LLSpinCtrl;
-class LLTextBox;
-class LLTextEditor;
-class LLTextureCtrl;
-class LLWebBrowserCtrl;
-class LLViewBorder;
-class LLColorSwatchCtrl;
-class LLScrollingPanelList;
-class LLCtrlListInterface;
-class LLCtrlSelectionInterface;
-class LLCtrlScrollInterface;
-
-// Widget
class LLUICtrlFactory
{
public:
LLUICtrlFactory();
// do not call! needs to be public so run-time can clean up the singleton
- virtual ~LLUICtrlFactory();
+ virtual ~LLUICtrlFactory() {}
void setupPaths();
void buildFloater(LLFloater* floaterp, const LLString &filename,
- const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE);
-
+ const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE);
BOOL buildPanel(LLPanel* panelp, const LLString &filename,
const LLCallbackMap::map_t* factory_map = NULL);
- LLMenuGL *buildMenu(const LLString &filename, LLView* parentp);
+ void removePanel(LLPanel* panelp) { mBuiltPanels.erase(panelp->getHandle()); }
+ void removeFloater(LLFloater* floaterp) { mBuiltFloaters.erase(floaterp->getHandle()); }
- LLPieMenu *buildPieMenu(const LLString &filename, LLView* parentp);
+ class LLMenuGL *buildMenu(const LLString &filename, LLView* parentp);
+ class LLPieMenu *buildPieMenu(const LLString &filename, LLView* parentp);
// Does what you want for LLFloaters and LLPanels
// Returns 0 on success
S32 saveToXML(LLView* viewp, const LLString& filename);
- void removePanel(LLPanel* panelp);
- void removeFloater(LLFloater* floaterp);
+ // Rebuilds all currently built panels.
void rebuild();
static EWidgetType getWidgetType(const LLString& ctrl_type);
@@ -107,38 +74,42 @@ public:
static BOOL getAttributeColor(LLXMLNodePtr node, const LLString& name, LLColor4& color);
// specific typed getters
- static LLButton* getButtonByName( LLPanel* panelp, const LLString& name);
- static LLCheckBoxCtrl* getCheckBoxByName( LLPanel* panelp, const LLString& name);
- static LLComboBox* getComboBoxByName( LLPanel* panelp, const LLString& name);
- static LLIconCtrl* getIconByName( LLPanel* panelp, const LLString& name);
- static LLLineEditor* getLineEditorByName( LLPanel* panelp, const LLString& name);
- static LLNameListCtrl* getNameListByName( LLPanel* panelp, const LLString& name);
- static LLRadioGroup* getRadioGroupByName( LLPanel* panelp, const LLString& name);
- static LLScrollListCtrl* getScrollListByName( LLPanel* panelp, const LLString& name);
- static LLSliderCtrl* getSliderByName( LLPanel* panelp, const LLString& name);
- static LLSlider* getSliderBarByName( LLPanel* panelp, const LLString& name);
- static LLSpinCtrl* getSpinnerByName( LLPanel* panelp, const LLString& name);
- static LLTextBox* getTextBoxByName( LLPanel* panelp, const LLString& name);
- static LLTextEditor* getTextEditorByName( LLPanel* panelp, const LLString& name);
- static LLTabContainerCommon* getTabContainerByName( LLPanel* panelp, const LLString& name);
- static LLScrollableContainerView* getScrollableContainerByName(LLPanel* panelp, const LLString& name);
- static LLTextureCtrl* getTexturePickerByName( LLPanel* panelp, const LLString& name);
- static LLPanel* getPanelByName(LLPanel* panelp, const LLString& name);
- static LLColorSwatchCtrl* getColorSwatchByName(LLPanel* panelp, const LLString& name);
- static LLWebBrowserCtrl* getWebBrowserCtrlByName(LLPanel* panelp, const LLString& name);
- static LLMenuItemCallGL* getMenuItemCallByName(LLPanel* panelp, const LLString& name);
- static LLScrollingPanelList* getScrollingPanelList(LLPanel* panelp, const LLString& name);
+ static class LLButton* getButtonByName( const LLPanel* panelp, const LLString& name);
+ static class LLCheckBoxCtrl* getCheckBoxByName( const LLPanel* panelp, const LLString& name);
+ static class LLComboBox* getComboBoxByName( const LLPanel* panelp, const LLString& name);
+ static class LLIconCtrl* getIconByName( const LLPanel* panelp, const LLString& name);
+ static class LLLineEditor* getLineEditorByName( const LLPanel* panelp, const LLString& name);
+ static class LLRadioGroup* getRadioGroupByName( const LLPanel* panelp, const LLString& name);
+ static class LLScrollListCtrl* getScrollListByName( const LLPanel* panelp, const LLString& name);
+ static class LLSliderCtrl* getSliderByName( const LLPanel* panelp, const LLString& name);
+ static class LLSlider* getSliderBarByName( const LLPanel* panelp, const LLString& name);
+ static class LLSpinCtrl* getSpinnerByName( const LLPanel* panelp, const LLString& name);
+ static class LLTextBox* getTextBoxByName( const LLPanel* panelp, const LLString& name);
+ static class LLTextEditor* getTextEditorByName( const LLPanel* panelp, const LLString& name);
+ static class LLTabContainer* getTabContainerByName( const LLPanel* panelp, const LLString& name);
+ static class LLScrollableContainerView* getScrollableContainerByName(const LLPanel* panelp, const LLString& name);
+ static class LLPanel* getPanelByName( const LLPanel* panelp, const LLString& name);
+ static class LLMenuItemCallGL* getMenuItemCallByName( const LLPanel* panelp, const LLString& name);
+ static class LLScrollingPanelList* getScrollingPanelList( const LLPanel* panelp, const LLString& name);
// interface getters
- static LLCtrlListInterface* getListInterfaceByName(LLPanel* panelp, const LLString& name);
- static LLCtrlSelectionInterface* getSelectionInterfaceByName(LLPanel* panelp, const LLString& name);
- static LLCtrlScrollInterface* getScrollInterfaceByName(LLPanel* panelp, const LLString& name);
+ static LLCtrlListInterface* getListInterfaceByName( const LLPanel* panelp, const LLString& name);
+ static LLCtrlSelectionInterface* getSelectionInterfaceByName(const LLPanel* panelp, const LLString& name);
+ static LLCtrlScrollInterface* getScrollInterfaceByName(const LLPanel* panelp, const LLString& name);
LLPanel* createFactoryPanel(LLString name);
virtual LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node);
virtual void createWidget(LLPanel *parent, LLXMLNodePtr node);
+ template <class T> T* createDummyWidget(const LLString& name)
+ {
+ return NULL;
+ //static LLPanel dummy_panel;
+ //LLXMLNodePtr new_node_ptr = new LLXMLNode(T::getWidgetTag(), FALSE);
+ //return createWidget(&dummy_panel, new_node_ptr);
+ }
+
// Creator library
typedef LLView* (*creator_function_t)(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
void registerCreator(LLString ctrlname, creator_function_t function);
@@ -147,10 +118,21 @@ public:
protected:
+ template<class T>
+ class LLUICtrlCreator
+ {
+ public:
+ static void registerCreator(LLString name, LLUICtrlFactory *factory)
+ {
+ factory->registerCreator(name, T::fromXML);
+ }
+ };
+
+private:
- typedef std::map<LLViewHandle, LLString> built_panel_t;
+ typedef std::map<LLHandle<LLPanel>, LLString> built_panel_t;
built_panel_t mBuiltPanels;
- typedef std::map<LLViewHandle, LLString> built_floater_t;
+ typedef std::map<LLHandle<LLFloater>, LLString> built_floater_t;
built_floater_t mBuiltFloaters;
std::deque<const LLCallbackMap::map_t*> mFactoryStack;
@@ -162,14 +144,5 @@ protected:
static std::vector<LLString> mXUIPaths;
};
-template<class T>
-class LLUICtrlCreator
-{
-public:
- static void registerCreator(LLString name, LLUICtrlFactory *factory)
- {
- factory->registerCreator(name, T::fromXML);
- }
-};
-#endif //LL_LLWIDGETFACTORY_H
+#endif //LLUICTRLFACTORY_H
diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp
index b0da5dd7fb..d6496b1a41 100644
--- a/indra/llui/lluistring.cpp
+++ b/indra/llui/lluistring.cpp
@@ -1,6 +1,6 @@
/**
* @file lluistring.cpp
- * @brief LLUIString base class
+ * @brief LLUIString implementation.
*
* $LicenseInfo:firstyear=2006&license=viewergpl$
*
@@ -30,14 +30,11 @@
*/
#include "linden_common.h"
-
#include "lluistring.h"
const LLString::format_map_t LLUIString::sNullArgs;
-// public
-
LLUIString::LLUIString(const LLString& instring, const LLString::format_map_t& args)
: mOrig(instring),
mArgs(args)
@@ -98,13 +95,6 @@ void LLUIString::clear()
mWResult.clear();
}
-void LLUIString::clearArgs()
-{
- mArgs.clear();
-}
-
-// private
-
void LLUIString::format()
{
mResult = mOrig;
diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h
index ede8aefbca..dd787baafe 100644
--- a/indra/llui/lluistring.h
+++ b/indra/llui/lluistring.h
@@ -1,7 +1,7 @@
/**
* @file lluistring.h
* @author: Steve Bennetts
- * @brief LLUIString base class
+ * @brief A fancy wrapper for LLString supporting argument substitutions.
*
* $LicenseInfo:firstyear=2006&license=viewergpl$
*
@@ -33,12 +33,6 @@
#ifndef LL_LLUISTRING_H
#define LL_LLUISTRING_H
-// lluistring.h
-//
-// Copyright 2006, Linden Research, Inc.
-// Original aurthor: Steve
-
-#include "stdtypes.h"
#include "llstring.h"
#include <string>
@@ -89,7 +83,7 @@ public:
S32 length() const { return mWResult.size(); }
void clear();
- void clearArgs();
+ void clearArgs() { mArgs.clear(); }
// These utuilty functions are included for text editing.
// They do not affect mOrig and do not perform argument substitution
diff --git a/indra/llui/llundo.cpp b/indra/llui/llundo.cpp
index 6fd5d08654..8104351d11 100644
--- a/indra/llui/llundo.cpp
+++ b/indra/llui/llundo.cpp
@@ -1,6 +1,5 @@
/**
* @file llundo.cpp
- * @brief LLUndo class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -29,12 +28,8 @@
* $/LicenseInfo$
*/
-// Generic interface for undo/redo circular buffer
-
#include "linden_common.h"
-
#include "llundo.h"
-#include "llerror.h"
// TODO:
@@ -82,7 +77,7 @@ LLUndoBuffer::~LLUndoBuffer()
//-----------------------------------------------------------------------------
// getNextAction()
//-----------------------------------------------------------------------------
-LLUndoAction *LLUndoBuffer::getNextAction(BOOL setClusterBegin)
+LLUndoBuffer::LLUndoAction* LLUndoBuffer::getNextAction(BOOL setClusterBegin)
{
LLUndoAction *nextAction = mActions[mNextAction];
diff --git a/indra/llui/llundo.h b/indra/llui/llundo.h
index 8b982978f5..99f0f59116 100644
--- a/indra/llui/llundo.h
+++ b/indra/llui/llundo.h
@@ -1,6 +1,6 @@
/**
* @file llundo.h
- * @brief LLUndo class header file
+ * @brief Generic interface for undo/redo circular buffer.
*
* $LicenseInfo:firstyear=2000&license=viewergpl$
*
@@ -32,34 +32,24 @@
#ifndef LL_LLUNDO_H
#define LL_LLUNDO_H
-class LLUndoAction
-{
- friend class LLUndoBuffer;
-protected:
- S32 mClusterID;
-protected:
- LLUndoAction(): mClusterID(0) {};
- virtual ~LLUndoAction(){};
-
-public:
- static LLUndoAction *create() { return NULL; }
-
- virtual void undo() = 0;
- virtual void redo() = 0;
- virtual void cleanup() {};
-};
class LLUndoBuffer
{
-protected:
- LLUndoAction **mActions; // array of pointers to undoactions
- S32 mNumActions; // total number of actions in ring buffer
- S32 mNextAction; // next action to perform undo/redo on
- S32 mLastAction; // last action actually added to undo buffer
- S32 mFirstAction; // beginning of ring buffer (don't undo any further)
- S32 mOperationID; // current operation id, for undoing and redoing in clusters
-
public:
+ class LLUndoAction
+ {
+ friend class LLUndoBuffer;
+ public:
+ virtual void undo() = 0;
+ virtual void redo() = 0;
+ virtual void cleanup() {};
+ protected:
+ LLUndoAction(): mClusterID(0) {};
+ virtual ~LLUndoAction(){};
+ private:
+ S32 mClusterID;
+ };
+
LLUndoBuffer( LLUndoAction (*create_func()), S32 initial_count );
virtual ~LLUndoBuffer();
@@ -70,6 +60,14 @@ public:
BOOL canRedo() { return (mNextAction != mLastAction); }
void flushActions();
+
+private:
+ LLUndoAction **mActions; // array of pointers to undoactions
+ S32 mNumActions; // total number of actions in ring buffer
+ S32 mNextAction; // next action to perform undo/redo on
+ S32 mLastAction; // last action actually added to undo buffer
+ S32 mFirstAction; // beginning of ring buffer (don't undo any further)
+ S32 mOperationID; // current operation id, for undoing and redoing in clusters
};
#endif //LL_LLUNDO_H
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 370288e949..1014f17898 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -61,48 +61,11 @@ BOOL LLView::sForceReshape = FALSE;
LLView* LLView::sEditingUIView = NULL;
S32 LLView::sLastLeftXML = S32_MIN;
S32 LLView::sLastBottomXML = S32_MIN;
-std::map<LLViewHandle,LLView*> LLView::sViewHandleMap;
-
-S32 LLViewHandle::sNextID = 0;
-LLViewHandle LLViewHandle::sDeadHandle;
#if LL_DEBUG
BOOL LLView::sIsDrawing = FALSE;
#endif
-//static
-LLView* LLView::getViewByHandle(LLViewHandle handle)
-{
- if (handle == LLViewHandle::sDeadHandle)
- {
- return NULL;
- }
- std::map<LLViewHandle,LLView*>::iterator iter = sViewHandleMap.find(handle);
- if (iter != sViewHandleMap.end())
- {
- return iter->second;
- }
- else
- {
- return NULL;
- }
-}
-
-//static
-BOOL LLView::deleteViewByHandle(LLViewHandle handle)
-{
- std::map<LLViewHandle,LLView*>::iterator iter = sViewHandleMap.find(handle);
- if (iter != sViewHandleMap.end())
- {
- delete iter->second; // will remove from map
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-}
-
LLView::LLView() :
mParentView(NULL),
mReshapeFlags(FOLLOWS_NONE),
@@ -115,11 +78,8 @@ LLView::LLView() :
mLastVisible(TRUE),
mUseBoundingRect(FALSE),
mVisible(TRUE),
- mHidden(FALSE),
mNextInsertionOrdinal(0)
{
- mViewHandle.init();
- sViewHandleMap[mViewHandle] = this;
}
LLView::LLView(const LLString& name, BOOL mouse_opaque) :
@@ -135,11 +95,8 @@ LLView::LLView(const LLString& name, BOOL mouse_opaque) :
mLastVisible(TRUE),
mUseBoundingRect(FALSE),
mVisible(TRUE),
- mHidden(FALSE),
mNextInsertionOrdinal(0)
{
- mViewHandle.init();
- sViewHandleMap[mViewHandle] = this;
}
@@ -159,11 +116,8 @@ LLView::LLView(
mLastVisible(TRUE),
mUseBoundingRect(FALSE),
mVisible(TRUE),
- mHidden(FALSE),
mNextInsertionOrdinal(0)
{
- mViewHandle.init();
- sViewHandleMap[mViewHandle] = this;
}
@@ -183,8 +137,6 @@ LLView::~LLView()
gFocusMgr.removeMouseCaptureWithoutCallback( this );
}
- sViewHandleMap.erase(mViewHandle);
-
deleteAllChildren();
if (mParentView != NULL)
@@ -203,7 +155,7 @@ LLView::~LLView()
}
// virtual
-BOOL LLView::isView()
+BOOL LLView::isView() const
{
return TRUE;
}
@@ -215,16 +167,12 @@ BOOL LLView::isCtrl() const
}
// virtual
-BOOL LLView::isPanel()
+BOOL LLView::isPanel() const
{
return FALSE;
}
-void LLView::setMouseOpaque(BOOL b)
-{
- mMouseOpaque = b;
-}
-
+// virtual
void LLView::setToolTip(const LLStringExplicit& msg)
{
mToolTipMsg = msg;
@@ -248,52 +196,6 @@ void LLView::setRect(const LLRect& rect)
updateBoundingRect();
}
-
-void LLView::setFollows(U32 flags)
-{
- mReshapeFlags = flags;
-}
-
-void LLView::setFollowsNone()
-{
- mReshapeFlags = FOLLOWS_NONE;
-}
-
-void LLView::setFollowsLeft()
-{
- mReshapeFlags |= FOLLOWS_LEFT;
-}
-
-void LLView::setFollowsTop()
-{
- mReshapeFlags |= FOLLOWS_TOP;
-}
-
-void LLView::setFollowsRight()
-{
- mReshapeFlags |= FOLLOWS_RIGHT;
-}
-
-void LLView::setFollowsBottom()
-{
- mReshapeFlags |= FOLLOWS_BOTTOM;
-}
-
-void LLView::setFollowsAll()
-{
- mReshapeFlags |= FOLLOWS_ALL;
-}
-
-void LLView::setSoundFlags(U8 flags)
-{
- mSoundFlags = flags;
-}
-
-void LLView::setName(LLString name)
-{
- mName = name;
-}
-
void LLView::setUseBoundingRect( BOOL use_bounding_rect )
{
if (mUseBoundingRect != use_bounding_rect)
@@ -308,11 +210,6 @@ BOOL LLView::getUseBoundingRect()
return mUseBoundingRect;
}
-const LLString& LLView::getToolTip()
-{
- return mToolTipMsg.getString();
-}
-
// virtual
const LLString& LLView::getName() const
{
@@ -452,8 +349,6 @@ void LLView::removeCtrl(LLUICtrl* ctrl)
}
}
-S32 LLView::getDefaultTabGroup() const { return mDefaultTabGroup; }
-
LLView::ctrl_list_t LLView::getCtrlList() const
{
ctrl_list_t controls;
@@ -476,12 +371,6 @@ LLView::ctrl_list_t LLView::getCtrlListSorted() const
return controls;
}
-LLCompareByTabOrder::LLCompareByTabOrder(LLView::child_tab_order_t order): mTabOrder(order) {}
-
-bool LLCompareByTabOrder::compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const
-{
- return a < b;
-}
// This method compares two LLViews by the tab order specified in the comparator object. The
// code for this is a little convoluted because each argument can have four states:
@@ -537,68 +426,69 @@ BOOL LLView::isInEnabledChain() const
return TRUE;
}
-BOOL LLView::isFocusRoot() const
+// virtual
+BOOL LLView::canFocusChildren() const
{
- return mIsFocusRoot;
+ return TRUE;
}
-LLView* LLView::findRootMostFocusRoot()
+//virtual
+void LLView::setTentative(BOOL b)
{
- LLView* focus_root = NULL;
- LLView* next_view = this;
- while(next_view)
- {
- if (next_view->isFocusRoot())
- {
- focus_root = next_view;
- }
- next_view = next_view->getParent();
- }
- return focus_root;
}
-BOOL LLView::canFocusChildren() const
+//virtual
+BOOL LLView::getTentative() const
{
- return TRUE;
+ return FALSE;
}
-BOOL LLView::focusNextRoot()
+//virtual
+void LLView::setEnabled(BOOL enabled)
{
- LLView::child_list_t result = LLView::getFocusRootsQuery().run(this);
- return LLView::focusNext(result);
+ mEnabled = enabled;
}
-BOOL LLView::focusPrevRoot()
+//virtual
+BOOL LLView::setLabelArg( const LLString& key, const LLStringExplicit& text )
{
- LLView::child_list_t result = LLView::getFocusRootsQuery().run(this);
- return LLView::focusPrev(result);
+ return FALSE;
}
-BOOL LLView::focusNextItem(BOOL text_fields_only)
+//virtual
+LLRect LLView::getSnapRect() const
{
- // this assumes that this method is called on the focus root.
- LLCtrlQuery query = LLView::getTabOrderQuery();
- if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly"))
- {
- query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
- }
- LLView::child_list_t result = query(this);
+ return mRect;
+}
+
+//virtual
+LLRect LLView::getRequiredRect()
+{
+ return mRect;
+}
+
+//virtual
+void LLView::onFocusLost()
+{
+}
+
+//virtual
+void LLView::onFocusReceived()
+{
+}
+
+BOOL LLView::focusNextRoot()
+{
+ LLView::child_list_t result = LLView::getFocusRootsQuery().run(this);
return LLView::focusNext(result);
}
-BOOL LLView::focusPrevItem(BOOL text_fields_only)
+BOOL LLView::focusPrevRoot()
{
- // this assumes that this method is called on the focus root.
- LLCtrlQuery query = LLView::getTabOrderQuery();
- if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly"))
- {
- query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
- }
- LLView::child_list_t result = query(this);
+ LLView::child_list_t result = LLView::getFocusRootsQuery().run(this);
return LLView::focusPrev(result);
}
-
// static
BOOL LLView::focusNext(LLView::child_list_t & result)
{
@@ -674,80 +564,6 @@ BOOL LLView::focusPrev(LLView::child_list_t & result)
return FALSE;
}
-BOOL LLView::focusFirstItem(BOOL prefer_text_fields)
-{
- // search for text field first
- if(prefer_text_fields)
- {
- LLCtrlQuery query = LLView::getTabOrderQuery();
- query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
- LLView::child_list_t result = query(this);
- if(result.size() > 0)
- {
- LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
- if(!ctrl->hasFocus())
- {
- ctrl->setFocus(TRUE);
- ctrl->onTabInto();
- gFocusMgr.triggerFocusFlash();
- }
- return TRUE;
- }
- }
- // no text field found, or we don't care about text fields
- LLView::child_list_t result = LLView::getTabOrderQuery().run(this);
- if(result.size() > 0)
- {
- LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
- if(!ctrl->hasFocus())
- {
- ctrl->setFocus(TRUE);
- ctrl->onTabInto();
- gFocusMgr.triggerFocusFlash();
- }
- return TRUE;
- }
- return FALSE;
-}
-
-BOOL LLView::focusLastItem(BOOL prefer_text_fields)
-{
- // search for text field first
- if(prefer_text_fields)
- {
- LLCtrlQuery query = LLView::getTabOrderQuery();
- query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
- LLView::child_list_t result = query(this);
- if(result.size() > 0)
- {
- LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back());
- if(!ctrl->hasFocus())
- {
- ctrl->setFocus(TRUE);
- ctrl->onTabInto();
- gFocusMgr.triggerFocusFlash();
- }
- return TRUE;
- }
- }
- // no text field found, or we don't care about text fields
- LLView::child_list_t result = LLView::getTabOrderQuery().run(this);
- if(result.size() > 0)
- {
- LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back());
- if(!ctrl->hasFocus())
- {
- ctrl->setFocus(TRUE);
- ctrl->onTabInto();
- gFocusMgr.triggerFocusFlash();
- }
- return TRUE;
- }
- return FALSE;
-}
-
-
-
// delete all children. Override this function if you need to
// perform any extra clean up such as cached pointers to selected
// children, etc.
@@ -773,23 +589,6 @@ void LLView::setAllChildrenEnabled(BOOL b)
}
// virtual
-void LLView::setTentative(BOOL b)
-{
-}
-
-// virtual
-BOOL LLView::getTentative() const
-{
- return FALSE;
-}
-
-// virtual
-void LLView::setEnabled(BOOL enabled)
-{
- mEnabled = enabled;
-}
-
-// virtual
void LLView::setVisible(BOOL visible)
{
if ( mVisible != visible )
@@ -812,18 +611,6 @@ void LLView::setVisible(BOOL visible)
}
// virtual
-void LLView::setHidden(BOOL hidden)
-{
- mHidden = hidden;
-}
-
-// virtual
-BOOL LLView::setLabelArg(const LLString& key, const LLStringExplicit& text)
-{
- return FALSE;
-}
-
-// virtual
void LLView::onVisibilityChange ( BOOL new_visibility )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
@@ -845,9 +632,9 @@ void LLView::translate(S32 x, S32 y)
}
// virtual
-BOOL LLView::canSnapTo(LLView* other_view)
+BOOL LLView::canSnapTo(const LLView* other_view) const
{
- return other_view->getVisible();
+ return other_view != this && other_view->getVisible();
}
// virtual
@@ -956,7 +743,7 @@ BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
if( called_from_parent )
{
// Downward traversal
- if (getVisible() && mEnabled)
+ if (getVisible() && getEnabled())
{
handled = childrenHandleKey( key, mask ) != NULL;
}
@@ -1003,7 +790,7 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent)
if( called_from_parent )
{
// Downward traversal
- if (getVisible() && mEnabled)
+ if (getVisible() && getEnabled())
{
handled = childrenHandleUnicodeChar( uni_char ) != NULL;
}
@@ -1074,16 +861,16 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask,
LLView* handled_view = FALSE;
// CRO this is an experiment to allow drag and drop into object inventory based on the DragAndDrop tool's permissions rather than the parent
if( getVisible() )
-// if( getVisible() && mEnabled )
+// if( getVisible() && getEnabled() )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
LLView* viewp = *child_it;
- S32 local_x = x - viewp->mRect.mLeft;
- S32 local_y = y - viewp->mRect.mBottom;
+ S32 local_x = x - viewp->getRect().mLeft;
+ S32 local_y = y - viewp->getRect().mBottom;
if( viewp->pointInView(local_x, local_y) &&
viewp->getVisible() &&
- viewp->mEnabled &&
+ viewp->getEnabled() &&
viewp->handleDragAndDrop(local_x, local_y, mask, drop,
cargo_type,
cargo_data,
@@ -1158,7 +945,7 @@ BOOL LLView::handleDoubleClick(S32 x, S32 y, MASK mask)
BOOL LLView::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
BOOL handled = FALSE;
- if( getVisible() && mEnabled )
+ if( getVisible() && getEnabled() )
{
handled = childrenHandleScrollWheel( x, y, clicks ) != NULL;
if( !handled && blockMouseEvent(x, y) )
@@ -1192,13 +979,13 @@ BOOL LLView::handleRightMouseUp(S32 x, S32 y, MASK mask)
LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks)
{
LLView* handled_view = NULL;
- if (getVisible() && mEnabled )
+ if (getVisible() && getEnabled() )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
LLView* viewp = *child_it;
- S32 local_x = x - viewp->mRect.mLeft;
- S32 local_y = y - viewp->mRect.mBottom;
+ S32 local_x = x - viewp->getRect().mLeft;
+ S32 local_y = y - viewp->getRect().mBottom;
if (viewp->pointInView(local_x, local_y) &&
viewp->handleScrollWheel( local_x, local_y, clicks ))
{
@@ -1218,13 +1005,13 @@ LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks)
LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask)
{
LLView* handled_view = NULL;
- if (getVisible() && mEnabled )
+ if (getVisible() && getEnabled() )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
LLView* viewp = *child_it;
- S32 local_x = x - viewp->mRect.mLeft;
- S32 local_y = y - viewp->mRect.mBottom;
+ S32 local_x = x - viewp->getRect().mLeft;
+ S32 local_y = y - viewp->getRect().mBottom;
if(viewp->pointInView(local_x, local_y) &&
viewp->getVisible() &&
viewp->getEnabled() &&
@@ -1248,7 +1035,7 @@ LLView* LLView::childrenHandleKey(KEY key, MASK mask)
{
LLView* handled_view = NULL;
- if ( getVisible() && mEnabled )
+ if ( getVisible() && getEnabled() )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
@@ -1273,7 +1060,7 @@ LLView* LLView::childrenHandleUnicodeChar(llwchar uni_char)
{
LLView* handled_view = NULL;
- if ( getVisible() && mEnabled )
+ if ( getVisible() && getEnabled() )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
@@ -1300,12 +1087,12 @@ LLView* LLView::childrenHandleMouseDown(S32 x, S32 y, MASK mask)
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
LLView* viewp = *child_it;
- S32 local_x = x - viewp->mRect.mLeft;
- S32 local_y = y - viewp->mRect.mBottom;
+ S32 local_x = x - viewp->getRect().mLeft;
+ S32 local_y = y - viewp->getRect().mBottom;
if (viewp->pointInView(local_x, local_y) &&
viewp->getVisible() &&
- viewp->mEnabled &&
+ viewp->getEnabled() &&
viewp->handleMouseDown( local_x, local_y, mask ))
{
if (sDebugMouseHandling)
@@ -1323,16 +1110,16 @@ LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask)
{
LLView* handled_view = NULL;
- if (getVisible() && mEnabled )
+ if (getVisible() && getEnabled() )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
LLView* viewp = *child_it;
- S32 local_x = x - viewp->mRect.mLeft;
- S32 local_y = y - viewp->mRect.mBottom;
+ S32 local_x = x - viewp->getRect().mLeft;
+ S32 local_y = y - viewp->getRect().mBottom;
if (viewp->pointInView(local_x, local_y) &&
viewp->getVisible() &&
- viewp->mEnabled &&
+ viewp->getEnabled() &&
viewp->handleRightMouseDown( local_x, local_y, mask ))
{
if (sDebugMouseHandling)
@@ -1351,16 +1138,16 @@ LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask)
{
LLView* handled_view = NULL;
- if (getVisible() && mEnabled )
+ if (getVisible() && getEnabled() )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
LLView* viewp = *child_it;
- S32 local_x = x - viewp->mRect.mLeft;
- S32 local_y = y - viewp->mRect.mBottom;
+ S32 local_x = x - viewp->getRect().mLeft;
+ S32 local_y = y - viewp->getRect().mBottom;
if (viewp->pointInView(local_x, local_y) &&
viewp->getVisible() &&
- viewp->mEnabled &&
+ viewp->getEnabled() &&
viewp->handleDoubleClick( local_x, local_y, mask ))
{
if (sDebugMouseHandling)
@@ -1378,18 +1165,18 @@ LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask)
LLView* LLView::childrenHandleMouseUp(S32 x, S32 y, MASK mask)
{
LLView* handled_view = NULL;
- if( getVisible() && mEnabled )
+ if( getVisible() && getEnabled() )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
LLView* viewp = *child_it;
- S32 local_x = x - viewp->mRect.mLeft;
- S32 local_y = y - viewp->mRect.mBottom;
+ S32 local_x = x - viewp->getRect().mLeft;
+ S32 local_y = y - viewp->getRect().mBottom;
if (!viewp->pointInView(local_x, local_y))
continue;
if (!viewp->getVisible())
continue;
- if (!viewp->mEnabled)
+ if (!viewp->getEnabled())
continue;
if (viewp->handleMouseUp( local_x, local_y, mask ))
{
@@ -1408,16 +1195,16 @@ LLView* LLView::childrenHandleMouseUp(S32 x, S32 y, MASK mask)
LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask)
{
LLView* handled_view = NULL;
- if( getVisible() && mEnabled )
+ if( getVisible() && getEnabled() )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
LLView* viewp = *child_it;
- S32 local_x = x - viewp->mRect.mLeft;
- S32 local_y = y - viewp->mRect.mBottom;
+ S32 local_x = x - viewp->getRect().mLeft;
+ S32 local_y = y - viewp->getRect().mBottom;
if (viewp->pointInView(local_x, local_y) &&
viewp->getVisible() &&
- viewp->mEnabled &&
+ viewp->getEnabled() &&
viewp->handleRightMouseUp( local_x, local_y, mask ))
{
if (sDebugMouseHandling)
@@ -1440,8 +1227,8 @@ void LLView::draw()
drawDebugRect();
// Check for bogus rectangle
- if (mRect.mRight <= mRect.mLeft
- || mRect.mTop <= mRect.mBottom)
+ if (getRect().mRight <= getRect().mLeft
+ || getRect().mTop <= getRect().mBottom)
{
llwarns << "Bogus rectangle for " << getName() << " with " << mRect << llendl;
}
@@ -1578,14 +1365,14 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr
void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
{
// compute how much things changed and apply reshape logic to children
- S32 delta_width = width - mRect.getWidth();
- S32 delta_height = height - mRect.getHeight();
+ S32 delta_width = width - getRect().getWidth();
+ S32 delta_height = height - getRect().getHeight();
if (delta_width || delta_height || sForceReshape)
{
// adjust our rectangle
- mRect.mRight = mRect.mLeft + width;
- mRect.mTop = mRect.mBottom + height;
+ mRect.mRight = getRect().mLeft + width;
+ mRect.mTop = getRect().mBottom + height;
// move child views according to reshape flags
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
@@ -1631,8 +1418,8 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
// for now, same as bottom
}
- S32 delta_x = child_rect.mLeft - viewp->mRect.mLeft;
- S32 delta_y = child_rect.mBottom - viewp->mRect.mBottom;
+ 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());
}
@@ -1649,11 +1436,6 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
updateBoundingRect();
}
-LLRect LLView::getRequiredRect()
-{
- return mRect;
-}
-
void LLView::updateBoundingRect()
{
if (isDead()) return;
@@ -1701,16 +1483,16 @@ void LLView::updateBoundingRect()
}
}
-const LLRect LLView::getScreenRect() const
+LLRect LLView::getScreenRect() const
{
// *FIX: check for one-off error
LLRect screen_rect;
localPointToScreen(0, 0, &screen_rect.mLeft, &screen_rect.mBottom);
- localPointToScreen(mRect.getWidth(), mRect.getHeight(), &screen_rect.mRight, &screen_rect.mTop);
+ localPointToScreen(getRect().getWidth(), getRect().getHeight(), &screen_rect.mRight, &screen_rect.mTop);
return screen_rect;
}
-const LLRect LLView::getLocalBoundingRect() const
+LLRect LLView::getLocalBoundingRect() const
{
LLRect local_bounding_rect = getBoundingRect();
local_bounding_rect.translate(-mRect.mLeft, -mRect.mBottom);
@@ -1719,20 +1501,20 @@ const LLRect LLView::getLocalBoundingRect() const
}
-const LLRect LLView::getLocalRect() const
+LLRect LLView::getLocalRect() const
{
- LLRect local_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
+ LLRect local_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
return local_rect;
}
-const LLRect LLView::getLocalSnapRect() const
+LLRect LLView::getLocalSnapRect() const
{
LLRect local_snap_rect = getSnapRect();
- local_snap_rect.translate(-mRect.mLeft, -mRect.mBottom);
+ local_snap_rect.translate(-getRect().mLeft, -getRect().mBottom);
return local_snap_rect;
}
-BOOL LLView::hasAncestor(const LLView* parentp)
+BOOL LLView::hasAncestor(const LLView* parentp) const
{
if (!parentp)
{
@@ -1771,7 +1553,7 @@ BOOL LLView::childHasKeyboardFocus( const LLString& childname ) const
BOOL LLView::hasChild(const LLString& childname, BOOL recurse) const
{
- return getChildByName(childname, recurse) ? TRUE : FALSE;
+ return getChildByName(childname, recurse) != NULL;
}
//-----------------------------------------------------------------------------
@@ -1829,55 +1611,55 @@ BOOL LLView::blockMouseEvent(S32 x, S32 y) const
// virtual
void LLView::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
{
- *local_x = screen_x - mRect.mLeft;
- *local_y = screen_y - mRect.mBottom;
+ *local_x = screen_x - getRect().mLeft;
+ *local_y = screen_y - getRect().mBottom;
const LLView* cur = this;
while( cur->mParentView )
{
cur = cur->mParentView;
- *local_x -= cur->mRect.mLeft;
- *local_y -= cur->mRect.mBottom;
+ *local_x -= cur->getRect().mLeft;
+ *local_y -= cur->getRect().mBottom;
}
}
void LLView::localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
{
- *screen_x = local_x + mRect.mLeft;
- *screen_y = local_y + mRect.mBottom;
+ *screen_x = local_x + getRect().mLeft;
+ *screen_y = local_y + getRect().mBottom;
const LLView* cur = this;
while( cur->mParentView )
{
cur = cur->mParentView;
- *screen_x += cur->mRect.mLeft;
- *screen_y += cur->mRect.mBottom;
+ *screen_x += cur->getRect().mLeft;
+ *screen_y += cur->getRect().mBottom;
}
}
void LLView::screenRectToLocal(const LLRect& screen, LLRect* local) const
{
*local = screen;
- local->translate( -mRect.mLeft, -mRect.mBottom );
+ local->translate( -getRect().mLeft, -getRect().mBottom );
const LLView* cur = this;
while( cur->mParentView )
{
cur = cur->mParentView;
- local->translate( -cur->mRect.mLeft, -cur->mRect.mBottom );
+ local->translate( -cur->getRect().mLeft, -cur->getRect().mBottom );
}
}
void LLView::localRectToScreen(const LLRect& local, LLRect* screen) const
{
*screen = local;
- screen->translate( mRect.mLeft, mRect.mBottom );
+ screen->translate( getRect().mLeft, getRect().mBottom );
const LLView* cur = this;
while( cur->mParentView )
{
cur = cur->mParentView;
- screen->translate( cur->mRect.mLeft, cur->mRect.mBottom );
+ screen->translate( cur->getRect().mLeft, cur->getRect().mBottom );
}
}
@@ -1891,12 +1673,15 @@ LLView* LLView::getRootView()
return view;
}
-//static
-LLWindow* LLView::getWindow(void)
+BOOL LLView::deleteViewByHandle(LLHandle<LLView> handle)
{
- return LLUI::sWindow;
+ LLView* viewp = handle.get();
+
+ delete viewp;
+ return viewp != NULL;
}
+
// 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.)
@@ -1909,50 +1694,50 @@ BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outs
{
const S32 KEEP_ONSCREEN_PIXELS = 16;
- if( mRect.mRight - KEEP_ONSCREEN_PIXELS < constraint.mLeft )
+ if( getRect().mRight - KEEP_ONSCREEN_PIXELS < constraint.mLeft )
{
- delta_x = constraint.mLeft - (mRect.mRight - KEEP_ONSCREEN_PIXELS);
+ delta_x = constraint.mLeft - (getRect().mRight - KEEP_ONSCREEN_PIXELS);
}
else
- if( mRect.mLeft + KEEP_ONSCREEN_PIXELS > constraint.mRight )
+ if( getRect().mLeft + KEEP_ONSCREEN_PIXELS > constraint.mRight )
{
- delta_x = constraint.mRight - (mRect.mLeft + KEEP_ONSCREEN_PIXELS);
- delta_x += llmax( 0, mRect.getWidth() - constraint.getWidth() );
+ delta_x = constraint.mRight - (getRect().mLeft + KEEP_ONSCREEN_PIXELS);
+ delta_x += llmax( 0, getRect().getWidth() - constraint.getWidth() );
}
- if( mRect.mTop > constraint.mTop )
+ if( getRect().mTop > constraint.mTop )
{
- delta_y = constraint.mTop - mRect.mTop;
+ delta_y = constraint.mTop - getRect().mTop;
}
else
- if( mRect.mTop - KEEP_ONSCREEN_PIXELS < constraint.mBottom )
+ if( getRect().mTop - KEEP_ONSCREEN_PIXELS < constraint.mBottom )
{
- delta_y = constraint.mBottom - (mRect.mTop - KEEP_ONSCREEN_PIXELS);
- delta_y -= llmax( 0, mRect.getHeight() - constraint.getHeight() );
+ delta_y = constraint.mBottom - (getRect().mTop - KEEP_ONSCREEN_PIXELS);
+ delta_y -= llmax( 0, getRect().getHeight() - constraint.getHeight() );
}
}
else
{
- if( mRect.mLeft < constraint.mLeft )
+ if( getRect().mLeft < constraint.mLeft )
{
- delta_x = constraint.mLeft - mRect.mLeft;
+ delta_x = constraint.mLeft - getRect().mLeft;
}
else
- if( mRect.mRight > constraint.mRight )
+ if( getRect().mRight > constraint.mRight )
{
- delta_x = constraint.mRight - mRect.mRight;
- delta_x += llmax( 0, mRect.getWidth() - constraint.getWidth() );
+ delta_x = constraint.mRight - getRect().mRight;
+ delta_x += llmax( 0, getRect().getWidth() - constraint.getWidth() );
}
- if( mRect.mTop > constraint.mTop )
+ if( getRect().mTop > constraint.mTop )
{
- delta_y = constraint.mTop - mRect.mTop;
+ delta_y = constraint.mTop - getRect().mTop;
}
else
- if( mRect.mBottom < constraint.mBottom )
+ if( getRect().mBottom < constraint.mBottom )
{
- delta_y = constraint.mBottom - mRect.mBottom;
- delta_y -= llmax( 0, mRect.getHeight() - constraint.getHeight() );
+ delta_y = constraint.mBottom - getRect().mBottom;
+ delta_y -= llmax( 0, getRect().getHeight() - constraint.getHeight() );
}
}
@@ -1964,10 +1749,18 @@ BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outs
return FALSE;
}
-BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, LLView* other_view)
+void LLView::centerWithin(const LLRect& bounds)
{
- LLView* cur_view = this;
- LLView* root_view = NULL;
+ S32 left = bounds.mLeft + (bounds.getWidth() - getRect().getWidth()) / 2;
+ S32 bottom = bounds.mBottom + (bounds.getHeight() - getRect().getHeight()) / 2;
+
+ translate( left - getRect().mLeft, bottom - getRect().mBottom );
+}
+
+BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, LLView* other_view) const
+{
+ const LLView* cur_view = this;
+ const LLView* root_view = NULL;
while (cur_view)
{
@@ -2058,8 +1851,8 @@ LLXMLNodePtr LLView::getXML(bool save_children) const
node->createChild("height", TRUE)->setIntValue(getRect().getHeight());
LLView* parent = getParent();
- S32 left = mRect.mLeft;
- S32 bottom = mRect.mBottom;
+ S32 left = getRect().mLeft;
+ S32 bottom = getRect().mBottom;
if (parent) bottom -= parent->getRect().getHeight();
node->createChild("left", TRUE)->setIntValue(left);
@@ -2095,7 +1888,6 @@ LLXMLNodePtr LLView::getXML(bool save_children) const
node->createChild("follows", TRUE)->setStringValue(buffer.str());
}
// Export all widgets as enabled and visible - code must disable.
- node->createChild("hidden", TRUE)->setBoolValue(mHidden);
node->createChild("mouse_opaque", TRUE)->setBoolValue(mMouseOpaque );
if (!mToolTipMsg.getString().empty())
{
@@ -2106,7 +1898,7 @@ LLXMLNodePtr LLView::getXML(bool save_children) const
node->createChild("sound_flags", TRUE)->setIntValue((S32)mSoundFlags);
}
- node->createChild("enabled", TRUE)->setBoolValue(mEnabled);
+ node->createChild("enabled", TRUE)->setBoolValue(getEnabled());
if (!mControlName.empty())
{
@@ -2194,6 +1986,15 @@ const LLCtrlQuery & LLView::getTabOrderQuery()
return query;
}
+// This class is only used internally by getFocusRootsQuery below.
+class LLFocusRootsFilter : public LLQueryFilter, public LLSingleton<LLFocusRootsFilter>
+{
+ /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const
+ {
+ return filterResult_t(view->isCtrl() && view->isFocusRoot(), !view->isFocusRoot());
+ }
+};
+
// static
const LLCtrlQuery & LLView::getFocusRootsQuery()
{
@@ -2201,7 +2002,7 @@ const LLCtrlQuery & LLView::getFocusRootsQuery()
if(query.getPreFilters().size() == 0) {
query.addPreFilter(LLVisibleFilter::getInstance());
query.addPreFilter(LLEnabledFilter::getInstance());
- query.addPreFilter(LLView::LLFocusRootsFilter::getInstance());
+ query.addPreFilter(LLFocusRootsFilter::getInstance());
query.addPostFilter(LLRootsFilter::getInstance());
}
return query;
@@ -2211,167 +2012,189 @@ const LLCtrlQuery & LLView::getFocusRootsQuery()
void LLView::userSetShape(const LLRect& new_rect)
{
reshape(new_rect.getWidth(), new_rect.getHeight());
- translate(new_rect.mLeft - mRect.mLeft, new_rect.mBottom - mRect.mBottom);
+ translate(new_rect.mLeft - getRect().mLeft, new_rect.mBottom - getRect().mBottom);
}
LLView* LLView::findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir,
LLView::ESnapType snap_type, S32 threshold, S32 padding)
{
+ new_rect = mRect;
LLView* snap_view = NULL;
if (!mParentView)
{
- new_rect = mRect;
- return snap_view;
+ return NULL;
}
-
- // If the view is near the edge of its parent, snap it to
- // the edge.
- LLRect test_rect = getSnapRect();
- LLRect view_rect = getSnapRect();
- test_rect.stretch(padding);
- view_rect.stretch(padding);
-
- BOOL snapped_x = FALSE;
- BOOL snapped_y = FALSE;
-
- LLRect parent_local_snap_rect = mParentView->getLocalSnapRect();
-
- if (snap_type == SNAP_PARENT || snap_type == SNAP_PARENT_AND_SIBLINGS)
+
+ S32 delta_x = 0;
+ S32 delta_y = 0;
+ if (mouse_dir.mX >= 0)
{
- if (llabs(parent_local_snap_rect.mRight - test_rect.mRight) <= threshold && (parent_local_snap_rect.mRight - test_rect.mRight) * mouse_dir.mX >= 0)
- {
- view_rect.translate(parent_local_snap_rect.mRight - view_rect.mRight, 0);
- snap_view = mParentView;
- snapped_x = TRUE;
- }
-
- if (llabs(test_rect.mLeft - parent_local_snap_rect.mLeft) <= threshold && test_rect.mLeft * mouse_dir.mX <= 0)
- {
- view_rect.translate(parent_local_snap_rect.mLeft - view_rect.mLeft, 0);
- snap_view = mParentView;
- snapped_x = TRUE;
- }
-
- if (llabs(test_rect.mBottom - parent_local_snap_rect.mBottom) <= threshold && test_rect.mBottom * mouse_dir.mY <= 0)
- {
- view_rect.translate(0, parent_local_snap_rect.mBottom - view_rect.mBottom);
- snap_view = mParentView;
- snapped_y = TRUE;
- }
-
- if (llabs(parent_local_snap_rect.mTop - test_rect.mTop) <= threshold && (parent_local_snap_rect.mTop - test_rect.mTop) * mouse_dir.mY >= 0)
- {
- view_rect.translate(0, parent_local_snap_rect.mTop - view_rect.mTop);
- snap_view = mParentView;
- snapped_y = TRUE;
- }
+ S32 new_right = mRect.mRight;
+ LLView* view = findSnapEdge(new_right, mouse_dir, SNAP_RIGHT, snap_type, threshold, padding);
+ delta_x = new_right - mRect.mRight;
+ snap_view = view ? view : snap_view;
}
- if (snap_type == SNAP_SIBLINGS || snap_type == SNAP_PARENT_AND_SIBLINGS)
- {
- for ( child_list_const_iter_t child_it = mParentView->getChildList()->begin();
- child_it != mParentView->getChildList()->end(); ++child_it)
- {
- LLView* siblingp = *child_it;
- // skip self
- if (siblingp == this || !siblingp->getVisible() || !canSnapTo(siblingp))
- {
- continue;
- }
-
- LLRect sibling_rect = siblingp->getSnapRect();
-
- if (!snapped_x && llabs(test_rect.mRight - sibling_rect.mLeft) <= threshold && (test_rect.mRight - sibling_rect.mLeft) * mouse_dir.mX <= 0)
- {
- view_rect.translate(sibling_rect.mLeft - view_rect.mRight, 0);
- if (!snapped_y)
- {
- if (llabs(test_rect.mTop - sibling_rect.mTop) <= threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
- {
- view_rect.translate(0, sibling_rect.mTop - test_rect.mTop);
- snapped_y = TRUE;
- }
- else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
- {
- view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom);
- snapped_y = TRUE;
- }
- }
- snap_view = siblingp;
- snapped_x = TRUE;
- }
- if (!snapped_x && llabs(test_rect.mLeft - sibling_rect.mRight) <= threshold && (test_rect.mLeft - sibling_rect.mRight) * mouse_dir.mX <= 0)
- {
- view_rect.translate(sibling_rect.mRight - view_rect.mLeft, 0);
- if (!snapped_y)
- {
- if (llabs(test_rect.mTop - sibling_rect.mTop) <= threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
- {
- view_rect.translate(0, sibling_rect.mTop - test_rect.mTop);
- snapped_y = TRUE;
- }
- else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
- {
- view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom);
- snapped_y = TRUE;
- }
- }
- snap_view = siblingp;
- snapped_x = TRUE;
- }
+ if (mouse_dir.mX <= 0)
+ {
+ S32 new_left = mRect.mLeft;
+ LLView* view = findSnapEdge(new_left, mouse_dir, SNAP_LEFT, snap_type, threshold, padding);
+ delta_x = new_left - mRect.mLeft;
+ snap_view = view ? view : snap_view;
+ }
- if (!snapped_y && llabs(test_rect.mBottom - sibling_rect.mTop) <= threshold && (test_rect.mBottom - sibling_rect.mTop) * mouse_dir.mY <= 0)
- {
- view_rect.translate(0, sibling_rect.mTop - view_rect.mBottom);
- if (!snapped_x)
- {
- if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
- {
- view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0);
- snapped_x = TRUE;
- }
- else if (llabs(test_rect.mRight - sibling_rect.mRight) <= threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
- {
- view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0);
- snapped_x = TRUE;
- }
- }
- snap_view = siblingp;
- snapped_y = TRUE;
- }
+ if (mouse_dir.mY >= 0)
+ {
+ S32 new_top = mRect.mTop;
+ LLView* view = findSnapEdge(new_top, mouse_dir, SNAP_TOP, snap_type, threshold, padding);
+ delta_y = new_top - mRect.mTop;
+ snap_view = view ? view : snap_view;
+ }
- if (!snapped_y && llabs(test_rect.mTop - sibling_rect.mBottom) <= threshold && (test_rect.mTop - sibling_rect.mBottom) * mouse_dir.mY <= 0)
- {
- view_rect.translate(0, sibling_rect.mBottom - view_rect.mTop);
- if (!snapped_x)
- {
- if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
- {
- view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0);
- snapped_x = TRUE;
- }
- else if (llabs(test_rect.mRight - sibling_rect.mRight) <= threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
- {
- view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0);
- snapped_x = TRUE;
- }
- }
- snap_view = siblingp;
- snapped_y = TRUE;
- }
-
- if (snapped_x && snapped_y)
- {
- break;
- }
- }
+ if (mouse_dir.mY <= 0)
+ {
+ S32 new_bottom = mRect.mBottom;
+ LLView* view = findSnapEdge(new_bottom, mouse_dir, SNAP_BOTTOM, snap_type, threshold, padding);
+ delta_y = new_bottom - mRect.mBottom;
+ snap_view = view ? view : snap_view;
}
- // shrink actual view rect back down
- view_rect.stretch(-padding);
- new_rect = view_rect;
+ new_rect.translate(delta_x, delta_y);
return snap_view;
+
+ //// If the view is near the edge of its parent, snap it to
+ //// the edge.
+ //LLRect test_rect = getSnapRect();
+ //LLRect view_rect = getSnapRect();
+ //test_rect.stretch(padding);
+ //view_rect.stretch(padding);
+
+ //S32 x_threshold = threshold;
+ //S32 y_threshold = threshold;
+
+ //LLRect parent_local_snap_rect = mParentView->getLocalSnapRect();
+
+ //if (snap_type == SNAP_PARENT || snap_type == SNAP_PARENT_AND_SIBLINGS)
+ //{
+ // if (llabs(parent_local_snap_rect.mRight - test_rect.mRight) <= x_threshold && (parent_local_snap_rect.mRight - test_rect.mRight) * mouse_dir.mX >= 0)
+ // {
+ // view_rect.translate(parent_local_snap_rect.mRight - view_rect.mRight, 0);
+ // snap_view = mParentView;
+ // x_threshold = llabs(parent_local_snap_rect.mRight - test_rect.mRight);
+ // }
+
+ // if (llabs(test_rect.mLeft - parent_local_snap_rect.mLeft) <= x_threshold && test_rect.mLeft * mouse_dir.mX <= 0)
+ // {
+ // view_rect.translate(parent_local_snap_rect.mLeft - view_rect.mLeft, 0);
+ // snap_view = mParentView;
+ // x_threshold = llabs(test_rect.mLeft - parent_local_snap_rect.mLeft);
+ // }
+
+ // if (llabs(test_rect.mBottom - parent_local_snap_rect.mBottom) <= y_threshold && test_rect.mBottom * mouse_dir.mY <= 0)
+ // {
+ // view_rect.translate(0, parent_local_snap_rect.mBottom - view_rect.mBottom);
+ // snap_view = mParentView;
+ // y_threshold = llabs(test_rect.mBottom - parent_local_snap_rect.mBottom);
+ // }
+
+ // if (llabs(parent_local_snap_rect.mTop - test_rect.mTop) <= y_threshold && (parent_local_snap_rect.mTop - test_rect.mTop) * mouse_dir.mY >= 0)
+ // {
+ // view_rect.translate(0, parent_local_snap_rect.mTop - view_rect.mTop);
+ // snap_view = mParentView;
+ // y_threshold = llabs(parent_local_snap_rect.mTop - test_rect.mTop);
+ // }
+ //}
+ //if (snap_type == SNAP_SIBLINGS || snap_type == SNAP_PARENT_AND_SIBLINGS)
+ //{
+ // for ( child_list_const_iter_t child_it = mParentView->getChildList()->begin();
+ // child_it != mParentView->getChildList()->end(); ++child_it)
+ // {
+ // LLView* siblingp = *child_it;
+
+ // // skip non-snappable views (self, invisible views, etc)
+ // if (!canSnapTo(siblingp)) continue;
+
+ // LLRect sibling_rect = siblingp->getSnapRect();
+
+ // if (llabs(test_rect.mRight - sibling_rect.mLeft) <= x_threshold
+ // && (test_rect.mRight - sibling_rect.mLeft) * mouse_dir.mX <= 0)
+ // {
+ // view_rect.translate(sibling_rect.mLeft - view_rect.mRight, 0);
+ // if (llabs(test_rect.mTop - sibling_rect.mTop) <= y_threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
+ // {
+ // view_rect.translate(0, sibling_rect.mTop - test_rect.mTop);
+ // y_threshold = llabs(test_rect.mTop - sibling_rect.mTop);
+ // }
+ // else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= y_threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
+ // {
+ // view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom);
+ // y_threshold = llabs(test_rect.mBottom - sibling_rect.mBottom);
+ // }
+ // snap_view = siblingp;
+ // x_threshold = llabs(test_rect.mRight - sibling_rect.mLeft);
+ // }
+
+ // if (llabs(test_rect.mLeft - sibling_rect.mRight) <= x_threshold
+ // && (test_rect.mLeft - sibling_rect.mRight) * mouse_dir.mX <= 0)
+ // {
+ // view_rect.translate(sibling_rect.mRight - view_rect.mLeft, 0);
+ // if (llabs(test_rect.mTop - sibling_rect.mTop) <= y_threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
+ // {
+ // view_rect.translate(0, sibling_rect.mTop - test_rect.mTop);
+ // y_threshold = llabs(test_rect.mTop - sibling_rect.mTop);
+ // }
+ // else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= y_threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
+ // {
+ // view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom);
+ // y_threshold = llabs(test_rect.mBottom - sibling_rect.mBottom);
+ // }
+ // snap_view = siblingp;
+ // x_threshold = llabs(test_rect.mLeft - sibling_rect.mRight);
+ // }
+
+ // if (llabs(test_rect.mBottom - sibling_rect.mTop) <= y_threshold
+ // && (test_rect.mBottom - sibling_rect.mTop) * mouse_dir.mY <= 0)
+ // {
+ // view_rect.translate(0, sibling_rect.mTop - view_rect.mBottom);
+ // if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= x_threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
+ // {
+ // view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0);
+ // x_threshold = llabs(test_rect.mLeft - sibling_rect.mLeft);
+ // }
+ // else if (llabs(test_rect.mRight - sibling_rect.mRight) <= x_threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
+ // {
+ // view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0);
+ // x_threshold = llabs(test_rect.mRight - sibling_rect.mRight);
+ // }
+ // snap_view = siblingp;
+ // y_threshold = llabs(test_rect.mBottom - sibling_rect.mTop);
+ // }
+
+ // if (llabs(test_rect.mTop - sibling_rect.mBottom) <= y_threshold
+ // && (test_rect.mTop - sibling_rect.mBottom) * mouse_dir.mY <= 0)
+ // {
+ // view_rect.translate(0, sibling_rect.mBottom - view_rect.mTop);
+ // if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= x_threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
+ // {
+ // view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0);
+ // x_threshold = llabs(test_rect.mLeft - sibling_rect.mLeft);
+ // }
+ // else if (llabs(test_rect.mRight - sibling_rect.mRight) <= x_threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
+ // {
+ // view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0);
+ // x_threshold = llabs(test_rect.mRight - sibling_rect.mRight);
+ // }
+ // snap_view = siblingp;
+ // y_threshold = llabs(test_rect.mTop - sibling_rect.mBottom);
+ // }
+ // }
+ //}
+
+ //// shrink actual view rect back down
+ //view_rect.stretch(-padding);
+ //new_rect = view_rect;
+ //return snap_view;
}
LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding)
@@ -2407,8 +2230,8 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
LLRect test_rect = snap_rect;
test_rect.stretch(padding);
- BOOL snapped_x = FALSE;
- BOOL snapped_y = FALSE;
+ S32 x_threshold = threshold;
+ S32 y_threshold = threshold;
LLRect parent_local_snap_rect = mParentView->getLocalSnapRect();
@@ -2417,35 +2240,38 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
switch(snap_edge)
{
case SNAP_RIGHT:
- if (llabs(parent_local_snap_rect.mRight - test_rect.mRight) <= threshold && (parent_local_snap_rect.mRight - test_rect.mRight) * mouse_dir.mX >= 0)
+ if (llabs(parent_local_snap_rect.mRight - test_rect.mRight) <= x_threshold
+ && (parent_local_snap_rect.mRight - test_rect.mRight) * mouse_dir.mX >= 0)
{
snap_pos = parent_local_snap_rect.mRight - padding;
snap_view = mParentView;
- snapped_x = TRUE;
+ x_threshold = llabs(parent_local_snap_rect.mRight - test_rect.mRight);
}
break;
case SNAP_LEFT:
- if (llabs(test_rect.mLeft - parent_local_snap_rect.mLeft) <= threshold && test_rect.mLeft * mouse_dir.mX <= 0)
+ if (llabs(test_rect.mLeft - parent_local_snap_rect.mLeft) <= x_threshold
+ && test_rect.mLeft * mouse_dir.mX <= 0)
{
snap_pos = parent_local_snap_rect.mLeft + padding;
snap_view = mParentView;
- snapped_x = TRUE;
+ x_threshold = llabs(test_rect.mLeft - parent_local_snap_rect.mLeft);
}
break;
case SNAP_BOTTOM:
- if (llabs(test_rect.mBottom - parent_local_snap_rect.mBottom) <= threshold && test_rect.mBottom * mouse_dir.mY <= 0)
+ if (llabs(test_rect.mBottom - parent_local_snap_rect.mBottom) <= y_threshold
+ && test_rect.mBottom * mouse_dir.mY <= 0)
{
snap_pos = parent_local_snap_rect.mBottom + padding;
snap_view = mParentView;
- snapped_y = TRUE;
+ y_threshold = llabs(test_rect.mBottom - parent_local_snap_rect.mBottom);
}
break;
case SNAP_TOP:
- if (llabs(parent_local_snap_rect.mTop - test_rect.mTop) <= threshold && (parent_local_snap_rect.mTop - test_rect.mTop) * mouse_dir.mY >= 0)
+ if (llabs(parent_local_snap_rect.mTop - test_rect.mTop) <= y_threshold && (parent_local_snap_rect.mTop - test_rect.mTop) * mouse_dir.mY >= 0)
{
snap_pos = parent_local_snap_rect.mTop - padding;
snap_view = mParentView;
- snapped_y = TRUE;
+ y_threshold = llabs(parent_local_snap_rect.mTop - test_rect.mTop);
}
break;
default:
@@ -2459,111 +2285,100 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
child_it != mParentView->getChildList()->end(); ++child_it)
{
LLView* siblingp = *child_it;
- // skip self
- if (siblingp == this || !siblingp->getVisible() || !canSnapTo(siblingp))
- {
- continue;
- }
+
+ if (!canSnapTo(siblingp)) continue;
LLRect sibling_rect = siblingp->getSnapRect();
switch(snap_edge)
{
case SNAP_RIGHT:
- if (!snapped_x)
+ if (llabs(test_rect.mRight - sibling_rect.mLeft) <= x_threshold
+ && (test_rect.mRight - sibling_rect.mLeft) * mouse_dir.mX <= 0)
{
- if (llabs(test_rect.mRight - sibling_rect.mLeft) <= threshold && (test_rect.mRight - sibling_rect.mLeft) * mouse_dir.mX <= 0)
+ snap_pos = sibling_rect.mLeft - padding;
+ snap_view = siblingp;
+ x_threshold = llabs(test_rect.mRight - sibling_rect.mLeft);
+ }
+ // if snapped with sibling along other axis, check for shared edge
+ else if (llabs(sibling_rect.mTop - (test_rect.mBottom - padding)) <= y_threshold
+ || llabs(sibling_rect.mBottom - (test_rect.mTop + padding)) <= x_threshold)
+ {
+ if (llabs(test_rect.mRight - sibling_rect.mRight) <= x_threshold
+ && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
{
- snap_pos = sibling_rect.mLeft - padding;
+ snap_pos = sibling_rect.mRight;
snap_view = siblingp;
- snapped_x = TRUE;
- }
- // if snapped with sibling along other axis, check for shared edge
- else if (llabs(sibling_rect.mTop - (test_rect.mBottom - padding)) <= threshold ||
- llabs(sibling_rect.mBottom - (test_rect.mTop + padding)) <= threshold)
- {
- if (llabs(test_rect.mRight - sibling_rect.mRight) <= threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
- {
- snap_pos = sibling_rect.mRight;
- snap_view = siblingp;
- snapped_x = TRUE;
- }
+ x_threshold = llabs(test_rect.mRight - sibling_rect.mRight);
}
}
break;
case SNAP_LEFT:
- if (!snapped_x)
+ if (llabs(test_rect.mLeft - sibling_rect.mRight) <= x_threshold
+ && (test_rect.mLeft - sibling_rect.mRight) * mouse_dir.mX <= 0)
+ {
+ snap_pos = sibling_rect.mRight + padding;
+ snap_view = siblingp;
+ x_threshold = llabs(test_rect.mLeft - sibling_rect.mRight);
+ }
+ // if snapped with sibling along other axis, check for shared edge
+ else if (llabs(sibling_rect.mTop - (test_rect.mBottom - padding)) <= y_threshold
+ || llabs(sibling_rect.mBottom - (test_rect.mTop + padding)) <= y_threshold)
{
- if (llabs(test_rect.mLeft - sibling_rect.mRight) <= threshold && (test_rect.mLeft - sibling_rect.mRight) * mouse_dir.mX <= 0)
+ if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= x_threshold
+ && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
{
- snap_pos = sibling_rect.mRight + padding;
+ snap_pos = sibling_rect.mLeft;
snap_view = siblingp;
- snapped_x = TRUE;
- }
- // if snapped with sibling along other axis, check for shared edge
- else if (llabs(sibling_rect.mTop - (test_rect.mBottom - padding)) <= threshold ||
- llabs(sibling_rect.mBottom - (test_rect.mTop + padding)) <= threshold)
- {
- if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
- {
- snap_pos = sibling_rect.mLeft;
- snap_view = siblingp;
- snapped_x = TRUE;
- }
+ x_threshold = llabs(test_rect.mLeft - sibling_rect.mLeft);
}
}
break;
case SNAP_BOTTOM:
- if (!snapped_y)
+ if (llabs(test_rect.mBottom - sibling_rect.mTop) <= y_threshold
+ && (test_rect.mBottom - sibling_rect.mTop) * mouse_dir.mY <= 0)
{
- if (llabs(test_rect.mBottom - sibling_rect.mTop) <= threshold && (test_rect.mBottom - sibling_rect.mTop) * mouse_dir.mY <= 0)
+ snap_pos = sibling_rect.mTop + padding;
+ snap_view = siblingp;
+ y_threshold = llabs(test_rect.mBottom - sibling_rect.mTop);
+ }
+ // if snapped with sibling along other axis, check for shared edge
+ else if (llabs(sibling_rect.mRight - (test_rect.mLeft - padding)) <= x_threshold
+ || llabs(sibling_rect.mLeft - (test_rect.mRight + padding)) <= x_threshold)
+ {
+ if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= y_threshold
+ && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
{
- snap_pos = sibling_rect.mTop + padding;
+ snap_pos = sibling_rect.mBottom;
snap_view = siblingp;
- snapped_y = TRUE;
- }
- // if snapped with sibling along other axis, check for shared edge
- else if (llabs(sibling_rect.mRight - (test_rect.mLeft - padding)) <= threshold ||
- llabs(sibling_rect.mLeft - (test_rect.mRight + padding)) <= threshold)
- {
- if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
- {
- snap_pos = sibling_rect.mBottom;
- snap_view = siblingp;
- snapped_y = TRUE;
- }
+ y_threshold = llabs(test_rect.mBottom - sibling_rect.mBottom);
}
}
break;
case SNAP_TOP:
- if (!snapped_y)
+ if (llabs(test_rect.mTop - sibling_rect.mBottom) <= y_threshold
+ && (test_rect.mTop - sibling_rect.mBottom) * mouse_dir.mY <= 0)
+ {
+ snap_pos = sibling_rect.mBottom - padding;
+ snap_view = siblingp;
+ y_threshold = llabs(test_rect.mTop - sibling_rect.mBottom);
+ }
+ // if snapped with sibling along other axis, check for shared edge
+ else if (llabs(sibling_rect.mRight - (test_rect.mLeft - padding)) <= x_threshold
+ || llabs(sibling_rect.mLeft - (test_rect.mRight + padding)) <= x_threshold)
{
- if (llabs(test_rect.mTop - sibling_rect.mBottom) <= threshold && (test_rect.mTop - sibling_rect.mBottom) * mouse_dir.mY <= 0)
+ if (llabs(test_rect.mTop - sibling_rect.mTop) <= y_threshold
+ && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
{
- snap_pos = sibling_rect.mBottom - padding;
+ snap_pos = sibling_rect.mTop;
snap_view = siblingp;
- snapped_y = TRUE;
- }
- // if snapped with sibling along other axis, check for shared edge
- else if (llabs(sibling_rect.mRight - (test_rect.mLeft - padding)) <= threshold ||
- llabs(sibling_rect.mLeft - (test_rect.mRight + padding)) <= threshold)
- {
- if (llabs(test_rect.mTop - sibling_rect.mTop) <= threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
- {
- snap_pos = sibling_rect.mTop;
- snap_view = siblingp;
- snapped_y = TRUE;
- }
+ y_threshold = llabs(test_rect.mTop - sibling_rect.mTop);
}
}
break;
default:
llerrs << "Invalid snap edge" << llendl;
}
- if (snapped_x && snapped_y)
- {
- break;
- }
}
}
@@ -2571,21 +2386,6 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
return snap_view;
}
-bool operator==(const LLViewHandle& lhs, const LLViewHandle& rhs)
-{
- return lhs.mID == rhs.mID;
-}
-
-bool operator!=(const LLViewHandle& lhs, const LLViewHandle& rhs)
-{
- return lhs.mID != rhs.mID;
-}
-
-bool operator<(const LLViewHandle &lhs, const LLViewHandle &rhs)
-{
- return lhs.mID < rhs.mID;
-}
-
//-----------------------------------------------------------------------------
// Listener dispatch functions
//-----------------------------------------------------------------------------
@@ -2876,13 +2676,6 @@ void LLView::initFromXML(LLXMLNodePtr node, LLView* parent)
setVisible(visible);
}
- if (node->hasAttribute("hidden"))
- {
- BOOL hidden;
- node->getAttributeBOOL("hidden", hidden);
- setHidden(hidden);
- }
-
node->getAttributeBOOL("use_bounding_rect", mUseBoundingRect);
node->getAttributeBOOL("mouse_opaque", mMouseOpaque);
@@ -3014,12 +2807,6 @@ void LLView::setControlValue(const LLSD& value)
}
//virtual
-LLString LLView::getControlName() const
-{
- return mControlName;
-}
-
-//virtual
void LLView::setControlName(const LLString& control_name, LLView *context)
{
if (context == NULL)
@@ -3058,11 +2845,6 @@ bool LLView::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
return FALSE;
}
-void LLView::setValue(const LLSD& value)
-{
-}
-
-
void LLView::addBoolControl(LLString name, bool initial_value)
{
mFloaterControls[name] = new LLControl(name, TYPE_BOOLEAN, initial_value, "Internal floater control");
@@ -3077,3 +2859,14 @@ LLControlBase *LLView::getControl(LLString name)
}
return NULL;
}
+
+//virtual
+void LLView::setValue(const LLSD& value)
+{
+}
+
+//virtual
+LLSD LLView::getValue() const
+{
+ return LLSD();
+}
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index e54983d67d..c8556c7edc 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -52,10 +52,6 @@
#include "stdenums.h"
#include "lluistring.h"
-class LLColor4;
-class LLWindow;
-class LLUICtrl;
-class LLScrollListItem;
const U32 FOLLOWS_NONE = 0x00;
const U32 FOLLOWS_LEFT = 0x01;
@@ -69,29 +65,90 @@ const BOOL NOT_MOUSE_OPAQUE = FALSE;
const U32 GL_NAME_UI_RESERVED = 2;
-class LLSimpleListener;
-class LLEventDispatcher;
-class LLViewHandle
-{
-public:
- LLViewHandle() { mID = 0; }
-
- void init() { mID = ++sNextID; }
- void markDead() { mID = 0; }
- BOOL isDead() { return (mID == 0); }
- friend bool operator==(const LLViewHandle& lhs, const LLViewHandle& rhs);
- friend bool operator!=(const LLViewHandle& lhs, const LLViewHandle& rhs);
- friend bool operator<(const LLViewHandle &a, const LLViewHandle &b);
-
-public:
- static LLViewHandle sDeadHandle;
+/*
+// virtual functions defined in LLView:
+
+virtual BOOL isCtrl() const;
+ LLUICtrl
+virtual BOOL isPanel();
+ LLPanel
+virtual void setRect(const LLRect &rect);
+ LLLineEditor
+virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group);
+virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
+virtual void removeCtrl( LLUICtrl* ctrl);
+ LLPanel
+virtual BOOL canFocusChildren() const { return TRUE; }
+ LLFolderView
+virtual void deleteAllChildren();
+ LLFolderView, LLPanelInventory
+virtual void setTentative(BOOL b) {}
+ LLUICtrl, LLSliderCtrl, LLSpinCtrl
+virtual BOOL getTentative() const { return FALSE; }
+ LLUICtrl, LLCheckBoxCtrl
+virtual void setVisible(BOOL visible);
+ LLFloater, LLAlertDialog, LLMenuItemGL, LLModalDialog
+virtual void setEnabled(BOOL enabled) { mEnabled = enabled; }
+ LLCheckBoxCtrl, LLComboBox, LLLineEditor, LLMenuGL, LLRadioGroup, etc
+virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ) { return FALSE; }
+ LLUICtrl, LLButton, LLCheckBoxCtrl, LLLineEditor, LLMenuGL, LLSliderCtrl
+virtual void onVisibilityChange ( BOOL curVisibilityIn );
+ LLMenuGL
+virtual LLRect getSnapRect() const { return mRect; } *TODO: Make non virtual
+ LLFloater
+virtual LLRect getRequiredRect() { return mRect; }
+ LLScrolllistCtrl
+virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+ LLUICtrl, et. al.
+virtual void translate( S32 x, S32 y );
+ LLMenuGL
+virtual void userSetShape(const LLRect& new_rect);
+ LLFloater, LLScrollLIstVtrl
+virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0);
+virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0);
+ LLScrollListCtrl
+virtual BOOL canSnapTo(const LLView* other_view) const { return other_view != this && other_view->getVisible(); }
+ LLFloater
+virtual void snappedTo(LLView* snap_view) {}
+ LLFloater
+virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
+ *
+virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
+ *
+virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,EDragAndDropType cargo_type,void* cargo_data,EAcceptance* accept,LLString& tooltip_msg);
+ *
+virtual void draw();
+ *
+virtual EWidgetType getWidgetType() const = 0;
+ *
+virtual LLString getWidgetTag() const = 0;
+ *
+virtual LLXMLNodePtr getXML(bool save_children = true) const;
+ *
+virtual void initFromXML(LLXMLNodePtr node, LLView* parent);
+ *
+virtual void onFocusLost() {}
+ LLUICtrl, LLScrollListCtrl, LLMenuGL, LLLineEditor, LLComboBox
+virtual void onFocusReceived() {}
+ LLUICtrl, LLTextEditor, LLScrollListVtrl, LLMenuGL, LLLineEditor
+virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
+ LLTabContainer, LLPanel, LLMenuGL
+virtual void setControlName(const LLString& control, LLView *context);
+ LLSliderCtrl, LLCheckBoxCtrl
+virtual LLString getControlName() const { return mControlName; }
+ LLSliderCtrl, LLCheckBoxCtrl
+virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
+ LLMenuItem
+virtual void setValue(const LLSD& value);
+ *
protected:
- S32 mID;
-
- static S32 sNextID;
-};
+virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
+ *
+virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent);
+ *
+*/
class LLView : public LLMouseHandler, public LLMortician, public LLSimpleListenerObservable
{
@@ -128,7 +185,7 @@ public:
typedef child_list_t::reverse_iterator child_list_reverse_iter_t;
typedef child_list_t::const_reverse_iterator child_list_const_reverse_iter_t;
- typedef std::vector<LLUICtrl *> ctrl_list_t;
+ typedef std::vector<class LLUICtrl *> ctrl_list_t;
typedef std::pair<S32, S32> tab_order_t;
typedef std::pair<LLUICtrl *, tab_order_t> tab_order_pair_t;
@@ -139,105 +196,48 @@ public:
typedef child_tab_order_t::reverse_iterator child_tab_order_reverse_iter_t;
typedef child_tab_order_t::const_reverse_iterator child_tab_order_const_reverse_iter_t;
-private:
- LLView* mParentView;
- child_list_t mChildList;
-
-protected:
- LLString mName;
- // location in pixels, relative to surrounding structure, bottom,left=0,0
- LLRect mRect;
- LLRect mBoundingRect;
-
- U32 mReshapeFlags;
-
- child_tab_order_t mCtrlOrder;
- S32 mDefaultTabGroup;
-
- BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application."
- // A disabled view, for example, may still have a scrollbar that responds to mouse events.
- BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect.
- LLUIString mToolTipMsg; // isNull() is true if none.
-
- U8 mSoundFlags;
- BOOL mSaveToXML;
-
- BOOL mIsFocusRoot;
- BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements
-
-public:
- LLViewHandle mViewHandle;
- BOOL mLastVisible;
-
-private:
- BOOL mVisible;
- BOOL mHidden; // Never show (generally for replacement text only)
-
- S32 mNextInsertionOrdinal;
-
-protected:
- static LLWindow* sWindow; // All root views must know about their window.
-
-public:
- static BOOL sDebugRects; // Draw debug rects behind everything.
- static BOOL sDebugKeys;
- static S32 sDepth;
- static BOOL sDebugMouseHandling;
- static LLString sMouseHandlerMessage;
- static S32 sSelectID;
- static BOOL sEditingUI;
- static LLView* sEditingUIView;
- static S32 sLastLeftXML;
- static S32 sLastBottomXML;
- static std::map<LLViewHandle,LLView*> sViewHandleMap;
- static BOOL sForceReshape;
-
-public:
- static LLView* getViewByHandle(LLViewHandle handle);
- static BOOL deleteViewByHandle(LLViewHandle handle);
-
-public:
LLView();
LLView(const LLString& name, BOOL mouse_opaque);
LLView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE);
virtual ~LLView();
- // Hack to support LLFocusMgr
- virtual BOOL isView();
+ // Hack to support LLFocusMgr (from LLMouseHandler)
+ /*virtual*/ BOOL isView() const;
// Some UI widgets need to be added as controls. Others need to
// be added as regular view children. isCtrl should return TRUE
// if a widget needs to be added as a ctrl
virtual BOOL isCtrl() const;
- virtual BOOL isPanel();
+ virtual BOOL isPanel() const;
//
// MANIPULATORS
//
- void setMouseOpaque( BOOL b );
+ void setMouseOpaque( BOOL b ) { mMouseOpaque = b; }
+ BOOL getMouseOpaque() const { return mMouseOpaque; }
void setToolTip( const LLStringExplicit& msg );
BOOL setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text );
void setToolTipArgs( const LLString::format_map_t& args );
virtual void setRect(const LLRect &rect);
- void setFollows(U32 flags);
+ void setFollows(U32 flags) { mReshapeFlags = flags; }
// deprecated, use setFollows() with FOLLOWS_LEFT | FOLLOWS_TOP, etc.
- void setFollowsNone();
- void setFollowsLeft();
- void setFollowsTop();
- void setFollowsRight();
- void setFollowsBottom();
- void setFollowsAll();
-
- void setSoundFlags(U8 flags);
- void setName(LLString name);
+ void setFollowsNone() { mReshapeFlags = FOLLOWS_NONE; }
+ void setFollowsLeft() { mReshapeFlags |= FOLLOWS_LEFT; }
+ void setFollowsTop() { mReshapeFlags |= FOLLOWS_TOP; }
+ void setFollowsRight() { mReshapeFlags |= FOLLOWS_RIGHT; }
+ void setFollowsBottom() { mReshapeFlags |= FOLLOWS_BOTTOM; }
+ void setFollowsAll() { mReshapeFlags |= FOLLOWS_ALL; }
+
+ void setSoundFlags(U8 flags) { mSoundFlags = flags; }
+ void setName(LLString name) { mName = name; }
void setUseBoundingRect( BOOL use_bounding_rect );
BOOL getUseBoundingRect();
- const LLString& getToolTip();
+ const LLString& getToolTip() const { return mToolTipMsg.getString(); }
void sendChildToFront(LLView* child);
void sendChildToBack(LLView* child);
@@ -253,61 +253,47 @@ public:
virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
virtual void removeCtrl( LLUICtrl* ctrl);
- child_tab_order_t getCtrlOrder() const { return mCtrlOrder; }
+ child_tab_order_t getCtrlOrder() const { return mCtrlOrder; }
ctrl_list_t getCtrlList() const;
ctrl_list_t getCtrlListSorted() const;
- S32 getDefaultTabGroup() const;
+
+ void setDefaultTabGroup(S32 d) { mDefaultTabGroup = d; }
+ S32 getDefaultTabGroup() const { return mDefaultTabGroup; }
BOOL isInVisibleChain() const;
BOOL isInEnabledChain() const;
- BOOL isFocusRoot() const;
- LLView* findRootMostFocusRoot();
+ void setFocusRoot(BOOL b) { mIsFocusRoot = b; }
+ BOOL isFocusRoot() const { return mIsFocusRoot; }
virtual BOOL canFocusChildren() const;
- class LLFocusRootsFilter : public LLQueryFilter, public LLSingleton<LLFocusRootsFilter>
- {
- /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const
- {
- return filterResult_t(view->isCtrl() && view->isFocusRoot(), TRUE);
- }
- };
-
- virtual BOOL focusNextRoot();
- virtual BOOL focusPrevRoot();
-
- virtual BOOL focusNextItem(BOOL text_entry_only);
- virtual BOOL focusPrevItem(BOOL text_entry_only);
- virtual BOOL focusFirstItem(BOOL prefer_text_fields = FALSE );
- virtual BOOL focusLastItem(BOOL prefer_text_fields = FALSE);
+ BOOL focusNextRoot();
+ BOOL focusPrevRoot();
// delete all children. Override this function if you need to
// perform any extra clean up such as cached pointers to selected
// children, etc.
virtual void deleteAllChildren();
- // by default, does nothing
virtual void setTentative(BOOL b);
- // by default, returns false
virtual BOOL getTentative() const;
- virtual void setAllChildrenEnabled(BOOL b);
+ void setAllChildrenEnabled(BOOL b);
- virtual void setEnabled(BOOL enabled);
virtual void setVisible(BOOL visible);
- virtual void setHidden(BOOL hidden); // Never show (replacement text)
+ BOOL getVisible() const { return mVisible; }
+ virtual void setEnabled(BOOL enabled);
+ BOOL getEnabled() const { return mEnabled; }
+ U8 getSoundFlags() const { return mSoundFlags; }
- // by default, does nothing and returns false
virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
virtual void onVisibilityChange ( BOOL curVisibilityIn );
void pushVisible(BOOL visible) { mLastVisible = mVisible; setVisible(visible); }
void popVisible() { setVisible(mLastVisible); mLastVisible = TRUE; }
+
+ LLHandle<LLView> getHandle() { mHandle.bind(this); return mHandle; }
- //
- // ACCESSORS
- //
- BOOL getMouseOpaque() const { return mMouseOpaque; }
U32 getFollows() const { return mReshapeFlags; }
BOOL followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; }
@@ -318,26 +304,26 @@ public:
const LLRect& getRect() const { return mRect; }
const LLRect& getBoundingRect() const { return mBoundingRect; }
- const LLRect getLocalBoundingRect() const;
- const LLRect getScreenRect() const;
- const LLRect getLocalRect() const;
- virtual const LLRect getSnapRect() const { return mRect; }
- virtual const LLRect getLocalSnapRect() const;
-
- virtual LLRect getRequiredRect(); // Get required size for this object. 0 for width/height means don't care.
+ LLRect getLocalBoundingRect() const;
+ LLRect getScreenRect() const;
+ LLRect getLocalRect() const;
+ virtual LLRect getSnapRect() const;
+ LLRect getLocalSnapRect() const;
+
+ // Override and return required size for this object. 0 for width/height means don't care.
+ virtual LLRect getRequiredRect();
void updateBoundingRect();
LLView* getRootView();
LLView* getParent() const { return mParentView; }
- LLView* getFirstChild() { return (mChildList.empty()) ? NULL : *(mChildList.begin()); }
+ LLView* getFirstChild() const { return (mChildList.empty()) ? NULL : *(mChildList.begin()); }
S32 getChildCount() const { return (S32)mChildList.size(); }
template<class _Pr3> void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); }
- BOOL hasAncestor(const LLView* parentp);
-
+ BOOL hasAncestor(const LLView* parentp) const;
BOOL hasChild(const LLString& childname, BOOL recurse = FALSE) const;
-
BOOL childHasKeyboardFocus( const LLString& childname ) const;
+
//
// UTILITIES
//
@@ -345,15 +331,15 @@ public:
// Default behavior is to use reshape flags to resize child views
virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
virtual void translate( S32 x, S32 y );
- virtual void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); }
+ void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); }
BOOL translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside );
+ void centerWithin(const LLRect& bounds);
virtual void userSetShape(const LLRect& new_rect);
virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0);
virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0);
- // Defaults to other_view->getVisible()
- virtual BOOL canSnapTo(LLView* other_view);
+ virtual BOOL canSnapTo(const LLView* other_view) const;
virtual void snappedTo(LLView* snap_view);
@@ -365,49 +351,97 @@ public:
EAcceptance* accept,
LLString& tooltip_msg);
- // LLMouseHandler functions
- // Default behavior is to pass events to children
-
- /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
- /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
- /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
- /*virtual*/ void onMouseCaptureLost();
- /*virtual*/ BOOL hasMouseCapture();
-
- // Default behavior is to pass the tooltip event to children,
- // then display mToolTipMsg if no child handled it.
- /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect);
-
LLString getShowNamesToolTip();
virtual void draw();
- void drawDebugRect();
- void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE);
-
- virtual const LLString& getName() const;
-
virtual EWidgetType getWidgetType() const = 0;
virtual LLString getWidgetTag() const = 0;
virtual LLXMLNodePtr getXML(bool save_children = true) const;
- static U32 createRect(LLXMLNodePtr node, LLRect &rect, LLView* parent_view, const LLRect &required_rect = LLRect());
virtual void initFromXML(LLXMLNodePtr node, LLView* parent);
void parseFollowsFlags(LLXMLNodePtr node);
+ // Some widgets, like close box buttons, don't need to be saved
+ BOOL getSaveToXML() const { return mSaveToXML; }
+ void setSaveToXML(BOOL b) { mSaveToXML = b; }
+
+ virtual void onFocusLost();
+ virtual void onFocusReceived();
+
+ typedef enum e_hit_test_type
+ {
+ HIT_TEST_USE_BOUNDING_RECT,
+ HIT_TEST_IGNORE_BOUNDING_RECT
+ }EHitTestType;
+
+ BOOL parentPointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const;
+ BOOL pointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const;
+ BOOL blockMouseEvent(S32 x, S32 y) const;
+
+ // See LLMouseHandler virtuals for screenPointToLocal and localPointToScreen
+ BOOL localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, LLView* other_view) const;
+ BOOL localRectToOtherView( const LLRect& local, LLRect* other, LLView* other_view ) const;
+ void screenRectToLocal( const LLRect& screen, LLRect* local ) const;
+ void localRectToScreen( const LLRect& local, LLRect* screen ) const;
+
+ // Listener dispatching functions (Dispatcher deletes pointers to listeners on deregistration or destruction)
+ LLSimpleListener* getListenerByName(const LLString &callback_name);
+ void registerEventListener(LLString name, LLSimpleListener* function);
+ void deregisterEventListener(LLString name);
+ LLString findEventListener(LLSimpleListener *listener) const;
+ void addListenerToControl(LLEventDispatcher *observer, const LLString& name, LLSD filter, LLSD userdata);
+
+ void addBoolControl(LLString name, bool initial_value);
+ LLControlBase *getControl(LLString name);
+ LLControlBase *findControl(LLString name);
+
+ void setControlValue(const LLSD& value);
+ virtual void setControlName(const LLString& control, LLView *context);
+ virtual LLString getControlName() const { return mControlName; }
+ virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
+ virtual void setValue(const LLSD& value);
+ virtual LLSD getValue() const;
+
+ const child_list_t* getChildList() const { return &mChildList; }
+
+ // LLMouseHandler functions
+ // Default behavior is to pass events to children
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
+ /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); // Display mToolTipMsg if no child handles it.
+ /*virtual*/ const LLString& getName() const;
+ /*virtual*/ void onMouseCaptureLost();
+ /*virtual*/ BOOL hasMouseCapture();
+ /*virtual*/ BOOL isView(); // Hack to support LLFocusMgr
+ /*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;
+
+ template <class T> T* getChild(const LLString& name, BOOL recurse = TRUE) const
+ {
+ T* result = dynamic_cast<T*>(getChildByName(name, TRUE));
+ //if (!result)
+ //{
+ // // create dummy widget instance here
+ // result = gUICtrlFactory->createDummyWidget<T>(name);
+ //}
+ return result;
+ }
+
+ // statics
+ static U32 createRect(LLXMLNodePtr node, LLRect &rect, LLView* parent_view, const LLRect &required_rect = LLRect());
+
static LLFontGL* selectFont(LLXMLNodePtr node);
static LLFontGL::HAlign selectFontHAlign(LLXMLNodePtr node);
static LLFontGL::VAlign selectFontVAlign(LLXMLNodePtr node);
static LLFontGL::StyleFlags selectFontStyle(LLXMLNodePtr node);
- // Some widgets, like close box buttons, don't need to be saved
- BOOL getSaveToXML() const { return mSaveToXML; }
- void setSaveToXML(BOOL b) { mSaveToXML = b; }
-
+
// Only saves color if different from default setting.
static void addColorXML(LLXMLNodePtr node, const LLColor4& color,
const LLString& xml_name, const LLString& control_name);
@@ -432,54 +466,17 @@ public:
// return query for iterating over focus roots in tab order
static const LLCtrlQuery & getFocusRootsQuery();
- BOOL getEnabled() const { return mEnabled; }
- BOOL getVisible() const { return mVisible && !mHidden; }
- U8 getSoundFlags() const { return mSoundFlags; }
-
- typedef enum e_hit_test_type
- {
- HIT_TEST_USE_BOUNDING_RECT,
- HIT_TEST_IGNORE_BOUNDING_RECT
- }EHitTestType;
-
- BOOL parentPointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const;
- BOOL pointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const;
- BOOL blockMouseEvent(S32 x, S32 y) const;
-
- 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;
- virtual BOOL localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, LLView* other_view);
- virtual void screenRectToLocal( const LLRect& screen, LLRect* local ) const;
- virtual void localRectToScreen( const LLRect& local, LLRect* screen ) const;
- virtual BOOL localRectToOtherView( const LLRect& local, LLRect* other, LLView* other_view ) const;
-
-
- static LLWindow* getWindow(void);
-
- // Listener dispatching functions (Dispatcher deletes pointers to listeners on deregistration or destruction)
- LLSimpleListener* getListenerByName(const LLString &callback_name);
- void registerEventListener(LLString name, LLSimpleListener* function);
- void deregisterEventListener(LLString name);
- LLString findEventListener(LLSimpleListener *listener) const;
- void addListenerToControl(LLEventDispatcher *observer, const LLString& name, LLSD filter, LLSD userdata);
-
- virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
-
- void addBoolControl(LLString name, bool initial_value);
- LLControlBase *getControl(LLString name);
- virtual LLControlBase *findControl(LLString name);
-
- void setControlValue(const LLSD& value);
- virtual void setControlName(const LLString& control, LLView *context);
- virtual LLString getControlName() const;
- virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
- virtual void setValue(const LLSD& value);
- const child_list_t* getChildList() const { return &mChildList; }
+ static BOOL deleteViewByHandle(LLHandle<LLView> handle);
+ static LLWindow* getWindow(void) { return LLUI::sWindow; }
+
protected:
virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent);
+ void drawDebugRect();
+ void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE);
+
LLView* childrenHandleKey(KEY key, MASK mask);
LLView* childrenHandleUnicodeChar(llwchar uni_char);
LLView* childrenHandleDragAndDrop(S32 x, S32 y, MASK mask,
@@ -497,15 +494,64 @@ protected:
LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask);
LLView* childrenHandleRightMouseUp(S32 x, S32 y, MASK mask);
- typedef std::map<LLString, LLPointer<LLSimpleListener> > dispatch_list_t;
- dispatch_list_t mDispatchList;
-
-protected:
typedef std::map<LLString, LLControlBase*> control_map_t;
control_map_t mFloaterControls;
+ virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
+
+private:
+ LLView* mParentView;
+ child_list_t mChildList;
+
+ LLString mName;
+ // location in pixels, relative to surrounding structure, bottom,left=0,0
+ LLRect mRect;
+ LLRect mBoundingRect;
+
+ U32 mReshapeFlags;
+
+ child_tab_order_t mCtrlOrder;
+ S32 mDefaultTabGroup;
+
+ BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application."
+ // A disabled view, for example, may still have a scrollbar that responds to mouse events.
+ BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect.
+ LLUIString mToolTipMsg; // isNull() is true if none.
+
+ U8 mSoundFlags;
+ BOOL mSaveToXML;
+
+ BOOL mIsFocusRoot;
+ BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements
+
+ LLRootHandle<LLView> mHandle;
+ BOOL mLastVisible;
+
+ BOOL mVisible;
+
+ S32 mNextInsertionOrdinal;
+
+ static LLWindow* sWindow; // All root views must know about their window.
+
+ typedef std::map<LLString, LLPointer<LLSimpleListener> > dispatch_list_t;
+ dispatch_list_t mDispatchList;
+
LLString mControlName;
- friend class LLUICtrlFactory;
+
+
+// Just debugging stuff? We should try to hide anything that's not. -MG
+public:
+ static BOOL sDebugRects; // Draw debug rects behind everything.
+ static BOOL sDebugKeys;
+ static S32 sDepth;
+ static BOOL sDebugMouseHandling;
+ static LLString sMouseHandlerMessage;
+ static S32 sSelectID;
+ static BOOL sEditingUI;
+ static LLView* sEditingUIView;
+ static S32 sLastLeftXML;
+ static S32 sLastBottomXML;
+ static BOOL sForceReshape;
};
@@ -514,12 +560,12 @@ protected:
class LLCompareByTabOrder
{
public:
- LLCompareByTabOrder(LLView::child_tab_order_t order);
+ LLCompareByTabOrder(LLView::child_tab_order_t order) : mTabOrder(order) {}
virtual ~LLCompareByTabOrder() {}
bool operator() (const LLView* const a, const LLView* const b) const;
-protected:
- virtual bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const;
+private:
+ virtual bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const { return a < b; }
LLView::child_tab_order_t mTabOrder;
};
-#endif
+#endif //LL_LLVIEW_H
diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp
index 8fbe671613..546eb23c03 100644
--- a/indra/llui/llviewborder.cpp
+++ b/indra/llui/llviewborder.cpp
@@ -1,6 +1,5 @@
/**
* @file llviewborder.cpp
- * @brief LLViewBorder base class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -29,19 +28,8 @@
* $/LicenseInfo$
*/
-// A customizable decorative border. Does not interact with mouse events.
-
#include "linden_common.h"
-
#include "llviewborder.h"
-
-#include "llgl.h"
-#include "llui.h"
-#include "llimagegl.h"
-//#include "llviewerimagelist.h"
-#include "llcontrol.h"
-#include "llglheaders.h"
-#include "v2math.h"
#include "llfocusmgr.h"
LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bevel, EStyle style, S32 width )
@@ -53,7 +41,6 @@ LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bev
mHighlightDark( LLUI::sColorsGroup->getColor( "DefaultHighlightDark" ) ),
mShadowLight( LLUI::sColorsGroup->getColor( "DefaultShadowLight" ) ),
mShadowDark( LLUI::sColorsGroup->getColor( "DefaultShadowDark" ) ),
-// mKeyboardFocusColor(LLUI::sColorsGroup->getColor( "FocusColor" ) ),
mBorderWidth( width ),
mTexture( NULL ),
mHasKeyboardFocus( FALSE )
@@ -61,12 +48,6 @@ LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bev
setFollowsAll();
}
-// virtual
-BOOL LLViewBorder::isCtrl() const
-{
- return FALSE;
-}
-
void LLViewBorder::setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light )
{
mShadowDark = shadow_dark;
@@ -160,8 +141,8 @@ void LLViewBorder::drawOnePixelLines()
}
S32 left = 0;
- S32 top = mRect.getHeight();
- S32 right = mRect.getWidth();
+ S32 top = getRect().getHeight();
+ S32 right = getRect().getWidth();
S32 bottom = 0;
glColor4fv( top_color.mV );
@@ -219,8 +200,8 @@ void LLViewBorder::drawTwoPixelLines()
}
S32 left = 0;
- S32 top = mRect.getHeight();
- S32 right = mRect.getWidth();
+ S32 top = getRect().getHeight();
+ S32 right = getRect().getWidth();
S32 bottom = 0;
// draw borders
@@ -253,10 +234,10 @@ void LLViewBorder::drawTextures()
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- drawTextureTrapezoid( 0.f, mBorderWidth, mRect.getWidth(), 0, 0 );
- drawTextureTrapezoid( 90.f, mBorderWidth, mRect.getHeight(), (F32)mRect.getWidth(),0 );
- drawTextureTrapezoid( 180.f, mBorderWidth, mRect.getWidth(), (F32)mRect.getWidth(),(F32)mRect.getHeight() );
- drawTextureTrapezoid( 270.f, mBorderWidth, mRect.getHeight(), 0, (F32)mRect.getHeight() );
+ drawTextureTrapezoid( 0.f, mBorderWidth, getRect().getWidth(), 0, 0 );
+ drawTextureTrapezoid( 90.f, mBorderWidth, getRect().getHeight(), (F32)getRect().getWidth(),0 );
+ drawTextureTrapezoid( 180.f, mBorderWidth, getRect().getWidth(), (F32)getRect().getWidth(),(F32)getRect().getHeight() );
+ drawTextureTrapezoid( 270.f, mBorderWidth, getRect().getHeight(), 0, (F32)getRect().getHeight() );
}
@@ -292,7 +273,7 @@ void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32
glPopMatrix();
}
-bool LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
+BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
{
if (node->hasAttribute("bevel_style"))
{
@@ -316,25 +297,11 @@ bool LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel
{
bevel_style = LLViewBorder::BEVEL_BRIGHT;
}
- return true;
+ return TRUE;
}
- return false;
-}
-
-void LLViewBorder::setValue(const LLSD& val)
-{
- setRect(LLRect(val));
-}
-
-EWidgetType LLViewBorder::getWidgetType() const
-{
- return WIDGET_TYPE_VIEW_BORDER;
+ return FALSE;
}
-LLString LLViewBorder::getWidgetTag() const
-{
- return LL_VIEW_BORDER_TAG;
-}
// static
LLView* LLViewBorder::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h
index 6a91c5ebf7..e9fd8aa4e1 100644
--- a/indra/llui/llviewborder.h
+++ b/indra/llui/llviewborder.h
@@ -1,6 +1,6 @@
/**
* @file llviewborder.h
- * @brief LLViewBorder base class
+ * @brief A customizable decorative border. Does not interact with mouse events.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -29,64 +29,53 @@
* $/LicenseInfo$
*/
-// A customizable decorative border. Does not interact with mouse events.
-
#ifndef LL_LLVIEWBORDER_H
#define LL_LLVIEWBORDER_H
#include "llview.h"
-#include "v4color.h"
-#include "lluuid.h"
-#include "llimagegl.h"
-#include "llxmlnode.h"
-
-class LLUUID;
-class LLUICtrlFactory;
class LLViewBorder : public LLView
{
public:
enum EBevel { BEVEL_IN, BEVEL_OUT, BEVEL_BRIGHT, BEVEL_NONE };
-
enum EStyle { STYLE_LINE, STYLE_TEXTURE };
LLViewBorder( const LLString& name, const LLRect& rect, EBevel bevel = BEVEL_OUT, EStyle style = STYLE_LINE, S32 width = 1 );
- virtual void setValue(const LLSD& val);
- virtual EWidgetType getWidgetType() const;
- virtual LLString getWidgetTag() const;
+ virtual void setValue(const LLSD& val) { setRect(LLRect(val)); }
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_VIEW_BORDER; }
+ virtual LLString getWidgetTag() const { return LL_VIEW_BORDER_TAG; }
- virtual BOOL isCtrl() const;
+ virtual BOOL isCtrl() const { return FALSE; }
// llview functionality
virtual void draw();
- static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
- static bool getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style);
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
+ static BOOL getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style);
void setBorderWidth(S32 width) { mBorderWidth = width; }
+ S32 getBorderWidth() const { return mBorderWidth; }
void setBevel(EBevel bevel) { mBevel = bevel; }
+ EBevel getBevel() const { return mBevel; }
void setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light );
void setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark,
const LLColor4& highlight_light, const LLColor4& highlight_dark );
- void setTexture( const LLUUID &image_id );
+ void setTexture( const class LLUUID &image_id );
- EBevel getBevel() const { return mBevel; }
EStyle getStyle() const { return mStyle; }
- S32 getBorderWidth() const { return mBorderWidth; }
void setKeyboardFocusHighlight( BOOL b ) { mHasKeyboardFocus = b; }
-protected:
+private:
void drawOnePixelLines();
void drawTwoPixelLines();
void drawTextures();
void drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y );
-protected:
EBevel mBevel;
- EStyle mStyle;
+ const EStyle mStyle;
LLColor4 mHighlightLight;
LLColor4 mHighlightDark;
LLColor4 mShadowLight;
diff --git a/indra/llui/llviewquery.cpp b/indra/llui/llviewquery.cpp
index db00c76821..dedc9a6ebb 100644
--- a/indra/llui/llviewquery.cpp
+++ b/indra/llui/llviewquery.cpp
@@ -71,22 +71,9 @@ filterResult_t LLWidgetTypeFilter::operator() (const LLView* const view, const v
return filterResult_t(view->getWidgetType() == mType, TRUE);
}
+//
// LLViewQuery
-
-LLViewQuery::LLViewQuery(): mPreFilters(), mPostFilters(), mSorterp()
-{
-}
-
-void LLViewQuery::addPreFilter(const LLQueryFilter* prefilter) { mPreFilters.push_back(prefilter); }
-
-void LLViewQuery::addPostFilter(const LLQueryFilter* postfilter) { mPostFilters.push_back(postfilter); }
-
-const LLViewQuery::filterList_t & LLViewQuery::getPreFilters() const { return mPreFilters; }
-
-const LLViewQuery::filterList_t & LLViewQuery::getPostFilters() const { return mPostFilters; }
-
-void LLViewQuery::setSorter(const LLQuerySorter* sorterp) { mSorterp = sorterp; }
-const LLQuerySorter* LLViewQuery::getSorter() const { return mSorterp; }
+//
viewList_t LLViewQuery::run(LLView* view) const
{
diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h
index 63559e8240..59ef1c1896 100644
--- a/indra/llui/llviewquery.h
+++ b/indra/llui/llviewquery.h
@@ -42,12 +42,12 @@ class LLView;
typedef std::list<LLView *> viewList_t;
typedef std::pair<BOOL, BOOL> filterResult_t;
-// Abstract base class for all filters.
+// Abstract base class for all query filters.
class LLQueryFilter
{
public:
virtual ~LLQueryFilter() {};
- virtual filterResult_t operator() (const LLView* const view, const viewList_t & children) const =0;
+ virtual filterResult_t operator() (const LLView* const view, const viewList_t & children) const = 0;
};
class LLQuerySorter
@@ -105,25 +105,28 @@ public:
typedef filterList_t::iterator filterList_iter_t;
typedef filterList_t::const_iterator filterList_const_iter_t;
- LLViewQuery();
+ LLViewQuery() : mPreFilters(), mPostFilters(), mSorterp() {}
virtual ~LLViewQuery() {}
- void addPreFilter(const LLQueryFilter* prefilter);
- void addPostFilter(const LLQueryFilter* postfilter);
- const filterList_t & getPreFilters() const;
- const filterList_t & getPostFilters() const;
+ void addPreFilter(const LLQueryFilter* prefilter) { mPreFilters.push_back(prefilter); }
+ void addPostFilter(const LLQueryFilter* postfilter) { mPostFilters.push_back(postfilter); }
+ const filterList_t & getPreFilters() const { return mPreFilters; }
+ const filterList_t & getPostFilters() const { return mPostFilters; }
- void setSorter(const LLQuerySorter* sorter);
- const LLQuerySorter* getSorter() const;
+ void setSorter(const LLQuerySorter* sorter) { mSorterp = sorter; }
+ const LLQuerySorter* getSorter() const { return mSorterp; }
viewList_t run(LLView * view) const;
// syntactic sugar
viewList_t operator () (LLView * view) const { return run(view); }
-protected:
+
// override this method to provide iteration over other types of children
virtual void filterChildren(LLView * view, viewList_t & filtered_children) const;
+
+private:
+
filterResult_t runFilters(LLView * view, const viewList_t children, const filterList_t filters) const;
-protected:
+
filterList_t mPreFilters;
filterList_t mPostFilters;
const LLQuerySorter* mSorterp;
@@ -135,4 +138,4 @@ public:
LLCtrlQuery();
};
-#endif
+#endif // LL_LLVIEWQUERY_H
diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h
index 057c75e663..e3ef37e4e7 100644
--- a/indra/llwindow/llmousehandler.h
+++ b/indra/llwindow/llmousehandler.h
@@ -57,7 +57,7 @@ public:
virtual void onMouseCaptureLost() = 0;
// Hack to support LLFocusMgr
- virtual BOOL isView() = 0;
+ virtual BOOL isView() const = 0;
virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const = 0;
virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const = 0;
diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp
index 4501daf7a0..9b0675945d 100644
--- a/indra/llxml/llxmlnode.cpp
+++ b/indra/llxml/llxmlnode.cpp
@@ -3024,80 +3024,65 @@ LLXMLNodePtr LLXMLNode::getNextSibling()
LLString LLXMLNode::getTextContents() const
{
std::string msg;
- LLXMLNodeList p_children;
- getChildren("p", p_children);
- if (p_children.size() > 0)
- {
- // Case 1: node has <p>text</p> tags
- LLXMLNodeList::iterator itor;
- for (itor = p_children.begin(); itor != p_children.end(); ++itor)
- {
- LLXMLNodePtr p = itor->second;
- msg += p->getValue() + "\n";
- }
- }
- else
- {
- LLString contents = mValue;
- std::string::size_type n = contents.find_first_not_of(" \t\n");
- if (n != std::string::npos && contents[n] == '\"')
- {
- // Case 2: node has quoted text
- S32 num_lines = 0;
+ LLString contents = mValue;
+ std::string::size_type n = contents.find_first_not_of(" \t\n");
+ if (n != std::string::npos && contents[n] == '\"')
+ {
+ // Case 1: node has quoted text
+ S32 num_lines = 0;
+ while(1)
+ {
+ // mContents[n] == '"'
+ ++n;
+ std::string::size_type t = n;
+ std::string::size_type m = 0;
+ // fix-up escaped characters
while(1)
{
- // mContents[n] == '"'
- ++n;
- std::string::size_type t = n;
- std::string::size_type m = 0;
- // fix-up escaped characters
- while(1)
- {
- m = contents.find_first_of("\\\"", t); // find first \ or "
- if ((m == std::string::npos) || (contents[m] == '\"'))
- {
- break;
- }
- contents.erase(m,1);
- t = m+1;
- }
- if (m == std::string::npos)
+ m = contents.find_first_of("\\\"", t); // find first \ or "
+ if ((m == std::string::npos) || (contents[m] == '\"'))
{
break;
}
- // mContents[m] == '"'
- num_lines++;
- msg += contents.substr(n,m-n) + "\n";
- n = contents.find_first_of("\"", m+1);
- if (n == std::string::npos)
+ contents.erase(m,1);
+ t = m+1;
+ }
+ if (m == std::string::npos)
+ {
+ break;
+ }
+ // mContents[m] == '"'
+ num_lines++;
+ msg += contents.substr(n,m-n) + "\n";
+ n = contents.find_first_of("\"", m+1);
+ if (n == std::string::npos)
+ {
+ if (num_lines == 1)
{
- if (num_lines == 1)
- {
- msg.erase(msg.size()-1); // remove "\n" if only one line
- }
- break;
+ msg.erase(msg.size()-1); // remove "\n" if only one line
}
+ break;
}
}
- else
+ }
+ else
+ {
+ // Case 2: node has embedded text (beginning and trailing whitespace trimmed)
+ LLString::size_type start = mValue.find_first_not_of(" \t\n");
+ if (start != mValue.npos)
{
- // Case 3: node has embedded text (beginning and trailing whitespace trimmed)
- LLString::size_type start = mValue.find_first_not_of(" \t\n");
- if (start != mValue.npos)
+ LLString::size_type end = mValue.find_last_not_of(" \t\n");
+ if (end != mValue.npos)
{
- LLString::size_type end = mValue.find_last_not_of(" \t\n");
- if (end != mValue.npos)
- {
- msg = mValue.substr(start, end+1-start);
- }
- else
- {
- msg = mValue.substr(start);
- }
+ msg = mValue.substr(start, end+1-start);
+ }
+ else
+ {
+ msg = mValue.substr(start);
}
- // Convert any internal CR to LF
- msg = utf8str_removeCRLF(msg);
}
+ // Convert any internal CR to LF
+ msg = utf8str_removeCRLF(msg);
}
return msg;
}
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 51ab279e16..bd885f955c 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -969,12 +969,12 @@ void LLAgent::sendReliableMessage()
{
if (gDisconnected)
{
- llwarns << "Trying to send message when disconnected!" << llendl;
+ lldebugs << "Trying to send message when disconnected!" << llendl;
return;
}
if (!mRegionp)
{
- llwarns << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << llendl;
+ lldebugs << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << llendl;
return;
}
gMessageSystem->sendReliable(mRegionp->getHost());
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 5e5a58cffb..1b21a71212 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -117,6 +117,8 @@ inline bool operator==(const LLGroupData &a, const LLGroupData &b)
class LLAgent : public LLObservable
{
+ LOG_CLASS(LLAgent);
+
public:
// When the agent hasn't typed anything for this duration, it leaves the
// typing state (for both chat and IM).
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index 6d0244e55e..108e2cafe0 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -266,9 +266,8 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds)
{
using namespace std;
- U32 new_buddy_count = 0;
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ U32 new_buddy_count = 0;
+ std::string first,last;
LLUUID agent_id;
for(buddy_map_t::const_iterator itr = buds.begin(); itr != buds.end(); ++itr)
{
@@ -588,8 +587,7 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg)
{
if((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MODIFY_OBJECTS)
{
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string first, last;
LLStringBase<char>::format_map_t args;
if(gCacheName->getName(agent_id, first, last))
{
@@ -646,8 +644,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
setBuddyOnline(agent_id,online);
if(chat_notify)
{
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string first, last;
if(gCacheName->getName(agent_id, first, last))
{
notify = TRUE;
@@ -801,8 +798,6 @@ bool LLCollectProxyBuddies::operator()(const LLUUID& buddy_id, LLRelationship* b
bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy)
{
- mFirst[0] = '\0';
- mLast[0] = '\0';
gCacheName->getName(buddy_id, mFirst, mLast);
std::ostringstream fullname;
fullname << mFirst << " " << mLast;
@@ -816,8 +811,6 @@ bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship
bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy)
{
- mFirst[0] = '\0';
- mLast[0] = '\0';
gCacheName->getName(buddy_id, mFirst, mLast);
std::ostringstream fullname;
fullname << mFirst << " " << mLast;
@@ -831,8 +824,6 @@ bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship*
bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy)
{
- mFirst[0] = '\0';
- mLast[0] = '\0';
gCacheName->getName(buddy_id, mFirst, mLast);
std::ostringstream fullname;
fullname << mFirst << " " << mLast;
diff --git a/indra/newview/llcallingcard.h b/indra/newview/llcallingcard.h
index f713af389f..c00fe5295d 100644
--- a/indra/newview/llcallingcard.h
+++ b/indra/newview/llcallingcard.h
@@ -212,8 +212,8 @@ public:
virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t;
buddy_map_t mMappable;
- char mFirst[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- char mLast[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
+ std::string mFirst;
+ std::string mLast;
};
// collect dictionary sorted map of name -> agent_id for every online buddy
@@ -225,8 +225,8 @@ public:
virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t;
buddy_map_t mOnline;
- char mFirst[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char mLast[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string mFirst;
+ std::string mLast;
};
// collect dictionary sorted map of name -> agent_id for every buddy,
@@ -240,8 +240,8 @@ public:
typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t;
buddy_map_t mOnline;
buddy_map_t mOffline;
- char mFirst[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char mLast[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string mFirst;
+ std::string mLast;
};
#endif // LL_LLCALLINGCARD_H
diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp
index 1798aea122..2ea9bf6e5e 100644
--- a/indra/newview/llchatbar.cpp
+++ b/indra/newview/llchatbar.cpp
@@ -125,6 +125,12 @@ BOOL LLChatBar::postBuild()
// attempt to bind to an existing combo box named gesture
setGestureCombo(LLUICtrlFactory::getComboBoxByName(this, "Gesture"));
+ LLButton * sayp = getChild<LLButton>("Say");
+ if(sayp)
+ {
+ setDefaultBtn(sayp);
+ }
+
mInputEditor = LLUICtrlFactory::getLineEditorByName(this, "Chat Editor");
if (mInputEditor)
{
diff --git a/indra/newview/llclassifiedstatsresponder.cpp b/indra/newview/llclassifiedstatsresponder.cpp
index 0b33ce707e..a605d08448 100644
--- a/indra/newview/llclassifiedstatsresponder.cpp
+++ b/indra/newview/llclassifiedstatsresponder.cpp
@@ -43,7 +43,7 @@
#include "llview.h"
#include "message.h"
-LLClassifiedStatsResponder::LLClassifiedStatsResponder(LLViewHandle classified_panel_handle, LLUUID classified_id)
+LLClassifiedStatsResponder::LLClassifiedStatsResponder(LLHandle<LLView> classified_panel_handle, LLUUID classified_id)
: mClassifiedPanelHandle(classified_panel_handle),
mClassifiedID(classified_id)
{
@@ -58,7 +58,7 @@ void LLClassifiedStatsResponder::result(const LLSD& content)
S32 search_map = content["search_map_clicks"].asInteger();
S32 search_profile = content["search_profile_clicks"].asInteger();
- LLPanelClassified* classified_panelp = (LLPanelClassified*)LLPanel::getPanelByHandle(mClassifiedPanelHandle);
+ LLPanelClassified* classified_panelp = (LLPanelClassified*)mClassifiedPanelHandle.get();
if(classified_panelp)
{
diff --git a/indra/newview/llclassifiedstatsresponder.h b/indra/newview/llclassifiedstatsresponder.h
index 45d6ec38cf..a2b1daa8da 100644
--- a/indra/newview/llclassifiedstatsresponder.h
+++ b/indra/newview/llclassifiedstatsresponder.h
@@ -39,14 +39,14 @@
class LLClassifiedStatsResponder : public LLHTTPClient::Responder
{
public:
- LLClassifiedStatsResponder(LLViewHandle classified_panel_handle, LLUUID classified_id);
+ LLClassifiedStatsResponder(LLHandle<LLView> classified_panel_handle, LLUUID classified_id);
//If we get back a normal response, handle it here
virtual void result(const LLSD& content);
//If we get back an error (not found, etc...), handle it here
virtual void error(U32 status, const std::string& reason);
protected:
- LLViewHandle mClassifiedPanelHandle;
+ LLHandle<LLView> mClassifiedPanelHandle;
LLUUID mClassifiedID;
};
diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp
index b814f0d63f..b2b29ffc9f 100644
--- a/indra/newview/llcolorswatch.cpp
+++ b/indra/newview/llcolorswatch.cpp
@@ -61,14 +61,14 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect
mOnSelectCallback(NULL)
{
mCaption = new LLTextBox( name,
- LLRect( 0, BTN_HEIGHT_SMALL, mRect.getWidth(), 0 ),
- LLString::null,
+ LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ),
+ name,
LLFontGL::sSansSerifSmall );
mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM );
addChild( mCaption );
// Scalable UI made this off-by-one, I don't know why. JC
- LLRect border_rect(0, mRect.getHeight()-1, mRect.getWidth()-1, 0);
+ LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0);
border_rect.mBottom += BTN_HEIGHT_SMALL;
mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN);
addChild(mBorder);
@@ -89,14 +89,14 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect
mOnSelectCallback(NULL)
{
mCaption = new LLTextBox( label,
- LLRect( 0, BTN_HEIGHT_SMALL, mRect.getWidth(), 0 ),
- LLString::null,
+ LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ),
+ label,
LLFontGL::sSansSerifSmall );
mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM );
addChild( mCaption );
// Scalable UI made this off-by-one, I don't know why. JC
- LLRect border_rect(0, mRect.getHeight()-1, mRect.getWidth()-1, 0);
+ LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0);
border_rect.mBottom += BTN_HEIGHT_SMALL;
mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN);
addChild(mBorder);
@@ -108,7 +108,7 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect
LLColorSwatchCtrl::~LLColorSwatchCtrl ()
{
// parent dialog is destroyed so we are too and we need to cancel selection
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle);
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
if (pickerp)
{
pickerp->cancelSelection();
@@ -130,7 +130,7 @@ BOOL LLColorSwatchCtrl::handleHover(S32 x, S32 y, MASK mask)
BOOL LLColorSwatchCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent)
{
- if( getVisible() && mEnabled && !called_from_parent && ' ' == uni_char )
+ if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char )
{
showPicker(TRUE);
}
@@ -141,7 +141,7 @@ BOOL LLColorSwatchCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from
void LLColorSwatchCtrl::setOriginal(const LLColor4& color)
{
mColor = color;
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle);
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
if (pickerp)
{
pickerp->setOrigRgb(mColor.mV[VRED], mColor.mV[VGREEN], mColor.mV[VBLUE]);
@@ -151,7 +151,7 @@ void LLColorSwatchCtrl::setOriginal(const LLColor4& color)
void LLColorSwatchCtrl::set(const LLColor4& color, BOOL update_picker, BOOL from_event)
{
mColor = color;
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle);
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
if (pickerp && update_picker)
{
pickerp->setCurRgb(mColor.mV[VRED], mColor.mV[VGREEN], mColor.mV[VBLUE]);
@@ -188,7 +188,7 @@ BOOL LLColorSwatchCtrl::handleMouseUp(S32 x, S32 y, MASK mask)
// If mouseup in the widget, it's been clicked
if ( pointInView(x, y) )
{
- llassert(mEnabled);
+ llassert(getEnabled());
llassert(getVisible());
showPicker(FALSE);
@@ -206,7 +206,7 @@ void LLColorSwatchCtrl::draw()
{
mBorder->setKeyboardFocusHighlight(hasFocus());
// Draw border
- LLRect border( 0, mRect.getHeight(), mRect.getWidth(), BTN_HEIGHT_SMALL );
+ LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL );
gl_rect_2d( border, mBorderColor, FALSE );
LLRect interior = border;
@@ -253,7 +253,7 @@ void LLColorSwatchCtrl::setEnabled( BOOL enabled )
if (!enabled)
{
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle);
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
if (pickerp)
{
pickerp->cancelSelection();
@@ -275,7 +275,7 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
LLColorSwatchCtrl* subject = ( LLColorSwatchCtrl* )data;
if ( subject )
{
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(subject->mPickerHandle);
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)subject->mPickerHandle.get();
if (pickerp)
{
// move color across from selector to internal widget storage
@@ -300,14 +300,14 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
subject->onCommit ();
}
}
- };
+ }
}
void LLColorSwatchCtrl::setValid(BOOL valid )
{
mValid = valid;
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle);
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
if (pickerp)
{
pickerp->setActive(valid);
@@ -316,7 +316,7 @@ void LLColorSwatchCtrl::setValid(BOOL valid )
void LLColorSwatchCtrl::showPicker(BOOL take_focus)
{
- LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)LLFloater::getFloaterByHandle(mPickerHandle);
+ LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
if (!pickerp)
{
pickerp = new LLFloaterColorPicker(this, mCanApplyImmediately);
@@ -324,7 +324,7 @@ void LLColorSwatchCtrl::showPicker(BOOL take_focus)
mPickerHandle = pickerp->getHandle();
}
- // initialize picker singleton with current color
+ // initialize picker with current color
pickerp->initUI ( mColor.mV [ VRED ], mColor.mV [ VGREEN ], mColor.mV [ VBLUE ] );
// display it
diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h
index 05b2dc434c..cc9b9ad017 100644
--- a/indra/newview/llcolorswatch.h
+++ b/indra/newview/llcolorswatch.h
@@ -98,7 +98,7 @@ protected:
LLColor4 mColor;
LLColor4 mBorderColor;
LLTextBox* mCaption;
- LLViewHandle mPickerHandle;
+ LLHandle<LLFloater> mPickerHandle;
LLViewBorder* mBorder;
BOOL mCanApplyImmediately;
LLUICtrlCallback mOnCancelCallback;
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index ee9177c18d..654c33bb93 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -286,7 +286,7 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)
S32 LLFastTimerView::getLegendIndex(S32 y)
{
- S32 idx = (mRect.getHeight() - y) / ((S32) LLFontGL::sMonospace->getLineHeight()+2) - 5;
+ S32 idx = (getRect().getHeight() - y) / ((S32) LLFontGL::sMonospace->getLineHeight()+2) - 5;
if (idx >= 0 && idx < FTV_DISPLAY_NUM)
{
return ft_display_idx[idx];
@@ -415,7 +415,8 @@ void LLFastTimerView::draw()
S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f);
S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f);
- mRect.setLeftTopAndSize(mRect.mLeft, mRect.mTop, width, height);
+ // HACK: casting away const. Should use setRect or some helper function instead.
+ const_cast<LLRect&>(getRect()).setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height);
S32 left, top, right, bottom;
S32 x, y, barw, barh, dx, dy;
@@ -461,7 +462,7 @@ void LLFastTimerView::draw()
// Draw the window background
{
LLGLSNoTexture gls_ui_no_texture;
- gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f));
+ gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f));
}
S32 xleft = margin;
@@ -642,7 +643,7 @@ void LLFastTimerView::draw()
// update rectangle that includes timer bars
mBarRect.mLeft = xleft;
- mBarRect.mRight = mRect.mRight - xleft;
+ mBarRect.mRight = getRect().mRight - xleft;
mBarRect.mTop = ytop - ((S32)LLFontGL::sMonospace->getLineHeight() + 4);
mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT;
@@ -760,29 +761,29 @@ void LLFastTimerView::draw()
y -= ((S32)LLFontGL::sMonospace->getLineHeight() + 4);
//heading
- gl_rect_2d(xleft-5, by, mRect.getWidth()-5, y+5, FALSE);
+ gl_rect_2d(xleft-5, by, getRect().getWidth()-5, y+5, FALSE);
//tree view
gl_rect_2d(5, by, xleft-10, 5, FALSE);
by = y + 5;
//average bar
- gl_rect_2d(xleft-5, by, mRect.getWidth()-5, by-barh-dy-5, FALSE);
+ gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-5, FALSE);
by -= barh*2+dy;
//current frame bar
- gl_rect_2d(xleft-5, by, mRect.getWidth()-5, by-barh-dy-2, FALSE);
+ gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-2, FALSE);
by -= barh+dy+1;
//history bars
- gl_rect_2d(xleft-5, by, mRect.getWidth()-5, LINE_GRAPH_HEIGHT-barh-dy-2, FALSE);
+ gl_rect_2d(xleft-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-barh-dy-2, FALSE);
by = LINE_GRAPH_HEIGHT-barh-dy-7;
//line graph
- graph_rect = LLRect(xleft-5, by, mRect.getWidth()-5, 5);
+ graph_rect = LLRect(xleft-5, by, getRect().getWidth()-5, 5);
gl_rect_2d(graph_rect, FALSE);
}
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index c73b3315cc..5fd0c4ca06 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -216,6 +216,8 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter)
mCurrentFile = mFiles;
LLString tstr = utf16str_to_utf8str(llutf16string(mFilesW));
memcpy(mFiles, tstr.c_str(), tstr.size()+1); /*Flawfinder: ignore*/
+
+ mCurrentFile = &mFiles[mOFN.nFileOffset];
}
else
{
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 7da2ac79b1..4edf6f3652 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -93,7 +93,7 @@ LLFloaterAbout::LLFloaterAbout()
if (region)
{
const LLVector3d &pos = gAgent.getPositionGlobal();
- LLUIString pos_text = childGetText("you_are_at");
+ LLUIString pos_text = getUIString("you_are_at");
pos_text.setArg("[POSITION]",
llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]));
support.append(pos_text);
@@ -177,7 +177,7 @@ LLFloaterAbout::LLFloaterAbout()
// Fix views
childDisable("credits_editor");
- LLTextEditor * support_widget = (LLTextEditor *) getChildByName("support_editor", true);
+ LLTextEditor * support_widget = getChild<LLTextEditor>("support_editor", true);
if (support_widget)
{
support_widget->setEnabled( FALSE );
diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp
index 18c3983b9a..2eddb45f23 100644
--- a/indra/newview/llfloateranimpreview.cpp
+++ b/indra/newview/llfloateranimpreview.cpp
@@ -280,7 +280,7 @@ BOOL LLFloaterAnimPreview::postBuild()
childSetValue("hand_pose_combo", LLHandMotion::getHandPoseName(motionp->getHandPose()));
childSetValue("ease_in_time", LLSD(motionp->getEaseInDuration()));
childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration()));
- mEnabled = TRUE;
+ setEnabled(TRUE);
char seconds_string[128]; /*Flawfinder: ignore*/
snprintf(seconds_string, sizeof(seconds_string), " - %.2f seconds", motionp->getDuration()); /* Flawfinder: ignore */
@@ -291,8 +291,8 @@ BOOL LLFloaterAnimPreview::postBuild()
delete mAnimPreview;
mAnimPreview = NULL;
mMotionID.setNull();
- childSetValue("bad_animation_text", childGetText("failed_to_initialize"));
- mEnabled = FALSE;
+ childSetValue("bad_animation_text", getString("failed_to_initialize"));
+ setEnabled(FALSE);
}
}
else
@@ -301,20 +301,20 @@ BOOL LLFloaterAnimPreview::postBuild()
{
if (loaderp->getDuration() > MAX_ANIM_DURATION)
{
- LLUIString out_str = childGetText("anim_too_long");
+ LLUIString out_str = getString("anim_too_long");
out_str.setArg("[LENGTH]", llformat("%.1f", loaderp->getDuration()));
out_str.setArg("[MAX_LENGTH]", llformat("%.1f", MAX_ANIM_DURATION));
childSetValue("bad_animation_text", out_str.getString());
}
else
{
- LLUIString out_str = childGetText("failed_file_read");
+ LLUIString out_str = getString("failed_file_read");
out_str.setArg("[STATUS]", loaderp->getStatus()); // *TODO:Translate
childSetValue("bad_animation_text", out_str.getString());
}
}
- mEnabled = FALSE;
+ setEnabled(FALSE);
mMotionID.setNull();
mAnimPreview = NULL;
}
@@ -334,7 +334,7 @@ LLFloaterAnimPreview::~LLFloaterAnimPreview()
delete mAnimPreview;
mAnimPreview = NULL;
- mEnabled = FALSE;
+ setEnabled(FALSE);
}
//-----------------------------------------------------------------------------
@@ -507,7 +507,7 @@ void LLFloaterAnimPreview::onMouseCaptureLost()
void LLFloaterAnimPreview::onBtnPlay(void* user_data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
if (previewp->mMotionID.notNull() && previewp->mAnimPreview)
{
@@ -538,7 +538,7 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data)
void LLFloaterAnimPreview::onBtnStop(void* user_data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
if (previewp->mMotionID.notNull() && previewp->mAnimPreview)
{
@@ -563,7 +563,7 @@ void LLFloaterAnimPreview::onBtnStop(void* user_data)
void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
if (previewp->mAnimPreview)
{
@@ -609,7 +609,7 @@ void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
if (previewp->mAnimPreview)
{
@@ -639,7 +639,7 @@ void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -657,7 +657,7 @@ void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data)
void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -677,7 +677,7 @@ void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data)
void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -697,7 +697,7 @@ void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data)
void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -716,7 +716,7 @@ void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data)
void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -731,7 +731,7 @@ void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data)
void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -746,7 +746,7 @@ void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data)
void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -760,7 +760,7 @@ void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data)
void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -775,7 +775,7 @@ void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data)
void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return;
+ if (!previewp->getEnabled()) return;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -791,7 +791,7 @@ BOOL LLFloaterAnimPreview::validateEaseIn(LLUICtrl* spin, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return FALSE;
+ if (!previewp->getEnabled()) return FALSE;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -812,7 +812,7 @@ BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return FALSE;
+ if (!previewp->getEnabled()) return FALSE;
LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID);
@@ -833,7 +833,7 @@ BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return FALSE;
+ if (!previewp->getEnabled()) return FALSE;
F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal();
F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal();
@@ -862,7 +862,7 @@ BOOL LLFloaterAnimPreview::validateLoopOut(LLUICtrl* spin, void* data)
{
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
- if (!previewp->mEnabled) return FALSE;
+ if (!previewp->getEnabled()) return FALSE;
F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal();
F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal();
@@ -947,7 +947,7 @@ void LLFloaterAnimPreview::refresh()
void LLFloaterAnimPreview::onBtnOK(void* userdata)
{
LLFloaterAnimPreview* floaterp = (LLFloaterAnimPreview*)userdata;
- if (!floaterp->mEnabled) return;
+ if (!floaterp->getEnabled()) return;
if (floaterp->mAnimPreview)
{
@@ -1153,3 +1153,4 @@ void LLPreviewAnimation::pan(F32 right, F32 up)
}
+
diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp
index e044ead818..094cbb6c33 100644
--- a/indra/newview/llfloaterauction.cpp
+++ b/indra/newview/llfloaterauction.cpp
@@ -123,7 +123,7 @@ void LLFloaterAuction::initialize()
mParcelHost.invalidate();
if(parcelp && parcelp->getForSale())
{
- childSetText("parcel_text", childGetText("already for sale"));
+ childSetText("parcel_text", getString("already for sale"));
}
else
{
diff --git a/indra/newview/llfloaterauction.h b/indra/newview/llfloaterauction.h
index 135c9fa26b..10e08c14b1 100644
--- a/indra/newview/llfloaterauction.h
+++ b/indra/newview/llfloaterauction.h
@@ -69,7 +69,7 @@ private:
LLTransactionID mTransactionID;
LLAssetID mImageID;
LLPointer<LLImageGL> mImage;
- LLHandle<LLParcelSelection> mParcelp;
+ LLSafeHandle<LLParcelSelection> mParcelp;
S32 mParcelID;
LLHost mParcelHost;
};
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index 2cfcc47af3..a44b3b3755 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -347,8 +347,9 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
LLString avatar_name;
if (avatar_id.isNull())
{
- self->childSetTextArg("NotFound", "[TEXT]", self->childGetText("Edit"));
- avatar_name = self->childGetValue("NotFound").asString();
+ LLString::format_map_t map;
+ map["[TEXT]"] = self->childGetText("Edit");
+ avatar_name = self->getString("NotFound", map);
self->mListNames->setEnabled(FALSE);
}
else
diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp
index 64dc96807c..f05f9a7b52 100644
--- a/indra/newview/llfloateravatartextures.cpp
+++ b/indra/newview/llfloateravatartextures.cpp
@@ -67,26 +67,26 @@ LLFloaterAvatarTextures* LLFloaterAvatarTextures::show(const LLUUID &id)
BOOL LLFloaterAvatarTextures::postBuild()
{
- mBakedHead = (LLTextureCtrl*)getChildByName("baked_head");
- mBakedEyes = (LLTextureCtrl*)getChildByName("baked_eyes");
- mBakedUpper = (LLTextureCtrl*)getChildByName("baked_upper_body");
- mBakedLower = (LLTextureCtrl*)getChildByName("baked_lower_body");
- mBakedSkirt = (LLTextureCtrl*)getChildByName("baked_skirt");
- mHair = (LLTextureCtrl*)getChildByName("hair");
- mMakeup = (LLTextureCtrl*)getChildByName("head_bodypaint");
- mEye = (LLTextureCtrl*)getChildByName("eye_texture");
- mShirt = (LLTextureCtrl*)getChildByName("shirt");
- mUpperTattoo = (LLTextureCtrl*)getChildByName("upper_bodypaint");
- mUpperJacket = (LLTextureCtrl*)getChildByName("upper_jacket");
- mGloves = (LLTextureCtrl*)getChildByName("gloves");
- mUndershirt = (LLTextureCtrl*)getChildByName("undershirt");
- mPants = (LLTextureCtrl*)getChildByName("pants");
- mLowerTattoo = (LLTextureCtrl*)getChildByName("lower_bodypaint");
- mShoes = (LLTextureCtrl*)getChildByName("shoes");
- mSocks = (LLTextureCtrl*)getChildByName("socks");
- mJacket = (LLTextureCtrl*)getChildByName("jacket");
- mUnderpants = (LLTextureCtrl*)getChildByName("underpants");
- mSkirt = (LLTextureCtrl*)getChildByName("skirt_texture");
+ mBakedHead = getChild<LLTextureCtrl>("baked_head");
+ mBakedEyes = getChild<LLTextureCtrl>("baked_eyes");
+ mBakedUpper = getChild<LLTextureCtrl>("baked_upper_body");
+ mBakedLower = getChild<LLTextureCtrl>("baked_lower_body");
+ mBakedSkirt = getChild<LLTextureCtrl>("baked_skirt");
+ mHair = getChild<LLTextureCtrl>("hair");
+ mMakeup = getChild<LLTextureCtrl>("head_bodypaint");
+ mEye = getChild<LLTextureCtrl>("eye_texture");
+ mShirt = getChild<LLTextureCtrl>("shirt");
+ mUpperTattoo = getChild<LLTextureCtrl>("upper_bodypaint");
+ mUpperJacket = getChild<LLTextureCtrl>("upper_jacket");
+ mGloves = getChild<LLTextureCtrl>("gloves");
+ mUndershirt = getChild<LLTextureCtrl>("undershirt");
+ mPants = getChild<LLTextureCtrl>("pants");
+ mLowerTattoo = getChild<LLTextureCtrl>("lower_bodypaint");
+ mShoes = getChild<LLTextureCtrl>("shoes");
+ mSocks = getChild<LLTextureCtrl>("socks");
+ mJacket = getChild<LLTextureCtrl>("jacket");
+ mUnderpants = getChild<LLTextureCtrl>("underpants");
+ mSkirt = getChild<LLTextureCtrl>("skirt_texture");
mTitle = getTitle();
childSetAction("Dump", onClickDump, this);
@@ -142,16 +142,10 @@ void LLFloaterAvatarTextures::refresh()
LLVOAvatar *avatarp = find_avatar(mID);
if (avatarp)
{
- char firstname[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char lastname[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- if (gCacheName->getName(avatarp->getID(), firstname, lastname))
+ std::string fullname;
+ if (gCacheName->getFullName(avatarp->getID(), fullname))
{
- LLString name;
- name.assign( firstname );
- name.append( " " );
- name.append( lastname );
-
- setTitle(mTitle + ": " + name);
+ setTitle(mTitle + ": " + fullname);
}
update_texture_ctrl(avatarp, mBakedHead, LLVOAvatar::TEX_HEAD_BAKED);
update_texture_ctrl(avatarp, mBakedEyes, LLVOAvatar::TEX_EYES_BAKED);
diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp
index abae92a854..3f6ed92868 100644
--- a/indra/newview/llfloaterbump.cpp
+++ b/indra/newview/llfloaterbump.cpp
@@ -85,7 +85,7 @@ void LLFloaterBump::show(void *contents)
if (gMeanCollisionList.isEmpty())
{
- LLString none_detected = sInstance->childGetText("none_detected");
+ LLString none_detected = sInstance->getString("none_detected");
LLSD row;
row["columns"][0]["value"] = none_detected;
row["columns"][0]["font"] = "SansSerifBold";
@@ -151,7 +151,7 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd)
}
// All above action strings are in XML file
- LLUIString text = sInstance->childGetText(action);
+ LLUIString text = sInstance->getUIString(action);
text.setArg("[TIME]", time);
text.setArg("[FIRST]", mcd->mFirstName);
text.setArg("[LAST]", mcd->mLastName);
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index 707ec0e852..5ce5d8616b 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -121,11 +121,11 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
switch (sale_info.getSaleType())
{
case LLSaleInfo::FS_ORIGINAL:
- title = sInstance->childGetText("title_buy_text");
+ title = sInstance->getString("title_buy_text");
break;
case LLSaleInfo::FS_COPY:
default:
- title = sInstance->childGetText("title_buy_copy_text");
+ title = sInstance->getString("title_buy_copy_text");
break;
}
title.setArg("[NAME]", node->mName);
@@ -165,15 +165,15 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
LLString text = node->mName;
if (!(next_owner_mask & PERM_COPY))
{
- text.append(sInstance->childGetText("no_copy_text"));
+ text.append(sInstance->getString("no_copy_text"));
}
if (!(next_owner_mask & PERM_MODIFY))
{
- text.append(sInstance->childGetText("no_modify_text"));
+ text.append(sInstance->getString("no_modify_text"));
}
if (!(next_owner_mask & PERM_TRANSFER))
{
- text.append(sInstance->childGetText("no_transfer_text"));
+ text.append(sInstance->getString("no_transfer_text"));
}
row["columns"][1]["column"] = "text";
diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h
index cdf79da954..7f18a894e7 100644
--- a/indra/newview/llfloaterbuy.h
+++ b/indra/newview/llfloaterbuy.h
@@ -71,7 +71,7 @@ protected:
private:
static LLFloaterBuy* sInstance;
- LLHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
LLSaleInfo mSaleInfo;
};
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index 38266797cf..b133a1e88b 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -124,9 +124,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
if (!node) return;
if(node->mPermissions->isGroupOwned())
{
- char group_name[MAX_STRING]; /*Flawfinder: ignore*/
- gCacheName->getGroupName(owner_id, group_name);
- owner_name.assign(group_name);
+ gCacheName->getGroupName(owner_id, owner_name);
}
sInstance->childSetTextArg("contains_text", "[NAME]", node->mName);
@@ -240,15 +238,15 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
if (!(next_owner_mask & PERM_COPY))
{
- text.append(childGetText("no_copy_text"));
+ text.append(getString("no_copy_text"));
}
if (!(next_owner_mask & PERM_MODIFY))
{
- text.append(childGetText("no_modify_text"));
+ text.append(getString("no_modify_text"));
}
if (!(next_owner_mask & PERM_TRANSFER))
{
- text.append(childGetText("no_transfer_text"));
+ text.append(getString("no_transfer_text"));
}
row["columns"][1]["column"] = "text";
diff --git a/indra/newview/llfloaterbuycontents.h b/indra/newview/llfloaterbuycontents.h
index 8231174579..6b08bb4ad7 100644
--- a/indra/newview/llfloaterbuycontents.h
+++ b/indra/newview/llfloaterbuycontents.h
@@ -67,7 +67,7 @@ protected:
protected:
static LLFloaterBuyContents* sInstance;
- LLHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
LLSaleInfo mSaleInfo;
};
diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp
index 4b5bb3548b..8866ad7ed1 100644
--- a/indra/newview/llfloaterbuycurrency.cpp
+++ b/indra/newview/llfloaterbuycurrency.cpp
@@ -316,7 +316,7 @@ void LLFloaterBuyCurrencyUI::onClickBuy(void* data)
LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false);
if (self)
{
- self->mManager.buy(self->childGetText("buy_currency"));
+ self->mManager.buy(self->getString("buy_currency"));
self->updateUI();
// JC: updateUI() doesn't get called again until progress is made
// with transaction processing, so the "Purchase" button would be
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 12722b6d95..52736c8c60 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -390,13 +390,13 @@ void LLFloaterBuyLandUI::updateParcelInfo()
if (!mParcelValid)
{
- mCannotBuyReason= childGetText("no_land_selected");
+ mCannotBuyReason = getString("no_land_selected");
return;
}
if (mParcel->getMultipleOwners())
{
- mCannotBuyReason = childGetText("multiple_parcels_selected");
+ mCannotBuyReason = getString("multiple_parcels_selected");
return;
}
@@ -454,13 +454,13 @@ void LLFloaterBuyLandUI::updateParcelInfo()
bool haveEnoughCash = mParcelPrice <= mAgentCashBalance;
S32 cashBuy = haveEnoughCash ? 0 : (mParcelPrice - mAgentCashBalance);
mCurrency.setAmount(cashBuy, true);
- mCurrency.setZeroMessage(haveEnoughCash ? childGetText("none_needed") : "");
+ mCurrency.setZeroMessage(haveEnoughCash ? getString("none_needed") : "");
// checks that we can buy the land
if(mIsForGroup && !gAgent.hasPowerInActiveGroup(GP_LAND_DEED))
{
- mCannotBuyReason = childGetText("cant_buy_for_group");
+ mCannotBuyReason = getString("cant_buy_for_group");
return;
}
@@ -474,7 +474,7 @@ void LLFloaterBuyLandUI::updateParcelInfo()
|| (mParcelPrice == 0 && authorizedBuyer.isNull()))
{
- mCannotBuyReason = childGetText("parcel_not_for_sale");
+ mCannotBuyReason = getString("parcel_not_for_sale");
return;
}
@@ -482,18 +482,18 @@ void LLFloaterBuyLandUI::updateParcelInfo()
{
if (mIsForGroup)
{
- mCannotBuyReason = childGetText("group_already_owns");
+ mCannotBuyReason = getString("group_already_owns");
}
else
{
- mCannotBuyReason = childGetText("you_already_own");
+ mCannotBuyReason = getString("you_already_own");
}
return;
}
if (!authorizedBuyer.isNull() && buyer != authorizedBuyer)
{
- mCannotBuyReason = childGetText("set_to_sell_to_other");
+ mCannotBuyReason = getString("set_to_sell_to_other");
return;
}
}
@@ -501,14 +501,14 @@ void LLFloaterBuyLandUI::updateParcelInfo()
{
if (mParcelActualArea == 0)
{
- mCannotBuyReason = childGetText("no_public_land");
+ mCannotBuyReason = getString("no_public_land");
return;
}
if (mParcel->hasOthersSelected())
{
// Policy: Must not have someone else's land selected
- mCannotBuyReason = childGetText("not_owned_by_you");
+ mCannotBuyReason = getString("not_owned_by_you");
return;
}
}
@@ -521,39 +521,39 @@ void LLFloaterBuyLandUI::updateCovenantInfo()
LLViewerRegion* region = gParcelMgr->getSelectionRegion();
if(!region) return;
- LLTextBox* region_name = (LLTextBox*)getChildByName("region_name_text");
+ LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
if (region_name)
{
region_name->setText(region->getName());
}
- LLTextBox* resellable_clause = (LLTextBox*)getChildByName("resellable_clause");
+ LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
if (resellable_clause)
{
if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
{
- resellable_clause->setText(childGetText("can_not_resell"));
+ resellable_clause->setText(getString("can_not_resell"));
}
else
{
- resellable_clause->setText(childGetText("can_resell"));
+ resellable_clause->setText(getString("can_resell"));
}
}
- LLTextBox* changeable_clause = (LLTextBox*)getChildByName("changeable_clause");
+ LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
if (changeable_clause)
{
if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
{
- changeable_clause->setText(childGetText("can_change"));
+ changeable_clause->setText(getString("can_change"));
}
else
{
- changeable_clause->setText(childGetText("can_not_change"));
+ changeable_clause->setText(getString("can_not_change"));
}
}
- LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)getChildByName("agree_covenant");
+ LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
if(check)
{
check->set(false);
@@ -562,7 +562,7 @@ void LLFloaterBuyLandUI::updateCovenantInfo()
check->setCommitCallback(onChangeAgreeCovenant);
}
- LLTextBox* box = (LLTextBox*)getChildByName("covenant_text");
+ LLTextBox* box = getChild<LLTextBox>("covenant_text");
if(box)
{
box->setVisible(FALSE);
@@ -589,14 +589,14 @@ void LLFloaterBuyLandUI::onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data)
void LLFloaterBuyLandUI::updateCovenantText(const std::string &string, const LLUUID& asset_id)
{
- LLViewerTextEditor* editor = (LLViewerTextEditor*)getChildByName("covenant_editor");
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor");
if (editor)
{
editor->setHandleEditKeysDirectly(FALSE);
editor->setText(string);
- LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)getChildByName("agree_covenant");
- LLTextBox* box = (LLTextBox*)getChildByName("covenant_text");
+ LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
+ LLTextBox* box = getChild<LLTextBox>("covenant_text");
if(check && box)
{
if (asset_id.isNull())
@@ -621,19 +621,19 @@ void LLFloaterBuyLandUI::updateCovenantText(const std::string &string, const LLU
void LLFloaterBuyLandUI::updateEstateName(const std::string& name)
{
- LLTextBox* box = (LLTextBox*)getChildByName("estate_name_text");
+ LLTextBox* box = getChild<LLTextBox>("estate_name_text");
if (box) box->setText(name);
}
void LLFloaterBuyLandUI::updateLastModified(const std::string& text)
{
- LLTextBox* editor = (LLTextBox*)getChildByName("covenant_timestamp_text");
+ LLTextBox* editor = getChild<LLTextBox>("covenant_timestamp_text");
if (editor) editor->setText(text);
}
void LLFloaterBuyLandUI::updateEstateOwnerName(const std::string& name)
{
- LLTextBox* box = (LLTextBox*)getChildByName("estate_owner_text");
+ LLTextBox* box = getChild<LLTextBox>("estate_owner_text");
if (box) box->setText(name);
}
@@ -819,18 +819,11 @@ void LLFloaterBuyLandUI::updateNames()
}
else if (parcelp->getIsGroupOwned())
{
- char groupName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
-
- gCacheName->getGroupName(parcelp->getGroupID(), &groupName[0]);
- mParcelSellerName = groupName;
+ gCacheName->getGroupName(parcelp->getGroupID(), mParcelSellerName);
}
else
{
- char firstName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char lastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
-
- gCacheName->getName(parcelp->getOwnerID(), firstName, lastName);
- mParcelSellerName = llformat("%s %s", firstName, lastName);
+ gCacheName->getFullName(parcelp->getOwnerID(), mParcelSellerName);
}
}
@@ -908,7 +901,7 @@ void LLFloaterBuyLandUI::tellUserError(
{
mCanBuy = false;
mCannotBuyIsError = true;
- mCannotBuyReason = childGetText("fetching_error");
+ mCannotBuyReason = getString("fetching_error");
mCannotBuyReason += message;
mCannotBuyURI = uri;
}
@@ -998,17 +991,15 @@ void LLFloaterBuyLandUI::refreshUI()
mParcelValid ? mParcelSnapshot : LLUUID::null);
}
-
-
if (mParcelValid)
{
childSetText("info_parcel", mParcelLocation);
-
- childSetTextArg("meters_supports_object", "[AMOUNT]", llformat("%d", mParcelActualArea));
- childSetTextArg("meters_supports_object", "[AMOUNT2]", llformat("%d", mParcelSupportedObjects));
-
- childSetText("info_size", childGetText("meters_supports_object"));
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea);
+ string_args["[AMOUNT2]"] = llformat("%d", mParcelSupportedObjects);
+
+ childSetText("info_size", getString("meters_supports_object", string_args));
childSetText("info_price",
@@ -1022,7 +1013,7 @@ void LLFloaterBuyLandUI::refreshUI()
}
else
{
- childSetText("info_parcel", childGetText("no_parcel_selected"));
+ childSetText("info_parcel", getString("no_parcel_selected"));
childSetText("info_size", LLString::null);
childSetText("info_price", LLString::null);
}
@@ -1031,12 +1022,12 @@ void LLFloaterBuyLandUI::refreshUI()
mCanBuy
?
mIsForGroup
- ? childGetText("buying_for_group")//"Buying land for group:"
- : childGetText("buying_will")//"Buying this land will:"
+ ? getString("buying_for_group")//"Buying land for group:"
+ : getString("buying_will")//"Buying this land will:"
:
mCannotBuyIsError
- ? childGetText("cannot_buy_now")//"Cannot buy now:"
- : childGetText("not_for_sale")//"Not for sale:"
+ ? getString("cannot_buy_now")//"Cannot buy now:"
+ : getString("not_for_sale")//"Not for sale:"
);
}
@@ -1081,8 +1072,8 @@ void LLFloaterBuyLandUI::refreshUI()
childSetText("account_action", mSiteMembershipAction);
childSetText("account_reason",
mSiteMembershipUpgrade
- ? childGetText("must_upgrade")
- : childGetText("cant_own_land")
+ ? getString("must_upgrade")
+ : getString("cant_own_land")
);
LLComboBox* levels = LLUICtrlFactory::getComboBoxByName(this, "account_level");
@@ -1127,18 +1118,17 @@ void LLFloaterBuyLandUI::refreshUI()
if (mIsForGroup)
{
- childSetTextArg("insufficient_land_credits", "[GROUP]", LLString(gAgent.mGroupName));
+ LLString::format_map_t string_args;
+ string_args["[GROUP]"] = LLString(gAgent.mGroupName);
-
- message += childGetText("insufficient_land_credits");
+ message += getString("insufficient_land_credits", string_args);
}
else
{
-
- childSetTextArg("land_holdings", "[BUYER]", llformat("%d", mAgentCommittedTier));
- message += childGetText("land_holdings");
-
+ LLString::format_map_t string_args;
+ string_args["[BUYER]"] = llformat("%d", mAgentCommittedTier);
+ message += getString("land_holdings", string_args);
}
if (!mParcelValid)
@@ -1147,21 +1137,24 @@ void LLFloaterBuyLandUI::refreshUI()
}
else if (mParcelBillableArea == mParcelActualArea)
{
- childSetTextArg("parcel_meters", "[AMOUNT]", llformat("%d", mParcelActualArea));
- message += childGetText("parcel_meters");
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea);
+ message += getString("parcel_meters", string_args);
}
else
{
if (mParcelBillableArea > mParcelActualArea)
{
- childSetTextArg("premium_land", "[AMOUNT]", llformat("%d", mParcelBillableArea) );
- message += childGetText("premium_land");
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelBillableArea);
+ message += getString("premium_land", string_args);
}
else
{
- childSetTextArg("discounted_land", "[AMOUNT]", llformat("%d", mParcelBillableArea) );
- message += childGetText("discounted_land");
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelBillableArea);
+ message += getString("discounted_land", string_args);
}
}
@@ -1208,35 +1201,36 @@ void LLFloaterBuyLandUI::refreshUI()
if (haveEnough)
{
-
- childSetTextArg("have_enough_lindens", "[AMOUNT]", llformat("%d", mAgentCashBalance));
- childSetText("currency_reason", childGetText("have_enough_lindens"));
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);
+
+ childSetText("currency_reason", getString("have_enough_lindens", string_args));
}
else
{
- childSetTextArg("not_enough_lindens", "[AMOUNT]", llformat("%d", mAgentCashBalance));
- childSetTextArg("not_enough_lindens", "[AMOUNT2]", llformat("%d", mParcelPrice - mAgentCashBalance));
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);
+ string_args["[AMOUNT2]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
- childSetText("currency_reason", childGetText("not_enough_lindens"));
+ childSetText("currency_reason", getString("not_enough_lindens", string_args));
childSetTextArg("currency_est", "[AMOUNT2]", llformat("%#.2f", mCurrency.getEstimate() / 100.0));
-
}
if (willHaveEnough)
{
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", finalBalance);
- childSetTextArg("balance_left", "[AMOUNT]", llformat("%d", finalBalance));
-
- childSetText("currency_balance", childGetText("balance_left"));
+ childSetText("currency_balance", getString("balance_left", string_args));
}
else
{
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
- childSetTextArg("balance_needed", "[AMOUNT]", llformat("%d", mParcelPrice - mAgentCashBalance));
-
- childSetText("currency_balance", childGetText("balance_needed"));
+ childSetText("currency_balance", getString("balance_needed", string_args));
}
@@ -1264,7 +1258,7 @@ void LLFloaterBuyLandUI::refreshUI()
bool agrees_to_covenant = false;
- LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)getChildByName("agree_covenant");
+ LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
if (check)
{
agrees_to_covenant = check->get();
@@ -1298,17 +1292,17 @@ void LLFloaterBuyLandUI::startBuyPreConfirm()
}
if (mCurrency.getAmount() > 0)
{
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mCurrency.getAmount());
+ string_args["[AMOUNT2]"] = llformat("%#.2f", mCurrency.getEstimate() / 100.0);
- childSetTextArg("buy_for_US", "[AMOUNT]", llformat("%d", mCurrency.getAmount()));
- childSetTextArg("buy_for_US", "[AMOUNT2]", llformat("%#.2f", mCurrency.getEstimate() / 100.0));
-
- action += childGetText("buy_for_US");
+ action += getString("buy_for_US", string_args);
}
- childSetTextArg("pay_to_for_land", "[AMOUNT]", llformat("%d", mParcelPrice));
- childSetTextArg("pay_to_for_land", "[SELLER]", mParcelSellerName);
-
- action += childGetText("pay_to_for_land");
+ LLString::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", mParcelPrice);
+ string_args["[SELLER]"] = mParcelSellerName;
+ action += getString("pay_to_for_land", string_args);
LLConfirmationManager::confirm(mSiteConfirm,
@@ -1322,7 +1316,7 @@ void LLFloaterBuyLandUI::startBuyPostConfirm(const std::string& password)
runWebSitePrep(password);
mCanBuy = false;
- mCannotBuyReason = childGetText("processing");
+ mCannotBuyReason = getString("processing");
refreshUI();
}
diff --git a/indra/newview/llfloaterbuyland.h b/indra/newview/llfloaterbuyland.h
index dd7cb393ca..19ad83bb27 100644
--- a/indra/newview/llfloaterbuyland.h
+++ b/indra/newview/llfloaterbuyland.h
@@ -40,7 +40,7 @@ class LLFloaterBuyLand
{
public:
static void buyLand(LLViewerRegion* region,
- LLHandle<LLParcelSelection> parcel,
+ LLSafeHandle<LLParcelSelection> parcel,
bool is_for_group);
static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
static void updateEstateName(const std::string& name);
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
index 82fe16172b..851d81f349 100644
--- a/indra/newview/llfloaterchat.cpp
+++ b/indra/newview/llfloaterchat.cpp
@@ -128,7 +128,7 @@ void LLFloaterChat::draw()
childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel"));
- LLChatBar* chat_barp = (LLChatBar*)getChildByName("chat_panel", TRUE);
+ LLChatBar* chat_barp = getChild<LLChatBar>("chat_panel", TRUE);
if (chat_barp)
{
chat_barp->refresh();
@@ -142,7 +142,7 @@ BOOL LLFloaterChat::postBuild()
{
mPanel = (LLPanelActiveSpeakers*)LLUICtrlFactory::getPanelByName(this, "active_speakers_panel");
- LLChatBar* chat_barp = (LLChatBar*)getChildByName("chat_panel", TRUE);
+ LLChatBar* chat_barp = getChild<LLChatBar>("chat_panel", TRUE);
if (chat_barp)
{
chat_barp->setGestureCombo(LLUICtrlFactory::getComboBoxByName(this, "Gesture"));
@@ -221,8 +221,8 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file)
// could flash the chat button in the status bar here. JC
LLFloaterChat* chat_floater = LLFloaterChat::getInstance(LLSD());
- LLViewerTextEditor* history_editor = (LLViewerTextEditor*)chat_floater->getChildByName("Chat History Editor", TRUE);
- LLViewerTextEditor* history_editor_with_mute = (LLViewerTextEditor*)chat_floater->getChildByName("Chat History Editor with mute", TRUE);
+ LLViewerTextEditor* history_editor = chat_floater->getChild<LLViewerTextEditor>("Chat History Editor");
+ LLViewerTextEditor* history_editor_with_mute = chat_floater->getChild<LLViewerTextEditor>("Chat History Editor with mute");
history_editor->setParseHTML(TRUE);
history_editor_with_mute->setParseHTML(TRUE);
@@ -255,8 +255,8 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file)
// static
void LLFloaterChat::setHistoryCursorAndScrollToEnd()
{
- LLViewerTextEditor* history_editor = (LLViewerTextEditor*)LLFloaterChat::getInstance(LLSD())->getChildByName("Chat History Editor", TRUE);
- LLViewerTextEditor* history_editor_with_mute = (LLViewerTextEditor*)LLFloaterChat::getInstance(LLSD())->getChildByName("Chat History Editor with mute", TRUE);
+ LLViewerTextEditor* history_editor = LLFloaterChat::getInstance(LLSD())->getChild<LLViewerTextEditor>("Chat History Editor");
+ LLViewerTextEditor* history_editor_with_mute = LLFloaterChat::getInstance(LLSD())->getChild<LLViewerTextEditor>("Chat History Editor with mute");
if (history_editor)
{
@@ -299,8 +299,8 @@ void LLFloaterChat::onClickToggleShowMute(LLUICtrl* caller, void *data)
//LLCheckBoxCtrl*
BOOL show_mute = LLUICtrlFactory::getCheckBoxByName(floater,"show mutes")->get();
- LLViewerTextEditor* history_editor = (LLViewerTextEditor*)floater->getChildByName("Chat History Editor", TRUE);
- LLViewerTextEditor* history_editor_with_mute = (LLViewerTextEditor*)floater->getChildByName("Chat History Editor with mute", TRUE);
+ LLViewerTextEditor* history_editor = floater->getChild<LLViewerTextEditor>("Chat History Editor");
+ LLViewerTextEditor* history_editor_with_mute = floater->getChild<LLViewerTextEditor>("Chat History Editor with mute");
if (!history_editor || !history_editor_with_mute)
return;
@@ -455,26 +455,35 @@ void* LLFloaterChat::createChatPanel(void* data)
return chatp;
}
+// static
+void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata)
+{
+ LLFloaterChat* self = (LLFloaterChat*)userdata;
+
+ self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel"));
+}
+
+//static
+bool LLFloaterChat::visible(LLFloater* instance, const LLSD& key)
+{
+ return VisibilityPolicy<LLFloater>::visible(instance, key);
+}
+
//static
-void LLFloaterChat::hideInstance(const LLSD& id)
+void LLFloaterChat::show(LLFloater* instance, const LLSD& key)
{
- LLFloaterChat* floaterp = LLFloaterChat::getInstance(LLSD());
+ VisibilityPolicy<LLFloater>::show(instance, key);
+}
- if(floaterp->getHost())
+//static
+void LLFloaterChat::hide(LLFloater* instance, const LLSD& key)
+{
+ if(instance->getHost())
{
- LLFloaterChatterBox::hideInstance(LLSD());
+ LLFloaterChatterBox::hideInstance();
}
else
{
- LLUISingleton<LLFloaterChat>::hideInstance(id);
+ VisibilityPolicy<LLFloater>::hide(instance, key);
}
}
-
-// static
-void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata)
-{
- LLFloaterChat* self = (LLFloaterChat*)userdata;
-
- self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel"));
-}
-
diff --git a/indra/newview/llfloaterchat.h b/indra/newview/llfloaterchat.h
index 58fa607b38..c8ce7c0b55 100644
--- a/indra/newview/llfloaterchat.h
+++ b/indra/newview/llfloaterchat.h
@@ -50,7 +50,7 @@ class LLCheckBoxCtrl;
class LLPanelActiveSpeakers;
class LLFloaterChat
-: public LLFloater, public LLUISingleton<LLFloaterChat>
+ : public LLFloater, public LLUISingleton<LLFloaterChat, LLFloaterChat>
{
public:
LLFloaterChat(const LLSD& seed);
@@ -78,9 +78,12 @@ public:
static void loadHistory();
static void* createSpeakersPanel(void* data);
static void* createChatPanel(void* data);
- static void hideInstance(const LLSD& id);
-protected:
+ // visibility policy for LLUISingleton
+ static bool visible(LLFloater* instance, const LLSD& key);
+ static void show(LLFloater* instance, const LLSD& key);
+ static void hide(LLFloater* instance, const LLSD& key);
+
LLPanelActiveSpeakers* mPanel;
BOOL mScrolledToEnd;
};
diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp
index 85bc8182a5..f18c31baf9 100644
--- a/indra/newview/llfloaterchatterbox.cpp
+++ b/indra/newview/llfloaterchatterbox.cpp
@@ -73,42 +73,6 @@ void LLFloaterMyFriends::onClose(bool app_quitting)
setVisible(FALSE);
}
-//static
-LLFloaterMyFriends* LLFloaterMyFriends::showInstance(const LLSD& id)
-{
- LLFloaterMyFriends* floaterp = LLUIInstanceMgr<LLFloaterMyFriends>::showInstance(id);
- // garbage values in id will be interpreted as 0, or the friends tab
- floaterp->mTabs->selectTab(id);
-
- return floaterp;
-}
-
-//static
-void LLFloaterMyFriends::hideInstance(const LLSD& id)
-{
- LLFloaterMyFriends* floaterp = LLFloaterMyFriends::getInstance();
-
- if(floaterp->getHost())
- {
- LLFloaterChatterBox::hideInstance();
- }
- else
- {
- LLUISingleton<LLFloaterMyFriends>::hideInstance(id);
- }
-}
-
-// is the specified panel currently visible
-//static
-BOOL LLFloaterMyFriends::instanceVisible(const LLSD& id)
-{
- // if singleton not created yet, trivially return false
- if (!findInstance(id)) return FALSE;
-
- LLFloaterMyFriends* floaterp = getInstance(id);
- return floaterp->isInVisibleChain() && floaterp->mTabs->getCurrentPanelIndex() == id.asInteger();
-}
-
//static
void* LLFloaterMyFriends::createFriendsPanel(void* data)
{
@@ -271,7 +235,7 @@ void LLFloaterChatterBox::removeFloater(LLFloater* floaterp)
void LLFloaterChatterBox::addFloater(LLFloater* floaterp,
BOOL select_added_floater,
- LLTabContainerCommon::eInsertionPoint insertion_point)
+ LLTabContainer::eInsertionPoint insertion_point)
{
S32 num_locked_tabs = mTabContainer->getNumLockedTabs();
@@ -322,48 +286,6 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp,
}
}
-
-//static
-LLFloaterChatterBox* LLFloaterChatterBox::showInstance(const LLSD& seed)
-{
- LLFloaterChatterBox* chatterbox_floater = LLUISingleton<LLFloaterChatterBox>::showInstance(seed);
-
- // if TRUE, show tab for active voice channel, otherwise, just show last tab
- LLFloater* floater_to_show = NULL;
- LLUUID session_id = seed.asUUID();
- if (session_id.notNull())
- {
- floater_to_show = gIMMgr->findFloaterBySession(session_id);
- }
-
- if (floater_to_show)
- {
- floater_to_show->open();
- }
- else
- {
- // just open chatterbox to the last selected tab
- chatterbox_floater->open();
- }
-
- return chatterbox_floater;
-}
-
-//static
-BOOL LLFloaterChatterBox::instanceVisible(const LLSD &seed)
-{
- if (seed.asBoolean())
- {
- LLFloater* floater_to_show = getCurrentVoiceFloater();
- if (floater_to_show)
- {
- return floater_to_show->isInVisibleChain();
- }
- }
-
- return LLUISingleton<LLFloaterChatterBox>::instanceVisible(seed);
-}
-
//static
LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater()
{
diff --git a/indra/newview/llfloaterchatterbox.h b/indra/newview/llfloaterchatterbox.h
index bf06ee9d38..4b1da9c9bc 100644
--- a/indra/newview/llfloaterchatterbox.h
+++ b/indra/newview/llfloaterchatterbox.h
@@ -36,32 +36,12 @@
#include "llfloater.h"
#include "llstring.h"
+#include "llimview.h"
+#include "llimpanel.h"
-class LLTabContainerCommon;
+class LLTabContainer;
-class LLFloaterMyFriends : public LLFloater, public LLUISingleton<LLFloaterMyFriends>
-{
-public:
- LLFloaterMyFriends(const LLSD& seed);
- virtual ~LLFloaterMyFriends();
-
- virtual BOOL postBuild();
-
- void onClose(bool app_quitting);
-
- // override LLUISingleton behavior
- static LLFloaterMyFriends* showInstance(const LLSD& id = LLSD());
- static void hideInstance(const LLSD& id);
- static BOOL instanceVisible(const LLSD& id);
-
- static void* createFriendsPanel(void* data);
- static void* createGroupsPanel(void* data);
-
-protected:
- LLTabContainerCommon* mTabs;
-};
-
-class LLFloaterChatterBox : public LLMultiFloater, public LLUISingleton<LLFloaterChatterBox>
+class LLFloaterChatterBox : public LLMultiFloater, public LLUISingleton<LLFloaterChatterBox, LLFloaterChatterBox>
{
public:
LLFloaterChatterBox(const LLSD& seed);
@@ -75,16 +55,103 @@ public:
/*virtual*/ void removeFloater(LLFloater* floaterp);
/*virtual*/ void addFloater(LLFloater* floaterp,
BOOL select_added_floater,
- LLTabContainerCommon::eInsertionPoint insertion_point = LLTabContainerCommon::END);
-
- static LLFloaterChatterBox* showInstance(const LLSD& seed = LLSD());
- static BOOL instanceVisible(const LLSD& seed);
+ LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
static LLFloater* getCurrentVoiceFloater();
+
+ // visibility policy for LLUISingleton
+ static bool visible(LLFloater* instance, const LLSD& key)
+ {
+ LLFloater* floater_to_check = ((LLFloaterChatterBox*)instance)->getFloater(key);
+
+ if (floater_to_check)
+ {
+ return floater_to_check->isInVisibleChain();
+ }
+
+ // otherwise use default visibility rule for chatterbox
+ return VisibilityPolicy<LLFloater>::visible(instance, key);
+ }
+
+ static void show(LLFloater* instance, const LLSD& key)
+ {
+ LLFloater* floater_to_show = ((LLFloaterChatterBox*)instance)->getFloater(key);
+ VisibilityPolicy<LLFloater>::show(instance, key);
+
+ if (floater_to_show)
+ {
+ floater_to_show->open();
+ }
+ }
+
+ static void hide(LLFloater* instance, const LLSD& key)
+ {
+ VisibilityPolicy<LLFloater>::hide(instance, key);
+ }
+
+private:
+ LLFloater* getFloater(const LLSD& key)
+ {
+ LLFloater* floater = NULL;
+
+ //try to show requested session
+ LLUUID session_id = key.asUUID();
+ if (session_id.notNull())
+ {
+ floater = LLIMMgr::getInstance()->findFloaterBySession(session_id);
+ }
+
+ // if TRUE, show tab for active voice channel, otherwise, just show last tab
+ if (key.asBoolean())
+ {
+ floater = getCurrentVoiceFloater();
+ }
+
+ return floater;
+ }
protected:
LLFloater* mActiveVoiceFloater;
};
+class LLFloaterMyFriends : public LLFloater, public LLUISingleton<LLFloaterMyFriends, LLFloaterMyFriends>
+{
+public:
+ LLFloaterMyFriends(const LLSD& seed);
+ virtual ~LLFloaterMyFriends();
+
+ virtual BOOL postBuild();
+
+ void onClose(bool app_quitting);
+
+ static void* createFriendsPanel(void* data);
+ static void* createGroupsPanel(void* data);
+
+ // visibility policy for LLUISingleton
+ static bool visible(LLFloater* instance, const LLSD& key)
+ {
+ LLFloaterMyFriends* floaterp = (LLFloaterMyFriends*)instance;
+ return floaterp->isInVisibleChain() && floaterp->mTabs->getCurrentPanelIndex() == key.asInteger();
+ }
+
+ static void show(LLFloater* instance, const LLSD& key)
+ {
+ VisibilityPolicy<LLFloater>::show(instance, key);
+ // garbage values in id will be interpreted as 0, or the friends tab
+ ((LLFloaterMyFriends*)instance)->mTabs->selectTab(key);
+ }
+
+ static void hide(LLFloater* instance, const LLSD& key)
+ {
+ if (visible(instance, key))
+ {
+ LLFloaterChatterBox::hideInstance();
+ }
+ }
+
+protected:
+ LLTabContainer* mTabs;
+};
+
#endif // LL_LLFLOATERCHATTERBOX_H
diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp
index 324da688f8..137b35c3ee 100644
--- a/indra/newview/llfloatercolorpicker.cpp
+++ b/indra/newview/llfloatercolorpicker.cpp
@@ -577,7 +577,7 @@ void LLFloaterColorPicker::draw()
glEnd();
}
- if (gFocusMgr.childHasMouseCapture(mDragHandle))
+ if (gFocusMgr.childHasMouseCapture(getDragHandle()))
{
mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
}
@@ -902,104 +902,103 @@ BOOL
LLFloaterColorPicker::
handleMouseDown ( S32 x, S32 y, MASK mask )
{
- // if this window is in the foreground
- if ( mForeground )
- {
+ BOOL ret = LLFloater::handleMouseDown ( x, y, mask );
+
// make it the frontmost
- gFloaterView->bringToFront(this);
+ gFloaterView->bringToFront(this);
- // rect containing RGB area
- LLRect rgbAreaRect ( mRGBViewerImageLeft,
- mRGBViewerImageTop,
- mRGBViewerImageLeft + mRGBViewerImageWidth,
- mRGBViewerImageTop - mRGBViewerImageHeight );
+ // rect containing RGB area
+ LLRect rgbAreaRect ( mRGBViewerImageLeft,
+ mRGBViewerImageTop,
+ mRGBViewerImageLeft + mRGBViewerImageWidth,
+ mRGBViewerImageTop - mRGBViewerImageHeight );
- if ( rgbAreaRect.pointInRect ( x, y ) )
- {
- gViewerWindow->setMouseCapture(this);
- // mouse button down
- setMouseDownInHueRegion ( TRUE );
+ if ( rgbAreaRect.pointInRect ( x, y ) )
+ {
+ gViewerWindow->setMouseCapture(this);
+ // mouse button down
+ setMouseDownInHueRegion ( TRUE );
- // update all values based on initial click
- updateRgbHslFromPoint ( x, y );
+ // update all values based on initial click
+ updateRgbHslFromPoint ( x, y );
- // required by base class
- return TRUE;
- }
+ // required by base class
+ return TRUE;
+ }
- // rect containing RGB area
- LLRect lumAreaRect ( mLumRegionLeft,
- mLumRegionTop,
- mLumRegionLeft + mLumRegionWidth + mLumMarkerSize,
- mLumRegionTop - mLumRegionHeight );
+ // rect containing RGB area
+ LLRect lumAreaRect ( mLumRegionLeft,
+ mLumRegionTop,
+ mLumRegionLeft + mLumRegionWidth + mLumMarkerSize,
+ mLumRegionTop - mLumRegionHeight );
- if ( lumAreaRect.pointInRect ( x, y ) )
- {
- gViewerWindow->setMouseCapture(this);
- // mouse button down
- setMouseDownInLumRegion ( TRUE );
+ if ( lumAreaRect.pointInRect ( x, y ) )
+ {
+ gViewerWindow->setMouseCapture(this);
+ // mouse button down
+ setMouseDownInLumRegion ( TRUE );
- // required by base class
- return TRUE;
- }
+ // required by base class
+ return TRUE;
+ }
- // rect containing swatch area
- LLRect swatchRect ( mSwatchRegionLeft,
- mSwatchRegionTop,
- mSwatchRegionLeft + mSwatchRegionWidth,
- mSwatchRegionTop - mSwatchRegionHeight );
+ // rect containing swatch area
+ LLRect swatchRect ( mSwatchRegionLeft,
+ mSwatchRegionTop,
+ mSwatchRegionLeft + mSwatchRegionWidth,
+ mSwatchRegionTop - mSwatchRegionHeight );
- setMouseDownInSwatch( FALSE );
- if ( swatchRect.pointInRect ( x, y ) )
- {
- setMouseDownInSwatch( TRUE );
+ setMouseDownInSwatch( FALSE );
+ if ( swatchRect.pointInRect ( x, y ) )
+ {
+ setMouseDownInSwatch( TRUE );
- // required - dont drag windows here.
- return TRUE;
- }
+ // required - dont drag windows here.
+ return TRUE;
+ }
- // rect containing palette area
- LLRect paletteRect ( mPaletteRegionLeft,
- mPaletteRegionTop,
- mPaletteRegionLeft + mPaletteRegionWidth,
- mPaletteRegionTop - mPaletteRegionHeight );
+ // rect containing palette area
+ LLRect paletteRect ( mPaletteRegionLeft,
+ mPaletteRegionTop,
+ mPaletteRegionLeft + mPaletteRegionWidth,
+ mPaletteRegionTop - mPaletteRegionHeight );
- if ( paletteRect.pointInRect ( x, y ) )
+ if ( paletteRect.pointInRect ( x, y ) )
+ {
+ // release keyboard focus so we can change text values
+ if (gFocusMgr.childHasKeyboardFocus(this))
{
- // release keyboard focus so we can change text values
- if (gFocusMgr.childHasKeyboardFocus(this))
- {
- mSelectBtn->setFocus(TRUE);
- }
-
- // calculate which palette index we selected
- S32 c = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth;
- S32 r = ( ( y - ( mPaletteRegionTop - mPaletteRegionHeight ) ) * numPaletteRows ) / mPaletteRegionHeight;
+ mSelectBtn->setFocus(TRUE);
+ }
- U32 index = ( numPaletteRows - r - 1 ) * numPaletteColumns + c;
+ // calculate which palette index we selected
+ S32 c = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth;
+ S32 r = ( ( y - ( mPaletteRegionTop - mPaletteRegionHeight ) ) * numPaletteRows ) / mPaletteRegionHeight;
- if ( index <= mPalette.size () )
- {
- LLColor4 selected = *mPalette [ index ];
+ U32 index = ( numPaletteRows - r - 1 ) * numPaletteColumns + c;
- setCurRgb ( selected [ 0 ], selected [ 1 ], selected [ 2 ] );
+ if ( index <= mPalette.size () )
+ {
+ LLColor4 selected = *mPalette [ index ];
- if (mApplyImmediateCheck->get())
- {
- LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
- }
+ setCurRgb ( selected [ 0 ], selected [ 1 ], selected [ 2 ] );
- // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion
- enableTextCallbacks ( FALSE );
- updateTextEntry ();
- enableTextCallbacks ( TRUE );
+ if (mApplyImmediateCheck->get())
+ {
+ LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE );
}
- return TRUE;
+ // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion
+ enableTextCallbacks ( FALSE );
+ updateTextEntry ();
+ enableTextCallbacks ( TRUE );
}
+
+ return TRUE;
}
+
// dispatch to base class for the rest of things
- return LLFloater::handleMouseDown ( x, y, mask );
+ return ret;
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp
index 9d52107a20..30326dc496 100644
--- a/indra/newview/llfloaterfriends.cpp
+++ b/indra/newview/llfloaterfriends.cpp
@@ -60,6 +60,7 @@
//Maximum number of people you can select to do an operation on at once.
#define MAX_FRIEND_SELECT 20
+#define DEFAULT_PERIOD 5.0
#define RIGHTS_CHANGE_TIMEOUT 5.0
#define OBSERVER_TIMEOUT 0.5
@@ -80,7 +81,6 @@ public:
// events can arrive quickly in bulk - we need not process EVERY one of them -
// so we wait a short while to let others pile-in, and process them in aggregate.
mEventTimer.start();
- mEventTimer.reset();
// save-up all the mask-bits which have come-in
mMask |= mask;
@@ -102,7 +102,7 @@ protected:
LLPanelFriends::LLPanelFriends() :
LLPanel(),
- LLEventTimer(1000000),
+ LLEventTimer(DEFAULT_PERIOD),
mObserver(NULL),
mShowMaxSelectWarning(TRUE),
mAllowRightsChange(TRUE),
@@ -122,7 +122,7 @@ LLPanelFriends::~LLPanelFriends()
BOOL LLPanelFriends::tick()
{
mEventTimer.stop();
- mPeriod = 1000000;
+ mPeriod = DEFAULT_PERIOD;
mAllowRightsChange = TRUE;
updateFriends(LLFriendObserver::ADD);
return FALSE;
@@ -152,7 +152,6 @@ void LLPanelFriends::updateFriends(U32 changed_mask)
{
mPeriod = RIGHTS_CHANGE_TIMEOUT;
mEventTimer.start();
- mEventTimer.reset();
mAllowRightsChange = FALSE;
}
else
@@ -208,17 +207,20 @@ BOOL LLPanelFriends::postBuild()
}
-void LLPanelFriends::addFriend(const std::string& name, const LLUUID& agent_id)
+BOOL LLPanelFriends::addFriend(const LLUUID& agent_id)
{
LLAvatarTracker& at = LLAvatarTracker::instance();
const LLRelationship* relationInfo = at.getBuddyInfo(agent_id);
- if(!relationInfo) return;
+ if(!relationInfo) return FALSE;
BOOL online = relationInfo->isOnline();
+ std::string fullname;
+ BOOL have_name = gCacheName->getFullName(agent_id, fullname);
+
LLSD element;
element["id"] = agent_id;
element["columns"][LIST_FRIEND_NAME]["column"] = "friend_name";
- element["columns"][LIST_FRIEND_NAME]["value"] = name.c_str();
+ element["columns"][LIST_FRIEND_NAME]["value"] = fullname;
element["columns"][LIST_FRIEND_NAME]["font"] = "SANSSERIF";
element["columns"][LIST_FRIEND_NAME]["font-style"] = "NORMAL";
element["columns"][LIST_ONLINE_STATUS]["column"] = "icon_online_status";
@@ -247,30 +249,39 @@ void LLPanelFriends::addFriend(const std::string& name, const LLUUID& agent_id)
element["columns"][LIST_EDIT_THEIRS]["value"] = relationInfo->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS);
element["columns"][LIST_FRIEND_UPDATE_GEN]["column"] = "friend_last_update_generation";
- element["columns"][LIST_FRIEND_UPDATE_GEN]["value"] = relationInfo->getChangeSerialNum();
+ element["columns"][LIST_FRIEND_UPDATE_GEN]["value"] = have_name ? relationInfo->getChangeSerialNum() : -1;
mFriendsList->addElement(element, ADD_BOTTOM);
+ return have_name;
}
// propagate actual relationship to UI
-void LLPanelFriends::updateFriendItem(LLScrollListItem* itemp, const LLRelationship* info)
+BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationship* info)
{
- if (!itemp) return;
- if (!info) return;
+ if (!info) return FALSE;
+ LLScrollListItem* itemp = mFriendsList->getItem(agent_id);
+ if (!itemp) return FALSE;
+
+ std::string fullname;
+ BOOL have_name = gCacheName->getFullName(agent_id, fullname);
itemp->getColumn(LIST_ONLINE_STATUS)->setValue(info->isOnline() ? gViewerArt.getString("icon_avatar_online.tga") : LLString());
+ itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname);
// render name of online friends in bold text
((LLScrollListText*)itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle(info->isOnline() ? LLFontGL::BOLD : LLFontGL::NORMAL);
itemp->getColumn(LIST_VISIBLE_ONLINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS));
itemp->getColumn(LIST_VISIBLE_MAP)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION));
itemp->getColumn(LIST_EDIT_MINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS));
- itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(info->getChangeSerialNum());
+ S32 change_generation = have_name ? info->getChangeSerialNum() : -1;
+ itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(change_generation);
// enable this item, in case it was disabled after user input
itemp->setEnabled(TRUE);
// changed item in place, need to request sort
mFriendsList->sortItems();
+
+ return have_name;
}
void LLPanelFriends::refreshRightsChangeList()
@@ -354,7 +365,8 @@ void LLPanelFriends::refreshNames()
std::vector<LLScrollListItem*>::iterator item_it = items.begin();
std::vector<LLScrollListItem*>::iterator item_end = items.end();
-
+
+ BOOL have_names = TRUE;
LLAvatarTracker::buddy_map_t::iterator buddy_it;
for (buddy_it = all_buddies.begin() ; buddy_it != all_buddies.end(); ++buddy_it)
{
@@ -379,24 +391,24 @@ void LLPanelFriends::refreshNames()
if (last_change_generation < info->getChangeSerialNum())
{
// update existing item in UI
- updateFriendItem(mFriendsList->getItem(buddy_it->first), info);
+ have_names &= updateFriendItem(buddy_it->first, info);
}
++item_it;
}
// add new friend to list
else
{
- const LLUUID& buddy_id = buddy_it->first;
- char first_name[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last_name[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
-
- gCacheName->getName(buddy_id, first_name, last_name);
- std::ostringstream fullname;
- fullname << first_name << " " << last_name;
- addFriend(fullname.str(), buddy_id);
+ have_names &= addFriend(buddy_it->first);
}
}
+ if (!have_names)
+ {
+ mEventTimer.start();
+ }
+ // changed item in place, need to request sort and update columns
+ mFriendsList->sortItems();
+ // re-select items
mFriendsList->selectMultiple(selected_ids);
mFriendsList->setScrollPos(pos);
}
@@ -412,7 +424,7 @@ void LLPanelFriends::refreshUI()
single_selected = TRUE;
if(num_selected > 1)
{
- childSetText("friend_name_label", childGetText("Multiple"));
+ childSetText("friend_name_label", getString("Multiple"));
multiple_selected = TRUE;
}
else
@@ -501,26 +513,17 @@ void LLPanelFriends::onClickIM(void* user_data)
{
LLUUID agent_id = ids[0];
const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(agent_id);
- char first[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- char last[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- if(info && gCacheName->getName(agent_id, first, last))
+ std::string fullname;
+ if(info && gCacheName->getFullName(agent_id, fullname))
{
- char buffer[MAX_STRING]; /* Flawfinder: ignore */
- snprintf(buffer, MAX_STRING, "%s %s", first, last); /* Flawfinder: ignore */
gIMMgr->setFloaterOpen(TRUE);
- gIMMgr->addSession(
- buffer,
- IM_NOTHING_SPECIAL,
- agent_id);
+ gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id);
}
}
else
{
gIMMgr->setFloaterOpen(TRUE);
- gIMMgr->addSession("Friends Conference",
- IM_SESSION_CONFERENCE_START,
- ids[0],
- ids);
+ gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], ids);
}
make_ui_sound("UISndStartIM");
}
@@ -612,8 +615,7 @@ void LLPanelFriends::onClickRemove(void* user_data)
if(ids.size() == 1)
{
LLUUID agent_id = ids[0];
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string first, last;
if(gCacheName->getName(agent_id, first, last))
{
args["[FIRST_NAME]"] = first;
@@ -671,8 +673,7 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command
if(ids.size() == 1)
{
LLUUID agent_id = ids.begin()->first;
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string first, last;
if(gCacheName->getName(agent_id, first, last))
{
args["[FIRST_NAME]"] = first;
@@ -720,9 +721,8 @@ void LLPanelFriends::modifyRightsConfirmation(S32 option, void* user_data)
rights_map_t::iterator rights_it;
for (rights_it = rights->begin(); rights_it != rights->end(); ++rights_it)
{
- LLScrollListItem* itemp = panelp->mFriendsList->getItem(rights_it->first);
const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(rights_it->first);
- panelp->updateFriendItem(itemp, info);
+ panelp->updateFriendItem(rights_it->first, info);
}
}
panelp->refreshUI();
diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h
index 46e4eaaf79..2e87688f8e 100644
--- a/indra/newview/llfloaterfriends.h
+++ b/indra/newview/llfloaterfriends.h
@@ -41,7 +41,8 @@
class LLFriendObserver;
class LLRelationship;
-
+class LLScrollListItem;
+class LLScrollListCtrl;
/**
* @class LLPanelFriends
@@ -100,8 +101,8 @@ private:
void refreshUI();
void refreshRightsChangeList();
void applyRightsToFriends();
- void addFriend(const std::string& name, const LLUUID& agent_id);
- void updateFriendItem(LLScrollListItem* itemp, const LLRelationship* relationship);
+ BOOL addFriend(const LLUUID& agent_id);
+ BOOL updateFriendItem(const LLUUID& agent_id, const LLRelationship* relationship);
typedef enum
{
@@ -138,7 +139,7 @@ private:
LLFriendObserver* mObserver;
LLUUID mAddFriendID;
LLString mAddFriendName;
- LLScrollListCtrl* mFriendsList;
+ LLScrollListCtrl* mFriendsList;
BOOL mShowMaxSelectWarning;
BOOL mAllowRightsChange;
S32 mNumRightsChanged;
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index 3bc7f5a28c..44d158d2e3 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -99,7 +99,7 @@ LLFloaterGesture::~LLFloaterGesture()
// Custom saving rectangle, since load must be done
// after postBuild.
- gSavedSettings.setRect("FloaterGestureRect", mRect);
+ gSavedSettings.setRect("FloaterGestureRect", getRect());
}
// virtual
diff --git a/indra/newview/llfloatergroupinvite.cpp b/indra/newview/llfloatergroupinvite.cpp
index 6d76f7685a..a82e6e914e 100644
--- a/indra/newview/llfloatergroupinvite.cpp
+++ b/indra/newview/llfloatergroupinvite.cpp
@@ -83,7 +83,7 @@ LLFloaterGroupInvite::LLFloaterGroupInvite(const std::string& name,
const LLUUID& group_id)
: LLFloater(name, rect, title)
{
- LLRect contents(mRect);
+ LLRect contents(getRect());
contents.mTop -= LLFLOATER_HEADER_SIZE;
mImpl = new impl(group_id);
diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h
index 63b9096e77..a1740861d5 100644
--- a/indra/newview/llfloatergroups.h
+++ b/indra/newview/llfloatergroups.h
@@ -53,9 +53,9 @@ class LLScrollListCtrl;
class LLButton;
class LLFloaterGroupPicker;
-class LLFloaterGroupPicker : public LLFloater, public LLUIInstanceMgr<LLFloaterGroupPicker>
+class LLFloaterGroupPicker : public LLFloater, public LLUIFactory<LLFloaterGroupPicker, LLFloaterGroupPicker, VisibilityPolicy<LLFloater> >
{
- friend class LLUIInstanceMgr<LLFloaterGroupPicker>;
+ friend class LLUIFactory<LLFloaterGroupPicker>;
public:
~LLFloaterGroupPicker();
void setSelectCallback( void (*callback)(LLUUID, void*),
@@ -63,11 +63,13 @@ public:
void setPowersMask(U64 powers_mask);
BOOL postBuild();
+ // implementation of factory policy
+ static LLFloaterGroupPicker* findInstance(const LLSD& seed);
+ static LLFloaterGroupPicker* createInstance(const LLSD& seed);
+
protected:
LLFloaterGroupPicker(const LLSD& seed);
void ok();
- static LLFloaterGroupPicker* findInstance(const LLSD& seed);
- static LLFloaterGroupPicker* createInstance(const LLSD& seed);
static void onBtnOK(void* userdata);
static void onBtnCancel(void* userdata);
diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp
index 9f1624d20c..4280e250d7 100644
--- a/indra/newview/llfloaterinspect.cpp
+++ b/indra/newview/llfloaterinspect.cpp
@@ -211,18 +211,13 @@ void LLFloaterInspect::refresh()
{
LLSelectNode* obj = *iter;
LLSD row;
- char owner_first_name[MAX_STRING], owner_last_name[MAX_STRING];
- char creator_first_name[MAX_STRING], creator_last_name[MAX_STRING];
char time[MAX_STRING];
- std::ostringstream owner_name, creator_name, date;
+ std::string owner_name, creator_name;
time_t timestamp = (time_t) (obj->mCreationDate/1000000);
LLString::copy(time, ctime(&timestamp), MAX_STRING);
time[24] = '\0';
- date << obj->mCreationDate;
- gCacheName->getName(obj->mPermissions->getOwner(), owner_first_name, owner_last_name);
- owner_name << owner_first_name << " " << owner_last_name;
- gCacheName->getName(obj->mPermissions->getCreator(), creator_first_name, creator_last_name);
- creator_name << creator_first_name << " " << creator_last_name;
+ gCacheName->getFullName(obj->mPermissions->getOwner(), owner_name);
+ gCacheName->getFullName(obj->mPermissions->getCreator(), creator_name);
row["id"] = obj->getObject()->getID();
row["columns"][0]["column"] = "object_name";
row["columns"][0]["type"] = "text";
@@ -238,10 +233,10 @@ void LLFloaterInspect::refresh()
}
row["columns"][1]["column"] = "owner_name";
row["columns"][1]["type"] = "text";
- row["columns"][1]["value"] = owner_name.str().c_str();
+ row["columns"][1]["value"] = owner_name;
row["columns"][2]["column"] = "creator_name";
row["columns"][2]["type"] = "text";
- row["columns"][2]["value"] = creator_name.str().c_str();
+ row["columns"][2]["value"] = creator_name;
row["columns"][3]["column"] = "creation_date";
row["columns"][3]["type"] = "text";
row["columns"][3]["value"] = time;
diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h
index 8656f13124..befb133f68 100644
--- a/indra/newview/llfloaterinspect.h
+++ b/indra/newview/llfloaterinspect.h
@@ -67,7 +67,7 @@ private:
// static data
static LLFloaterInspect* sInstance;
- LLHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
};
#endif //LL_LLFLOATERINSPECT_H
diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp
index 04a5cf6a24..9f1bef5be7 100644
--- a/indra/newview/llfloaterlagmeter.cpp
+++ b/indra/newview/llfloaterlagmeter.cpp
@@ -72,49 +72,49 @@ LLFloaterLagMeter::LLFloaterLagMeter()
mServerText = LLUICtrlFactory::getTextBoxByName(this, "server_text");
mServerCause = LLUICtrlFactory::getTextBoxByName(this, "server_lag_cause");
- LLString config_string = childGetText("client_frame_rate_critical_fps");
+ LLString config_string = getString("client_frame_rate_critical_fps", mStringArgs);
mClientFrameTimeCritical = 1.0f / (float)atof( config_string.c_str() );
- config_string = childGetText("client_frame_rate_warning_fps");
+ config_string = getString("client_frame_rate_warning_fps", mStringArgs);
mClientFrameTimeWarning = 1.0f / (float)atof( config_string.c_str() );
- config_string = childGetText("network_packet_loss_critical_pct");
+ config_string = getString("network_packet_loss_critical_pct", mStringArgs);
mNetworkPacketLossCritical = (float)atof( config_string.c_str() );
- config_string = childGetText("network_packet_loss_warning_pct");
+ config_string = getString("network_packet_loss_warning_pct", mStringArgs);
mNetworkPacketLossWarning = (float)atof( config_string.c_str() );
- config_string = childGetText("network_ping_critical_ms");
+ config_string = getString("network_ping_critical_ms", mStringArgs);
mNetworkPingCritical = (float)atof( config_string.c_str() );
- config_string = childGetText("network_ping_warning_ms");
+ config_string = getString("network_ping_warning_ms", mStringArgs);
mNetworkPingWarning = (float)atof( config_string.c_str() );
- config_string = childGetText("server_frame_rate_critical_fps");
+ config_string = getString("server_frame_rate_critical_fps", mStringArgs);
mServerFrameTimeCritical = 1000.0f / (float)atof( config_string.c_str() );
- config_string = childGetText("server_frame_rate_warning_fps");
+ config_string = getString("server_frame_rate_warning_fps", mStringArgs);
mServerFrameTimeWarning = 1000.0f / (float)atof( config_string.c_str() );
- config_string = childGetText("server_single_process_max_time_ms");
+ config_string = getString("server_single_process_max_time_ms", mStringArgs);
mServerSingleProcessMaxTime = (float)atof( config_string.c_str() );
mShrunk = false;
- config_string = childGetText("max_width_px");
+ config_string = getString("max_width_px", mStringArgs);
mMaxWidth = atoi( config_string.c_str() );
- config_string = childGetText("min_width_px");
+ config_string = getString("min_width_px", mStringArgs);
mMinWidth = atoi( config_string.c_str() );
- childSetTextArg("client_frame_time_critical_msg", "[CLIENT_FRAME_RATE_CRITICAL]", childGetText("client_frame_rate_critical_fps"));
- childSetTextArg("client_frame_time_warning_msg", "[CLIENT_FRAME_RATE_CRITICAL]", childGetText("client_frame_rate_critical_fps"));
- childSetTextArg("client_frame_time_warning_msg", "[CLIENT_FRAME_RATE_WARNING]", childGetText("client_frame_rate_warning_fps"));
+ mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps");
+ mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps");
+ mStringArgs["[CLIENT_FRAME_RATE_WARNING]"] = getString("client_frame_rate_warning_fps");
- childSetTextArg("network_packet_loss_critical_msg", "[NETWORK_PACKET_LOSS_CRITICAL]", childGetText("network_packet_loss_critical_pct"));
- childSetTextArg("network_packet_loss_warning_msg", "[NETWORK_PACKET_LOSS_CRITICAL]", childGetText("network_packet_loss_critical_pct"));
- childSetTextArg("network_packet_loss_warning_msg", "[NETWORK_PACKET_LOSS_WARNING]", childGetText("network_packet_loss_warning_pct"));
+ mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct");
+ mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct");
+ mStringArgs["[NETWORK_PACKET_LOSS_WARNING]"] = getString("network_packet_loss_warning_pct");
- childSetTextArg("network_ping_critical_msg", "[NETWORK_PING_CRITICAL]", childGetText("network_ping_critical_ms"));
- childSetTextArg("network_ping_warning_msg", "[NETWORK_PING_CRITICAL]", childGetText("network_ping_critical_ms"));
- childSetTextArg("network_ping_warning_msg", "[NETWORK_PING_WARNING]", childGetText("network_ping_warning_ms"));
+ mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms");
+ mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms");
+ mStringArgs["[NETWORK_PING_WARNING]"] = getString("network_ping_warning_ms");
- childSetTextArg("server_frame_time_critical_msg", "[SERVER_FRAME_RATE_CRITICAL]", childGetText("server_frame_rate_critical_fps"));
- childSetTextArg("server_frame_time_warning_msg", "[SERVER_FRAME_RATE_CRITICAL]", childGetText("server_frame_rate_critical_fps"));
- childSetTextArg("server_frame_time_warning_msg", "[SERVER_FRAME_RATE_WARNING]", childGetText("server_frame_rate_warning_fps"));
+ mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps");
+ mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps");
+ mStringArgs["[SERVER_FRAME_RATE_WARNING]"] = getString("server_frame_rate_warning_fps");
childSetAction("minimize", onClickShrink, this);
@@ -162,25 +162,25 @@ void LLFloaterLagMeter::determineClient()
if (!gFocusMgr.getAppHasFocus())
{
mClientButton->setImageUnselected(LAG_GOOD_IMAGE_NAME);
- mClientText->setText( childGetText("client_frame_time_window_bg_msg") );
+ mClientText->setText( getString("client_frame_time_window_bg_msg", mStringArgs) );
mClientCause->setText( LLString::null );
}
else if(client_frame_time >= mClientFrameTimeCritical)
{
mClientButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME);
- mClientText->setText( childGetText("client_frame_time_critical_msg") );
+ mClientText->setText( getString("client_frame_time_critical_msg", mStringArgs) );
find_cause = true;
}
else if(client_frame_time >= mClientFrameTimeWarning)
{
mClientButton->setImageUnselected(LAG_WARNING_IMAGE_NAME);
- mClientText->setText( childGetText("client_frame_time_warning_msg") );
+ mClientText->setText( getString("client_frame_time_warning_msg", mStringArgs) );
find_cause = true;
}
else
{
mClientButton->setImageUnselected(LAG_GOOD_IMAGE_NAME);
- mClientText->setText( childGetText("client_frame_time_normal_msg") );
+ mClientText->setText( getString("client_frame_time_normal_msg", mStringArgs) );
mClientCause->setText( LLString::null );
}
@@ -188,19 +188,19 @@ void LLFloaterLagMeter::determineClient()
{
if(gSavedSettings.getF32("RenderFarClip") > 128)
{
- mClientCause->setText( childGetText("client_draw_distance_cause_msg") );
+ mClientCause->setText( getString("client_draw_distance_cause_msg", mStringArgs) );
}
else if(LLAppViewer::instance()->getTextureFetch()->getNumRequests() > 2)
{
- mClientCause->setText( childGetText("client_texture_loading_cause_msg") );
+ mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) );
}
else if(LLViewerImage::sBoundTextureMemory > LLViewerImage::sMaxBoundTextureMem)
{
- mClientCause->setText( childGetText("client_texture_memory_cause_msg") );
+ mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) );
}
else
{
- mClientCause->setText( childGetText("client_complex_objects_cause_msg") );
+ mClientCause->setText( getString("client_complex_objects_cause_msg", mStringArgs) );
}
}
}
@@ -215,40 +215,40 @@ void LLFloaterLagMeter::determineNetwork()
if(packet_loss >= mNetworkPacketLossCritical)
{
mNetworkButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME);
- mNetworkText->setText( childGetText("network_packet_loss_critical_msg") );
+ mNetworkText->setText( getString("network_packet_loss_critical_msg", mStringArgs) );
find_cause_loss = true;
}
else if(ping_time >= mNetworkPingCritical)
{
mNetworkButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME);
- mNetworkText->setText( childGetText("network_ping_critical_msg") );
+ mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) );
find_cause_ping = true;
}
else if(packet_loss >= mNetworkPacketLossWarning)
{
mNetworkButton->setImageUnselected(LAG_WARNING_IMAGE_NAME);
- mNetworkText->setText( childGetText("network_packet_loss_warning_msg") );
+ mNetworkText->setText( getString("network_packet_loss_warning_msg", mStringArgs) );
find_cause_loss = true;
}
else if(ping_time >= mNetworkPingWarning)
{
mNetworkButton->setImageUnselected(LAG_WARNING_IMAGE_NAME);
- mNetworkText->setText( childGetText("network_ping_warning_msg") );
+ mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) );
find_cause_ping = true;
}
else
{
mNetworkButton->setImageUnselected(LAG_GOOD_IMAGE_NAME);
- mNetworkText->setText( childGetText("network_performance_normal_msg") );
+ mNetworkText->setText( getString("network_performance_normal_msg", mStringArgs) );
}
if(find_cause_loss)
{
- mNetworkCause->setText( childGetText("network_packet_loss_cause_msg") );
+ mNetworkCause->setText( getString("network_packet_loss_cause_msg", mStringArgs) );
}
else if(find_cause_ping)
{
- mNetworkCause->setText( childGetText("network_ping_cause_msg") );
+ mNetworkCause->setText( getString("network_ping_cause_msg", mStringArgs) );
}
else
{
@@ -264,19 +264,19 @@ void LLFloaterLagMeter::determineServer()
if(sim_frame_time >= mServerFrameTimeCritical)
{
mServerButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME);
- mServerText->setText( childGetText("server_frame_time_critical_msg") );
+ mServerText->setText( getString("server_frame_time_critical_msg", mStringArgs) );
find_cause = true;
}
else if(sim_frame_time >= mServerFrameTimeWarning)
{
mServerButton->setImageUnselected(LAG_WARNING_IMAGE_NAME);
- mServerText->setText( childGetText("server_frame_time_warning_msg") );
+ mServerText->setText( getString("server_frame_time_warning_msg", mStringArgs) );
find_cause = true;
}
else
{
mServerButton->setImageUnselected(LAG_GOOD_IMAGE_NAME);
- mServerText->setText( childGetText("server_frame_time_normal_msg") );
+ mServerText->setText( getString("server_frame_time_normal_msg", mStringArgs) );
mServerCause->setText( LLString::null );
}
@@ -284,27 +284,27 @@ void LLFloaterLagMeter::determineServer()
{
if(gViewerStats->mSimSimPhysicsMsec.getCurrent() > mServerSingleProcessMaxTime)
{
- mServerCause->setText( childGetText("server_physics_cause_msg") );
+ mServerCause->setText( getString("server_physics_cause_msg", mStringArgs) );
}
else if(gViewerStats->mSimScriptMsec.getCurrent() > mServerSingleProcessMaxTime)
{
- mServerCause->setText( childGetText("server_scripts_cause_msg") );
+ mServerCause->setText( getString("server_scripts_cause_msg", mStringArgs) );
}
else if(gViewerStats->mSimNetMsec.getCurrent() > mServerSingleProcessMaxTime)
{
- mServerCause->setText( childGetText("server_net_cause_msg") );
+ mServerCause->setText( getString("server_net_cause_msg", mStringArgs) );
}
else if(gViewerStats->mSimAgentMsec.getCurrent() > mServerSingleProcessMaxTime)
{
- mServerCause->setText( childGetText("server_agent_cause_msg") );
+ mServerCause->setText( getString("server_agent_cause_msg", mStringArgs) );
}
else if(gViewerStats->mSimImagesMsec.getCurrent() > mServerSingleProcessMaxTime)
{
- mServerCause->setText( childGetText("server_images_cause_msg") );
+ mServerCause->setText( getString("server_images_cause_msg", mStringArgs) );
}
else
{
- mServerCause->setText( childGetText("server_generic_cause_msg") );
+ mServerCause->setText( getString("server_generic_cause_msg", mStringArgs) );
}
}
}
@@ -314,38 +314,38 @@ void LLFloaterLagMeter::onClickShrink(void * data)
{
LLFloaterLagMeter * self = (LLFloaterLagMeter*)data;
- LLButton * button = (LLButton*)self->getChildByName("minimize");
+ LLButton * button = self->getChild<LLButton>("minimize");
S32 delta_width = self->mMaxWidth - self->mMinWidth;
LLRect r = self->getRect();
if(self->mShrunk)
{
- self->setTitle( self->childGetText("max_title_msg") );
+ self->setTitle( self->getString("max_title_msg", self->mStringArgs) );
// make left edge appear to expand
r.translate(-delta_width, 0);
self->setRect(r);
self->reshape(self->mMaxWidth, self->getRect().getHeight());
- self->childSetText("client", self->childGetText("client_text_msg") + ":");
- self->childSetText("network", self->childGetText("network_text_msg") + ":");
- self->childSetText("server", self->childGetText("server_text_msg") + ":");
+ self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) + ":");
+ self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) + ":");
+ self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) + ":");
// usually "<<"
- button->setLabel( self->childGetText("smaller_label") );
+ button->setLabel( self->getString("smaller_label", self->mStringArgs) );
}
else
{
- self->setTitle( self->childGetText("min_title_msg") );
+ self->setTitle( self->getString("min_title_msg", self->mStringArgs) );
// make left edge appear to collapse
r.translate(delta_width, 0);
self->setRect(r);
self->reshape(self->mMinWidth, self->getRect().getHeight());
- self->childSetText("client", self->childGetText("client_text_msg") );
- self->childSetText("network", self->childGetText("network_text_msg") );
- self->childSetText("server", self->childGetText("server_text_msg") );
+ self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) );
+ self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) );
+ self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) );
// usually ">>"
- button->setLabel( self->childGetText("bigger_label") );
+ button->setLabel( self->getString("bigger_label", self->mStringArgs) );
}
// Don't put keyboard focus on the button
button->setFocus(FALSE);
diff --git a/indra/newview/llfloaterlagmeter.h b/indra/newview/llfloaterlagmeter.h
index 0309f199f7..83603826c4 100644
--- a/indra/newview/llfloaterlagmeter.h
+++ b/indra/newview/llfloaterlagmeter.h
@@ -74,6 +74,8 @@ private:
LLTextBox * mServerText;
LLTextBox * mServerCause;
+ LLString::format_map_t mStringArgs;
+
static LLFloaterLagMeter * sInstance;
};
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index f340ff2569..aafd5d7cb4 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -112,7 +112,7 @@ static const BOOL BUY_PERSONAL_LAND = FALSE;
LLParcelSelectionObserver* LLFloaterLand::sObserver = NULL;
S32 LLFloaterLand::sLastTab = 0;
-LLViewHandle LLPanelLandGeneral::sBuyPassDialogHandle;
+LLHandle<LLFloater> LLPanelLandGeneral::sBuyPassDialogHandle;
// Local classes
class LLParcelSelectionObserver : public LLParcelObserver
@@ -189,10 +189,6 @@ void LLFloaterLand::refreshAll()
void LLFloaterLand::onOpen()
{
- // Select tab from last view
- mTabLand->selectTab(sLastTab);
-
-
// Done automatically when the selected parcel's properties arrive
// (and hence we have the local id).
// gParcelMgr->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER);
@@ -237,7 +233,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed)
factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this);
factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this);
- gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map);
+ gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map, false);
sObserver = new LLParcelSelectionObserver();
gParcelMgr->addObserver( sObserver );
@@ -245,7 +241,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed)
BOOL LLFloaterLand::postBuild()
{
- LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(this, "landtab");
+ LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(this, "landtab");
mTabLand = (LLTabContainer*) tab;
@@ -483,7 +479,7 @@ void LLPanelLandGeneral::refresh()
mCheckContributeWithDeed->setEnabled(FALSE);
mTextOwner->setText(LLString::null);
- mBtnProfile->setLabel(childGetText("profile_text"));
+ mBtnProfile->setLabel(getString("profile_text"));
mBtnProfile->setEnabled(FALSE);
mTextClaimDate->setText(LLString::null);
@@ -537,12 +533,12 @@ void LLPanelLandGeneral::refresh()
{
mTextSalePending->setText(LLString::null);
mTextSalePending->setEnabled(FALSE);
- mTextOwner->setText(childGetText("public_text"));
+ mTextOwner->setText(getString("public_text"));
mTextOwner->setEnabled(FALSE);
mBtnProfile->setEnabled(FALSE);
mTextClaimDate->setText(LLString::null);
mTextClaimDate->setEnabled(FALSE);
- mTextGroup->setText(childGetText("none_text"));
+ mTextGroup->setText(getString("none_text"));
mTextGroup->setEnabled(FALSE);
mBtnStartAuction->setEnabled(FALSE);
}
@@ -550,12 +546,12 @@ void LLPanelLandGeneral::refresh()
{
if(!is_leased && (owner_id == gAgent.getID()))
{
- mTextSalePending->setText(childGetText("need_tier_to_modify"));
+ mTextSalePending->setText(getString("need_tier_to_modify"));
mTextSalePending->setEnabled(TRUE);
}
else if(parcel->getAuctionID())
{
- mTextSalePending->setText(childGetText("auction_id_text"));
+ mTextSalePending->setText(getString("auction_id_text"));
mTextSalePending->setTextArg("[ID]", llformat("%u", parcel->getAuctionID()));
mTextSalePending->setEnabled(TRUE);
}
@@ -574,15 +570,15 @@ void LLPanelLandGeneral::refresh()
if (parcel->getGroupID().isNull())
{
// Not group owned, so "Profile"
- mBtnProfile->setLabel(childGetText("profile_text"));
+ mBtnProfile->setLabel(getString("profile_text"));
- mTextGroup->setText(childGetText("none_text"));
+ mTextGroup->setText(getString("none_text"));
mTextGroup->setEnabled(FALSE);
}
else
{
// Group owned, so "Info"
- mBtnProfile->setLabel(childGetText("info_text"));
+ mBtnProfile->setLabel(getString("info_text"));
//mTextGroup->setText("HIPPOS!");//parcel->getGroupName());
mTextGroup->setEnabled(TRUE);
@@ -692,9 +688,9 @@ void LLPanelLandGeneral::refresh()
&dwell);
// Area
- LLUIString price = childGetText("area_size_text");
+ LLUIString price = getString("area_size_text");
price.setArg("[AREA]", llformat("%d",area));
- mTextPriceLabel->setText(childGetText("area_text"));
+ mTextPriceLabel->setText(getString("area_text"));
mTextPrice->setText(price.getString());
mTextDwell->setText(llformat("%.0f", dwell));
@@ -732,29 +728,24 @@ void LLPanelLandGeneral::refreshNames()
LLString owner;
if (parcel->getIsGroupOwned())
{
- owner = childGetText("group_owned_text");
+ owner = getString("group_owned_text");
}
else
{
// Figure out the owner's name
- char owner_first[MAX_STRING]; /*Flawfinder: ignore*/
- char owner_last[MAX_STRING]; /*Flawfinder: ignore*/
- gCacheName->getName(parcel->getOwnerID(), owner_first, owner_last);
- owner = llformat("%s %s", owner_first, owner_last);
+ gCacheName->getFullName(parcel->getOwnerID(), owner);
}
if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
{
- owner += childGetText("sale_pending_text");
+ owner += getString("sale_pending_text");
}
mTextOwner->setText(owner);
LLString group;
if(!parcel->getGroupID().isNull())
{
- char buffer[MAX_STRING]; /*Flawfinder: ignore*/
- gCacheName->getGroupName(parcel->getGroupID(), buffer);
- group = buffer;
+ gCacheName->getGroupName(parcel->getGroupID(), group);
}
mTextGroup->setText(group);
@@ -762,18 +753,12 @@ void LLPanelLandGeneral::refreshNames()
if(auth_buyer_id.notNull())
{
LLString name;
- char firstname[MAX_STRING]; /*Flawfinder: ignore*/
- char lastname[MAX_STRING]; /*Flawfinder: ignore*/
- gCacheName->getName(auth_buyer_id, firstname, lastname);
- name.assign(firstname);
- name.append(" ");
- name.append(lastname);
-
+ gCacheName->getFullName(auth_buyer_id, name);
mSaleInfoForSale2->setTextArg("[BUYER]", name);
}
else
{
- mSaleInfoForSale2->setTextArg("[BUYER]", childGetText("anyone"));
+ mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone"));
}
}
@@ -949,7 +934,7 @@ void LLPanelLandGeneral::cbBuyPass(S32 option, void* data)
//static
BOOL LLPanelLandGeneral::buyPassDialogVisible()
{
- return LLFloater::getFloaterByHandle(sBuyPassDialogHandle) != NULL;
+ return sBuyPassDialogHandle.get() != NULL;
}
// static
@@ -1071,7 +1056,7 @@ BOOL LLPanelLandObjects::postBuild()
image_id.set( gViewerArt.getString("icon_group.tga") );
mIconGroup = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
- mOwnerList = LLUICtrlFactory::getNameListByName(this, "owner list");
+ mOwnerList = getChild<LLNameListCtrl>("owner list");
mOwnerList->sortByColumn(3, FALSE);
childSetCommitCallback("owner list", onCommitList, this);
mOwnerList->setDoubleClickCallback(onDoubleClickOwner);
@@ -1181,12 +1166,12 @@ void LLPanelLandObjects::refresh()
if (sw_total > sw_max)
{
- mSWTotalObjects->setText(childGetText("objects_deleted_text"));
+ mSWTotalObjects->setText(getString("objects_deleted_text"));
mSWTotalObjects->setTextArg("[DELETED]", llformat("%d", sw_total - sw_max));
}
else
{
- mSWTotalObjects->setText(childGetText("objects_available_text"));
+ mSWTotalObjects->setText(getString("objects_available_text"));
mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", sw_max - sw_total));
}
mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", sw_total));
@@ -1311,8 +1296,7 @@ void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata)
}
else
{
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string first, last;
gCacheName->getName(owner_id, first, last);
args["[FIRST]"] = first;
args["[LAST]"] = last;
@@ -1336,7 +1320,7 @@ void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata)
{
if (parcel)
{
- char group_name[MAX_STRING]; /*Flawfinder: ignore*/
+ std::string group_name;
gCacheName->getGroupName(parcel->getGroupID(), group_name);
LLString::format_map_t args;
args["[GROUPNAME]"] = group_name;
@@ -1639,12 +1623,8 @@ void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata)
}
else
{
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- gCacheName->getName(owner_id, first, last);
- std::string name = first;
- name += " ";
- name += last;
+ std::string name;
+ gCacheName->getFullName(owner_id, name);
args["[NAME]"] = name;
gViewerWindow->alertXml("ReturnObjectsOwnedByUser", args, callbackReturnOwnerObjects, userdata);
}
@@ -1659,7 +1639,7 @@ void LLPanelLandObjects::onClickReturnGroupObjects(void* userdata)
send_parcel_select_objects(parcel->getLocalID(), RT_GROUP);
- char group_name[MAX_STRING]; /*Flawfinder: ignore*/
+ std::string group_name;
gCacheName->getGroupName(parcel->getGroupID(), group_name);
LLStringBase<char>::format_map_t args;
@@ -1688,7 +1668,7 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata)
if (parcel->getIsGroupOwned())
{
- char group_name[MAX_STRING]; /*Flawfinder: ignore*/
+ std::string group_name;
gCacheName->getGroupName(parcel->getGroupID(), group_name);
args["[NAME]"] = group_name;
@@ -1704,13 +1684,8 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata)
}
else
{
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- gCacheName->getName(owner_id, first, last);
std::string name;
- name += first;
- name += " ";
- name += last;
+ gCacheName->getFullName(owner_id, name);
args["[NAME]"] = name;
gViewerWindow->alertXml("ReturnObjectsNotOwnedByUser", args, callbackReturnOtherObjects, userdata);
@@ -1857,7 +1832,7 @@ BOOL LLPanelLandOptions::postBuild()
}*/
- mSnapshotCtrl = LLUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl");
+ mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl");
if (mSnapshotCtrl)
{
mSnapshotCtrl->setCommitCallback( onCommitAny );
@@ -1948,7 +1923,7 @@ void LLPanelLandOptions::refresh()
mSnapshotCtrl->setImageAssetID(LLUUID::null);
mSnapshotCtrl->setEnabled(FALSE);
- mLocationText->setTextArg("[LANDING]", childGetText("landing_point_none"));
+ mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
mSetBtn->setEnabled(FALSE);
mClearBtn->setEnabled(FALSE);
@@ -1995,13 +1970,13 @@ void LLPanelLandOptions::refresh()
mPushRestrictionCtrl->set( parcel->getRestrictPushObject() );
if(parcel->getRegionPushOverride())
{
- mPushRestrictionCtrl->setLabel(childGetText("push_restrict_region_text"));
+ mPushRestrictionCtrl->setLabel(getString("push_restrict_region_text"));
mPushRestrictionCtrl->setEnabled(false);
mPushRestrictionCtrl->set(TRUE);
}
else
{
- mPushRestrictionCtrl->setLabel(childGetText("push_restrict_text"));
+ mPushRestrictionCtrl->setLabel(getString("push_restrict_text"));
mPushRestrictionCtrl->setEnabled(can_change_options);
}
@@ -2025,7 +2000,7 @@ void LLPanelLandOptions::refresh()
LLVector3 pos = parcel->getUserLocation();
if (pos.isExactlyZero())
{
- mLocationText->setTextArg("[LANDING]", childGetText("landing_point_none"));
+ mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
}
else
{
@@ -2245,11 +2220,11 @@ BOOL LLPanelLandAccess::postBuild()
childSetAction("add_banned", onClickAddBanned, this);
childSetAction("remove_banned", onClickRemoveBanned, this);
- mListAccess = LLUICtrlFactory::getNameListByName(this, "AccessList");
+ mListAccess = getChild<LLNameListCtrl>("AccessList");
if (mListAccess)
mListAccess->sortByColumn(0, TRUE); // ascending
- mListBanned = LLUICtrlFactory::getNameListByName(this, "BannedList");
+ mListBanned = getChild<LLNameListCtrl>("BannedList");
if (mListBanned)
mListBanned->sortByColumn(0, TRUE); // ascending
@@ -2280,9 +2255,9 @@ void LLPanelLandAccess::refresh()
childSetValue("public_access", public_access );
childSetValue("GroupCheck", use_group );
- char group_name[MAX_STRING]; /*Flawfinder: ignore*/
+ std::string group_name;
gCacheName->getGroupName(parcel->getGroupID(), group_name);
- childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name) );
+ childSetLabelArg("GroupCheck", "[GROUP]", group_name );
// Allow list
{
@@ -2503,13 +2478,12 @@ void LLPanelLandAccess::refresh_ui()
void LLPanelLandAccess::refreshNames()
{
LLParcel* parcel = mParcel->getParcel();
- char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- group_name[0] = '\0';
+ std::string group_name;
if(parcel)
{
gCacheName->getGroupName(parcel->getGroupID(), group_name);
}
- childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name));
+ childSetLabelArg("GroupCheck", "[GROUP]", group_name);
}
@@ -2561,7 +2535,7 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata)
BOOL use_access_group = self->childGetValue("GroupCheck").asBoolean();
if (use_access_group)
{
- char group_name[MAX_STRING]; /*Flawfinder: ignore*/
+ std::string group_name;
if (!gCacheName->getGroupName(parcel->getGroupID(), group_name))
{
use_access_group = FALSE;
@@ -2738,35 +2712,35 @@ void LLPanelLandCovenant::refresh()
LLViewerRegion* region = gParcelMgr->getSelectionRegion();
if(!region) return;
- LLTextBox* region_name = (LLTextBox*)getChildByName("region_name_text");
+ LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
if (region_name)
{
region_name->setText(region->getName());
}
- LLTextBox* resellable_clause = (LLTextBox*)getChildByName("resellable_clause");
+ LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
if (resellable_clause)
{
if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
{
- resellable_clause->setText(childGetText("can_not_resell"));
+ resellable_clause->setText(getString("can_not_resell"));
}
else
{
- resellable_clause->setText(childGetText("can_resell"));
+ resellable_clause->setText(getString("can_resell"));
}
}
- LLTextBox* changeable_clause = (LLTextBox*)getChildByName("changeable_clause");
+ LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
if (changeable_clause)
{
if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
{
- changeable_clause->setText(childGetText("can_change"));
+ changeable_clause->setText(getString("can_change"));
}
else
{
- changeable_clause->setText(childGetText("can_not_change"));
+ changeable_clause->setText(getString("can_not_change"));
}
}
@@ -2785,7 +2759,7 @@ void LLPanelLandCovenant::updateCovenantText(const std::string &string)
LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
if (self)
{
- LLViewerTextEditor* editor = (LLViewerTextEditor*)self->getChildByName("covenant_editor");
+ LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("covenant_editor");
if (editor)
{
editor->setHandleEditKeysDirectly(TRUE);
@@ -2800,7 +2774,7 @@ void LLPanelLandCovenant::updateEstateName(const std::string& name)
LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
if (self)
{
- LLTextBox* editor = (LLTextBox*)self->getChildByName("estate_name_text");
+ LLTextBox* editor = self->getChild<LLTextBox>("estate_name_text");
if (editor) editor->setText(name);
}
}
@@ -2811,7 +2785,7 @@ void LLPanelLandCovenant::updateLastModified(const std::string& text)
LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
if (self)
{
- LLTextBox* editor = (LLTextBox*)self->getChildByName("covenant_timestamp_text");
+ LLTextBox* editor = self->getChild<LLTextBox>("covenant_timestamp_text");
if (editor) editor->setText(text);
}
}
@@ -2822,7 +2796,7 @@ void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name)
LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
if (self)
{
- LLTextBox* editor = (LLTextBox*)self->getChildByName("estate_owner_text");
+ LLTextBox* editor = self->getChild<LLTextBox>("estate_owner_text");
if (editor) editor->setText(name);
}
}
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index e504e27f21..38d58fabfe 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -68,8 +68,9 @@ class LLPanelLandRenters;
class LLPanelLandCovenant;
class LLFloaterLand
-: public LLFloater, public LLUISingleton<LLFloaterLand>
+: public LLFloater, public LLUISingleton<LLFloaterLand, VisibilityPolicy<LLFloater> >
{
+ friend class LLUISingleton<LLFloaterLand, VisibilityPolicy<LLFloater> >;
public:
static void refreshAll();
@@ -82,7 +83,6 @@ public:
virtual BOOL postBuild();
protected:
- friend class LLUISingleton<LLFloaterLand>;
// Does its own instance management, so clients not allowed
// to allocate or destroy.
@@ -113,7 +113,7 @@ protected:
LLPanelLandAccess* mPanelAccess;
LLPanelLandCovenant* mPanelCovenant;
- LLHandle<LLParcelSelection> mParcel;
+ LLSafeHandle<LLParcelSelection> mParcel;
public:
// When closing the dialog, we want to deselect the land. But when
@@ -128,7 +128,7 @@ class LLPanelLandGeneral
: public LLPanel
{
public:
- LLPanelLandGeneral(LLHandle<LLParcelSelection>& parcelp);
+ LLPanelLandGeneral(LLSafeHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandGeneral();
void refresh();
void refreshNames();
@@ -220,16 +220,16 @@ protected:
LLButton* mBtnBuyPass;
LLButton* mBtnStartAuction;
- LLHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
- static LLViewHandle sBuyPassDialogHandle;
+ static LLHandle<LLFloater> sBuyPassDialogHandle;
};
class LLPanelLandObjects
: public LLPanel
{
public:
- LLPanelLandObjects(LLHandle<LLParcelSelection>& parcelp);
+ LLPanelLandObjects(LLSafeHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandObjects();
void refresh();
virtual void draw();
@@ -292,7 +292,7 @@ protected:
S32 mSelectedCount;
BOOL mSelectedIsGroup;
- LLHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
@@ -300,7 +300,7 @@ class LLPanelLandOptions
: public LLPanel
{
public:
- LLPanelLandOptions(LLHandle<LLParcelSelection>& parcelp);
+ LLPanelLandOptions(LLSafeHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandOptions();
void refresh();
@@ -339,7 +339,7 @@ protected:
LLCheckBoxCtrl *mPushRestrictionCtrl;
LLButton *mPublishHelpButton;
- LLHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
@@ -347,7 +347,7 @@ class LLPanelLandAccess
: public LLPanel
{
public:
- LLPanelLandAccess(LLHandle<LLParcelSelection>& parcelp);
+ LLPanelLandAccess(LLSafeHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandAccess();
void refresh();
void refresh_ui();
@@ -369,7 +369,7 @@ protected:
LLNameListCtrl* mListAccess;
LLNameListCtrl* mListBanned;
- LLHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
@@ -377,7 +377,7 @@ class LLPanelLandCovenant
: public LLPanel
{
public:
- LLPanelLandCovenant(LLHandle<LLParcelSelection>& parcelp);
+ LLPanelLandCovenant(LLSafeHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandCovenant();
virtual BOOL postBuild();
void refresh();
@@ -387,7 +387,7 @@ public:
static void updateEstateOwnerName(const std::string& name);
protected:
- LLHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
#endif
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index ef628be471..4097abc22d 100644
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -128,7 +128,7 @@ LLFloaterMap::LLFloaterMap(const std::string& name)
TRUE) // close button
{
const S32 LEFT = LLPANEL_BORDER_WIDTH;
- const S32 TOP = mRect.getHeight();
+ const S32 TOP = getRect().getHeight();
S32 y = 0;
@@ -136,7 +136,7 @@ LLFloaterMap::LLFloaterMap(const std::string& name)
LLRect map_rect(
LEFT,
TOP - LLPANEL_BORDER_WIDTH,
- mRect.getWidth() - LLPANEL_BORDER_WIDTH,
+ getRect().getWidth() - LLPANEL_BORDER_WIDTH,
y );
LLColor4 bg_color = gColors.getColor( "NetMapBackgroundColor" );
mMap = new LLNetMap("Net Map", map_rect, bg_color);
@@ -144,8 +144,7 @@ LLFloaterMap::LLFloaterMap(const std::string& name)
addChildAtEnd(mMap);
// Get the drag handle all the way in back
- removeChild(mDragHandle);
- addChildAtEnd(mDragHandle);
+ sendChildToBack(getDragHandle());
setIsChrome(TRUE);
}
@@ -191,14 +190,14 @@ void LLFloaterMap::draw()
if( gAgent.cameraMouselook())
{
setMouseOpaque(FALSE);
- mDragHandle->setMouseOpaque(FALSE);
+ getDragHandle()->setMouseOpaque(FALSE);
drawChild(mMap);
}
else
{
setMouseOpaque(TRUE);
- mDragHandle->setMouseOpaque(TRUE);
+ getDragHandle()->setMouseOpaque(TRUE);
LLFloater::draw();
}
diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp
index d4c9478fdf..1cac8fd4c5 100644
--- a/indra/newview/llfloaternamedesc.cpp
+++ b/indra/newview/llfloaternamedesc.cpp
@@ -106,10 +106,10 @@ BOOL LLFloaterNameDesc::postBuild()
setTitle(mFilename);
- centerWindow();
+ centerWithin(gViewerWindow->getRootView()->getRect());
- S32 line_width = mRect.getWidth() - 2 * PREVIEW_HPAD;
- S32 y = mRect.getHeight() - PREVIEW_LINE_HEIGHT;
+ S32 line_width = getRect().getWidth() - 2 * PREVIEW_HPAD;
+ S32 y = getRect().getHeight() - PREVIEW_LINE_HEIGHT;
r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
y -= PREVIEW_LINE_HEIGHT;
@@ -158,19 +158,6 @@ LLFloaterNameDesc::~LLFloaterNameDesc()
gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
}
-//-----------------------------------------------------------------------------
-// centerWindow()
-//-----------------------------------------------------------------------------
-void LLFloaterNameDesc::centerWindow()
-{
- LLRect window_rect = gViewerWindow->getRootView()->getRect();
-
- S32 dialog_left = window_rect.mLeft + (window_rect.getWidth() - mRect.getWidth()) / 2;
- S32 dialog_bottom = window_rect.mBottom + (window_rect.getHeight() - mRect.getHeight()) / 2;
-
- translate( dialog_left - mRect.mLeft, dialog_bottom - mRect.mBottom );
-}
-
// Sub-classes should override this function if they allow editing
//-----------------------------------------------------------------------------
// onCommit()
diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h
index 2b0ec9b78a..8c968329c2 100644
--- a/indra/newview/llfloaternamedesc.h
+++ b/indra/newview/llfloaternamedesc.h
@@ -50,7 +50,6 @@ public:
static void doCommit(class LLUICtrl *, void* userdata);
protected:
virtual void onCommit();
- virtual void centerWindow();
protected:
BOOL mIsAudio;
diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h
index cd656bccaa..76d9291d47 100644
--- a/indra/newview/llfloateropenobject.h
+++ b/indra/newview/llfloateropenobject.h
@@ -73,7 +73,7 @@ protected:
static LLFloaterOpenObject* sInstance;
LLPanelInventory* mPanelInventory;
- LLHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
BOOL mDirty;
};
diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp
index 1f5ebec684..044c8c9d90 100644
--- a/indra/newview/llfloaterpostcard.cpp
+++ b/indra/newview/llfloaterpostcard.cpp
@@ -157,9 +157,9 @@ void LLFloaterPostcard::draw()
LLGLSUIDefault gls_ui;
LLFloater::draw();
- if(getVisible() && !mMinimized && mViewerImage.notNull() && mJPEGImage.notNull())
+ if(getVisible() && !isMinimized() && mViewerImage.notNull() && mJPEGImage.notNull())
{
- LLRect rect(mRect);
+ LLRect rect(getRect());
// first set the max extents of our preview
rect.translate(-rect.mLeft, -rect.mBottom);
@@ -352,14 +352,14 @@ void LLFloaterPostcard::missingSubjMsgAlertCallback(S32 option, void* data)
if((self->childGetValue("subject_form").asString()).empty())
{
// Stuff the subject back into the form.
- self->childSetValue("subject_form", self->childGetText("default_subject"));
+ self->childSetValue("subject_form", self->getString("default_subject"));
}
if(!self->mHasFirstMsgFocus)
{
// The user never switched focus to the messagee window.
// Using the default string.
- self->childSetValue("msg_form", self->childGetText("default_message"));
+ self->childSetValue("msg_form", self->getString("default_message"));
}
self->sendPostcard();
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 060952667b..cac2d0a0b6 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -127,7 +127,7 @@ S32 pref_min_height()
}
-LLPreferenceCore::LLPreferenceCore(LLTabContainerCommon* tab_container, LLButton * default_btn) :
+LLPreferenceCore::LLPreferenceCore(LLTabContainer* tab_container, LLButton * default_btn) :
mTabContainer(tab_container),
mGeneralPanel(NULL),
mInputPanel(NULL),
@@ -314,7 +314,7 @@ void LLPreferenceCore::cancel()
// static
void LLPreferenceCore::onTabChanged(void* user_data, bool from_click)
{
- LLTabContainerCommon* self = (LLTabContainerCommon*)user_data;
+ LLTabContainer* self = (LLTabContainer*)user_data;
gSavedSettings.setS32("LastPrefTab", self->getCurrentPanelIndex());
}
@@ -363,7 +363,7 @@ BOOL LLFloaterPreference::postBuild()
mPreferenceCore = new LLPreferenceCore(
LLUICtrlFactory::getTabContainerByName(this, "pref core"),
- static_cast<LLButton *>(getChildByName("OK"))
+ getChild<LLButton>("OK")
);
sInstance = this;
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index bf554766b7..7396467d8c 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -62,13 +62,13 @@ class LLPreferenceCore
{
public:
- LLPreferenceCore(LLTabContainerCommon* tab_container, LLButton * default_btn);
+ LLPreferenceCore(LLTabContainer* tab_container, LLButton * default_btn);
~LLPreferenceCore();
void apply();
void cancel();
- LLTabContainerCommon* getTabContainer() { return mTabContainer; }
+ LLTabContainer* getTabContainer() { return mTabContainer; }
void setPersonalInfo(
const char* visibility,
@@ -78,7 +78,7 @@ public:
static void onTabChanged(void* user_data, bool from_click);
private:
- LLTabContainerCommon *mTabContainer;
+ LLTabContainer *mTabContainer;
LLPanelGeneral *mGeneralPanel;
LLPanelInput *mInputPanel;
LLPanelNetwork *mNetworkPanel;
diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp
index 82f72103f7..ace3eeac66 100644
--- a/indra/newview/llfloaterproperties.cpp
+++ b/indra/newview/llfloaterproperties.cpp
@@ -303,18 +303,13 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
//////////////////
// CREATOR NAME //
//////////////////
- char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- char last_name[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
if(!gCacheName) return;
if(!gAgent.getRegion()) return;
if (item->getCreatorUUID().notNull())
{
- gCacheName->getName(item->getCreatorUUID(), first_name, last_name);
- LLString name(first_name);
- name.append(1, ' ');
- name.append(last_name);
-
+ std::string name;
+ gCacheName->getFullName(item->getCreatorUUID(), name);
childSetEnabled("BtnCreator",TRUE);
childSetEnabled("LabelCreatorTitle",TRUE);
childSetEnabled("LabelCreatorName",TRUE);
@@ -325,7 +320,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
childSetEnabled("BtnCreator",FALSE);
childSetEnabled("LabelCreatorTitle",FALSE);
childSetEnabled("LabelCreatorName",FALSE);
- childSetText("LabelCreatorName",childGetText("unknown"));
+ childSetText("LabelCreatorName",getString("unknown"));
}
////////////////
@@ -336,16 +331,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
LLString name;
if (perm.isGroupOwned())
{
- char group_name[DB_GROUP_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- gCacheName->getGroupName(perm.getGroup(), group_name);
- name.assign(group_name);
+ gCacheName->getGroupName(perm.getGroup(), name);
}
else
{
- gCacheName->getName(perm.getOwner(), first_name, last_name);
- name.assign(first_name);
- name.append(1, ' ');
- name.append(last_name);
+ gCacheName->getFullName(perm.getOwner(), name);
}
childSetEnabled("BtnOwner",TRUE);
childSetEnabled("LabelOwnerTitle",TRUE);
@@ -357,7 +347,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
childSetEnabled("BtnOwner",FALSE);
childSetEnabled("LabelOwnerTitle",FALSE);
childSetEnabled("LabelOwnerName",FALSE);
- childSetText("LabelOwnerName",childGetText("public"));
+ childSetText("LabelOwnerName",getString("public"));
}
//////////////////
@@ -368,7 +358,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
time_t time_utc = (time_t)item->getCreationDate();
if (0 == time_utc)
{
- childSetText("LabelAcquiredDate",childGetText("unknown"));
+ childSetText("LabelAcquiredDate",getString("unknown"));
}
else
{
@@ -380,11 +370,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
///////////////////////
if(can_agent_manipulate)
{
- childSetText("OwnerLabel",childGetText("you_can"));
+ childSetText("OwnerLabel",getString("you_can"));
}
else
{
- childSetText("OwnerLabel",childGetText("owner_can"));
+ childSetText("OwnerLabel",getString("owner_can"));
}
U32 base_mask = perm.getMaskBase();
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index c3ded7de4f..4a3b2192c0 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -214,7 +214,6 @@ BOOL LLFloaterRegionInfo::postBuild()
LLFloaterRegionInfo::~LLFloaterRegionInfo()
{
- sInstance = NULL;
}
void LLFloaterRegionInfo::onOpen()
@@ -248,14 +247,17 @@ void LLFloaterRegionInfo::requestRegionInfo()
void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**)
{
static LLDispatcher dispatch;
- if(!sInstance) return;
-
+ if(!findInstance())
+ {
+ return;
+ }
+
if (!estate_dispatch_initialized)
{
LLPanelEstateInfo::initDispatch(dispatch);
}
- LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(sInstance, "region_panels");
+ LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels");
if (!tab) return;
LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab, "Estate");
@@ -283,8 +285,12 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
LLPanel* panel;
llinfos << "LLFloaterRegionInfo::processRegionInfo" << llendl;
- if(!sInstance) return;
- LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(sInstance, "region_panels");
+ if(!findInstance())
+ {
+ return;
+ }
+
+ LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels");
if(!tab) return;
// extract message
@@ -361,7 +367,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
panel->childSetValue("sun_hour_slider", LLSD(sun_hour));
panel->childSetEnabled("sun_hour_slider", allow_modify && !use_estate_sun);
- sInstance->refreshFromRegion( gAgent.getRegion() );
+ getInstance()->refreshFromRegion( gAgent.getRegion() );
}
// static
@@ -369,7 +375,7 @@ LLPanelEstateInfo* LLFloaterRegionInfo::getPanelEstate()
{
LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance();
if (!floater) return NULL;
- LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels");
+ LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels");
if (!tab) return NULL;
LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab,"Estate");
return panel;
@@ -380,7 +386,7 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant()
{
LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance();
if (!floater) return NULL;
- LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels");
+ LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels");
if (!tab) return NULL;
LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)LLUICtrlFactory::getPanelByName(tab, "Covenant");
return panel;
@@ -1249,7 +1255,7 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance();
if (!floater) return true;
- LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels");
+ LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels");
if (!tab) return true;
LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab, "Estate");
@@ -2543,35 +2549,35 @@ LLPanelEstateCovenant::LLPanelEstateCovenant()
// virtual
bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region)
{
- LLTextBox* region_name = (LLTextBox*)getChildByName("region_name_text");
+ LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
if (region_name)
{
region_name->setText(region->getName());
}
- LLTextBox* resellable_clause = (LLTextBox*)getChildByName("resellable_clause");
+ LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
if (resellable_clause)
{
if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
{
- resellable_clause->setText(childGetText("can_not_resell"));
+ resellable_clause->setText(getString("can_not_resell"));
}
else
{
- resellable_clause->setText(childGetText("can_resell"));
+ resellable_clause->setText(getString("can_resell"));
}
}
- LLTextBox* changeable_clause = (LLTextBox*)getChildByName("changeable_clause");
+ LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
if (changeable_clause)
{
if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
{
- changeable_clause->setText(childGetText("can_change"));
+ changeable_clause->setText(getString("can_change"));
}
else
{
- changeable_clause->setText(childGetText("can_not_change"));
+ changeable_clause->setText(getString("can_not_change"));
}
}
@@ -2597,12 +2603,12 @@ bool LLPanelEstateCovenant::estateUpdate(LLMessageSystem* msg)
BOOL LLPanelEstateCovenant::postBuild()
{
initHelpBtn("covenant_help", "HelpEstateCovenant");
- mEstateNameText = (LLTextBox*)getChildByName("estate_name_text");
- mEstateOwnerText = (LLTextBox*)getChildByName("estate_owner_text");
- mLastModifiedText = (LLTextBox*)getChildByName("covenant_timestamp_text");
- mEditor = (LLViewerTextEditor*)getChildByName("covenant_editor");
+ mEstateNameText = getChild<LLTextBox>("estate_name_text");
+ mEstateOwnerText = getChild<LLTextBox>("estate_owner_text");
+ mLastModifiedText = getChild<LLTextBox>("covenant_timestamp_text");
+ mEditor = getChild<LLViewerTextEditor>("covenant_editor");
if (mEditor) mEditor->setHandleEditKeysDirectly(TRUE);
- LLButton* reset_button = (LLButton*)getChildByName("reset_covenant");
+ LLButton* reset_button = getChild<LLButton>("reset_covenant");
reset_button->setEnabled(gAgent.canManageEstate());
reset_button->setClickedCallback(LLPanelEstateCovenant::resetCovenantID, NULL);
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 96cf8af667..cdda7e532c 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -58,9 +58,9 @@ class LLPanelRegionTerrainInfo;
class LLPanelEstateInfo;
class LLPanelEstateCovenant;
-class LLFloaterRegionInfo : public LLFloater, public LLUISingleton<LLFloaterRegionInfo>
+class LLFloaterRegionInfo : public LLFloater, public LLFloaterSingleton<LLFloaterRegionInfo>
{
- friend class LLUISingleton<LLFloaterRegionInfo>;
+ friend class LLUISingleton<LLFloaterRegionInfo, VisibilityPolicy<LLFloater> >;
public:
~LLFloaterRegionInfo();
@@ -90,7 +90,7 @@ protected:
void refreshFromRegion(LLViewerRegion* region);
// member data
- LLTabContainerCommon* mTab;
+ LLTabContainer* mTab;
typedef std::vector<LLPanelRegionInfo*> info_panels_t;
info_panels_t mInfoPanels;
//static S32 sRequestSerial; // serial # of last EstateOwnerRequest
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 2da9ed4e14..63d7d7b958 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -903,7 +903,7 @@ void LLFloaterReporter::takeScreenshot()
gImageList.addImage(image_in_list);
// the texture picker then uses that texture
- LLTexturePicker* texture = LLUICtrlFactory::getTexturePickerByName(this, "screenshot");
+ LLTexturePicker* texture = getChild<LLTextureCtrl>("screenshot");
if (texture)
{
texture->setImageAssetID(mResourceDatap->mAssetInfo.mUuid);
diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp
index 80a686d162..3a17e232b6 100644
--- a/indra/newview/llfloaterscriptdebug.cpp
+++ b/indra/newview/llfloaterscriptdebug.cpp
@@ -163,14 +163,14 @@ LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput()
LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLUUID& object_id)
: LLFloater("script instance floater", LLRect(0, 200, 200, 0), "Script", TRUE), mObjectID(object_id)
{
- S32 y = mRect.getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD;
+ S32 y = getRect().getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD;
S32 x = LLFLOATER_HPAD;
// History editor
// Give it a border on the top
LLRect history_editor_rect(
x,
y,
- mRect.getWidth() - LLFLOATER_HPAD,
+ getRect().getWidth() - LLFLOATER_HPAD,
LLFLOATER_VPAD );
mHistoryEditor = new LLViewerTextEditor( "Chat History Editor",
history_editor_rect, S32_MAX, "", LLFontGL::sSansSerif);
@@ -186,14 +186,14 @@ void LLFloaterScriptDebugOutput::init(const LLString& title, BOOL resizable,
BOOL minimizable, BOOL close_btn)
{
LLFloater::init(title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
- S32 y = mRect.getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD;
+ S32 y = getRect().getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD;
S32 x = LLFLOATER_HPAD;
// History editor
// Give it a border on the top
LLRect history_editor_rect(
x,
y,
- mRect.getWidth() - LLFLOATER_HPAD,
+ getRect().getWidth() - LLFLOATER_HPAD,
LLFLOATER_VPAD );
mHistoryEditor = new LLViewerTextEditor( "Chat History Editor",
history_editor_rect, S32_MAX, "", LLFontGL::sSansSerif);
diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp
index ffa1e13bf2..f3d8996b6a 100644
--- a/indra/newview/llfloatersellland.cpp
+++ b/indra/newview/llfloatersellland.cpp
@@ -244,13 +244,7 @@ void LLFloaterSellLandUI::updateParcelInfo()
if(mSellToBuyer)
{
LLString name;
- char firstname[MAX_STRING]; /* Flawfinder: ignore */
- char lastname[MAX_STRING]; /* Flawfinder: ignore */
- gCacheName->getName(mAuthorizedBuyer, firstname, lastname);
- name.assign(firstname);
- name.append(" ");
- name.append(lastname);
-
+ gCacheName->getFullName(mAuthorizedBuyer, name);
childSetText("sell_to_agent", name);
}
}
diff --git a/indra/newview/llfloatersellland.h b/indra/newview/llfloatersellland.h
index 8cada4e579..d8eb5d0a0a 100644
--- a/indra/newview/llfloatersellland.h
+++ b/indra/newview/llfloatersellland.h
@@ -40,7 +40,7 @@ class LLFloaterSellLand
{
public:
static void sellLand(LLViewerRegion* region,
- LLHandle<LLParcelSelection> parcel);
+ LLSafeHandle<LLParcelSelection> parcel);
};
#endif // LL_LLFLOATERSELLLAND_H
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 31c60d8b2d..d2f3bc7cf5 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -221,7 +221,7 @@ F32 LLSnapshotLivePreview::getImageAspect()
}
F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]);
- F32 window_aspect_ratio = ((F32)mRect.getWidth()) / ((F32)mRect.getHeight());
+ F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight());
if (gSavedSettings.getBOOL("KeepAspectForSnapshot"))
{
@@ -262,26 +262,26 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot)
}
LLRect& rect = mImageRect[mCurImageIndex];
- rect.set(0, mRect.getHeight(), mRect.getWidth(), 0);
+ rect.set(0, getRect().getHeight(), getRect().getWidth(), 0);
F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]);
- F32 window_aspect_ratio = ((F32)mRect.getWidth()) / ((F32)mRect.getHeight());
+ F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight());
if (gSavedSettings.getBOOL("KeepAspectForSnapshot"))
{
if (image_aspect_ratio > window_aspect_ratio)
{
// trim off top and bottom
- S32 new_height = llround((F32)mRect.getWidth() / image_aspect_ratio);
- rect.mBottom += (mRect.getHeight() - new_height) / 2;
- rect.mTop -= (mRect.getHeight() - new_height) / 2;
+ S32 new_height = llround((F32)getRect().getWidth() / image_aspect_ratio);
+ rect.mBottom += (getRect().getHeight() - new_height) / 2;
+ rect.mTop -= (getRect().getHeight() - new_height) / 2;
}
else if (image_aspect_ratio < window_aspect_ratio)
{
// trim off left and right
- S32 new_width = llround((F32)mRect.getHeight() * image_aspect_ratio);
- rect.mLeft += (mRect.getWidth() - new_width) / 2;
- rect.mRight -= (mRect.getWidth() - new_width) / 2;
+ S32 new_width = llround((F32)getRect().getHeight() * image_aspect_ratio);
+ rect.mLeft += (getRect().getWidth() - new_width) / 2;
+ rect.mRight -= (getRect().getWidth() - new_width) / 2;
}
}
}
@@ -314,7 +314,7 @@ void LLSnapshotLivePreview::draw()
mSnapshotUpToDate)
{
LLColor4 bg_color(0.f, 0.f, 0.3f, 0.4f);
- gl_rect_2d(mRect, bg_color);
+ gl_rect_2d(getRect(), bg_color);
LLRect &rect = mImageRect[mCurImageIndex];
LLRect shadow_rect = mImageRect[mCurImageIndex];
shadow_rect.stretch(BORDER_WIDTH);
@@ -349,7 +349,7 @@ void LLSnapshotLivePreview::draw()
glPopMatrix();
glColor4f(1.f, 1.f, 1.f, mFlashAlpha);
- gl_rect_2d(mRect);
+ gl_rect_2d(getRect());
if (mNeedsFlash)
{
if (mFlashAlpha < 1.f)
@@ -470,7 +470,7 @@ void LLSnapshotLivePreview::draw()
glPushMatrix();
{
LLRect& rect = mImageRect[old_image_index];
- glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(mRect.getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
+ glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f);
glBegin(GL_QUADS);
{
@@ -497,7 +497,7 @@ void LLSnapshotLivePreview::draw()
/*virtual*/
void LLSnapshotLivePreview::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- LLRect old_rect = mRect;
+ LLRect old_rect = getRect();
LLView::reshape(width, height, called_from_parent);
if (old_rect.getWidth() != width || old_rect.getHeight() != height)
{
@@ -742,7 +742,7 @@ public:
static void updateControls(LLFloaterSnapshot* floater);
static void updateLayout(LLFloaterSnapshot* floater);
- static LLViewHandle sPreviewHandle;
+ static LLHandle<LLView> sPreviewHandle;
private:
static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater);
@@ -757,12 +757,12 @@ public:
};
// static
-LLViewHandle LLFloaterSnapshot::Impl::sPreviewHandle;
+LLHandle<LLView> LLFloaterSnapshot::Impl::sPreviewHandle;
// static
LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater)
{
- LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)LLView::getViewByHandle(sPreviewHandle);
+ LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)sPreviewHandle.get();
return previewp;
}
@@ -817,7 +817,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
floaterp->getParent()->setMouseOpaque(TRUE);
// shrink to smaller layout
- floaterp->reshape(floaterp->mRect.getWidth(), 410);
+ floaterp->reshape(floaterp->getRect().getWidth(), 410);
// can see and interact with fullscreen preview now
if (previewp)
@@ -850,7 +850,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
else // turning off freeze frame mode
{
floaterp->getParent()->setMouseOpaque(FALSE);
- floaterp->reshape(floaterp->mRect.getWidth(), 510);
+ floaterp->reshape(floaterp->getRect().getWidth(), 510);
if (previewp)
{
previewp->setVisible(FALSE);
@@ -1242,8 +1242,8 @@ LLFloaterSnapshot::~LLFloaterSnapshot()
{
if (sInstance == this)
{
- delete LLView::getViewByHandle(Impl::sPreviewHandle);
- Impl::sPreviewHandle = LLViewHandle::sDeadHandle;
+ LLView::deleteViewByHandle(Impl::sPreviewHandle);
+ Impl::sPreviewHandle = LLHandle<LLView>();
sInstance = NULL;
}
@@ -1315,7 +1315,7 @@ BOOL LLFloaterSnapshot::postBuild()
sInstance->getRootView()->addChild(previewp);
sInstance->getRootView()->addChild(gSnapshotFloaterView);
- Impl::sPreviewHandle = previewp->mViewHandle;
+ Impl::sPreviewHandle = previewp->getHandle();
impl.updateControls(this);
@@ -1332,7 +1332,7 @@ void LLFloaterSnapshot::draw()
return;
}
- if(getVisible() && !mMinimized)
+ if(getVisible() && !isMinimized())
{
if (previewp && previewp->getDataSize() > 0)
{
@@ -1359,7 +1359,7 @@ void LLFloaterSnapshot::draw()
}
else
{
- childSetTextArg("file_size_label", "[SIZE]", childGetText("unknwon"));
+ childSetTextArg("file_size_label", "[SIZE]", getString("unknown"));
childSetColor("file_size_label", gColors.getColor( "LabelTextColor" ));
}
childSetEnabled("upload_btn", previewp->getSnapshotUpToDate());
@@ -1386,7 +1386,7 @@ void LLFloaterSnapshot::draw()
{
F32 aspect = previewp->getImageAspect();
// UI size for thumbnail
- S32 max_width = mRect.getWidth() - 20;
+ S32 max_width = getRect().getWidth() - 20;
S32 max_height = 90;
S32 img_render_width = 0;
@@ -1414,7 +1414,7 @@ void LLFloaterSnapshot::draw()
glScalef(llmin(1.f, (F32)image_width / (F32)previewp->getCurrentImage()->getWidth()), llmin(1.f, (F32)image_height / (F32)previewp->getCurrentImage()->getHeight()), 1.f);
}
glMatrixMode(GL_MODELVIEW);
- gl_draw_scaled_image((mRect.getWidth() - img_render_width) / 2, 35 + (max_height - img_render_height) / 2, img_render_width, img_render_height, previewp->getCurrentImage(), LLColor4::white);
+ gl_draw_scaled_image((getRect().getWidth() - img_render_width) / 2, 35 + (max_height - img_render_height) / 2, img_render_width, img_render_height, previewp->getCurrentImage(), LLColor4::white);
}
glMatrixMode(GL_TEXTURE);
glPopMatrix();
diff --git a/indra/newview/llfloatertelehub.h b/indra/newview/llfloatertelehub.h
index 5b9821ebe9..dd7631f6dd 100644
--- a/indra/newview/llfloatertelehub.h
+++ b/indra/newview/llfloatertelehub.h
@@ -75,7 +75,7 @@ private:
S32 mNumSpawn;
LLVector3 mSpawnPointPos[MAX_SPAWNPOINTS_PER_TELEHUB];
- LLHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
static LLFloaterTelehub* sInstance;
};
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index d03ce373cc..8879be2e51 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -181,7 +181,7 @@ BOOL LLFloaterTools::postBuild()
// make sounds on visibility changes.
setSoundFlags(LLView::SILENT);
- mDragHandle->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") );
+ getDragHandle()->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") );
LLRect rect;
mBtnFocus = LLUICtrlFactory::getButtonByName(this,"button focus");//btn;
@@ -317,14 +317,14 @@ BOOL LLFloaterTools::postBuild()
mTab->selectFirstTab();
}
- mStatusText["rotate"] = childGetText("status_rotate");
- mStatusText["scale"] = childGetText("status_scale");
- mStatusText["move"] = childGetText("status_move");
- mStatusText["modifyland"] = childGetText("status_modifyland");
- mStatusText["camera"] = childGetText("status_camera");
- mStatusText["grab"] = childGetText("status_grab");
- mStatusText["place"] = childGetText("status_place");
- mStatusText["selectland"] = childGetText("status_selectland");
+ mStatusText["rotate"] = getString("status_rotate");
+ mStatusText["scale"] = getString("status_scale");
+ mStatusText["move"] = getString("status_move");
+ mStatusText["modifyland"] = getString("status_modifyland");
+ mStatusText["camera"] = getString("status_camera");
+ mStatusText["grab"] = getString("status_grab");
+ mStatusText["place"] = getString("status_place");
+ mStatusText["selectland"] = getString("status_selectland");
return TRUE;
}
@@ -396,7 +396,7 @@ LLFloaterTools::LLFloaterTools()
mTabLand(NULL),
mDirty(TRUE)
{
- mAutoFocus = FALSE;
+ setAutoFocus(FALSE);
LLCallbackMap::map_t factory_map;
factory_map["General"] = LLCallbackMap(createPanelPermissions, this);//LLPanelPermissions
factory_map["Object"] = LLCallbackMap(createPanelObject, this);//LLPanelObject
@@ -442,7 +442,7 @@ void LLFloaterTools::setStatusText(const std::string& text)
void LLFloaterTools::refresh()
{
- const S32 INFO_WIDTH = mRect.getWidth();
+ const S32 INFO_WIDTH = getRect().getWidth();
const S32 INFO_HEIGHT = 384;
LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT);
BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME );
@@ -611,19 +611,19 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
switch (mObjectSelection->getSelectType())
{
case SELECT_TYPE_HUD:
- mComboGridMode->add(childGetText("grid_screen_text"));
- mComboGridMode->add(childGetText("grid_local_text"));
- //mComboGridMode->add(childGetText("grid_reference_text"));
+ mComboGridMode->add(getString("grid_screen_text"));
+ mComboGridMode->add(getString("grid_local_text"));
+ //mComboGridMode->add(getString("grid_reference_text"));
break;
case SELECT_TYPE_WORLD:
- mComboGridMode->add(childGetText("grid_world_text"));
- mComboGridMode->add(childGetText("grid_local_text"));
- mComboGridMode->add(childGetText("grid_reference_text"));
+ mComboGridMode->add(getString("grid_world_text"));
+ mComboGridMode->add(getString("grid_local_text"));
+ mComboGridMode->add(getString("grid_reference_text"));
break;
case SELECT_TYPE_ATTACHMENT:
- mComboGridMode->add(childGetText("grid_attachment_text"));
- mComboGridMode->add(childGetText("grid_local_text"));
- mComboGridMode->add(childGetText("grid_reference_text"));
+ mComboGridMode->add(getString("grid_attachment_text"));
+ mComboGridMode->add(getString("grid_local_text"));
+ mComboGridMode->add(getString("grid_reference_text"));
break;
}
@@ -805,12 +805,12 @@ void LLFloaterTools::showMore(BOOL show_more)
if (show_more)
{
- reshape( mRect.getWidth(), mLargeHeight, TRUE);
+ reshape( getRect().getWidth(), mLargeHeight, TRUE);
translate( 0, mSmallHeight - mLargeHeight );
}
else
{
- reshape( mRect.getWidth(), mSmallHeight, TRUE);
+ reshape( getRect().getWidth(), mSmallHeight, TRUE);
translate( 0, mLargeHeight - mSmallHeight );
}
childSetVisible("button less", show_more);
diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h
index f56cdbecb5..a6fdc76d9f 100644
--- a/indra/newview/llfloatertools.h
+++ b/indra/newview/llfloatertools.h
@@ -34,6 +34,7 @@
#include "llfloater.h"
#include "llcoord.h"
+#include "llparcelselection.h"
class LLButton;
class LLTextBox;
@@ -50,8 +51,7 @@ class LLComboBox;
class LLParcelSelection;
class LLObjectSelection;
-typedef LLHandle<LLParcelSelection> LLParcelSelectionHandle;
-typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle;
+typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
class LLFloaterTools
: public LLFloater
@@ -174,7 +174,7 @@ public:
std::vector<LLButton*> mButtons;//[ 15 ];
- LLTabContainerCommon *mTab;
+ LLTabContainer *mTab;
LLPanelPermissions *mPanelPermissions;
LLPanelObject *mPanelObject;
LLPanelVolume *mPanelVolume;
diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp
index 6bbb748a10..593d1f5114 100644
--- a/indra/newview/llfloatertopobjects.cpp
+++ b/indra/newview/llfloatertopobjects.cpp
@@ -207,7 +207,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
LLSD element;
element["id"] = LLUUID::null;
element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = childGetText("none_descriptor");
+ element["columns"][0]["value"] = getString("none_descriptor");
element["columns"][0]["font"] = "SANSSERIF";
list->addElement(element);
@@ -219,19 +219,19 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS)
{
- setTitle(childGetText("top_scripts_title"));
- list->setColumnLabel("score", childGetText("scripts_score_label"));
+ setTitle(getString("top_scripts_title"));
+ list->setColumnLabel("score", getString("scripts_score_label"));
- LLUIString format = childGetText("top_scripts_text");
+ LLUIString format = getString("top_scripts_text");
format.setArg("[COUNT]", llformat("%d", total_count));
format.setArg("[TIME]", llformat("%0.1f", mtotalScore));
childSetValue("title_text", LLSD(format));
}
else
{
- setTitle(childGetText("top_colliders_title"));
- list->setColumnLabel("score", childGetText("colliders_score_label"));
- LLUIString format = childGetText("top_colliders_text");
+ setTitle(getString("top_colliders_title"));
+ list->setColumnLabel("score", getString("colliders_score_label"));
+ LLUIString format = getString("top_colliders_text");
format.setArg("[COUNT]", llformat("%d", total_count));
childSetValue("title_text", LLSD(format));
}
diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp
index bdf583126f..5875c4bef7 100644
--- a/indra/newview/llfloatertos.cpp
+++ b/indra/newview/llfloatertos.cpp
@@ -159,7 +159,7 @@ BOOL LLFloaterTOS::postBuild()
editor->setVisible( FALSE );
};
- LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "tos_html");
+ LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("tos_html");
if ( web_browser )
{
// start to observe it so we see navigate complete events
@@ -169,7 +169,7 @@ BOOL LLFloaterTOS::postBuild()
};
gResponsePtr = LLIamHere::build( this );
- LLHTTPClient::get( childGetValue( "real_url" ).asString(), gResponsePtr );
+ LLHTTPClient::get( getString( "real_url" ), gResponsePtr );
};
return TRUE;
@@ -180,14 +180,14 @@ void LLFloaterTOS::setSiteIsAlive( bool alive )
// only do this for TOS pages
if ( mType == TOS_TOS )
{
- LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "tos_html");
+ LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("tos_html");
// if the contents of the site was retrieved
if ( alive )
{
if ( web_browser )
{
// navigate to the "real" page
- web_browser->navigateTo( childGetValue( "real_url" ).asString() );
+ web_browser->navigateTo( getString( "real_url" ) );
};
}
else
@@ -212,7 +212,7 @@ void LLFloaterTOS::setSiteIsAlive( bool alive )
LLFloaterTOS::~LLFloaterTOS()
{
// stop obsaerving events
- LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "tos_html");
+ LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("tos_html");
if ( web_browser )
{
web_browser->addObserver( this );
diff --git a/indra/newview/llfloaterurldisplay.h b/indra/newview/llfloaterurldisplay.h
index 5ee447391f..307b16fd73 100644
--- a/indra/newview/llfloaterurldisplay.h
+++ b/indra/newview/llfloaterurldisplay.h
@@ -39,7 +39,7 @@ class LLPanelPlace;
class LLSD;
class LLUUID;
-class LLFloaterURLDisplay : public LLFloater, public LLUISingleton<LLFloaterURLDisplay>
+class LLFloaterURLDisplay : public LLFloater, public LLFloaterSingleton<LLFloaterURLDisplay>
{
public:
LLFloaterURLDisplay(const LLSD& sd);
diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp
index 1ad9e0577c..f121efb6b7 100644
--- a/indra/newview/llfloaterurlentry.cpp
+++ b/indra/newview/llfloaterurlentry.cpp
@@ -27,11 +27,11 @@ static LLFloaterURLEntry* sInstance = NULL;
class LLMediaTypeResponder : public LLHTTPClient::Responder
{
public:
- LLMediaTypeResponder( LLViewHandle parent ) :
+ LLMediaTypeResponder( const LLHandle<LLFloater> parent ) :
mParent( parent )
{}
- LLViewHandle mParent;
+ LLHandle<LLFloater> mParent;
virtual void completedHeader(U32 status, const std::string& reason, const LLSD& content)
@@ -49,8 +49,7 @@ public:
void completeAny(U32 status, const std::string& mime_type)
{
- LLFloaterURLEntry* floater_url_entry =
- (LLFloaterURLEntry*)LLFloater::getFloaterByHandle(mParent);
+ LLFloaterURLEntry* floater_url_entry = (LLFloaterURLEntry*)mParent.get();
if ( floater_url_entry )
floater_url_entry->headerFetchComplete( status, mime_type );
}
@@ -59,7 +58,7 @@ public:
//-----------------------------------------------------------------------------
// LLFloaterURLEntry()
//-----------------------------------------------------------------------------
-LLFloaterURLEntry::LLFloaterURLEntry(LLViewHandle parent)
+LLFloaterURLEntry::LLFloaterURLEntry(LLHandle<LLPanel> parent)
:
LLFloater(),
mPanelLandMediaHandle(parent)
@@ -119,7 +118,7 @@ void LLFloaterURLEntry::buildURLHistory()
void LLFloaterURLEntry::headerFetchComplete(U32 status, const std::string& mime_type)
{
- LLPanelLandMedia* panel_media = (LLPanelLandMedia*)LLPanel::getPanelByHandle(mPanelLandMediaHandle);
+ LLPanelLandMedia* panel_media = (LLPanelLandMedia*)mPanelLandMediaHandle.get();
if (panel_media)
{
// status is ignored for now -- error = "none/none"
@@ -133,7 +132,7 @@ void LLFloaterURLEntry::headerFetchComplete(U32 status, const std::string& mime_
}
// static
-LLViewHandle LLFloaterURLEntry::show(LLViewHandle parent)
+LLHandle<LLFloater> LLFloaterURLEntry::show(LLHandle<LLPanel> parent)
{
if (sInstance)
{
@@ -149,7 +148,7 @@ LLViewHandle LLFloaterURLEntry::show(LLViewHandle parent)
void LLFloaterURLEntry::updateFromLandMediaPanel()
{
- LLPanelLandMedia* panel_media = (LLPanelLandMedia*)LLPanel::getPanelByHandle(mPanelLandMediaHandle);
+ LLPanelLandMedia* panel_media = (LLPanelLandMedia*)mPanelLandMediaHandle.get();
if (panel_media)
{
std::string media_url = panel_media->getMediaURL();
diff --git a/indra/newview/llfloaterurlentry.h b/indra/newview/llfloaterurlentry.h
index 022c1eddd7..95954d82bb 100644
--- a/indra/newview/llfloaterurlentry.h
+++ b/indra/newview/llfloaterurlentry.h
@@ -10,15 +10,17 @@
#define LL_LLFLOATERURLENTRY_H
#include "llfloater.h"
+#include "llpanellandmedia.h"
class LLLineEditor;
+class LLComboBox;
class LLFloaterURLEntry : public LLFloater
{
public:
// Can only be shown by LLPanelLandMedia, and pushes data back into
// that panel via the handle.
- static LLViewHandle show(LLViewHandle panel_land_media_handle);
+ static LLHandle<LLFloater> show(LLHandle<LLPanel> panel_land_media_handle);
void updateFromLandMediaPanel();
@@ -27,13 +29,13 @@ public:
bool addURLToCombobox(const std::string& media_url);
private:
- LLFloaterURLEntry(LLViewHandle parent);
+ LLFloaterURLEntry(LLHandle<LLPanel> parent);
/*virtual*/ ~LLFloaterURLEntry();
void buildURLHistory();
private:
LLComboBox* mMediaURLEdit;
- LLViewHandle mPanelLandMediaHandle;
+ LLHandle<LLPanel> mPanelLandMediaHandle;
static void onBtnOK(void*);
static void onBtnCancel(void*);
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 9f9396a2d0..9da923e739 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -39,13 +39,6 @@
#include "llfloaterworldmap.h"
-// Library includes
-#include "llfontgl.h"
-#include "llinventory.h"
-#include "lllineeditor.h"
-#include "message.h"
-
-// Viewer includes
#include "llagent.h"
#include "llviewerwindow.h"
#include "llbutton.h"
@@ -54,36 +47,23 @@
#include "llcombobox.h"
#include "llviewercontrol.h"
#include "lldraghandle.h"
-#include "lleconomy.h"
#include "llfirstuse.h"
#include "llfocusmgr.h"
-#include "lliconctrl.h"
#include "llinventorymodel.h"
-#include "llinventoryview.h"
#include "lllandmarklist.h"
+#include "lllineeditor.h"
#include "llnetmap.h"
#include "llpreviewlandmark.h"
-#include "llradiogroup.h"
#include "llregionhandle.h"
-#include "llresizehandle.h"
-#include "llresmgr.h"
#include "llscrolllistctrl.h"
-#include "llsliderctrl.h"
-#include "llspinctrl.h"
-#include "llstatusbar.h"
-#include "lltabcontainer.h"
#include "lltextbox.h"
#include "lltracker.h"
-#include "llui.h"
-#include "lluiconstants.h"
#include "llurldispatcher.h"
-#include "llviewercamera.h"
#include "llviewermenu.h"
#include "llviewerregion.h"
#include "llviewerstats.h"
#include "llworldmap.h"
#include "llworldmapview.h"
-#include "llurl.h"
#include "llvieweruictrlfactory.h"
#include "llappviewer.h"
#include "llmapimagetype.h"
@@ -518,7 +498,7 @@ void LLFloaterWorldMap::draw()
childSetEnabled("copy_slurl", (mSLURL.size() > 0) );
setMouseOpaque(TRUE);
- mDragHandle->setMouseOpaque(TRUE);
+ getDragHandle()->setMouseOpaque(TRUE);
//RN: snaps to zoom value because interpolation caused jitter in the text rendering
if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)childGetValue("zoom slider").asReal())
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index 6f3c583557..3cf12a9eb7 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -161,7 +161,7 @@ protected:
void cacheLandmarkPosition();
protected:
- LLTabContainerCommon* mTabs;
+ LLTabContainer* mTabs;
// Sets gMapScale, in pixels per region
F32 mCurZoomVal;
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 90df2284c5..a710d1688d 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -87,6 +87,11 @@ const F32 FOLDER_CLOSE_TIME_CONSTANT = 0.02f;
const F32 FOLDER_OPEN_TIME_CONSTANT = 0.03f;
const S32 MAX_FOLDER_ITEM_OVERLAP = 2;
+enum {
+ SIGNAL_NO_KEYBOARD_FOCUS = 1,
+ SIGNAL_KEYBOARD_FOCUS = 2
+};
+
F32 LLFolderView::sAutoOpenTime = 1.f;
void delete_selected_item(void* user_data);
@@ -600,16 +605,6 @@ const LLString& LLFolderViewItem::getName( void ) const
return mLabel;
}
-LLFolderViewFolder* LLFolderViewItem::getParentFolder( void )
-{
- return mParentFolder;
-}
-
-LLFolderViewEventListener* LLFolderViewItem::getListener( void )
-{
- return mListener;
-}
-
// LLView functionality
BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask )
{
@@ -817,7 +812,7 @@ void LLFolderViewItem::draw()
LLGLSTexture gls_texture;
if (mArrowImage)
{
- gl_draw_scaled_rotated_image(mIndentation, mRect.getHeight() - ARROW_SIZE - TEXT_PAD,
+ gl_draw_scaled_rotated_image(mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD,
ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, mArrowImage, sFgColor);
}
}
@@ -853,33 +848,33 @@ void LLFolderViewItem::draw()
gl_rect_2d(
0,
- mRect.getHeight(),
- mRect.getWidth() - 2,
- llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD),
+ getRect().getHeight(),
+ getRect().getWidth() - 2,
+ llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD),
bg_color, filled);
if (mIsCurSelection)
{
gl_rect_2d(
0,
- mRect.getHeight(),
- mRect.getWidth() - 2,
- llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD),
+ getRect().getHeight(),
+ getRect().getWidth() - 2,
+ llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD),
sHighlightFgColor, FALSE);
}
- if (mRect.getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2)
+ if (getRect().getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2)
{
gl_rect_2d(
0,
- llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD) - 2,
- mRect.getWidth() - 2,
+ llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD) - 2,
+ getRect().getWidth() - 2,
2,
sHighlightFgColor, FALSE);
if (show_context)
{
gl_rect_2d(
0,
- llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD) - 2,
- mRect.getWidth() - 2,
+ llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD) - 2,
+ getRect().getWidth() - 2,
2,
sHighlightBgColor, TRUE);
}
@@ -890,17 +885,17 @@ void LLFolderViewItem::draw()
LLGLSNoTexture gls_no_texture;
gl_rect_2d(
0,
- mRect.getHeight(),
- mRect.getWidth() - 2,
- llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD),
+ getRect().getHeight(),
+ getRect().getWidth() - 2,
+ llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD),
sHighlightBgColor, FALSE);
- if (mRect.getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2)
+ if (getRect().getHeight() > llround(sFont->getLineHeight()) + ICON_PAD + 2)
{
gl_rect_2d(
0,
- llfloor(mRect.getHeight() - sFont->getLineHeight() - ICON_PAD) - 2,
- mRect.getWidth() - 2,
+ llfloor(getRect().getHeight() - sFont->getLineHeight() - ICON_PAD) - 2,
+ getRect().getWidth() - 2,
2,
sHighlightBgColor, FALSE);
}
@@ -910,7 +905,7 @@ void LLFolderViewItem::draw()
if(mIcon)
{
- gl_draw_image(mIndentation + ARROW_SIZE + TEXT_PAD, mRect.getHeight() - mIcon->getHeight(), mIcon);
+ gl_draw_image(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight(), mIcon);
mIcon->addTextureStats( (F32)(mIcon->getWidth() * mIcon->getHeight()));
}
@@ -920,7 +915,7 @@ void LLFolderViewItem::draw()
BOOL debug_filters = getRoot()->getDebugFilters();
LLColor4 color = ( (mIsSelected && filled) ? sHighlightFgColor : sFgColor );
F32 right_x;
- F32 y = (F32)mRect.getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD;
+ F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD;
if (debug_filters)
{
@@ -963,14 +958,14 @@ void LLFolderViewItem::draw()
LLString combined_string = mLabel + mLabelSuffix;
S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1;
S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2;
- S32 bottom = llfloor(mRect.getHeight() - sFont->getLineHeight() - 3);
- S32 top = mRect.getHeight();
+ S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3);
+ S32 top = getRect().getHeight();
LLViewerImage::bindTexture(mBoxImage);
glColor4fv(sFilterBGColor.mV);
gl_segmented_rect_2d_tex(left, top, right, bottom, mBoxImage->getWidth(), mBoxImage->getHeight(), 16);
F32 match_string_left = text_left + sFont->getWidthF32(combined_string, 0, mStringMatchOffset);
- F32 y = (F32)mRect.getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD;
+ F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD;
sFont->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y,
sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle,
filter_string_length, S32_MAX, &right_x, FALSE );
@@ -1074,7 +1069,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
if (mIsOpen)
{
// Add sizes of children
- S32 parent_item_height = mRect.getHeight();
+ S32 parent_item_height = getRect().getHeight();
folders_t::iterator fit = mFolders.begin();
folders_t::iterator fend = mFolders.end();
@@ -1158,7 +1153,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
{
folders_t::iterator fit = iter++;
// number of pixels that bottom of folder label is from top of parent folder
- if (mRect.getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight()
+ if (getRect().getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight()
> llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP)
{
// hide if beyond current folder height
@@ -1171,7 +1166,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
{
items_t::iterator iit = iter++;
// number of pixels that bottom of item label is from top of parent folder
- if (mRect.getHeight() - (*iit)->getRect().mBottom
+ if (getRect().getHeight() - (*iit)->getRect().mBottom
> llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP)
{
(*iit)->setVisible(FALSE);
@@ -1184,7 +1179,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
}
// don't change width as this item is already as wide as its parent folder
- reshape(mRect.getWidth(),llround(mCurHeight));
+ reshape(getRect().getWidth(),llround(mCurHeight));
// pass current height value back to parent
*height = llround(mCurHeight);
@@ -1903,7 +1898,7 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item)
item,
mSortFunction);
mItems.insert(it,item);
- item->setRect(LLRect(0, 0, mRect.getWidth(), 0));
+ item->setRect(LLRect(0, 0, getRect().getWidth(), 0));
item->setVisible(FALSE);
addChild( item );
item->dirtyFilter();
@@ -1921,7 +1916,7 @@ BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder)
mSortFunction);
mFolders.insert(it,folder);
folder->setOrigin(0, 0);
- folder->reshape(mRect.getWidth(), 0);
+ folder->reshape(getRect().getWidth(), 0);
folder->setVisible(FALSE);
addChild( folder );
folder->dirtyFilter();
@@ -1972,6 +1967,7 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL open, ERecurseType recur
mListener->openItem();
}
}
+
if (recurse == RECURSE_DOWN || recurse == RECURSE_UP_DOWN)
{
for (folders_t::iterator iter = mFolders.begin();
@@ -2131,7 +2127,7 @@ BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask)
handled = LLFolderViewItem::handleHover(x, y, mask);
}
- //if(x < LEFT_INDENTATION + mIndentation && x > mIndentation - LEFT_PAD && y > mRect.getHeight() - )
+ //if(x < LEFT_INDENTATION + mIndentation && x > mIndentation - LEFT_PAD && y > getRect().getHeight() - )
//{
// gViewerWindow->setCursor(UI_CURSOR_ARROW);
// mExpanderHighlighted = TRUE;
@@ -2544,7 +2540,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico
#pragma warning( pop )
#endif
mScrollContainer( NULL ),
- mPopupMenuHandle( LLViewHandle::sDeadHandle ),
+ mPopupMenuHandle(),
mAllowMultiSelect(TRUE),
mShowFolderHierarchy(FALSE),
mSourceID(source_id),
@@ -2562,11 +2558,11 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico
mArrangeGeneration(0),
mUserData(NULL),
mSelectCallback(NULL),
- mSelectionChanged(FALSE),
+ mSignalSelectCallback(0),
mMinWidth(0),
mDragAndDropThisFrame(FALSE)
{
- LLRect new_rect(rect.mLeft, rect.mBottom + mRect.getHeight(), rect.mLeft + mRect.getWidth(), rect.mBottom);
+ LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom);
setRect( rect );
reshape(rect.getWidth(), rect.getHeight());
mIsOpen = TRUE; // this view is always open.
@@ -2582,7 +2578,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico
// just make sure the label ("Inventory Folder") never shows up
mLabel = LLString::null;
- mRenamer = new LLLineEditor("ren", mRect, "", sFont,
+ mRenamer = new LLLineEditor("ren", getRect(), "", sFont,
DB_INV_ITEM_NAME_STR_LEN,
&LLFolderView::commitRename,
NULL,
@@ -2606,7 +2602,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico
}
menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor"));
menu->setVisible(FALSE);
- mPopupMenuHandle = menu->mViewHandle;
+ mPopupMenuHandle = menu->getHandle();
setTabStop(TRUE);
}
@@ -2710,7 +2706,7 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder)
mFolders.insert(mFolders.begin(), folder);
}
folder->setOrigin(0, 0);
- folder->reshape(mRect.getWidth(), 0);
+ folder->reshape(getRect().getWidth(), 0);
folder->setVisible(FALSE);
addChild( folder );
folder->dirtyFilter();
@@ -2726,7 +2722,7 @@ void LLFolderView::closeAllFolders()
void LLFolderView::openFolder(const LLString& foldername)
{
- LLFolderViewFolder* inv = (LLFolderViewFolder*)getChildByName(foldername);
+ LLFolderViewFolder* inv = getChild<LLFolderViewFolder>(foldername);
if (inv)
{
setSelection(inv, FALSE, FALSE);
@@ -2759,7 +2755,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen
S32 total_width = LEFT_PAD;
S32 running_height = mDebugFilters ? llceil(sSmallFont->getLineHeight()) : 0;
S32 target_height = running_height;
- S32 parent_item_height = mRect.getHeight();
+ S32 parent_item_height = getRect().getHeight();
for (folders_t::iterator iter = mFolders.begin();
iter != mFolders.end();)
@@ -2943,7 +2939,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL open, /* Flaw
llassert(mSelectedItems.size() <= 1);
- mSelectionChanged = TRUE;
+ mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS;
return rv;
}
@@ -2985,7 +2981,7 @@ BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected)
rv = LLFolderViewFolder::changeSelection(selection, selected);
- mSelectionChanged = TRUE;
+ mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS;
return rv;
}
@@ -3011,7 +3007,7 @@ S32 LLFolderView::extendSelection(LLFolderViewItem* selection, LLFolderViewItem*
rv++;
}
- mSelectionChanged = TRUE;
+ mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS;
return rv;
}
@@ -3181,7 +3177,7 @@ void LLFolderView::draw()
LLString current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d",
mFilter.getCurrentGeneration(), mFilter.getMinRequiredGeneration(), mFilter.getMustPassGeneration());
sSmallFont->renderUTF8(current_filter_string, 0, 2,
- mRect.getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f),
+ getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f),
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE );
}
@@ -3287,7 +3283,7 @@ void LLFolderView::revertRenamingItem( void )
void LLFolderView::removeSelectedItems( void )
{
- if(getVisible() && mEnabled)
+ if(getVisible() && getEnabled())
{
// just in case we're removing the renaming item.
mRenameItem = NULL;
@@ -3392,7 +3388,7 @@ void LLFolderView::removeSelectedItems( void )
// open the selected item.
void LLFolderView::openSelectedItems( void )
{
- if(getVisible() && mEnabled)
+ if(getVisible() && getEnabled())
{
if (mSelectedItems.size() == 1)
{
@@ -3432,7 +3428,7 @@ void LLFolderView::openSelectedItems( void )
void LLFolderView::propertiesSelectedItems( void )
{
- if(getVisible() && mEnabled)
+ if(getVisible() && getEnabled())
{
if (mSelectedItems.size() == 1)
{
@@ -3531,17 +3527,16 @@ BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder)
return FALSE;
}
-BOOL LLFolderView::canCopy()
+BOOL LLFolderView::canCopy() const
{
- if (!(getVisible() && mEnabled && (mSelectedItems.size() > 0)))
+ if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0)))
{
return FALSE;
}
-
- selected_items_t::iterator selected_it;
- for (selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it)
+
+ for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it)
{
- LLFolderViewItem* item = *selected_it;
+ const LLFolderViewItem* item = *selected_it;
if (!item->getListener()->isItemCopyable())
{
return FALSE;
@@ -3556,7 +3551,7 @@ void LLFolderView::copy()
// *NOTE: total hack to clear the inventory clipboard
LLInventoryClipboard::instance().reset();
S32 count = mSelectedItems.size();
- if(getVisible() && mEnabled && (count > 0))
+ if(getVisible() && getEnabled() && (count > 0))
{
LLFolderViewEventListener* listener = NULL;
selected_items_t::iterator item_it;
@@ -3572,7 +3567,7 @@ void LLFolderView::copy()
mSearchString.clear();
}
-BOOL LLFolderView::canCut()
+BOOL LLFolderView::canCut() const
{
return FALSE;
}
@@ -3582,24 +3577,24 @@ void LLFolderView::cut()
// implement Windows-style cut-and-leave
}
-BOOL LLFolderView::canPaste()
+BOOL LLFolderView::canPaste() const
{
if (mSelectedItems.empty())
{
return FALSE;
}
- if(getVisible() && mEnabled)
+ if(getVisible() && getEnabled())
{
- selected_items_t::iterator item_it;
- for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
+ for (selected_items_t::const_iterator item_it = mSelectedItems.begin();
+ item_it != mSelectedItems.end(); ++item_it)
{
// *TODO: only check folders and parent folders of items
- LLFolderViewItem* item = (*item_it);
- LLFolderViewEventListener* listener = item->getListener();
+ const LLFolderViewItem* item = (*item_it);
+ const LLFolderViewEventListener* listener = item->getListener();
if(!listener || !listener->isClipboardPasteable())
{
- LLFolderViewFolder* folderp = item->getParentFolder();
+ const LLFolderViewFolder* folderp = item->getParentFolder();
listener = folderp->getListener();
if (!listener || !listener->isClipboardPasteable())
{
@@ -3615,7 +3610,7 @@ BOOL LLFolderView::canPaste()
// paste selected item
void LLFolderView::paste()
{
- if(getVisible() && mEnabled)
+ if(getVisible() && getEnabled())
{
// find set of unique folders to paste into
std::set<LLFolderViewItem*> folder_set;
@@ -3657,7 +3652,7 @@ void LLFolderView::startRenamingSelectedItem( void )
{
item = mSelectedItems.front();
}
- if(getVisible() && mEnabled && (count == 1) && item && item->getListener() &&
+ if(getVisible() && getEnabled() && (count == 1) && item && item->getListener() &&
item->getListener()->isItemRenameable())
{
mRenameItem = item;
@@ -3676,7 +3671,7 @@ void LLFolderView::startRenamingSelectedItem( void )
mScrollContainer->calcVisibleSize( &scroller_width, &scroller_height, &dummy_bool, &dummy_bool);
}
- S32 width = llmax(llmin(item->getRect().getWidth() - x, scroller_width - x - mRect.mLeft), MINIMUM_RENAMER_WIDTH);
+ S32 width = llmax(llmin(item->getRect().getWidth() - x, scroller_width - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH);
S32 height = llfloor(sFont->getLineHeight() + RENAME_HEIGHT_PAD);
mRenamer->reshape( width, height, TRUE );
@@ -3709,7 +3704,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
// SL-51858: Key presses are not being passed to the Popup menu.
// A proper fix is non-trivial so instead just close the menu.
- LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle);
+ LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
if (menu && menu->isOpen())
{
LLMenuGL::sMenuContainer->hideMenus();
@@ -3721,7 +3716,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
item = *(getChildList()->begin());
}
- if( getVisible() && mEnabled && !called_from_parent )
+ if( getVisible() && getEnabled() && !called_from_parent )
{
switch( key )
{
@@ -3952,7 +3947,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare
{
// SL-51858: Key presses are not being passed to the Popup menu.
// A proper fix is non-trivial so instead just close the menu.
- LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle);
+ LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
if (menu && menu->isOpen())
{
LLMenuGL::sMenuContainer->hideMenus();
@@ -3977,11 +3972,11 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare
}
-BOOL LLFolderView::canDoDelete()
+BOOL LLFolderView::canDoDelete() const
{
if (mSelectedItems.size() == 0) return FALSE;
- selected_items_t::iterator item_it;
- for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
+
+ for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
{
if (!(*item_it)->getListener()->isItemRemovable())
{
@@ -4103,7 +4098,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL;
S32 count = mSelectedItems.size();
- LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle);
+ LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
if(handled && (count > 0) && menu)
{
//menu->empty();
@@ -4179,7 +4174,7 @@ void LLFolderView::deleteAllChildren()
gViewerWindow->setTopCtrl(NULL);
}
LLView::deleteViewByHandle(mPopupMenuHandle);
- mPopupMenuHandle = LLViewHandle::sDeadHandle;
+ mPopupMenuHandle = LLHandle<LLView>();
mRenamer = NULL;
mRenameItem = NULL;
clearSelection();
@@ -4247,7 +4242,7 @@ LLRect LLFolderView::getVisibleRect()
S32 visible_height = mScrollContainer->getRect().getHeight();
S32 visible_width = mScrollContainer->getRect().getWidth();
LLRect visible_rect;
- visible_rect.setLeftTopAndSize(-mRect.mLeft, visible_height - mRect.mBottom, visible_width, visible_height);
+ visible_rect.setLeftTopAndSize(-getRect().mLeft, visible_height - getRect().mBottom, visible_width, visible_height);
return visible_rect;
}
@@ -4257,7 +4252,7 @@ BOOL LLFolderView::getShowSelectionContext()
{
return TRUE;
}
- LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle);
+ LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
if (menu && menu->getVisible())
{
return TRUE;
@@ -4364,12 +4359,13 @@ void LLFolderView::doIdle()
}
}
- if (mSelectionChanged && mSelectCallback)
+ if (mSignalSelectCallback && mSelectCallback)
{
//RN: we use keyboard focus as a proxy for user-explicit actions
- mSelectCallback(mSelectedItems, gFocusMgr.childHasKeyboardFocus(this), mUserData);
+ BOOL take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS);
+ mSelectCallback(mSelectedItems, take_keyboard_focus, mUserData);
}
- mSelectionChanged = FALSE;
+ mSignalSelectCallback = FALSE;
}
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 37b9ee6c13..d451e75fa6 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -108,7 +108,7 @@ public:
// This method should be called when a drag begins. returns TRUE
// if the drag can begin, otherwise FALSE.
- virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) = 0;
+ virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0;
// This method will be called to determine if a drop can be
// performed, and will set drop to TRUE if a drop is
@@ -465,11 +465,14 @@ public:
// Used for sorting, like getLabel() above.
virtual U32 getCreationDate() const { return mCreationDate; }
- LLFolderViewFolder* getParentFolder( void );
+ LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; }
+ const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; }
+
LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE );
LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE );
- LLFolderViewEventListener* getListener( void );
+ const LLFolderViewEventListener* getListener( void ) const { return mListener; }
+ LLFolderViewEventListener* getListener( void ) { return mListener; }
// just rename the object.
void rename(const LLString& new_name);
@@ -803,16 +806,16 @@ public:
// copy & paste
virtual void copy();
- virtual BOOL canCopy();
+ virtual BOOL canCopy() const;
virtual void cut();
- virtual BOOL canCut();
+ virtual BOOL canCut() const;
virtual void paste();
- virtual BOOL canPaste();
+ virtual BOOL canPaste() const;
virtual void doDelete();
- virtual BOOL canDoDelete();
+ virtual BOOL canDoDelete() const;
// public rename functionality - can only start the process
void startRenamingSelectedItem( void );
@@ -885,7 +888,7 @@ protected:
void revertRenamingItem( void );
protected:
- LLViewHandle mPopupMenuHandle;
+ LLHandle<LLView> mPopupMenuHandle;
typedef std::deque<LLFolderViewItem*> selected_items_t;
selected_items_t mSelectedItems;
@@ -920,7 +923,7 @@ protected:
void* mUserData;
SelectCallback mSelectCallback;
- BOOL mSelectionChanged;
+ S32 mSignalSelectCallback;
S32 mMinWidth;
std::map<LLUUID, LLFolderViewItem*> mItemMap;
BOOL mDragAndDropThisFrame;
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 29b739bca3..a291f1da49 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -427,8 +427,8 @@ void LLHorizontalCompass::draw()
LLGLSUIDefault gls_ui;
- S32 width = mRect.getWidth();
- S32 height = mRect.getHeight();
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
S32 half_width = width / 2;
if( mTexture )
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 0c34ef3ebc..c26e9de423 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -438,7 +438,7 @@ void LLVoiceChannel::handleStatusChange(EStatusType type)
case STATUS_LOGGED_IN:
if (!mLoginNotificationHandle.isDead())
{
- LLNotifyBox* notifyp = (LLNotifyBox*)LLPanel::getPanelByHandle(mLoginNotificationHandle);
+ LLNotifyBox* notifyp = (LLNotifyBox*)mLoginNotificationHandle.get();
if (notifyp)
{
notifyp->close();
@@ -1251,9 +1251,9 @@ BOOL LLFloaterIMPanel::postBuild()
childSetEnabled("profile_btn", FALSE);
}
- sTitleString = getFormattedUIString("title_string");
- sTypingStartString = getFormattedUIString("typing_start_string");
- sSessionStartString = getFormattedUIString("session_start_string");
+ sTitleString = getString("title_string");
+ sTypingStartString = getString("typing_start_string");
+ sSessionStartString = getString("session_start_string");
if (mSpeakerPanel)
{
@@ -1330,12 +1330,12 @@ void LLFloaterIMPanel::draw()
if (self_speaker.notNull() && self_speaker->mModeratorMutedText)
{
mInputEditor->setEnabled(FALSE);
- mInputEditor->setLabel(getFormattedUIString("muted_text_label"));
+ mInputEditor->setLabel(getString("muted_text_label"));
}
else
{
mInputEditor->setEnabled(TRUE);
- mInputEditor->setLabel(getFormattedUIString("default_text_label"));
+ mInputEditor->setLabel(getString("default_text_label"));
}
if (mAutoConnect && enable_connect)
@@ -1539,7 +1539,7 @@ void LLFloaterIMPanel::selectNone()
BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
{
BOOL handled = FALSE;
- if( getVisible() && mEnabled && !called_from_parent && gFocusMgr.childHasKeyboardFocus(this))
+ if( getVisible() && getEnabled() && !called_from_parent && gFocusMgr.childHasKeyboardFocus(this))
{
if( KEY_RETURN == key && mask == MASK_NONE)
{
@@ -1926,7 +1926,7 @@ void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update)
if (voice_moderated)
{
- setTitle(mSessionLabel + LLString(" ") + getFormattedUIString("moderated_chat_label"));
+ setTitle(mSessionLabel + LLString(" ") + getString("moderated_chat_label"));
}
else
{
diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h
index ef36ff4a33..50830dedd0 100644
--- a/indra/newview/llimpanel.h
+++ b/indra/newview/llimpanel.h
@@ -100,7 +100,7 @@ protected:
LLString mSessionName;
LLString::format_map_t mNotifyArgs;
BOOL mIgnoreNextSessionLeave;
- LLViewHandle mLoginNotificationHandle;
+ LLHandle<LLPanel> mLoginNotificationHandle;
typedef std::map<LLUUID, LLVoiceChannel*> voice_channel_map_t;
static voice_channel_map_t sVoiceChannelMap;
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 2be41f01c5..58139e41aa 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -158,7 +158,7 @@ LLFloaterIM::LLFloaterIM()
BOOL LLFloaterIM::postBuild()
{
- sOnlyUserMessage = getFormattedUIString("only_user_message");
+ sOnlyUserMessage = getString("only_user_message");
sOfflineMessage = getUIString("offline_message");
sInviteMessage = getUIString("invite_message");
@@ -166,75 +166,75 @@ BOOL LLFloaterIM::postBuild()
if ( sErrorStringsMap.find("generic") == sErrorStringsMap.end() )
{
sErrorStringsMap["generic"] =
- getFormattedUIString("generic_request_error");
+ getString("generic_request_error");
}
if ( sErrorStringsMap.find("unverified") ==
sErrorStringsMap.end() )
{
sErrorStringsMap["unverified"] =
- getFormattedUIString("insufficient_perms_error");
+ getString("insufficient_perms_error");
}
if ( sErrorStringsMap.end() ==
sErrorStringsMap.find("no_ability") )
{
sErrorStringsMap["no_ability"] =
- getFormattedUIString("no_ability_error");
+ getString("no_ability_error");
}
if ( sErrorStringsMap.end() ==
sErrorStringsMap.find("muted") )
{
sErrorStringsMap["muted"] =
- getFormattedUIString("muted_error");
+ getString("muted_error");
}
if ( sErrorStringsMap.end() ==
sErrorStringsMap.find("not_a_moderator") )
{
sErrorStringsMap["not_a_moderator"] =
- getFormattedUIString("not_a_mod_error");
+ getString("not_a_mod_error");
}
if ( sErrorStringsMap.end() ==
sErrorStringsMap.find("does not exist") )
{
sErrorStringsMap["does not exist"] =
- getFormattedUIString("session_does_not_exist_error");
+ getString("session_does_not_exist_error");
}
if ( sEventStringsMap.end() == sEventStringsMap.find("add") )
{
sEventStringsMap["add"] =
- getFormattedUIString("add_session_event");
+ getString("add_session_event");
}
if ( sEventStringsMap.end() == sEventStringsMap.find("message") )
{
sEventStringsMap["message"] =
- getFormattedUIString("message_session_event");
+ getString("message_session_event");
}
if ( sEventStringsMap.end() == sEventStringsMap.find("mute") )
{
- sEventStringsMap["mute"] = getFormattedUIString(
- "mute_agent_event");
+ sEventStringsMap["mute"] =
+ getString("mute_agent_event");
}
if ( sForceCloseSessionMap.end() ==
sForceCloseSessionMap.find("removed") )
{
sForceCloseSessionMap["removed"] =
- getFormattedUIString("removed_from_group");
+ getString("removed_from_group");
}
if ( sForceCloseSessionMap.end() ==
sForceCloseSessionMap.find("no ability") )
{
sForceCloseSessionMap["no ability"] =
- getFormattedUIString("close_on_no_ability");
+ getString("close_on_no_ability");
}
return TRUE;
@@ -1015,12 +1015,12 @@ BOOL LLIMMgr::getFloaterOpen()
void LLIMMgr::disconnectAllSessions()
{
LLFloaterIMPanel* floater = NULL;
- std::set<LLViewHandle>::iterator handle_it;
+ std::set<LLHandle<LLFloater> >::iterator handle_it;
for(handle_it = mFloaters.begin();
handle_it != mFloaters.end();
)
{
- floater = (LLFloaterIMPanel*)LLFloater::getFloaterByHandle(*handle_it);
+ floater = (LLFloaterIMPanel*)handle_it->get();
// MUST do this BEFORE calling floater->onClose() because that may remove the item from the set, causing the subsequent increment to crash.
++handle_it;
@@ -1040,12 +1040,12 @@ void LLIMMgr::disconnectAllSessions()
LLFloaterIMPanel* LLIMMgr::findFloaterBySession(const LLUUID& session_id)
{
LLFloaterIMPanel* rv = NULL;
- std::set<LLViewHandle>::iterator handle_it;
+ std::set<LLHandle<LLFloater> >::iterator handle_it;
for(handle_it = mFloaters.begin();
handle_it != mFloaters.end();
++handle_it)
{
- rv = (LLFloaterIMPanel*)LLFloater::getFloaterByHandle(*handle_it);
+ rv = (LLFloaterIMPanel*)handle_it->get();
if(rv && session_id == rv->getSessionID())
{
break;
@@ -1171,7 +1171,7 @@ LLFloaterIMPanel* LLIMMgr::createFloater(
session_id,
other_participant_id,
dialog);
- LLTabContainerCommon::eInsertionPoint i_pt = user_initiated ? LLTabContainerCommon::RIGHT_OF_CURRENT : LLTabContainerCommon::END;
+ LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END;
LLFloaterChatterBox::getInstance(LLSD())->addFloater(floater, FALSE, i_pt);
mFloaters.insert(floater->getHandle());
return floater;
@@ -1197,7 +1197,7 @@ LLFloaterIMPanel* LLIMMgr::createFloater(
other_participant_id,
ids,
dialog);
- LLTabContainerCommon::eInsertionPoint i_pt = user_initiated ? LLTabContainerCommon::RIGHT_OF_CURRENT : LLTabContainerCommon::END;
+ LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END;
LLFloaterChatterBox::getInstance(LLSD())->addFloater(floater, FALSE, i_pt);
mFloaters.insert(floater->getHandle());
return floater;
@@ -1219,8 +1219,7 @@ void LLIMMgr::noteOfflineUsers(
for(S32 i = 0; i < count; ++i)
{
info = at.getBuddyInfo(ids.get(i));
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string first, last;
if(info && !info->isOnline()
&& gCacheName->getName(ids.get(i), first, last))
{
@@ -1628,3 +1627,4 @@ LLHTTPRegistration<LLViewerChatterBoxSessionUpdate>
LLHTTPRegistration<LLViewerChatterBoxInvitation>
gHTTPRegistrationMessageChatterBoxInvitation(
"/message/ChatterBoxInvitation");
+
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 11a6905a63..e787368324 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -165,7 +165,7 @@ public:
void clearPendingAgentListUpdates(const LLUUID& session_id);
//HACK: need a better way of enumerating existing session, or listening to session create/destroy events
- const std::set<LLViewHandle>& getIMFloaterHandles() { return mFloaters; }
+ const std::set<LLHandle<LLFloater> >& getIMFloaterHandles() { return mFloaters; }
private:
class LLIMSessionInvite;
@@ -199,7 +199,7 @@ private:
static void onInviteNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* userdata);
private:
- std::set<LLViewHandle> mFloaters;
+ std::set<LLHandle<LLFloater> > mFloaters;
LLFriendObserver* mFriendObserver;
// An IM has been received that you haven't seen yet.
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 2a260f6546..0e17d8503d 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -488,11 +488,11 @@ void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
// *TODO: remove this
-BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id)
+BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
{
BOOL rv = FALSE;
- LLInventoryObject* obj = getInventoryObject();
+ const LLInventoryObject* obj = getInventoryObject();
if(obj)
{
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index c61fa7f2b6..9ef666b357 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -188,7 +188,7 @@ public:
void getClipboardEntries(bool show_asset_id, std::vector<LLString> &items,
std::vector<LLString> &disabled_items, U32 flags);
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
- virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id);
+ virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
virtual BOOL dragOrDrop(MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data) { return FALSE; }
diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp
index 30106443c0..9e0fa26f25 100644
--- a/indra/newview/lljoystickbutton.cpp
+++ b/indra/newview/lljoystickbutton.cpp
@@ -72,18 +72,18 @@ LLJoystick::LLJoystick(
mHeldDown(FALSE),
mHeldDownTimer()
{
- mHeldDownCallback = &LLJoystick::onHeldDown;
- mCallbackUserData = this;
+ setHeldDownCallback(&LLJoystick::onHeldDown);
+ setCallbackUserData(this);
}
void LLJoystick::updateSlop()
{
- mVertSlopNear = mRect.getHeight();
- mVertSlopFar = mRect.getHeight() * 2;
+ mVertSlopNear = getRect().getHeight();
+ mVertSlopFar = getRect().getHeight() * 2;
- mHorizSlopNear = mRect.getWidth();
- mHorizSlopFar = mRect.getWidth() * 2;
+ mHorizSlopNear = getRect().getWidth();
+ mHorizSlopFar = getRect().getWidth() * 2;
// Compute initial mouse offset based on initial quadrant.
// Place the mouse evenly between the near and far zones.
@@ -163,7 +163,7 @@ F32 LLJoystick::getElapsedHeldDownTime()
{
if( mHeldDown )
{
- return mMouseDownTimer.getElapsedTimeF32();
+ return getHeldDownTime();
}
else
{
@@ -244,13 +244,13 @@ LLXMLNodePtr LLJoystick::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
- node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign));
+ node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(getHAlign()));
node->createChild("quadrant", TRUE)->setStringValue(nameFromQuadrant(mInitialQuadrant));
- addImageAttributeToXML(node,mImageUnselectedName,mImageUnselectedID,"image_unselected");
- addImageAttributeToXML(node,mImageSelectedName,mImageSelectedID,"image_selected");
+ addImageAttributeToXML(node,getImageUnselectedName(),getImageUnselectedID(),"image_unselected");
+ addImageAttributeToXML(node,getImageSelectedName(),getImageSelectedID(),"image_selected");
- node->createChild("scale_image", TRUE)->setBoolValue(mScaleImage);
+ node->createChild("scale_image", TRUE)->setBoolValue(getScaleImage());
return node;
}
@@ -504,8 +504,8 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask)
updateSlop();
// Set initial offset based on initial click location
- S32 horiz_center = mRect.getWidth() / 2;
- S32 vert_center = mRect.getHeight() / 2;
+ S32 horiz_center = getRect().getWidth() / 2;
+ S32 vert_center = getRect().getHeight() / 2;
S32 dx = x - horiz_center;
S32 dy = y - vert_center;
@@ -607,26 +607,26 @@ void LLJoystickCameraRotate::draw()
{
LLGLSUIDefault gls_ui;
- mImageUnselected->draw( 0, 0 );
+ getImageUnselected()->draw( 0, 0 );
if( mInTop )
{
- drawRotatedImage( mImageSelected->getImage(), 0 );
+ drawRotatedImage( getImageSelected()->getImage(), 0 );
}
if( mInRight )
{
- drawRotatedImage( mImageSelected->getImage(), 1 );
+ drawRotatedImage( getImageSelected()->getImage(), 1 );
}
if( mInBottom )
{
- drawRotatedImage( mImageSelected->getImage(), 2 );
+ drawRotatedImage( getImageSelected()->getImage(), 2 );
}
if( mInLeft )
{
- drawRotatedImage( mImageSelected->getImage(), 3 );
+ drawRotatedImage( getImageSelected()->getImage(), 3 );
}
if (sDebugRects)
@@ -637,7 +637,7 @@ void LLJoystickCameraRotate::draw()
}
// Draws image rotated by multiples of 90 degrees
-void LLJoystickCameraRotate::drawRotatedImage( LLImageGL* image, S32 rotations )
+void LLJoystickCameraRotate::drawRotatedImage( const LLImageGL* image, S32 rotations )
{
S32 width = image->getWidth();
S32 height = image->getHeight();
@@ -732,7 +732,7 @@ BOOL LLJoystickCameraZoom::handleMouseDown(S32 x, S32 y, MASK mask)
if( handled )
{
- if (mFirstMouse.mY > mRect.getHeight() / 2)
+ if (mFirstMouse.mY > getRect().getHeight() / 2)
{
mInitialQuadrant = JQ_UP;
}
@@ -801,7 +801,7 @@ void LLJoystickCameraZoom::draw()
}
else
{
- mImageUnselected->draw( 0, 0 );
+ getImageUnselected()->draw( 0, 0 );
}
if (sDebugRects)
@@ -813,11 +813,11 @@ void LLJoystickCameraZoom::draw()
void LLJoystickCameraZoom::updateSlop()
{
- mVertSlopNear = mRect.getHeight() / 4;
- mVertSlopFar = mRect.getHeight() / 2;
+ mVertSlopNear = getRect().getHeight() / 4;
+ mVertSlopFar = getRect().getHeight() / 2;
- mHorizSlopNear = mRect.getWidth() / 4;
- mHorizSlopFar = mRect.getWidth() / 2;
+ mHorizSlopNear = getRect().getWidth() / 4;
+ mHorizSlopFar = getRect().getWidth() / 2;
// Compute initial mouse offset based on initial quadrant.
// Place the mouse evenly between the near and far zones.
diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h
index 1524b4f232..2cd53b4146 100644
--- a/indra/newview/lljoystickbutton.h
+++ b/indra/newview/lljoystickbutton.h
@@ -140,7 +140,7 @@ public:
protected:
F32 getOrbitRate();
virtual void updateSlop();
- void drawRotatedImage( LLImageGL* image, S32 rotations );
+ void drawRotatedImage( const LLImageGL* image, S32 rotations );
protected:
BOOL mInLeft;
diff --git a/indra/newview/llmanip.h b/indra/newview/llmanip.h
index 8c51746d1c..2dd0eab8b0 100644
--- a/indra/newview/llmanip.h
+++ b/indra/newview/llmanip.h
@@ -135,7 +135,7 @@ public:
EManipPart getHighlightedPart() { return mHighlightedPart; }
- LLHandle<LLObjectSelection> getSelection();
+ LLSafeHandle<LLObjectSelection> getSelection();
protected:
LLVector3 getSavedPivotPoint() const;
@@ -153,7 +153,7 @@ protected:
protected:
LLFrameTimer mHelpTextTimer;
BOOL mInSnapRegime;
- LLHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
EManipPart mHighlightedPart;
static F32 sHelpTextVisibleTime;
diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp
index a698c53f7f..616fabebf7 100644
--- a/indra/newview/llmemoryview.cpp
+++ b/indra/newview/llmemoryview.cpp
@@ -147,8 +147,8 @@ static const int MTV_DISPLAY_NUM = (sizeof(mtv_display_table)/sizeof(mtv_displa
void LLMemoryView::draw()
{
std::string tdesc;
- S32 width = mRect.getWidth();
- S32 height = mRect.getHeight();
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
LLGLSUIDefault gls_ui;
LLGLSNoTexture gls_no_tex;
diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp
index b5021eff9c..17185299a8 100644
--- a/indra/newview/llnamebox.cpp
+++ b/indra/newview/llnamebox.cpp
@@ -70,24 +70,15 @@ void LLNameBox::setNameID(const LLUUID& name_id, BOOL is_group)
{
mNameID = name_id;
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- LLString name;
+ std::string name;
if (!is_group)
{
- gCacheName->getName(name_id, first, last);
-
- name.assign(first);
- name.append(1, ' ');
- name.append(last);
+ gCacheName->getFullName(name_id, name);
}
else
{
- gCacheName->getGroupName(name_id, group_name);
-
- name.assign(group_name);
+ gCacheName->getGroupName(name_id, name);
}
setText(name);
diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp
index 1ca702b0a7..a36c67a879 100644
--- a/indra/newview/llnameeditor.cpp
+++ b/indra/newview/llnameeditor.cpp
@@ -90,23 +90,15 @@ void LLNameEditor::setNameID(const LLUUID& name_id, BOOL is_group)
{
mNameID = name_id;
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- LLString name;
+ std::string name;
if (!is_group)
{
- gCacheName->getName(name_id, first, last);
-
- name.assign(first);
- name.append(1, ' ');
- name.append(last);
+ gCacheName->getFullName(name_id, name);
}
else
{
- gCacheName->getGroupName(name_id, group_name);
- name.assign(group_name);
+ gCacheName->getGroupName(name_id, name);
}
setText(name);
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index 9dd37cf47d..a3faa55a06 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -73,15 +73,9 @@ BOOL LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos,
{
//llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl;
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string fullname;
+ BOOL result = gCacheName->getFullName(agent_id, fullname);
- BOOL result = gCacheName->getName(agent_id, first, last);
-
- LLString fullname;
- fullname.assign(first);
- fullname.append(1, ' ');
- fullname.append(last);
fullname.append(suffix);
addStringUUIDItem(fullname, agent_id, pos, enabled);
@@ -142,7 +136,7 @@ void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos,
BOOL enabled)
{
//llinfos << "LLNameListCtrl::addGroupNameItem " << group_id << llendl;
- char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string group_name;
gCacheName->getGroupName(group_id, group_name);
addStringUUIDItem(group_name, group_id, pos, enabled);
}
@@ -153,7 +147,7 @@ void LLNameListCtrl::addGroupNameItem(LLScrollListItem* item, EAddPosition pos)
{
//llinfos << "LLNameListCtrl::addGroupNameItem " << item->getUUID() << llendl;
- char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
+ std::string group_name;
gCacheName->getGroupName(item->getUUID(), group_name);
LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex);
@@ -166,15 +160,8 @@ BOOL LLNameListCtrl::addNameItem(LLScrollListItem* item, EAddPosition pos)
{
//llinfos << "LLNameListCtrl::addNameItem " << item->getUUID() << llendl;
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
-
- BOOL result = gCacheName->getName(item->getUUID(), first, last);
-
- LLString fullname;
- fullname.assign(first);
- fullname.append(1, ' ');
- fullname.append(last);
+ std::string fullname;
+ BOOL result = gCacheName->getFullName(item->getUUID(), fullname);
LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex);
((LLScrollListText*)cell)->setText( fullname );
@@ -195,17 +182,12 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos
{
LLScrollListItem* item = LLScrollListCtrl::addElement(value, pos, userdata);
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
-
// use supplied name by default
- LLString fullname = value["name"].asString();
+ std::string fullname = value["name"].asString();
if (value["target"].asString() == "GROUP")
{
- char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- gCacheName->getGroupName(item->getUUID(), group_name);
+ gCacheName->getGroupName(item->getUUID(), fullname);
// fullname will be "nobody" if group not found
- fullname = group_name;
}
else if (value["target"].asString() == "SPECIAL")
{
@@ -213,11 +195,10 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos
}
else // normal resident
{
- if (gCacheName->getName(item->getUUID(), first, last))
+ std::string name;
+ if (gCacheName->getFullName(item->getUUID(), name))
{
- fullname.assign(first);
- fullname.append(1, ' ');
- fullname.append(last);
+ fullname = name;
}
}
@@ -268,7 +249,7 @@ void LLNameListCtrl::refresh(const LLUUID& id, const char* first,
// TODO: scan items for that ID, fix if necessary
item_list::iterator iter;
- for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
+ for (iter = getItemList().begin(); iter != getItemList().end(); iter++)
{
LLScrollListItem* item = *iter;
if (item->getUUID() == id)
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index c3128652fe..257e87171a 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -158,7 +158,7 @@ LLNetMap::LLNetMap(
&LLTracker::isTracking, NULL) );
menu->setVisible(FALSE);
addChild(menu);
- mPopupMenuHandle = menu->mViewHandle;
+ mPopupMenuHandle = menu->getHandle();
sInstance = this;
@@ -191,8 +191,8 @@ void LLNetMap::setScale( F32 scale )
if (mObjectImagep.notNull())
{
- F32 half_width = (F32)(mRect.getWidth() / 2);
- F32 half_height = (F32)(mRect.getHeight() / 2);
+ F32 half_width = (F32)(getRect().getWidth() / 2);
+ F32 half_height = (F32)(getRect().getHeight() / 2);
F32 radius = sqrt( half_width * half_width + half_height * half_height );
F32 region_widths = (2.f*radius)/gMiniMapScale;
@@ -257,12 +257,12 @@ void LLNetMap::draw()
// Draw background rectangle
glColor4fv( mBackgroundColor.mV );
- gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0);
+ gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0);
}
// region 0,0 is in the middle
- S32 center_sw_left = mRect.getWidth() / 2 + llfloor(mCurPanX);
- S32 center_sw_bottom = mRect.getHeight() / 2 + llfloor(mCurPanY);
+ S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPanX);
+ S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPanY);
glPushMatrix();
@@ -542,8 +542,8 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos )
pos_local.rotVec( rot );
}
- pos_local.mV[VX] += mRect.getWidth() / 2 + mCurPanX;
- pos_local.mV[VY] += mRect.getHeight() / 2 + mCurPanY;
+ pos_local.mV[VX] += getRect().getWidth() / 2 + mCurPanX;
+ pos_local.mV[VY] += getRect().getHeight() / 2 + mCurPanY;
return pos_local;
}
@@ -554,15 +554,15 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
LLVector3 pos_local = globalPosToView( pos_global );
if( (pos_local.mV[VX] < 0) ||
(pos_local.mV[VY] < 0) ||
- (pos_local.mV[VX] >= mRect.getWidth()) ||
- (pos_local.mV[VY] >= mRect.getHeight()) )
+ (pos_local.mV[VX] >= getRect().getWidth()) ||
+ (pos_local.mV[VY] >= getRect().getHeight()) )
{
if (draw_arrow)
{
S32 x = llround( pos_local.mV[VX] );
S32 y = llround( pos_local.mV[VY] );
- LLWorldMapView::drawTrackingCircle( mRect, x, y, color, 1, 10 );
- LLWorldMapView::drawTrackingArrow( mRect, x, y, color );
+ LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10 );
+ LLWorldMapView::drawTrackingArrow( getRect(), x, y, color );
}
}
else
@@ -576,8 +576,8 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )
{
- x -= llround(mRect.getWidth() / 2 + mCurPanX);
- y -= llround(mRect.getHeight() / 2 + mCurPanY);
+ x -= llround(getRect().getWidth() / 2 + mCurPanX);
+ y -= llround(getRect().getHeight() / 2 + mCurPanY);
LLVector3 pos_local( (F32)x, (F32)y, 0 );
@@ -612,35 +612,32 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_s
{
return FALSE;
}
- if( getVisible() && pointInView( x, y ) )
+ LLViewerRegion* region = gWorldPointer->getRegionFromPosGlobal( viewPosToGlobal( x, y ) );
+ if( region )
{
- LLViewerRegion* region = gWorldPointer->getRegionFromPosGlobal( viewPosToGlobal( x, y ) );
- if( region )
- {
- msg.assign( region->getName() );
+ msg.assign( region->getName() );
#ifndef LL_RELEASE_FOR_DOWNLOAD
- char buffer[MAX_STRING]; /*Flawfinder: ignore*/
- msg.append("\n");
- region->getHost().getHostName(buffer, MAX_STRING);
- msg.append(buffer);
- msg.append("\n");
- region->getHost().getString(buffer, MAX_STRING);
- msg.append(buffer);
+ char buffer[MAX_STRING]; /*Flawfinder: ignore*/
+ msg.append("\n");
+ region->getHost().getHostName(buffer, MAX_STRING);
+ msg.append(buffer);
+ msg.append("\n");
+ region->getHost().getString(buffer, MAX_STRING);
+ msg.append(buffer);
#endif
- // *TODO: put this under the control of XUI so it can be
- // translated.
- msg.append("\n(Double-click to open Map)");
-
- S32 SLOP = 4;
- localPointToScreen(
- x - SLOP, y - SLOP,
- &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
- sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;
- sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;
- }
- handled = TRUE;
+ // *TODO: put this under the control of XUI so it can be
+ // translated.
+ msg.append("\n(Double-click to open Map)");
+
+ S32 SLOP = 4;
+ localPointToScreen(
+ x - SLOP, y - SLOP,
+ &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
+ sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;
+ sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;
}
+ handled = TRUE;
return handled;
}
@@ -651,8 +648,8 @@ void LLNetMap::setDirectionPos( LLTextBox* text_box, F32 rotation )
// Rotation of 0 means x = 1, y = 0 on the unit circle.
- F32 map_half_height = (F32)(mRect.getHeight() / 2);
- F32 map_half_width = (F32)(mRect.getWidth() / 2);
+ F32 map_half_height = (F32)(getRect().getHeight() / 2);
+ F32 map_half_width = (F32)(getRect().getWidth() / 2);
F32 text_half_height = (F32)(text_box->getRect().getHeight() / 2);
F32 text_half_width = (F32)(text_box->getRect().getWidth() / 2);
F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width );
@@ -762,9 +759,9 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color,
void LLNetMap::createObjectImage()
{
- // Find the size of the side of a square that surrounds the circle that surrounds mRect.
- F32 half_width = (F32)(mRect.getWidth() / 2);
- F32 half_height = (F32)(mRect.getHeight() / 2);
+ // Find the size of the side of a square that surrounds the circle that surrounds getRect().
+ F32 half_width = (F32)(getRect().getWidth() / 2);
+ F32 half_height = (F32)(getRect().getHeight() / 2);
F32 radius = sqrt( half_width * half_width + half_height * half_height );
S32 square_size = S32( 2 * radius );
@@ -798,7 +795,7 @@ BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask )
BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle);
+ LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
if (menu)
{
menu->buildDrawLabels();
diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h
index 40d80646cf..d375413d1d 100644
--- a/indra/newview/llnetmap.h
+++ b/indra/newview/llnetmap.h
@@ -92,7 +92,7 @@ protected:
static void fly( const LLVector3d& destination );
public:
- LLViewHandle mPopupMenuHandle;
+ LLHandle<LLView> mPopupMenuHandle;
LLColor4 mBackgroundColor;
F32 mScale; // Size of a region in pixels
diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp
index 2c33cccf71..8af83af272 100644
--- a/indra/newview/lloverlaybar.cpp
+++ b/indra/newview/lloverlaybar.cpp
@@ -123,7 +123,7 @@ BOOL LLOverlayBar::postBuild()
childSetAction("Stand Up",onClickStandUp,this);
childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible"));
- mIsFocusRoot = TRUE;
+ setFocusRoot(TRUE);
mBuilt = true;
layoutButtons();
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index d9416bbf37..7c8acd3947 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -159,7 +159,7 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
{
// check if inside
//LLRect parent_rect = mParentView->getRect();
- //mRect.set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0);
+ //getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0);
handled = TRUE;
// check the type
@@ -282,13 +282,12 @@ void LLPanelAvatarSecondLife::updatePartnerName()
{
if (mPartnerID.notNull())
{
- char first[128]; /*Flawfinder: ignore*/
- char last[128]; /*Flawfinder: ignore*/
+ std::string first, last;
BOOL found = gCacheName->getName(mPartnerID, first, last);
if (found)
{
- childSetTextArg("partner_edit", "[FIRST]", LLString(first));
- childSetTextArg("partner_edit", "[LAST]", LLString(last));
+ childSetTextArg("partner_edit", "[FIRST]", first);
+ childSetTextArg("partner_edit", "[LAST]", last);
}
childSetEnabled("partner_info", TRUE);
}
@@ -301,7 +300,7 @@ void LLPanelAvatarSecondLife::updatePartnerName()
//-----------------------------------------------------------------------------
void LLPanelAvatarSecondLife::clearControls()
{
- LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(this,"img");
+ LLTextureCtrl* image_ctrl = getChild<LLTextureCtrl>("img");
if(image_ctrl)
{
image_ctrl->setImageAssetID(LLUUID::null);
@@ -495,7 +494,7 @@ BOOL LLPanelAvatarWeb::postBuild(void)
childSetControlName("auto_load","AutoLoadWebProfiles");
- mWebBrowser = (LLWebBrowserCtrl*)getChildByName("profile_html");
+ mWebBrowser = getChild<LLWebBrowserCtrl>("profile_html");
// links open in internally
mWebBrowser->setOpenInExternalBrowser( false );
@@ -722,7 +721,7 @@ void LLPanelAvatarAdvanced::enableControls(BOOL self)
// setEnable is called, for some reason
if (mWantToEdit) mWantToEdit->setReadOnlyBgColor(LLColor4::transparent);
if (mSkillsEdit) mSkillsEdit->setReadOnlyBgColor(LLColor4::transparent);
- LLLineEditor* languages_edit = (LLLineEditor*)getChildByName("languages_edit");
+ LLLineEditor* languages_edit = getChild<LLLineEditor>("languages_edit");
languages_edit->setReadOnlyBgColor(LLColor4::transparent);
}
}
@@ -798,7 +797,7 @@ void LLPanelAvatarNotes::refresh()
void LLPanelAvatarNotes::clearControls()
{
- childSetText("notes edit", childGetText("Loading"));
+ childSetText("notes edit", getString("Loading"));
childSetEnabled("notes edit", false);
}
@@ -825,7 +824,7 @@ void LLPanelAvatarClassified::refresh()
{
BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID());
- LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"classified tab");
+ LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(this,"classified tab");
S32 tab_count = tabs ? tabs->getTabCount() : 0;
@@ -859,7 +858,7 @@ void LLPanelAvatarClassified::refresh()
BOOL LLPanelAvatarClassified::canClose()
{
- LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab");
+ LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab");
for (S32 i = 0; i < tabs->getTabCount(); i++)
{
LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i);
@@ -873,7 +872,7 @@ BOOL LLPanelAvatarClassified::canClose()
BOOL LLPanelAvatarClassified::titleIsValid()
{
- LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab");
+ LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab");
if ( tabs )
{
LLPanelClassified* panel = (LLPanelClassified*)tabs->getCurrentPanel();
@@ -891,7 +890,7 @@ BOOL LLPanelAvatarClassified::titleIsValid()
void LLPanelAvatarClassified::apply()
{
- LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab");
+ LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab");
for (S32 i = 0; i < tabs->getTabCount(); i++)
{
LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i);
@@ -902,7 +901,7 @@ void LLPanelAvatarClassified::apply()
void LLPanelAvatarClassified::deleteClassifiedPanels()
{
- LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab");
+ LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab");
if (tabs)
{
tabs->deleteAllTabs();
@@ -922,7 +921,7 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg,
char classified_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/
LLPanelClassified* panel_classified = NULL;
- LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab");
+ LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab");
// Don't remove old panels. We need to be able to process multiple
// packets for people who have lots of classifieds. JC
@@ -933,7 +932,7 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg,
msg->getUUIDFast(_PREHASH_Data, _PREHASH_ClassifiedID, classified_id, block);
msg->getStringFast(_PREHASH_Data, _PREHASH_Name, DB_PICK_NAME_SIZE, classified_name, block);
- panel_classified = new LLPanelClassified(FALSE);
+ panel_classified = new LLPanelClassified(false, false);
panel_classified->setClassifiedID(classified_id);
@@ -978,9 +977,9 @@ void LLPanelAvatarClassified::callbackNew(S32 option, void* data)
if (0 == option)
{
- LLPanelClassified* panel_classified = new LLPanelClassified(FALSE);
+ LLPanelClassified* panel_classified = new LLPanelClassified(false, false);
panel_classified->initNewClassified();
- LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab");
+ LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab");
if(tabs)
{
tabs->addTabPanel(panel_classified, panel_classified->getClassifiedName());
@@ -995,7 +994,7 @@ void LLPanelAvatarClassified::onClickDelete(void* data)
{
LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data;
- LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab");
+ LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab");
LLPanelClassified* panel_classified = NULL;
if(tabs)
{
@@ -1014,7 +1013,7 @@ void LLPanelAvatarClassified::onClickDelete(void* data)
void LLPanelAvatarClassified::callbackDelete(S32 option, void* data)
{
LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data;
- LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab");
+ LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab");
LLPanelClassified* panel_classified=NULL;
if(tabs)
{
@@ -1059,14 +1058,12 @@ LLPanelAvatarPicks::LLPanelAvatarPicks(const std::string& name,
void LLPanelAvatarPicks::refresh()
{
BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID());
-
- LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"picks tab");
+ LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"picks tab");
S32 tab_count = tabs ? tabs->getTabCount() : 0;
- BOOL allow_new = (tab_count < MAX_AVATAR_PICKS);
- BOOL allow_delete = (tab_count > 0);
-
- childSetEnabled("New...",self && allow_new);
- childSetEnabled("Delete...",self && allow_delete);
+ childSetEnabled("New...", self && tab_count < MAX_AVATAR_PICKS);
+ childSetEnabled("Delete...", self && tab_count > 0);
+ childSetVisible("New...", self && getPanelAvatar()->isEditable());
+ childSetVisible("Delete...", self && getPanelAvatar()->isEditable());
sendAvatarProfileRequestIfNeeded("avatarpicksrequest");
}
@@ -1074,7 +1071,7 @@ void LLPanelAvatarPicks::refresh()
void LLPanelAvatarPicks::deletePickPanels()
{
- LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab");
+ LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab");
if(tabs)
{
tabs->deleteAllTabs();
@@ -1093,7 +1090,7 @@ void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**)
char pick_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/
LLPanelPick* panel_pick = NULL;
- LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab");
+ LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab");
// Clear out all the old panels. We'll replace them with the correct
// number of new panels.
@@ -1143,7 +1140,7 @@ void LLPanelAvatarPicks::onClickNew(void* data)
{
LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data;
LLPanelPick* panel_pick = new LLPanelPick(FALSE);
- LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab");
+ LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab");
panel_pick->initNewPick();
if(tabs)
@@ -1158,7 +1155,7 @@ void LLPanelAvatarPicks::onClickNew(void* data)
void LLPanelAvatarPicks::onClickDelete(void* data)
{
LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data;
- LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab");
+ LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab");
LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL;
if (!panel_pick) return;
@@ -1176,7 +1173,7 @@ void LLPanelAvatarPicks::onClickDelete(void* data)
void LLPanelAvatarPicks::callbackDelete(S32 option, void* data)
{
LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data;
- LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab");
+ LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab");
LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL;
LLMessageSystem* msg = gMessageSystem;
@@ -1393,7 +1390,7 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name,
// Teens don't have this.
if (mPanelFirstLife) mPanelFirstLife->enableControls(own_avatar && mAllowEdit);
- LLView *target_view = getChildByName("drop_target_rect", TRUE);
+ LLView *target_view = getChild<LLView>("drop_target_rect");
if(target_view)
{
if (mDropTarget)
@@ -1453,6 +1450,8 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name,
{
childSetVisible("OK",FALSE);
childSetEnabled("OK",FALSE);
+ childSetVisible("Cancel",FALSE);
+ childSetEnabled("Cancel",FALSE);
}
childSetVisible("Instant Message...",FALSE);
childSetEnabled("Instant Message...",FALSE);
@@ -1676,7 +1675,7 @@ void LLPanelAvatar::onClickOK(void *userdata)
{
self->sendAvatarPropertiesUpdate();
- LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(self,"tab");
+ LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"tab");
if ( tabs->getCurrentPanel() != self->mPanelClassified )
{
self->mPanelClassified->apply();
@@ -1743,7 +1742,7 @@ void LLPanelAvatar::sendAvatarNotesUpdate()
std::string notes = mPanelNotes->childGetValue("notes edit").asString();
if (!mHaveNotes
- && (notes.empty() || notes == childGetText("Loading")))
+ && (notes.empty() || notes == getString("Loading")))
{
// no notes from server and no user updates
return;
@@ -1844,7 +1843,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**)
if(caption_text.empty())
{
LLString::format_map_t args;
- caption_text = self->mPanelSecondLife->childGetValue("CaptionTextAcctInfo").asString();
+ caption_text = self->mPanelSecondLife->getString("CaptionTextAcctInfo");
const char* ACCT_TYPE[] = {
"AcctTypeResident",
@@ -1853,7 +1852,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**)
"AcctTypeEmployee"
};
caption_index = llclamp(caption_index, (U8)0, (U8)(sizeof(ACCT_TYPE)/sizeof(ACCT_TYPE[0])-1));
- args["[ACCTTYPE]"] = self->mPanelSecondLife->childGetValue(ACCT_TYPE[caption_index]).asString();
+ args["[ACCTTYPE]"] = self->mPanelSecondLife->getString(ACCT_TYPE[caption_index]);
LLString payment_text = " ";
const S32 DEFAULT_CAPTION_LINDEN_INDEX = 3;
@@ -1871,10 +1870,10 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**)
{
payment_text = "NoPaymentInfoOnFile";
}
- args["[PAYMENTINFO]"] = self->mPanelSecondLife->childGetValue(payment_text).asString();
+ args["[PAYMENTINFO]"] = self->mPanelSecondLife->getString(payment_text);
LLString age_text = age_verified ? "AgeVerified" : "NotAgeVerified";
// Do not display age verification status at this time
- //args["[AGEVERIFICATION]"] = self->mPanelSecondLife->childGetValue(age_text).asString();
+ //args["[AGEVERIFICATION]"] = self->mPanelSecondLife->getString(age_text);
args["[AGEVERIFICATION]"] = " ";
}
else
@@ -1894,7 +1893,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**)
self->mPanelWeb->setWebURL(std::string(profile_url));
- LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(self->mPanelSecondLife,"img");
+ LLTextureCtrl* image_ctrl = self->mPanelSecondLife->getChild<LLTextureCtrl>("img");
if(image_ctrl)
{
image_ctrl->setImageAssetID(image_id);
@@ -1908,7 +1907,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**)
{
// Teens don't get these
self->mPanelFirstLife->childSetValue("about", fl_about_text);
- LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(self->mPanelFirstLife,"img");
+ LLTextureCtrl* image_ctrl = self->mPanelFirstLife->getChild<LLTextureCtrl>("img");
if(image_ctrl)
{
image_ctrl->setImageAssetID(fl_image_id);
@@ -2074,7 +2073,7 @@ void LLPanelAvatar::sendAvatarPropertiesUpdate()
if (mPanelFirstLife)
{
first_life_about_text = mPanelFirstLife->childGetValue("about").asString();
- LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(mPanelFirstLife,"img");
+ LLTextureCtrl* image_ctrl = mPanelFirstLife->getChild<LLTextureCtrl>("img");
if(image_ctrl)
{
first_life_image_id = image_ctrl->getImageAssetID();
@@ -2091,7 +2090,7 @@ void LLPanelAvatar::sendAvatarPropertiesUpdate()
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
msg->nextBlockFast(_PREHASH_PropertiesData);
- LLTextureCtrl* image_ctrl = LLUICtrlFactory::getTexturePickerByName(mPanelSecondLife,"img");
+ LLTextureCtrl* image_ctrl = mPanelSecondLife->getChild<LLTextureCtrl>("img");
if(image_ctrl)
{
msg->addUUIDFast( _PREHASH_ImageID, image_ctrl->getImageAssetID());
diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h
index d992c29304..6e5b7bfb41 100644
--- a/indra/newview/llpanelavatar.h
+++ b/indra/newview/llpanelavatar.h
@@ -46,7 +46,7 @@ class LLLineEditor;
class LLNameEditor;
class LLPanelAvatar;
class LLScrollListCtrl;
-class LLTabContainerCommon;
+class LLTabContainer;
class LLTextBox;
class LLTextEditor;
class LLTextureCtrl;
@@ -302,6 +302,7 @@ public:
void selectTabByName(std::string tab_name);
BOOL haveData() { return mHaveProperties && mHaveStatistics; }
+ BOOL isEditable() const { return mAllowEdit; }
static void processAvatarPropertiesReply(LLMessageSystem *msg, void **);
static void processAvatarInterestsReply(LLMessageSystem *msg, void **);
@@ -366,7 +367,7 @@ private:
// note is changed from database version
bool mHaveNotes;
std::string mLastNotes;
- LLTabContainerCommon* mTab;
+ LLTabContainer* mTab;
BOOL mAllowEdit;
typedef std::list<LLPanelAvatar*> panel_list_t;
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index f84ae06416..e24d258a22 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -144,7 +144,7 @@ public:
LLClassifiedTeleportHandler gClassifiedTeleportHandler;
*/
-LLPanelClassified::LLPanelClassified(BOOL in_finder, bool from_search)
+LLPanelClassified::LLPanelClassified(bool in_finder, bool from_search)
: LLPanel("Classified Panel"),
mInFinder(in_finder),
mFromSearch(from_search),
@@ -241,7 +241,7 @@ BOOL LLPanelClassified::postBuild()
mDescEditor->setFocusReceivedCallback(onFocusReceived, this);
mDescEditor->setCommitCallback(onCommitAny);
mDescEditor->setCallbackUserData(this);
- mDescEditor->setTabToNextField(TRUE);
+ mDescEditor->setTabsToNextField(TRUE);
mLocationEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "location_editor");
@@ -403,13 +403,7 @@ void LLPanelClassified::initNewClassified()
mCategoryCombo->setCurrentByIndex(0);
}
- // default new classifieds to publish
- //mEnabledCheck->set(TRUE);
-
- // delay commit until user hits save
- // sendClassifiedInfoUpdate();
-
- mUpdateBtn->setLabel(childGetText("publish_txt"));
+ mUpdateBtn->setLabel(getString("publish_txt"));
}
@@ -502,7 +496,7 @@ void LLPanelClassified::sendClassifiedInfoRequest()
if (!url.empty())
{
llinfos << "Classified stat request via capability" << llendl;
- LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(this->getHandle(), mClassifiedID));
+ LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(((LLView*)this)->getHandle(), mClassifiedID));
}
}
}
@@ -539,8 +533,6 @@ void LLPanelClassified::sendClassifiedInfoUpdate()
msg->addUUIDFast(_PREHASH_SnapshotID, mSnapshotCtrl->getImageAssetID());
msg->addVector3dFast(_PREHASH_PosGlobal, mPosGlobal);
BOOL mature = mMatureCheck->get();
- // Classifieds are always enabled/published 11/2005 JC
- //BOOL enabled = mEnabledCheck->get();
BOOL auto_renew = FALSE;
if (mAutoRenewCheck)
{
@@ -671,14 +663,15 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void **
}
LLString datestr = llformat("%02d/%02d/%d", now->tm_mon+1, now->tm_mday, now->tm_year+1900);
- self->childSetTextArg("ad_placed_paid", "[DATE]", datestr);
- self->childSetTextArg("ad_placed_paid", "[AMT]", llformat("%d", price_for_listing));
- self->childSetText("classified_info_text", self->childGetValue("ad_placed_paid").asString());
+ LLString::format_map_t string_args;
+ string_args["[DATE]"] = datestr;
+ string_args["[AMT]"] = llformat("%d", price_for_listing);
+ self->childSetText("classified_info_text", self->getString("ad_placed_paid", string_args));
// If we got data from the database, we know the listing is paid for.
self->mPaidFor = TRUE;
- self->mUpdateBtn->setLabel(self->childGetText("update_txt"));
+ self->mUpdateBtn->setLabel(self->getString("update_txt"));
}
}
@@ -727,9 +720,6 @@ void LLPanelClassified::refresh()
mCategoryCombo->setEnabled(godlike);
mCategoryCombo->setVisible(godlike);
- //mEnabledCheck->setVisible(godlike);
- //mEnabledCheck->setEnabled(godlike);
-
mMatureCheck->setEnabled(godlike);
mMatureCheck->setVisible(godlike);
@@ -750,8 +740,6 @@ void LLPanelClassified::refresh()
//mPriceEditor->setEnabled(is_self);
mCategoryCombo->setEnabled(is_self);
- //mEnabledCheck->setVisible(FALSE);
- //mEnabledCheck->setEnabled(is_self);
mMatureCheck->setEnabled(is_self);
if (mAutoRenewCheck)
@@ -845,7 +833,7 @@ void LLPanelClassified::confirmPublish(S32 option)
}
else
{
- LLTabContainerVertical* tab = (LLTabContainerVertical*)getParent();
+ LLTabContainer* tab = (LLTabContainer*)getParent();
tab->setCurrentTabName(mNameEditor->getText());
}
diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h
index cc82d33d33..f28795a4f2 100644
--- a/indra/newview/llpanelclassified.h
+++ b/indra/newview/llpanelclassified.h
@@ -57,7 +57,7 @@ class LLMessageSystem;
class LLPanelClassified : public LLPanel
{
public:
- LLPanelClassified(BOOL in_finder, bool from_search = false);
+ LLPanelClassified(bool in_finder, bool from_search);
/*virtual*/ ~LLPanelClassified();
void reset();
@@ -118,7 +118,7 @@ protected:
BOOL checkDirty(); // Update and return mDirty
protected:
- BOOL mInFinder;
+ bool mInFinder;
bool mFromSearch; // from web-based "All" search sidebar
BOOL mDirty;
bool mForceClose;
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 83fc991ae0..24b055b0a6 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -81,7 +81,7 @@ BOOL LLPanelFace::postBuild()
LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha
setMouseOpaque(FALSE);
- mTextureCtrl = LLUICtrlFactory::getTexturePickerByName(this,"texture control");
+ mTextureCtrl = getChild<LLTextureCtrl>("texture control");
if(mTextureCtrl)
{
mTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" )));
@@ -113,7 +113,7 @@ BOOL LLPanelFace::postBuild()
}
}
- mColorSwatch = LLUICtrlFactory::getColorSwatchByName(this,"colorswatch");
+ mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
if(mColorSwatch)
{
mColorSwatch->setCommitCallback(LLPanelFace::onCommitColor);
@@ -187,7 +187,7 @@ LLPanelFace::~LLPanelFace()
void LLPanelFace::sendTexture()
{
- LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(this,"texture control");
+ LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("texture control");
if(!mTextureCtrl) return;
if( !mTextureCtrl->getTentative() )
{
@@ -656,13 +656,13 @@ void LLPanelFace::getState()
if (selected_texgen == 1)
{
- childSetText("tex scale",childGetText("string repeats per meter"));
+ childSetText("tex scale",getString("string repeats per meter"));
childSetValue("TexScaleU", 2.0f * childGetValue("TexScaleU").asReal() );
childSetValue("TexScaleV", 2.0f * childGetValue("TexScaleV").asReal() );
}
else
{
- childSetText("tex scale",childGetText("string repeats per face"));
+ childSetText("tex scale",getString("string repeats per face"));
}
}
@@ -722,14 +722,14 @@ void LLPanelFace::getState()
clearCtrls();
// Disable non-UICtrls
- LLTextureCtrl* texture_ctrl = LLUICtrlFactory::getTexturePickerByName(this,"texture control");
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control");
if(texture_ctrl)
{
texture_ctrl->setImageAssetID( LLUUID::null );
texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl.
// texture_ctrl->setValid(FALSE);
}
- LLColorSwatchCtrl* mColorSwatch = LLUICtrlFactory::getColorSwatchByName(this,"colorswatch");
+ LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
if(mColorSwatch)
{
mColorSwatch->setEnabled( FALSE );
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index 76fbada562..d8faecf83d 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -67,22 +67,14 @@ BOOL LLPanelGroupTab::isVisibleByAgent(LLAgent* agentp)
BOOL LLPanelGroupTab::postBuild()
{
// Hook up the help button callback.
- LLButton* button = (LLButton*) getChildByName("help_button");
+ LLButton* button = getChild<LLButton>("help_button");
if (button)
{
button->setClickedCallback(onClickHelp);
button->setCallbackUserData(this);
}
- // Read help text from the xml file.
- LLTextBox* txt;
- // Don't recurse for this, since we don't currently have a recursive removeChild()
- txt = (LLTextBox*) getChildByName("help_text");
- if (txt)
- {
- mHelpText = txt->getText();
- removeChild(txt, TRUE);
- }
+ mHelpText = getString("help_text");
return TRUE;
}
@@ -219,14 +211,14 @@ void LLPanelGroup::updateTabVisibility()
BOOL LLPanelGroup::postBuild()
{
- mTabContainer = (LLTabContainerCommon*) getChildByName("group_tab_container");
+ mTabContainer = getChild<LLTabContainer>("group_tab_container");
if (mTabContainer)
{
// Select the initial tab specified via constructor
const BOOL recurse = TRUE;
LLPanelGroupTab* tabp =
- (LLPanelGroupTab*) getChildByName(mInitialTab, recurse);
+ getChild<LLPanelGroupTab>(mInitialTab, recurse);
if (!tabp)
{
@@ -272,23 +264,10 @@ BOOL LLPanelGroup::postBuild()
mCurrentTab->activate();
}
- // Read apply text from the xml file.
- LLTextBox* txt;
- // Don't recurse for this, since we don't currently have a recursive removeChild()
- txt = (LLTextBox*)getChildByName("default_needs_apply_text");
- if (txt)
- {
- mDefaultNeedsApplyMesg = txt->getText();
- removeChild(txt, TRUE);
- }
- txt = (LLTextBox*)getChildByName("want_apply_text");
- if (txt)
- {
- mWantApplyMesg = txt->getText();
- removeChild(txt, TRUE);
- }
+ mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
+ mWantApplyMesg = getString("want_apply_text");
- LLButton* button = (LLButton*) getChildByName("btn_ok");
+ LLButton* button = getChild<LLButton>("btn_ok");
if (button)
{
button->setClickedCallback(onBtnOK);
@@ -296,7 +275,7 @@ BOOL LLPanelGroup::postBuild()
button->setVisible(mAllowEdit);
}
- button = (LLButton*) getChildByName("btn_cancel");
+ button = getChild<LLButton>("btn_cancel");
if (button)
{
button->setClickedCallback(onBtnCancel);
@@ -304,7 +283,7 @@ BOOL LLPanelGroup::postBuild()
button->setVisible(mAllowEdit);
}
- button = (LLButton*) getChildByName("btn_apply");
+ button = getChild<LLButton>("btn_apply");
if (button)
{
button->setClickedCallback(onBtnApply);
@@ -314,7 +293,7 @@ BOOL LLPanelGroup::postBuild()
mApplyBtn = button;
}
- button = (LLButton*) getChildByName("btn_refresh");
+ button = getChild<LLButton>("btn_refresh");
if (button)
{
button->setClickedCallback(onBtnRefresh);
@@ -400,7 +379,7 @@ void LLPanelGroup::selectTab(std::string tab_name)
const BOOL recurse = TRUE;
LLPanelGroupTab* tabp =
- (LLPanelGroupTab*) getChildByName(tab_name, recurse);
+ getChild<LLPanelGroupTab>(tab_name, recurse);
if ( tabp && mTabContainer )
{
diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h
index 19f43ecb88..3928d1d2f5 100644
--- a/indra/newview/llpanelgroup.h
+++ b/indra/newview/llpanelgroup.h
@@ -41,7 +41,7 @@ const S32 UPDATE_MEMBERS_PER_FRAME = 500;
// Forward declares
class LLPanelGroupTab;
-class LLTabContainerCommon;
+class LLTabContainer;
class LLAgent;
class LLPanelGroupTabObserver
@@ -111,7 +111,7 @@ public:
protected:
LLPanelGroupTab* mCurrentTab;
LLPanelGroupTab* mRequestedTab;
- LLTabContainerCommon* mTabContainer;
+ LLTabContainer* mTabContainer;
BOOL mIgnoreTransition;
LLButton* mApplyBtn;
@@ -183,7 +183,7 @@ public:
protected:
LLUUID mGroupID;
- LLTabContainerCommon* mTabContainer;
+ LLTabContainer* mTabContainer;
LLString mHelpText;
BOOL mAllowEdit;
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 31688256f5..2e55cfb30a 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -99,10 +99,10 @@ BOOL LLPanelGroupGeneral::postBuild()
bool recurse = true;
// General info
- mGroupNameEditor = (LLLineEditor*) getChildByName("group_name_editor", recurse);
- mGroupName = (LLTextBox*) getChildByName("group_name", recurse);
+ mGroupNameEditor = getChild<LLLineEditor>("group_name_editor", recurse);
+ mGroupName = getChild<LLTextBox>("group_name", recurse);
- mInsignia = (LLTextureCtrl*) getChildByName("insignia", recurse);
+ mInsignia = getChild<LLTextureCtrl>("insignia", recurse);
if (mInsignia)
{
mInsignia->setCommitCallback(onCommitAny);
@@ -110,7 +110,7 @@ BOOL LLPanelGroupGeneral::postBuild()
mDefaultIconID = mInsignia->getImageAssetID();
}
- mEditCharter = (LLTextEditor*) getChildByName("charter", recurse);
+ mEditCharter = getChild<LLTextEditor>("charter", recurse);
if(mEditCharter)
{
mEditCharter->setCommitCallback(onCommitAny);
@@ -119,21 +119,21 @@ BOOL LLPanelGroupGeneral::postBuild()
mEditCharter->setCallbackUserData(this);
}
- mBtnJoinGroup = (LLButton*) getChildByName("join_button", recurse);
+ mBtnJoinGroup = getChild<LLButton>("join_button", recurse);
if ( mBtnJoinGroup )
{
mBtnJoinGroup->setClickedCallback(onClickJoin);
mBtnJoinGroup->setCallbackUserData(this);
}
- mBtnInfo = (LLButton*) getChildByName("info_button", recurse);
+ mBtnInfo = getChild<LLButton>("info_button", recurse);
if ( mBtnInfo )
{
mBtnInfo->setClickedCallback(onClickInfo);
mBtnInfo->setCallbackUserData(this);
}
- LLTextBox* founder = (LLTextBox*) getChildByName("founder_name");
+ LLTextBox* founder = getChild<LLTextBox>("founder_name");
if (founder)
{
mFounderName = new LLNameBox(founder->getName(),founder->getRect(),LLUUID::null,FALSE,founder->getFont(),founder->getMouseOpaque());
@@ -141,7 +141,7 @@ BOOL LLPanelGroupGeneral::postBuild()
addChild(mFounderName);
}
- mListVisibleMembers = (LLNameListCtrl*) getChildByName("visible_members", recurse);
+ mListVisibleMembers = getChild<LLNameListCtrl>("visible_members", recurse);
if (mListVisibleMembers)
{
mListVisibleMembers->setDoubleClickCallback(openProfile);
@@ -149,14 +149,14 @@ BOOL LLPanelGroupGeneral::postBuild()
}
// Options
- mCtrlShowInGroupList = (LLCheckBoxCtrl*) getChildByName("show_in_group_list", recurse);
+ mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse);
if (mCtrlShowInGroupList)
{
mCtrlShowInGroupList->setCommitCallback(onCommitAny);
mCtrlShowInGroupList->setCallbackUserData(this);
}
- mCtrlMature = (LLCheckBoxCtrl*) getChildByName("mature", recurse);
+ mCtrlMature = getChild<LLCheckBoxCtrl>("mature", recurse);
if (mCtrlMature)
{
mCtrlMature->setCommitCallback(onCommitAny);
@@ -164,21 +164,21 @@ BOOL LLPanelGroupGeneral::postBuild()
mCtrlMature->setVisible( !gAgent.isTeen() );
}
- mCtrlOpenEnrollment = (LLCheckBoxCtrl*) getChildByName("open_enrollement", recurse);
+ mCtrlOpenEnrollment = getChild<LLCheckBoxCtrl>("open_enrollement", recurse);
if (mCtrlOpenEnrollment)
{
mCtrlOpenEnrollment->setCommitCallback(onCommitAny);
mCtrlOpenEnrollment->setCallbackUserData(this);
}
- mCtrlEnrollmentFee = (LLCheckBoxCtrl*) getChildByName("check_enrollment_fee", recurse);
+ mCtrlEnrollmentFee = getChild<LLCheckBoxCtrl>("check_enrollment_fee", recurse);
if (mCtrlEnrollmentFee)
{
mCtrlEnrollmentFee->setCommitCallback(onCommitEnrollment);
mCtrlEnrollmentFee->setCallbackUserData(this);
}
- mSpinEnrollmentFee = (LLSpinCtrl*) getChildByName("spin_enrollment_fee", recurse);
+ mSpinEnrollmentFee = getChild<LLSpinCtrl>("spin_enrollment_fee", recurse);
if (mSpinEnrollmentFee)
{
mSpinEnrollmentFee->setCommitCallback(onCommitAny);
@@ -194,7 +194,7 @@ BOOL LLPanelGroupGeneral::postBuild()
accept_notices = data.mAcceptNotices;
list_in_profile = data.mListInProfile;
}
- mCtrlReceiveNotices = (LLCheckBoxCtrl*) getChildByName("receive_notices", recurse);
+ mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices", recurse);
if (mCtrlReceiveNotices)
{
mCtrlReceiveNotices->setCommitCallback(onCommitUserOnly);
@@ -203,7 +203,7 @@ BOOL LLPanelGroupGeneral::postBuild()
mCtrlReceiveNotices->setEnabled(data.mID.notNull());
}
- mCtrlListGroup = (LLCheckBoxCtrl*) getChildByName("list_groups_in_profile", recurse);
+ mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse);
if (mCtrlListGroup)
{
mCtrlListGroup->setCommitCallback(onCommitUserOnly);
@@ -212,31 +212,17 @@ BOOL LLPanelGroupGeneral::postBuild()
mCtrlListGroup->setEnabled(data.mID.notNull());
}
- mActiveTitleLabel = (LLTextBox*) getChildByName("active_title_label", recurse);
+ mActiveTitleLabel = getChild<LLTextBox>("active_title_label", recurse);
- mComboActiveTitle = (LLComboBox*) getChildByName("active_title", recurse);
+ mComboActiveTitle = getChild<LLComboBox>("active_title", recurse);
if (mComboActiveTitle)
{
mComboActiveTitle->setCommitCallback(onCommitTitle);
mComboActiveTitle->setCallbackUserData(this);
}
- // Extra data
- LLTextBox* txt;
- // Don't recurse for this, since we don't currently have a recursive removeChild()
- txt = (LLTextBox*)getChildByName("incomplete_member_data_str");
- if (txt)
- {
- mIncompleteMemberDataStr = txt->getText();
- removeChild(txt, TRUE);
- }
-
- txt = (LLTextBox*)getChildByName("confirm_group_create_str");
- if (txt)
- {
- mConfirmGroupCreateStr = txt->getText();
- removeChild(txt, TRUE);
- }
+ mIncompleteMemberDataStr = getString("incomplete_member_data_str");
+ mConfirmGroupCreateStr = getString("confirm_group_create_str");
// If the group_id is null, then we are creating a new group
if (mGroupID.isNull())
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index 9bab774a46..229daf44ff 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -474,12 +474,12 @@ BOOL LLPanelGroupInvite::postBuild()
{
BOOL recurse = TRUE;
- mImplementation->mLoadingText = childGetText("loading");
- mImplementation->mRoleNames = (LLComboBox*) getChildByName("role_name",
+ mImplementation->mLoadingText = getString("loading");
+ mImplementation->mRoleNames = getChild<LLComboBox>("role_name",
recurse);
- mImplementation->mGroupName = (LLTextBox*) getChildByName("group_name_text", recurse);
+ mImplementation->mGroupName = getChild<LLTextBox>("group_name_text", recurse);
mImplementation->mInvitees =
- (LLNameListCtrl*) getChildByName("invitee_list", recurse);
+ getChild<LLNameListCtrl>("invitee_list", recurse);
if ( mImplementation->mInvitees )
{
mImplementation->mInvitees->setCallbackUserData(mImplementation);
@@ -487,7 +487,7 @@ BOOL LLPanelGroupInvite::postBuild()
mImplementation->mInvitees->setCommitCallback(impl::callbackSelect);
}
- LLButton* button = (LLButton*) getChildByName("add_button", recurse);
+ LLButton* button = getChild<LLButton>("add_button", recurse);
if ( button )
{
// default to opening avatarpicker automatically
@@ -497,7 +497,7 @@ BOOL LLPanelGroupInvite::postBuild()
}
mImplementation->mRemoveButton =
- (LLButton*) getChildByName("remove_button", recurse);
+ getChild<LLButton>("remove_button", recurse);
if ( mImplementation->mRemoveButton )
{
mImplementation->mRemoveButton->
@@ -507,7 +507,7 @@ BOOL LLPanelGroupInvite::postBuild()
}
mImplementation->mOKButton =
- (LLButton*) getChildByName("ok_button", recurse);
+ getChild<LLButton>("ok_button", recurse);
if ( mImplementation->mOKButton )
{
mImplementation->mOKButton->
@@ -516,7 +516,7 @@ BOOL LLPanelGroupInvite::postBuild()
mImplementation->mOKButton->setEnabled(FALSE);
}
- button = (LLButton*) getChildByName("cancel_button", recurse);
+ button = getChild<LLButton>("cancel_button", recurse);
if ( button )
{
button->setClickedCallback(impl::callbackClickCancel);
diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index 7f12555fe2..c6aae2dd88 100644
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -60,7 +60,7 @@ public:
LLGroupMoneyTabEventHandler(LLButton* earlier_button,
LLButton* later_button,
LLTextEditor* text_editor,
- LLTabContainerCommon* tab_containerp,
+ LLTabContainer* tab_containerp,
LLPanel* panelp,
const LLString& loading_text,
const LLUUID& group_id,
@@ -92,7 +92,7 @@ public:
LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp,
LLButton* later_buttonp,
LLTextEditor* text_editorp,
- LLTabContainerCommon* tab_containerp,
+ LLTabContainer* tab_containerp,
LLPanel* panelp,
const LLString& loading_text,
const LLUUID& group_id);
@@ -109,7 +109,7 @@ public:
LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp,
LLButton* later_buttonp,
LLTextEditor* text_editorp,
- LLTabContainerCommon* tab_containerp,
+ LLTabContainer* tab_containerp,
LLPanel* panelp,
const LLString& loading_text,
const LLUUID& group_id);
@@ -123,7 +123,7 @@ class LLGroupMoneyPlanningTabEventHandler : public LLGroupMoneyTabEventHandler
{
public:
LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editor,
- LLTabContainerCommon* tab_containerp,
+ LLTabContainer* tab_containerp,
LLPanel* panelp,
const LLString& loading_text,
const LLUUID& group_id);
@@ -501,7 +501,7 @@ void LLPanelGroupLandMoney::activate()
if ( !mImplementationp->mBeenActivated )
{
//select the first tab
- LLTabContainerCommon* tabp = (LLTabContainerCommon*) getChildByName("group_money_tab_container");
+ LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container");
if ( tabp )
{
@@ -541,7 +541,7 @@ void LLPanelGroupLandMoney::update(LLGroupChange gc)
{
if (gc != GC_ALL) return; //Don't update if it's the wrong panel!
- LLTabContainerCommon* tabp = (LLTabContainerCommon*) getChildByName("group_money_tab_container");
+ LLTabContainer* tabp = getChild<LLTabContainer>("group_money_tab_container");
if ( tabp )
{
@@ -605,12 +605,12 @@ BOOL LLPanelGroupLandMoney::postBuild()
bool can_view = gAgent.isInGroup(mGroupID);
mImplementationp->mGroupOverLimitIconp =
- (LLIconCtrl*) getChildByName("group_over_limit_icon");
+ getChild<LLIconCtrl>("group_over_limit_icon");
mImplementationp->mGroupOverLimitTextp =
- (LLTextBox*) getChildByName("group_over_limit_text");
+ getChild<LLTextBox>("group_over_limit_text");
mImplementationp->mYourContributionEditorp
- = (LLLineEditor*) getChildByName("your_contribution_line_editor");
+ = getChild<LLLineEditor>("your_contribution_line_editor");
if ( mImplementationp->mYourContributionEditorp )
{
LLLineEditor* editor = mImplementationp->mYourContributionEditorp;
@@ -620,26 +620,13 @@ BOOL LLPanelGroupLandMoney::postBuild()
editor->setCallbackUserData(this);
}
- mImplementationp->mMapButtonp = (LLButton*) getChildByName("map_button");
+ mImplementationp->mMapButtonp = getChild<LLButton>("map_button");
mImplementationp->mGroupParcelsp =
- (LLScrollListCtrl*) getChildByName("group_parcel_list");
-
- LLTextBox *no_permsp =
- (LLTextBox*) getChildByName("cant_view_group_land_text");
- if ( no_permsp )
- {
- mImplementationp->mCantViewParcelsText = no_permsp->getText();
- removeChild(no_permsp, TRUE);
- }
-
- no_permsp = (LLTextBox*) getChildByName("cant_view_group_accounting_text");
- if ( no_permsp )
- {
- mImplementationp->mCantViewAccountsText = no_permsp->getText();
- removeChild(no_permsp, TRUE);
- }
+ getChild<LLScrollListCtrl>("group_parcel_list");
+ mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text");
+ mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text");
if ( mImplementationp->mMapButtonp )
{
@@ -677,8 +664,7 @@ BOOL LLPanelGroupLandMoney::postBuild()
LLTextEditor* textp;
LLPanel* panelp;
- LLTabContainerCommon* tabcp = (LLTabContainerCommon*)
- getChildByName("group_money_tab_container", true);
+ LLTabContainer* tabcp = getChild<LLTabContainer>("group_money_tab_container");
if ( !can_view )
{
@@ -694,13 +680,13 @@ BOOL LLPanelGroupLandMoney::postBuild()
}
}
- LLString loading_text = childGetText("loading_txt");
+ LLString loading_text = getString("loading_txt");
//pull out the widgets for the L$ details tab
- earlierp = (LLButton*) getChildByName("earlier_details_button", true);
- laterp = (LLButton*) getChildByName("later_details_button", true);
- textp = (LLTextEditor*) getChildByName("group_money_details_text", true);
- panelp = (LLPanel*) getChildByName("group_money_details_tab", true);
+ earlierp = getChild<LLButton>("earlier_details_button", true);
+ laterp = getChild<LLButton>("later_details_button", true);
+ textp = getChild<LLTextEditor>("group_money_details_text", true);
+ panelp = getChild<LLPanel>("group_money_details_tab", true);
if ( !can_view )
{
@@ -718,8 +704,8 @@ BOOL LLPanelGroupLandMoney::postBuild()
mGroupID);
}
- textp = (LLTextEditor*) getChildByName("group_money_planning_text", true);
- panelp = (LLPanel*) getChildByName("group_money_planning_tab", true);
+ textp = getChild<LLTextEditor>("group_money_planning_text", true);
+ panelp = getChild<LLPanel>("group_money_planning_tab", true);
if ( !can_view )
{
@@ -736,10 +722,10 @@ BOOL LLPanelGroupLandMoney::postBuild()
}
//pull out the widgets for the L$ sales tab
- earlierp = (LLButton*) getChildByName("earlier_sales_button", true);
- laterp = (LLButton*) getChildByName("later_sales_button", true);
- textp = (LLTextEditor*) getChildByName("group_money_sales_text", true);
- panelp = (LLPanel*) getChildByName("group_money_sales_tab", true);
+ earlierp = getChild<LLButton>("earlier_sales_button", true);
+ laterp = getChild<LLButton>("later_sales_button", true);
+ textp = getChild<LLTextEditor>("group_money_sales_text", true);
+ panelp = getChild<LLPanel>("group_money_sales_tab", true);
if ( !can_view )
{
@@ -881,7 +867,7 @@ std::map<LLPanel*, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sT
LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_buttonp,
LLButton* later_buttonp,
LLTextEditor* text_editorp,
- LLTabContainerCommon* tab_containerp,
+ LLTabContainer* tab_containerp,
LLPanel* panelp,
const LLString& loading_text,
const LLUUID& group_id,
@@ -998,7 +984,7 @@ void LLGroupMoneyTabEventHandler::clickTabCallback(void* data, bool from_click)
LLGroupMoneyDetailsTabEventHandler::LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp,
LLButton* later_buttonp,
LLTextEditor* text_editorp,
- LLTabContainerCommon* tab_containerp,
+ LLTabContainer* tab_containerp,
LLPanel* panelp,
const LLString& loading_text,
const LLUUID& group_id)
@@ -1138,7 +1124,7 @@ void LLPanelGroupLandMoney::processGroupAccountDetailsReply(LLMessageSystem* msg
LLGroupMoneySalesTabEventHandler::LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp,
LLButton* later_buttonp,
LLTextEditor* text_editorp,
- LLTabContainerCommon* tab_containerp,
+ LLTabContainer* tab_containerp,
LLPanel* panelp,
const LLString& loading_text,
const LLUUID& group_id)
@@ -1315,7 +1301,7 @@ void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem
//***************************************************
LLGroupMoneyPlanningTabEventHandler::LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editorp,
- LLTabContainerCommon* tab_containerp,
+ LLTabContainer* tab_containerp,
LLPanel* panelp,
const LLString& loading_text,
const LLUUID& group_id)
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 9ac88a3cc2..4c16936b68 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -129,7 +129,7 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
{
// check if inside
//LLRect parent_rect = mParentView->getRect();
- //mRect.set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0);
+ //getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0);
handled = TRUE;
// check the type
@@ -229,67 +229,62 @@ BOOL LLPanelGroupNotices::postBuild()
{
bool recurse = true;
- mNoticesList = (LLScrollListCtrl*)getChildByName("notice_list",recurse);
+ mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse);
mNoticesList->setCommitOnSelectionChange(TRUE);
mNoticesList->setCommitCallback(onSelectNotice);
mNoticesList->setCallbackUserData(this);
- mBtnNewMessage = (LLButton*)getChildByName("create_new_notice",recurse);
+ mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse);
mBtnNewMessage->setClickedCallback(onClickNewMessage);
mBtnNewMessage->setCallbackUserData(this);
mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND));
- mBtnGetPastNotices = (LLButton*)getChildByName("refresh_notices",recurse);
+ mBtnGetPastNotices = getChild<LLButton>("refresh_notices",recurse);
mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices);
mBtnGetPastNotices->setCallbackUserData(this);
// Create
- mCreateSubject = (LLLineEditor*)getChildByName("create_subject",recurse);
- mCreateMessage = (LLTextEditor*)getChildByName("create_message",recurse);
+ mCreateSubject = getChild<LLLineEditor>("create_subject",recurse);
+ mCreateMessage = getChild<LLTextEditor>("create_message",recurse);
- mCreateInventoryName = (LLLineEditor*)getChildByName("create_inventory_name",recurse);
+ mCreateInventoryName = getChild<LLLineEditor>("create_inventory_name",recurse);
mCreateInventoryName->setTabStop(FALSE);
mCreateInventoryName->setEnabled(FALSE);
- mCreateInventoryIcon = (LLIconCtrl*)getChildByName("create_inv_icon",recurse);
+ mCreateInventoryIcon = getChild<LLIconCtrl>("create_inv_icon",recurse);
mCreateInventoryIcon->setVisible(FALSE);
- mBtnSendMessage = (LLButton*)getChildByName("send_notice",recurse);
+ mBtnSendMessage = getChild<LLButton>("send_notice",recurse);
mBtnSendMessage->setClickedCallback(onClickSendMessage);
mBtnSendMessage->setCallbackUserData(this);
- mBtnRemoveAttachment = (LLButton*)getChildByName("remove_attachment",recurse);
+ mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",recurse);
mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment);
mBtnRemoveAttachment->setCallbackUserData(this);
mBtnRemoveAttachment->setEnabled(FALSE);
// View
- mViewSubject = (LLLineEditor*)getChildByName("view_subject",recurse);
- mViewMessage = (LLTextEditor*)getChildByName("view_message",recurse);
+ mViewSubject = getChild<LLLineEditor>("view_subject",recurse);
+ mViewMessage = getChild<LLTextEditor>("view_message",recurse);
- mViewInventoryName = (LLLineEditor*)getChildByName("view_inventory_name",recurse);
+ mViewInventoryName = getChild<LLLineEditor>("view_inventory_name",recurse);
mViewInventoryName->setTabStop(FALSE);
mViewInventoryName->setEnabled(FALSE);
- mViewInventoryIcon = (LLIconCtrl*)getChildByName("view_inv_icon",recurse);
+ mViewInventoryIcon = getChild<LLIconCtrl>("view_inv_icon",recurse);
mViewInventoryIcon->setVisible(FALSE);
- mBtnOpenAttachment = (LLButton*)getChildByName("open_attachment",recurse);
+ mBtnOpenAttachment = getChild<LLButton>("open_attachment",recurse);
mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment);
mBtnOpenAttachment->setCallbackUserData(this);
- LLTextBox *txt = (LLTextBox*) getChildByName("no_notices_text",false);
- if (txt)
- {
- mNoNoticesStr = txt->getText();
- removeChild(txt, TRUE);
- }
+ mNoNoticesStr = getString("no_notices_text");
- mPanelCreateNotice = (LLPanel*) getChildByName("panel_create_new_notice",recurse);
- mPanelViewNotice = (LLPanel*) getChildByName("panel_view_past_notice",recurse);
+ mPanelCreateNotice = getChild<LLPanel>("panel_create_new_notice",recurse);
+ mPanelViewNotice = getChild<LLPanel>("panel_view_past_notice",recurse);
// Must be in front of all other UI elements.
- LLPanel* dtv = (LLPanel*)getChildByName("drop_target",recurse);
+ LLPanel* dtv = getChild<LLPanel>("drop_target",recurse);
LLGroupDropTarget* target = new LLGroupDropTarget("drop_target",
dtv->getRect(),
this, mGroupID);
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index 1556f24afa..6ca3e1e085 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -133,7 +133,7 @@ BOOL LLPanelGroupRoles::postBuild()
{
lldebugs << "LLPanelGroupRoles::postBuild()" << llendl;
- mSubTabContainer = (LLTabContainerCommon*) getChildByName("roles_tab_container");
+ mSubTabContainer = getChild<LLTabContainer>("roles_tab_container");
if (!mSubTabContainer) return FALSE;
@@ -169,20 +169,8 @@ BOOL LLPanelGroupRoles::postBuild()
mCurrentTab->activate();
// Read apply text from the xml file.
- LLTextBox* txt;
- // Don't recurse for this, since we don't currently have a recursive removeChild()
- txt = (LLTextBox*)getChildByName("default_needs_apply_text");
- if (txt)
- {
- mDefaultNeedsApplyMesg = txt->getText();
- removeChild(txt, TRUE);
- }
- txt = (LLTextBox*)getChildByName("want_apply_text");
- if (txt)
- {
- mWantApplyMesg = txt->getText();
- removeChild(txt, TRUE);
- }
+ mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
+ mWantApplyMesg = getString("want_apply_text");
return LLPanelGroupTab::postBuild();
}
@@ -515,20 +503,20 @@ BOOL LLPanelGroupSubTab::postBuild()
{
// Hook up the search widgets.
bool recurse = true;
- mSearchLineEditor = (LLLineEditor*) getChildByName("search_text", recurse);
+ mSearchLineEditor = getChild<LLLineEditor>("search_text", recurse);
if (!mSearchLineEditor) return FALSE;
mSearchLineEditor->setKeystrokeCallback(onSearchKeystroke);
mSearchLineEditor->setCallbackUserData(this);
- mSearchButton = (LLButton*) getChildByName("search_button", recurse);
+ mSearchButton = getChild<LLButton>("search_button", recurse);
if (!mSearchButton) return FALSE;
mSearchButton->setClickedCallback(onClickSearch);
mSearchButton->setCallbackUserData(this);
mSearchButton->setEnabled(FALSE);
- mShowAllButton = (LLButton*) getChildByName("show_all_button", recurse);
+ mShowAllButton = getChild<LLButton>("show_all_button", recurse);
if (!mShowAllButton) return FALSE;
mShowAllButton->setClickedCallback(onClickShowAll);
@@ -540,21 +528,21 @@ BOOL LLPanelGroupSubTab::postBuild()
bool no_recurse = false;
- LLIconCtrl* icon = (LLIconCtrl*) getChildByName("power_folder_icon",no_recurse);
+ LLIconCtrl* icon = getChild<LLIconCtrl>("power_folder_icon",no_recurse);
if (icon && icon->getImage().notNull())
{
mActionIcons["folder"] = icon->getImage();
removeChild(icon, TRUE);
}
- icon = (LLIconCtrl*) getChildByName("power_all_have_icon",no_recurse);
+ icon = getChild<LLIconCtrl>("power_all_have_icon",no_recurse);
if (icon && icon->getImage().notNull())
{
mActionIcons["full"] = icon->getImage();
removeChild(icon, TRUE);
}
- icon = (LLIconCtrl*) getChildByName("power_partial_icon",no_recurse);
+ icon = getChild<LLIconCtrl>("power_partial_icon",no_recurse);
if (icon && icon->getImage().notNull())
{
mActionIcons["partial"] = icon->getImage();
@@ -913,12 +901,12 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
// Look recursively from the parent to find all our widgets.
bool recurse = true;
- mHeader = (LLPanel*) parent->getChildByName("members_header", recurse);
- mFooter = (LLPanel*) parent->getChildByName("members_footer", recurse);
+ mHeader = parent->getChild<LLPanel>("members_header", recurse);
+ mFooter = parent->getChild<LLPanel>("members_footer", recurse);
- mMembersList = (LLNameListCtrl*) parent->getChildByName("member_list", recurse);
- mAssignedRolesList = (LLScrollListCtrl*) parent->getChildByName("member_assigned_roles", recurse);
- mAllowedActionsList = (LLScrollListCtrl*) parent->getChildByName("member_allowed_actions", recurse);
+ mMembersList = parent->getChild<LLNameListCtrl>("member_list", recurse);
+ mAssignedRolesList = parent->getChild<LLScrollListCtrl>("member_assigned_roles", recurse);
+ mAllowedActionsList = parent->getChild<LLScrollListCtrl>("member_allowed_actions", recurse);
if (!mMembersList || !mAssignedRolesList || !mAllowedActionsList) return FALSE;
@@ -929,7 +917,7 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
// Show the member's profile on double click.
mMembersList->setDoubleClickCallback(onMemberDoubleClick);
- LLButton* button = (LLButton*) parent->getChildByName("member_invite", recurse);
+ LLButton* button = parent->getChild<LLButton>("member_invite", recurse);
if ( button )
{
button->setClickedCallback(onInviteMember);
@@ -937,7 +925,7 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE));
}
- mEjectBtn = (LLButton*) parent->getChildByName("member_eject", recurse);
+ mEjectBtn = parent->getChild<LLButton>("member_eject", recurse);
if ( mEjectBtn )
{
mEjectBtn->setClickedCallback(onEjectMembers);
@@ -1483,19 +1471,16 @@ void LLPanelGroupMembersSubTab::applyMemberChanges()
notifyObservers();
}
-bool LLPanelGroupMembersSubTab::matchesSearchFilter(char* first, char* last)
+bool LLPanelGroupMembersSubTab::matchesSearchFilter(const std::string& fullname)
{
// If the search filter is empty, everything passes.
if (mSearchFilter.empty()) return true;
// Create a full name, and compare it to the search filter.
- LLString fullname;
- fullname.assign(first);
- fullname.append(1, ' ');
- fullname.append(last);
- LLString::toLower(fullname);
+ std::string fullname_lc(fullname);
+ LLString::toLower(fullname_lc);
- std::string::size_type match = fullname.find(mSearchFilter);
+ std::string::size_type match = fullname_lc.find(mSearchFilter);
if (std::string::npos == match)
{
@@ -1709,8 +1694,6 @@ void LLPanelGroupMembersSubTab::updateMembers()
LLGroupMgrGroupData::member_iter end = gdatap->mMembers.end();
- char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
- char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
S32 i = 0;
for( ; mMemberProgress != end && i<UPDATE_MEMBERS_PER_FRAME;
++mMemberProgress, ++i)
@@ -1720,9 +1703,10 @@ void LLPanelGroupMembersSubTab::updateMembers()
// Do filtering on name if it is already in the cache.
bool add_member = true;
- if (gCacheName->getName(mMemberProgress->first, first, last))
+ std::string fullname;
+ if (gCacheName->getFullName(mMemberProgress->first, fullname))
{
- if ( !matchesSearchFilter(first, last) )
+ if ( !matchesSearchFilter(fullname) )
{
add_member = false;
}
@@ -1802,19 +1786,19 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
// Look recursively from the parent to find all our widgets.
bool recurse = true;
- mHeader = (LLPanel*) parent->getChildByName("roles_header", recurse);
- mFooter = (LLPanel*) parent->getChildByName("roles_footer", recurse);
+ mHeader = parent->getChild<LLPanel>("roles_header", recurse);
+ mFooter = parent->getChild<LLPanel>("roles_footer", recurse);
- mRolesList = (LLScrollListCtrl*) parent->getChildByName("role_list", recurse);
- mAssignedMembersList = (LLNameListCtrl*) parent->getChildByName("role_assigned_members", recurse);
- mAllowedActionsList = (LLScrollListCtrl*) parent->getChildByName("role_allowed_actions", recurse);
+ mRolesList = parent->getChild<LLScrollListCtrl>("role_list", recurse);
+ mAssignedMembersList = parent->getChild<LLNameListCtrl>("role_assigned_members", recurse);
+ mAllowedActionsList = parent->getChild<LLScrollListCtrl>("role_allowed_actions", recurse);
- mRoleName = (LLLineEditor*) parent->getChildByName("role_name", recurse);
- mRoleTitle = (LLLineEditor*) parent->getChildByName("role_title", recurse);
- mRoleDescription = (LLTextEditor*) parent->getChildByName("role_description", recurse);
+ mRoleName = parent->getChild<LLLineEditor>("role_name", recurse);
+ mRoleTitle = parent->getChild<LLLineEditor>("role_title", recurse);
+ mRoleDescription = parent->getChild<LLTextEditor>("role_description", recurse);
- mMemberVisibleCheck = (LLCheckBoxCtrl*) parent->getChildByName("role_visible_in_list", recurse);
+ mMemberVisibleCheck = parent->getChild<LLCheckBoxCtrl>("role_visible_in_list", recurse);
if (!mRolesList || !mAssignedMembersList || !mAllowedActionsList
|| !mRoleName || !mRoleTitle || !mRoleDescription || !mMemberVisibleCheck)
@@ -1823,15 +1807,10 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
return FALSE;
}
- LLTextBox* txt = (LLTextBox*) parent->getChildByName("cant_delete_role", FALSE);
- if (txt)
- {
- mRemoveEveryoneTxt = txt->getText();
- parent->removeChild(txt, TRUE);
- }
+ mRemoveEveryoneTxt = getString("cant_delete_role");
mCreateRoleButton =
- (LLButton*) parent->getChildByName("role_create", recurse);
+ parent->getChild<LLButton>("role_create", recurse);
if ( mCreateRoleButton )
{
mCreateRoleButton->setCallbackUserData(this);
@@ -1840,7 +1819,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
}
mDeleteRoleButton =
- (LLButton*) parent->getChildByName("role_delete", recurse);
+ parent->getChild<LLButton>("role_delete", recurse);
if ( mDeleteRoleButton )
{
mDeleteRoleButton->setCallbackUserData(this);
@@ -2515,14 +2494,14 @@ BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root)
// Look recursively from the parent to find all our widgets.
bool recurse = true;
- mHeader = (LLPanel*) parent->getChildByName("actions_header", recurse);
- mFooter = (LLPanel*) parent->getChildByName("actions_footer", recurse);
+ mHeader = parent->getChild<LLPanel>("actions_header", recurse);
+ mFooter = parent->getChild<LLPanel>("actions_footer", recurse);
- mActionDescription = (LLTextEditor*) parent->getChildByName("action_description", recurse);
+ mActionDescription = parent->getChild<LLTextEditor>("action_description", recurse);
- mActionList = (LLScrollListCtrl*) parent->getChildByName("action_list",recurse);
- mActionRoles = (LLScrollListCtrl*) parent->getChildByName("action_roles",recurse);
- mActionMembers = (LLNameListCtrl*) parent->getChildByName("action_members",recurse);
+ mActionList = parent->getChild<LLScrollListCtrl>("action_list",recurse);
+ mActionRoles = parent->getChild<LLScrollListCtrl>("action_roles",recurse);
+ mActionMembers = parent->getChild<LLNameListCtrl>("action_members",recurse);
if (!mActionList || !mActionDescription || !mActionRoles || !mActionMembers) return FALSE;
diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h
index 13d64d4edb..6d2c6ab4cf 100644
--- a/indra/newview/llpanelgrouproles.h
+++ b/indra/newview/llpanelgrouproles.h
@@ -93,7 +93,7 @@ public:
protected:
LLPanelGroupTab* mCurrentTab;
LLPanelGroupTab* mRequestedTab;
- LLTabContainerCommon* mSubTabContainer;
+ LLTabContainer* mSubTabContainer;
BOOL mFirstUse;
BOOL mIgnoreTransition;
@@ -205,7 +205,7 @@ protected:
typedef std::map<LLUUID, role_change_data_map_t*>::iterator member_role_change_iter;
typedef std::map<LLUUID, role_change_data_map_t*> member_role_changes_map_t;
- bool matchesSearchFilter(char* first, char* last);
+ bool matchesSearchFilter(const std::string& fullname);
U64 getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id);
bool getRoleChangeType(const LLUUID& member_id,
diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp
index 1ac95c9a82..eb40eefcb7 100644
--- a/indra/newview/llpanellandmedia.cpp
+++ b/indra/newview/llpanellandmedia.cpp
@@ -66,7 +66,7 @@ BOOL LLPanelLandMedia::postBuild()
mMusicURLEdit = LLUICtrlFactory::getLineEditorByName(this, "music_url");
childSetCommitCallback("music_url", onCommitAny, this);
- mMediaTextureCtrl = LLUICtrlFactory::getTexturePickerByName(this, "media texture");
+ mMediaTextureCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this, "media texture");
if (mMediaTextureCtrl)
{
mMediaTextureCtrl->setCommitCallback( onCommitAny );
@@ -77,7 +77,7 @@ BOOL LLPanelLandMedia::postBuild()
}
else
{
- llwarns << "LLUICtrlFactory::getTexturePickerByName() returned NULL for 'media texure'" << llendl;
+ llwarns << "LLViewerUICtrlFactory::getTexturePickerByName() returned NULL for 'media texure'" << llendl;
}
mMediaAutoScaleCheck = LLUICtrlFactory::getCheckBoxByName(this, "media_auto_scale");
@@ -242,7 +242,7 @@ void LLPanelLandMedia::refresh()
};
#endif
- LLFloaterURLEntry* floater_url_entry = (LLFloaterURLEntry*)LLFloater::getFloaterByHandle(mURLEntryFloater);
+ LLFloaterURLEntry* floater_url_entry = (LLFloaterURLEntry*)mURLEntryFloater.get();
if (floater_url_entry)
{
floater_url_entry->updateFromLandMediaPanel();
@@ -373,6 +373,6 @@ void LLPanelLandMedia::onSetBtn(void *userdata)
LLFloater* parent_floater = gFloaterView->getParentFloater(self);
if (parent_floater)
{
- parent_floater->addDependentFloater(LLFloater::getFloaterByHandle(self->mURLEntryFloater));
+ parent_floater->addDependentFloater(self->mURLEntryFloater.get());
}
}
diff --git a/indra/newview/llpanellandmedia.h b/indra/newview/llpanellandmedia.h
index aa84b245e2..769bc27532 100644
--- a/indra/newview/llpanellandmedia.h
+++ b/indra/newview/llpanellandmedia.h
@@ -11,7 +11,6 @@
#define LLPANELLANDMEDIA_H
#include "lllineeditor.h"
-#include "llmemory.h" // LLHandle<>
#include "llpanel.h"
#include "llparcelselection.h"
#include "lluifwd.h" // widget pointer types
@@ -20,7 +19,7 @@ class LLPanelLandMedia
: public LLPanel
{
public:
- LLPanelLandMedia(LLHandle<LLParcelSelection>& parcelp);
+ LLPanelLandMedia(LLSafeHandle<LLParcelSelection>& parcelp);
/*virtual*/ ~LLPanelLandMedia();
/*virtual*/ BOOL postBuild();
void refresh();
@@ -50,9 +49,9 @@ private:
LLCheckBoxCtrl* mMediaLoopCheck;
LLCheckBoxCtrl* mMediaUrlCheck;
LLCheckBoxCtrl* mMusicUrlCheck;
- LLViewHandle mURLEntryFloater;
+ LLHandle<LLFloater> mURLEntryFloater;
- LLHandle<LLParcelSelection>& mParcel;
+ LLSafeHandle<LLParcelSelection>& mParcel;
};
#endif
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index a80765c805..b65835fed3 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -328,7 +328,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
mCallbackData(cb_data),
mHtmlAvailable( TRUE )
{
- mIsFocusRoot = TRUE;
+ setFocusRoot(TRUE);
setBackgroundVisible(FALSE);
setBackgroundOpaque(TRUE);
@@ -437,7 +437,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
#endif
// get the web browser control
- LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "login_html");
+ LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html");
if ( web_browser )
{
// Need to handle login secondlife:///app/ URLs
@@ -454,22 +454,22 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
web_browser->setOpenInExternalBrowser( true );
// force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through)
- LLRect htmlRect = mRect;
+ LLRect htmlRect = getRect();
#if USE_VIEWER_AUTH
- htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY(), mRect.getWidth() + 6, mRect.getHeight());
+ htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight());
#else
- htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY() + 40, mRect.getWidth() + 6, mRect.getHeight() - 78 );
+ htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 );
#endif
web_browser->setRect( htmlRect );
web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE );
- reshape( mRect.getWidth(), mRect.getHeight(), 1 );
+ reshape( getRect().getWidth(), getRect().getHeight(), 1 );
// kick off a request to grab the url manually
gResponsePtr = LLIamHereLogin::build( this );
std::string login_page = LLAppViewer::instance()->getLoginPage();
if (login_page.empty())
{
- login_page = childGetValue( "real_url" ).asString();
+ login_page = getString( "real_url" );
}
LLHTTPClient::head( login_page, gResponsePtr );
};
@@ -482,7 +482,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
void LLPanelLogin::setSiteIsAlive( bool alive )
{
- LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "login_html");
+ LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html");
// if the contents of the site was retrieved
if ( alive )
{
@@ -555,16 +555,16 @@ void LLPanelLogin::draw()
glPushMatrix();
{
F32 image_aspect = 1.333333f;
- F32 view_aspect = (F32)mRect.getWidth() / (F32)mRect.getHeight();
+ F32 view_aspect = (F32)getRect().getWidth() / (F32)getRect().getHeight();
// stretch image to maintain aspect ratio
if (image_aspect > view_aspect)
{
- glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * mRect.getWidth(), 0.f, 0.f);
+ glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f);
glScalef(image_aspect / view_aspect, 1.f, 1.f);
}
- S32 width = mRect.getWidth();
- S32 height = mRect.getHeight();
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
if ( mHtmlAvailable )
{
@@ -905,7 +905,7 @@ void LLPanelLogin::setAlwaysRefresh(bool refresh)
{
if (LLStartUp::getStartupState() >= STATE_LOGIN_CLEANUP) return;
- LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html");
+ LLWebBrowserCtrl* web_browser = sInstance->getChild<LLWebBrowserCtrl>("login_html");
if (web_browser)
{
@@ -924,7 +924,7 @@ void LLPanelLogin::loadLoginPage()
std::string login_page = LLAppViewer::instance()->getLoginPage();
if (login_page.empty())
{
- login_page = sInstance->childGetValue( "real_url" ).asString();
+ login_page = sInstance->getString( "real_url" );
}
oStr << login_page;
@@ -1036,7 +1036,7 @@ void LLPanelLogin::loadLoginPage()
#endif
#endif
- LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html");
+ LLWebBrowserCtrl* web_browser = sInstance->getChild<LLWebBrowserCtrl>("login_html");
// navigate to the "real" page
web_browser->navigateTo( oStr.str() );
@@ -1044,7 +1044,7 @@ void LLPanelLogin::loadLoginPage()
void LLPanelLogin::onNavigateComplete( const EventType& eventIn )
{
- LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html");
+ LLWebBrowserCtrl* web_browser = sInstance->getChild<LLWebBrowserCtrl>("login_html");
if (web_browser)
{
// *HACK HACK HACK HACK!
@@ -1157,7 +1157,7 @@ void LLPanelLogin::onClickForgotPassword(void*)
{
if (sInstance )
{
- LLWeb::loadURL(sInstance->childGetValue( "forgot_password_url" ).asString());
+ LLWeb::loadURL(sInstance->getString( "forgot_password_url" ));
}
}
diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp
index a57993820f..f717088de6 100644
--- a/indra/newview/llpanelobject.cpp
+++ b/indra/newview/llpanelobject.cpp
@@ -259,7 +259,7 @@ BOOL LLPanelObject::postBuild()
mSpinRevolutions->setValidateBeforeCommit( &precommitValidate );
// Sculpt
- mCtrlSculptTexture = LLUICtrlFactory::getTexturePickerByName(this,"sculpt texture control");
+ mCtrlSculptTexture = getChild<LLTextureCtrl>("sculpt texture control");
if (mCtrlSculptTexture)
{
mCtrlSculptTexture->setDefaultImageAssetID(LLUUID(SCULPT_DEFAULT_TEXTURE));
@@ -1903,7 +1903,7 @@ void LLPanelObject::onSelectSculpt(LLUICtrl* ctrl, void* userdata)
{
LLPanelObject* self = (LLPanelObject*) userdata;
- LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(self, "sculpt texture control");
+ LLTextureCtrl* mTextureCtrl = self->getChild<LLTextureCtrl>("sculpt texture control");
if (mTextureCtrl)
{
@@ -1926,7 +1926,7 @@ BOOL LLPanelObject::onDropSculpt(LLUICtrl*, LLInventoryItem* item, void* userdat
{
LLPanelObject* self = (LLPanelObject*) userdata;
- LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(self, "sculpt texture control");
+ LLTextureCtrl* mTextureCtrl = self->getChild<LLTextureCtrl>("sculpt texture control");
if (mTextureCtrl)
{
@@ -1945,7 +1945,7 @@ void LLPanelObject::onCancelSculpt(LLUICtrl* ctrl, void* userdata)
{
LLPanelObject* self = (LLPanelObject*) userdata;
- LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(self,"sculpt texture control");
+ LLTextureCtrl* mTextureCtrl = self->getChild<LLTextureCtrl>("sculpt texture control");
if(!mTextureCtrl)
return;
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp
index 7beba92ebb..8ab31acb49 100644
--- a/indra/newview/llpanelpermissions.cpp
+++ b/indra/newview/llpanelpermissions.cpp
@@ -138,11 +138,11 @@ void LLPanelPermissions::refresh()
LLString deedText;
if (gSavedSettings.getWarning("DeedObject"))
{
- deedText = this->childGetText("text deed continued");
+ deedText = getString("text deed continued");
}
else
{
- deedText = this->childGetText("text deed");
+ deedText = getString("text deed");
}
BtnDeedToGroup->setLabelSelected(deedText);
BtnDeedToGroup->setLabelUnselected(deedText);
@@ -261,10 +261,10 @@ void LLPanelPermissions::refresh()
S32 string_index = 0;
LLString MODIFY_INFO_STRINGS[] =
{
- childGetText("text modify info 1"),
- childGetText("text modify info 2"),
- childGetText("text modify info 3"),
- childGetText("text modify info 4")
+ getString("text modify info 1"),
+ getString("text modify info 2"),
+ getString("text modify info 3"),
+ getString("text modify info 4")
};
if(!is_perm_modify)
{
@@ -572,7 +572,7 @@ void LLPanelPermissions::refresh()
if (!has_change_perm_ability && !has_change_sale_ability && !root_selected)
{
// ...must select root to choose permissions
- childSetValue("perm_modify", childGetText("text modify warning"));
+ childSetValue("perm_modify", getString("text modify warning"));
}
if (has_change_perm_ability)
diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp
index cd251314d3..2a85d52689 100644
--- a/indra/newview/llpanelpick.cpp
+++ b/indra/newview/llpanelpick.cpp
@@ -134,7 +134,7 @@ BOOL LLPanelPick::postBuild()
mDescEditor->setCommitOnFocusLost(TRUE);
mDescEditor->setCommitCallback(onCommitAny);
mDescEditor->setCallbackUserData(this);
- mDescEditor->setTabToNextField(TRUE);
+ mDescEditor->setTabsToNextField(TRUE);
mLocationEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "location_editor");
@@ -507,7 +507,7 @@ void LLPanelPick::onCommitAny(LLUICtrl* ctrl, void* data)
}
else
{*/
- LLTabContainerVertical* tab = (LLTabContainerVertical*)self->getParent();
+ LLTabContainer* tab = (LLTabContainer*)self->getParent();
if (tab)
{
if(tab) tab->setCurrentTabName(self->mNameEditor->getText());
diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp
index a05f7129ae..aa10dda62c 100644
--- a/indra/newview/llpanelplace.cpp
+++ b/indra/newview/llpanelplace.cpp
@@ -190,11 +190,11 @@ void LLPanelPlace::setErrorStatus(U32 status, const std::string& reason)
LLString error_text;
if(status == 404)
{
- error_text = childGetText("server_error_text");
+ error_text = getString("server_error_text");
}
else if(status == 499)
{
- error_text = childGetText("server_forbidden_text");
+ error_text = getString("server_forbidden_text");
}
mDescEditor->setText(error_text);
}
@@ -260,13 +260,13 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
std::string desc_str(desc);
if( !name_str.empty()
- && self->mNameEditor->getText().empty())
+ && self->mNameEditor && self->mNameEditor->getText().empty())
{
self->mNameEditor->setText(name_str);
}
if( !desc_str.empty()
- && self->mDescEditor->getText().empty())
+ && self->mDescEditor && self->mDescEditor->getText().empty())
{
self->mDescEditor->setText(desc_str);
}
@@ -290,8 +290,10 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
auction.setArg("[ID]", llformat("%010d ", auction_id));
info_text += auction;
}
- self->mInfoEditor->setText(info_text);
-
+ if (self->mInfoEditor)
+ {
+ self->mInfoEditor->setText(info_text);
+ }
// HACK: Flag 0x1 == mature region, otherwise assume PG
const char* rating = LLViewerRegion::accessToString(SIM_ACCESS_PG);
@@ -320,7 +322,10 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
LLString location = llformat("%s %d, %d, %d (%s)",
sim_name, region_x, region_y, region_z, rating);
- self->mLocationEditor->setText(location);
+ if (self->mLocationEditor)
+ {
+ self->mLocationEditor->setText(location);
+ }
BOOL show_auction = (auction_id > 0);
self->mAuctionBtn->setVisible(show_auction);
@@ -354,7 +359,7 @@ void LLPanelPlace::displayParcelInfo(const LLVector3& pos_region,
}
else
{
- mDescEditor->setText(childGetText("server_update_text"));
+ mDescEditor->setText(getString("server_update_text"));
}
mSnapshotCtrl->setImageAssetID(LLUUID::null);
}
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index e7b5e79377..83a2a5e0bd 100644
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -104,7 +104,7 @@ BOOL LLPanelVolume::postBuild()
// LIGHT Parameters
{
childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this);
- LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(this,"colorswatch");
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
if(LightColorSwatch){
LightColorSwatch->setOnCancelCallback(onLightCancelColor);
LightColorSwatch->setOnSelectCallback(onLightSelectColor);
@@ -213,7 +213,7 @@ void LLPanelVolume::getState( )
{
childSetEnabled("label color",true);
//mLabelColor ->setEnabled( TRUE );
- LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(this,"colorswatch");
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
if(LightColorSwatch)
{
LightColorSwatch->setEnabled( TRUE );
@@ -233,7 +233,7 @@ void LLPanelVolume::getState( )
else
{
childSetEnabled("label color",false);
- LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(this,"colorswatch");
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
if(LightColorSwatch)
{
LightColorSwatch->setEnabled( FALSE );
@@ -342,7 +342,7 @@ void LLPanelVolume::clearCtrls()
childSetEnabled("Light Checkbox Ctrl",false);
childSetEnabled("label color",false);
childSetEnabled("label color",false);
- LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(this,"colorswatch");
+ LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
if(LightColorSwatch)
{
LightColorSwatch->setEnabled( FALSE );
@@ -416,7 +416,7 @@ void LLPanelVolume::sendIsFlexible()
void LLPanelVolume::onLightCancelColor(LLUICtrl* ctrl, void* userdata)
{
LLPanelVolume* self = (LLPanelVolume*) userdata;
- LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(self,"colorswatch");
+ LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch");
if(LightColorSwatch)
{
LightColorSwatch->setColor(self->mLightSavedColor);
@@ -435,7 +435,7 @@ void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata)
LLVOVolume *volobjp = (LLVOVolume *)objectp;
- LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(self,"colorswatch");
+ LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch");
if(LightColorSwatch)
{
LLColor4 clr = LightColorSwatch->get();
@@ -460,7 +460,7 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )
volobjp->setLightIntensity((F32)self->childGetValue("Light Intensity").asReal());
volobjp->setLightRadius((F32)self->childGetValue("Light Radius").asReal());
volobjp->setLightFalloff((F32)self->childGetValue("Light Falloff").asReal());
- LLColorSwatchCtrl* LightColorSwatch = gUICtrlFactory->getColorSwatchByName(self,"colorswatch");
+ LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch");
if(LightColorSwatch)
{
LLColor4 clr = LightColorSwatch->get();
diff --git a/indra/newview/llparcelselection.cpp b/indra/newview/llparcelselection.cpp
index 5478a96b97..e49ae57bcf 100644
--- a/indra/newview/llparcelselection.cpp
+++ b/indra/newview/llparcelselection.cpp
@@ -17,9 +17,8 @@
LLPointer<LLParcelSelection> LLParcelSelection::sNullSelection;
template<>
- const LLHandle<LLParcelSelection>::NullFunc
- LLHandle<LLParcelSelection>::sNullFunc =
- LLParcelSelection::getNullParcelSelection;
+ const LLSafeHandle<LLParcelSelection>::NullFunc
+ LLSafeHandle<LLParcelSelection>::sNullFunc = LLParcelSelection::getNullParcelSelection;
//
// LLParcelSelection
diff --git a/indra/newview/llparcelselection.h b/indra/newview/llparcelselection.h
index 579a0f2549..e6729646c7 100644
--- a/indra/newview/llparcelselection.h
+++ b/indra/newview/llparcelselection.h
@@ -58,6 +58,6 @@ private:
static LLPointer<LLParcelSelection> sNullSelection;
};
-typedef LLHandle<LLParcelSelection> LLParcelSelectionHandle;
+typedef LLSafeHandle<LLParcelSelection> LLParcelSelectionHandle;
#endif
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp
index b0d7aa6d1b..cad38e36ff 100644
--- a/indra/newview/llpreview.cpp
+++ b/indra/newview/llpreview.cpp
@@ -56,7 +56,7 @@
// Globals and statics
LLPreview::preview_multimap_t LLPreview::sPreviewsBySource;
LLPreview::preview_map_t LLPreview::sInstances;
-std::map<LLUUID, LLViewHandle> LLMultiPreview::sAutoOpenPreviewHandles;
+std::map<LLUUID, LLHandle<LLFloater> > LLMultiPreview::sAutoOpenPreviewHandles;
// Functions
LLPreview::LLPreview(const std::string& name) :
@@ -72,7 +72,7 @@ LLPreview::LLPreview(const std::string& name) :
// don't add to instance list, since ItemID is null
mAuxItem = new LLInventoryItem; // (LLPointer is auto-deleted)
// don't necessarily steal focus on creation -- sometimes these guys pop up without user action
- mAutoFocus = FALSE;
+ setAutoFocus(FALSE);
gInventory.addObserver(this);
}
@@ -91,7 +91,7 @@ LLPreview::LLPreview(const std::string& name, const LLRect& rect, const std::str
{
mAuxItem = new LLInventoryItem;
// don't necessarily steal focus on creation -- sometimes these guys pop up without user action
- mAutoFocus = FALSE;
+ setAutoFocus(FALSE);
if (mItemUUID.notNull())
{
@@ -114,7 +114,7 @@ LLPreview::~LLPreview()
preview_multimap_t::iterator found_it = sPreviewsBySource.find(mSourceID);
for (; found_it != sPreviewsBySource.end(); ++found_it)
{
- if (found_it->second == mViewHandle)
+ if (found_it->second == getHandle())
{
sPreviewsBySource.erase(found_it);
break;
@@ -152,7 +152,7 @@ void LLPreview::setSourceID(const LLUUID& source_id)
preview_multimap_t::iterator found_it = sPreviewsBySource.find(mSourceID);
for (; found_it != sPreviewsBySource.end(); ++found_it)
{
- if (found_it->second == mViewHandle)
+ if (found_it->second == getHandle())
{
sPreviewsBySource.erase(found_it);
break;
@@ -160,7 +160,7 @@ void LLPreview::setSourceID(const LLUUID& source_id)
}
}
mSourceID = source_id;
- sPreviewsBySource.insert(preview_multimap_t::value_type(mSourceID, mViewHandle));
+ sPreviewsBySource.insert(preview_multimap_t::value_type(mSourceID, getHandle()));
}
const LLViewerInventoryItem *LLPreview::getItem() const
@@ -427,8 +427,7 @@ BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask)
void LLPreview::open() /*Flawfinder: ignore*/
{
- LLMultiFloater* hostp = getHost();
- if (!sHostp && !hostp && getAssetStatus() == PREVIEW_ASSET_UNLOADED)
+ if (!getFloaterHost() && !getHost() && getAssetStatus() == PREVIEW_ASSET_UNLOADED)
{
loadAsset();
}
@@ -524,14 +523,14 @@ LLPreview* LLPreview::getFirstPreviewForSource(const LLUUID& source_id)
if (found_it != sPreviewsBySource.end())
{
// just return first one
- return (LLPreview*)LLFloater::getFloaterByHandle(found_it->second);
+ return (LLPreview*)found_it->second.get();
}
return NULL;
}
void LLPreview::userSetShape(const LLRect& new_rect)
{
- if(new_rect.getWidth() != mRect.getWidth() || new_rect.getHeight() != mRect.getHeight())
+ if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight())
{
userResized();
}
@@ -560,7 +559,7 @@ void LLMultiPreview::open() /*Flawfinder: ignore*/
void LLMultiPreview::userSetShape(const LLRect& new_rect)
{
- if(new_rect.getWidth() != mRect.getWidth() || new_rect.getHeight() != mRect.getHeight())
+ if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight())
{
LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel();
if (frontmost_preview) frontmost_preview->userResized();
@@ -584,7 +583,7 @@ LLMultiPreview* LLMultiPreview::getAutoOpenInstance(const LLUUID& id)
handle_map_t::iterator found_it = sAutoOpenPreviewHandles.find(id);
if (found_it != sAutoOpenPreviewHandles.end())
{
- return (LLMultiPreview*)gFloaterView->getFloaterByHandle(found_it->second);
+ return (LLMultiPreview*)found_it->second.get();
}
return NULL;
}
diff --git a/indra/newview/llpreview.h b/indra/newview/llpreview.h
index 97cd2d5b07..5f129b99d4 100644
--- a/indra/newview/llpreview.h
+++ b/indra/newview/llpreview.h
@@ -58,10 +58,12 @@ public:
static void setAutoOpenInstance(LLMultiPreview* previewp, const LLUUID& id);
protected:
- typedef std::map<LLUUID, LLViewHandle> handle_map_t;
- static std::map<LLUUID, LLViewHandle> sAutoOpenPreviewHandles;
+ typedef std::map<LLUUID, LLHandle<LLFloater> > handle_map_t;
+ static handle_map_t sAutoOpenPreviewHandles;
};
+// https://wiki.lindenlab.com/mediawiki/index.php?title=LLPreview&oldid=81373
+
class LLPreview : public LLFloater, LLInventoryObserver
{
public:
@@ -160,7 +162,7 @@ protected:
EAssetStatus mAssetStatus;
typedef std::map<LLUUID, LLPreview*> preview_map_t;
- typedef std::multimap<LLUUID, LLViewHandle> preview_multimap_t;
+ typedef std::multimap<LLUUID, LLHandle<LLFloater> > preview_multimap_t;
static preview_multimap_t sPreviewsBySource;
static preview_map_t sInstances;
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index f6d5d9d9b7..ba96ba088b 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -96,8 +96,8 @@ LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const
// static
void LLPreviewAnim::endAnimCallback( void *userdata )
{
- LLViewHandle* handlep = ((LLViewHandle*)userdata);
- LLFloater* self = getFloaterByHandle(*handlep);
+ LLHandle<LLFloater>* handlep = ((LLHandle<LLFloater>*)userdata);
+ LLFloater* self = handlep->get();
delete handlep; // done with the handle
if (self)
{
@@ -132,7 +132,7 @@ void LLPreviewAnim::playAnim( void *userdata )
if (motion)
{
- motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLViewHandle(self->getHandle())));
+ motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
}
}
else
@@ -169,7 +169,7 @@ void LLPreviewAnim::auditionAnim( void *userdata )
if (motion)
{
- motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLViewHandle(self->getHandle())));
+ motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
}
}
else
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 61bda9dfc0..ba2925d45a 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -585,7 +585,7 @@ void LLPreviewGesture::addAnimations()
combo->removeall();
- LLString none_text = childGetText("none_text");
+ LLString none_text = getString("none_text");
combo->add(none_text, LLUUID::null);
@@ -640,7 +640,7 @@ void LLPreviewGesture::addSounds()
LLComboBox* combo = mSoundCombo;
combo->removeall();
- LLString none_text = childGetText("none_text");
+ LLString none_text = getString("none_text");
combo->add(none_text, LLUUID::null);
@@ -789,7 +789,7 @@ void LLPreviewGesture::refresh()
case STEP_ANIMATION:
{
LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- optionstext = childGetText("step_anim");
+ optionstext = getString("step_anim");
mAnimationCombo->setVisible(TRUE);
mAnimationRadio->setVisible(TRUE);
mAnimationRadio->setSelectedIndex((anim_step->mFlags & ANIM_FLAG_STOP) ? 1 : 0);
@@ -799,7 +799,7 @@ void LLPreviewGesture::refresh()
case STEP_SOUND:
{
LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
- optionstext = childGetText("step_sound");
+ optionstext = getString("step_sound");
mSoundCombo->setVisible(TRUE);
mSoundCombo->setCurrentByID(sound_step->mSoundAssetID);
break;
@@ -807,7 +807,7 @@ void LLPreviewGesture::refresh()
case STEP_CHAT:
{
LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
- optionstext = childGetText("step_chat");
+ optionstext = getString("step_chat");
mChatEditor->setVisible(TRUE);
mChatEditor->setText(chat_step->mChatText);
break;
@@ -815,7 +815,7 @@ void LLPreviewGesture::refresh()
case STEP_WAIT:
{
LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
- optionstext = childGetText("step_wait");
+ optionstext = getString("step_wait");
mWaitAnimCheck->setVisible(TRUE);
mWaitAnimCheck->set(wait_step->mFlags & WAIT_FLAG_ALL_ANIM);
mWaitTimeCheck->setVisible(TRUE);
@@ -1753,7 +1753,7 @@ void LLPreviewGesture::onClickPreview(void* data)
self->mPreviewGesture->mCallbackData = self;
// set the button title
- self->mPreviewBtn->setLabel(self->childGetText("stop_txt"));
+ self->mPreviewBtn->setLabel(self->getString("stop_txt"));
// play it, and delete when done
gGestureManager.playGesture(self->mPreviewGesture);
@@ -1775,7 +1775,7 @@ void LLPreviewGesture::onDonePreview(LLMultiGesture* gesture, void* data)
{
LLPreviewGesture* self = (LLPreviewGesture*)data;
- self->mPreviewBtn->setLabel(self->childGetText("preview_txt"));
+ self->mPreviewBtn->setLabel(self->getString("preview_txt"));
delete self->mPreviewGesture;
self->mPreviewGesture = NULL;
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index eef8c0d636..37d0ba8303 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -307,7 +307,7 @@ void LLPreviewNotecard::loadAsset()
// The object that we're trying to look at disappeared, bail.
llwarns << "Can't find object " << mObjectUUID << " associated with notecard." << llendl;
mAssetID.setNull();
- editor->setText(childGetText("no_object"));
+ editor->setText(getString("no_object"));
editor->makePristine();
editor->setEnabled(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
@@ -332,7 +332,7 @@ void LLPreviewNotecard::loadAsset()
else
{
mAssetID.setNull();
- editor->setText(childGetText("not_allowed"));
+ editor->setText(getString("not_allowed"));
editor->makePristine();
editor->setEnabled(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
@@ -654,7 +654,7 @@ void LLPreviewNotecard::reshape(S32 width, S32 height, BOOL called_from_parent)
{
// So that next time you open a script it will have the same height and width
// (although not the same position).
- gSavedSettings.setRect("NotecardEditorRect", mRect);
+ gSavedSettings.setRect("NotecardEditorRect", getRect());
}
}
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index d3afd65cbe..dd49262cb2 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -288,7 +288,7 @@ LLScriptEdCore::LLScriptEdCore(
const LLRect& rect,
const std::string& sample,
const std::string& help,
- const LLViewHandle& floater_handle,
+ const LLHandle<LLFloater>& floater_handle,
void (*load_callback)(void*),
void (*save_callback)(void*, BOOL),
void (*search_replace_callback) (void* userdata),
@@ -343,19 +343,19 @@ LLScriptEdCore::LLScriptEdCore(
LLKeywordToken *token;
- LLKeywords::word_token_map_t::iterator token_it;
- for (token_it = mEditor->mKeywords.mWordTokenMap.begin(); token_it != mEditor->mKeywords.mWordTokenMap.end(); ++token_it)
+ LLKeywords::keyword_iterator_t token_it;
+ for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it)
{
token = token_it->second;
- if (token->mColor == color)
- mFunctions->add(wstring_to_utf8str(token->mToken));
+ if (token->getColor() == color)
+ mFunctions->add(wstring_to_utf8str(token->getToken()));
}
- for (token_it = mEditor->mKeywords.mWordTokenMap.begin(); token_it != mEditor->mKeywords.mWordTokenMap.end(); ++token_it)
+ for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it)
{
token = token_it->second;
- if (token->mColor != color)
- mFunctions->add(wstring_to_utf8str(token->mToken));
+ if (token->getColor() != color)
+ mFunctions->add(wstring_to_utf8str(token->getToken()));
}
@@ -365,7 +365,7 @@ LLScriptEdCore::LLScriptEdCore(
initMenu();
// Do the work that addTabPanel() normally does.
- //LLRect tab_panel_rect( 0, mRect.getHeight(), mRect.getWidth(), 0 );
+ //LLRect tab_panel_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
//tab_panel_rect.stretch( -LLPANEL_BORDER_WIDTH );
//mCodePanel->setFollowsAll();
//mCodePanel->translate( tab_panel_rect.mLeft - mCodePanel->getRect().mLeft, tab_panel_rect.mBottom - mCodePanel->getRect().mBottom);
@@ -468,13 +468,13 @@ void LLScriptEdCore::draw()
void LLScriptEdCore::updateDynamicHelp(BOOL immediate)
{
- LLFloater* help_floater = LLFloater::getFloaterByHandle(mLiveHelpHandle);
+ LLFloater* help_floater = mLiveHelpHandle.get();
if (!help_floater) return;
// update back and forward buttons
LLButton* fwd_button = LLUICtrlFactory::getButtonByName(help_floater, "fwd_btn");
LLButton* back_button = LLUICtrlFactory::getButtonByName(help_floater, "back_btn");
- LLWebBrowserCtrl* browser = LLUICtrlFactory::getWebBrowserCtrlByName(help_floater, "lsl_guide_html");
+ LLWebBrowserCtrl* browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html");
back_button->setEnabled(browser->canNavigateBack());
fwd_button->setEnabled(browser->canNavigateForward());
@@ -483,12 +483,12 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate)
return;
}
- LLTextSegment* segment = NULL;
- std::vector<LLTextSegment*> selected_segments;
+ const LLTextSegment* segment = NULL;
+ std::vector<const LLTextSegment*> selected_segments;
mEditor->getSelectedSegments(selected_segments);
// try segments in selection range first
- std::vector<LLTextSegment*>::iterator segment_iter;
+ std::vector<const LLTextSegment*>::iterator segment_iter;
for (segment_iter = selected_segments.begin(); segment_iter != selected_segments.end(); ++segment_iter)
{
if((*segment_iter)->getToken() && (*segment_iter)->getToken()->getType() == LLKeywordToken::WORD)
@@ -501,7 +501,7 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate)
// then try previous segment in case we just typed it
if (!segment)
{
- LLTextSegment* test_segment = mEditor->getPreviousSegment();
+ const LLTextSegment* test_segment = mEditor->getPreviousSegment();
if(test_segment->getToken() && test_segment->getToken()->getType() == LLKeywordToken::WORD)
{
segment = test_segment;
@@ -530,10 +530,10 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate)
void LLScriptEdCore::setHelpPage(const LLString& help_string)
{
- LLFloater* help_floater = LLFloater::getFloaterByHandle(mLiveHelpHandle);
+ LLFloater* help_floater = mLiveHelpHandle.get();
if (!help_floater) return;
- LLWebBrowserCtrl* web_browser = gUICtrlFactory->getWebBrowserCtrlByName(help_floater, "lsl_guide_html");
+ LLWebBrowserCtrl* web_browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html");
if (!web_browser) return;
LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo");
@@ -553,7 +553,7 @@ void LLScriptEdCore::addHelpItemToHistory(const LLString& help_string)
{
if (help_string.empty()) return;
- LLFloater* help_floater = LLFloater::getFloaterByHandle(mLiveHelpHandle);
+ LLFloater* help_floater = mLiveHelpHandle.get();
if (!help_floater) return;
LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo");
@@ -660,7 +660,7 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata)
{
LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
- LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle);
+ LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
if (live_help_floater)
{
live_help_floater->setFocus(TRUE);
@@ -678,18 +678,18 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata)
live_help_floater->childSetAction("back_btn", onClickBack, userdata);
live_help_floater->childSetAction("fwd_btn", onClickForward, userdata);
- LLWebBrowserCtrl* browser = LLUICtrlFactory::getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html");
+ LLWebBrowserCtrl* browser = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html");
browser->setAlwaysRefresh(TRUE);
LLComboBox* help_combo = LLUICtrlFactory::getComboBoxByName(live_help_floater, "history_combo");
LLKeywordToken *token;
- LLKeywords::word_token_map_t::iterator token_it;
- for (token_it = corep->mEditor->mKeywords.mWordTokenMap.begin();
- token_it != corep->mEditor->mKeywords.mWordTokenMap.end();
+ LLKeywords::keyword_iterator_t token_it;
+ for (token_it = corep->mEditor->keywordsBegin();
+ token_it != corep->mEditor->keywordsEnd();
++token_it)
{
token = token_it->second;
- help_combo->add(wstring_to_utf8str(token->mToken));
+ help_combo->add(wstring_to_utf8str(token->getToken()));
}
help_combo->sortByName();
@@ -704,10 +704,10 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata)
void LLScriptEdCore::onClickBack(void* userdata)
{
LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
- LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle);
+ LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
if (live_help_floater)
{
- LLWebBrowserCtrl* browserp = LLUICtrlFactory::getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html");
+ LLWebBrowserCtrl* browserp = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html");
if (browserp)
{
browserp->navigateBack();
@@ -719,10 +719,10 @@ void LLScriptEdCore::onClickBack(void* userdata)
void LLScriptEdCore::onClickForward(void* userdata)
{
LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
- LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle);
+ LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
if (live_help_floater)
{
- LLWebBrowserCtrl* browserp = LLUICtrlFactory::getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html");
+ LLWebBrowserCtrl* browserp = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html");
if (browserp)
{
browserp->navigateForward();
@@ -757,14 +757,14 @@ void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata)
{
LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
- LLFloater* live_help_floater = LLFloater::getFloaterByHandle(corep->mLiveHelpHandle);
+ LLFloater* live_help_floater = corep->mLiveHelpHandle.get();
if (live_help_floater)
{
LLString help_string = ctrl->getValue().asString();
corep->addHelpItemToHistory(help_string);
- LLWebBrowserCtrl* web_browser = gUICtrlFactory->getWebBrowserCtrlByName(live_help_floater, "lsl_guide_html");
+ LLWebBrowserCtrl* web_browser = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html");
LLUIString url_string = gSavedSettings.getString("LSLHelpURL");
url_string.setArg("[APP_DIRECTORY]", gDirUtilp->getWorkingDir());
url_string.setArg("[LSL_STRING]", help_string);
@@ -971,7 +971,7 @@ void LLScriptEdCore::handleReloadFromServerDialog( S32 option, void* userdata )
case 0: // "Yes"
if( self->mLoadCallback )
{
- self->mEditor->setText( self->childGetText("loading") );
+ self->mEditor->setText( self->getString("loading") );
self->mLoadCallback( self->mUserdata );
}
break;
@@ -1071,7 +1071,7 @@ void* LLPreviewLSL::createScriptEdPanel(void* userdata)
LLRect(),
HELLO_LSL,
HELP_LSL,
- self->mViewHandle,
+ self->getHandle(),
LLPreviewLSL::onLoad,
LLPreviewLSL::onSave,
LLPreviewLSL::onSearchReplace,
@@ -1104,9 +1104,7 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect,
childSetText("desc", item->getDescription());
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
- LLMultiFloater* hostp = getHost();
-
- if (!sHostp && !hostp && getAssetStatus() == PREVIEW_ASSET_UNLOADED)
+ if (!getFloaterHost() && !getHost() && getAssetStatus() == PREVIEW_ASSET_UNLOADED)
{
loadAsset();
}
@@ -1185,7 +1183,7 @@ void LLPreviewLSL::loadAsset()
}
else
{
- mScriptEd->mEditor->setText(mScriptEd->childGetText("can_not_view"));
+ mScriptEd->mEditor->setText(mScriptEd->getString("can_not_view"));
mScriptEd->mEditor->makePristine();
mScriptEd->mEditor->setEnabled(FALSE);
mScriptEd->mFunctions->setEnabled(FALSE);
@@ -1565,7 +1563,7 @@ void LLPreviewLSL::reshape(S32 width, S32 height, BOOL called_from_parent)
{
// So that next time you open a script it will have the same height and width
// (although not the same position).
- gSavedSettings.setRect("PreviewScriptRect", mRect);
+ gSavedSettings.setRect("PreviewScriptRect", getRect());
}
}
@@ -1587,7 +1585,7 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata)
LLRect(),
HELLO_LSL,
HELP_LSL,
- self->mViewHandle,
+ self->getHandle(),
&LLLiveLSLEditor::onLoad,
&LLLiveLSLEditor::onSave,
&LLLiveLSLEditor::onSearchReplace,
@@ -1717,7 +1715,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new)
|| !gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE))))
{
mItem = new LLViewerInventoryItem(item);
- mScriptEd->mEditor->setText(childGetText("not_allowed"));
+ mScriptEd->mEditor->setText(getString("not_allowed"));
mScriptEd->mEditor->makePristine();
mScriptEd->mEditor->setEnabled(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
@@ -1971,12 +1969,12 @@ void LLLiveLSLEditor::draw()
{
if(object->permAnyOwner())
{
- runningCheckbox->setLabel(childGetText("script_running"));
+ runningCheckbox->setLabel(getString("script_running"));
runningCheckbox->setEnabled(TRUE);
}
else
{
- runningCheckbox->setLabel(childGetText("public_objects_can_not_run"));
+ runningCheckbox->setLabel(getString("public_objects_can_not_run"));
runningCheckbox->setEnabled(FALSE);
// *FIX: Set it to false so that the ui is correct for
// a box that is released to public. It could be
@@ -2224,7 +2222,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename,
// If we successfully saved it, then we should be able to check/uncheck the running box!
LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(this, "running");
- runningCheckbox->setLabel(childGetText("script_running"));
+ runningCheckbox->setLabel(getString("script_running"));
runningCheckbox->setEnabled(TRUE);
}
@@ -2404,6 +2402,6 @@ void LLLiveLSLEditor::reshape(S32 width, S32 height, BOOL called_from_parent)
{
// So that next time you open a script it will have the same height and width
// (although not the same position).
- gSavedSettings.setRect("PreviewScriptRect", mRect);
+ gSavedSettings.setRect("PreviewScriptRect", getRect());
}
}
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index a9b36f3978..55b006908f 100644
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -67,7 +67,7 @@ public:
const LLRect& rect,
const std::string& sample,
const std::string& help,
- const LLViewHandle& floater_handle,
+ const LLHandle<LLFloater>& floater_handle,
void (*load_callback)(void* userdata),
void (*save_callback)(void* userdata, BOOL close_after_save),
void (*search_replace_callback)(void* userdata),
@@ -144,7 +144,7 @@ private:
LLPanel* mCodePanel;
LLScrollListCtrl* mErrorList;
LLDynamicArray<LLEntryAndEdCore*> mBridges;
- LLViewHandle mLiveHelpHandle;
+ LLHandle<LLFloater> mLiveHelpHandle;
LLKeywordToken* mLastHelpToken;
LLFrameTimer mLiveHelpTimer;
S32 mLiveHelpHistorySize;
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 78d066f85f..20737eb7f1 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -199,7 +199,7 @@ void LLPreviewTexture::draw()
LLPreview::draw();
- if (!mMinimized)
+ if (!isMinimized())
{
LLGLSUIDefault gls_ui;
LLGLSNoTexture gls_notex;
@@ -255,7 +255,7 @@ void LLPreviewTexture::draw()
const S32 BAR_HEIGHT = 12;
const S32 BAR_LEFT_PAD = 80;
S32 left = interior.mLeft + 4 + BAR_LEFT_PAD;
- S32 bar_width = mRect.getWidth() - left - RESIZE_HANDLE_WIDTH - 2;
+ S32 bar_width = getRect().getWidth() - left - RESIZE_HANDLE_WIDTH - 2;
S32 top = interior.mBottom + 4 + BAR_HEIGHT;
S32 right = left + bar_width;
S32 bottom = top - BAR_HEIGHT;
@@ -434,8 +434,8 @@ void LLPreviewTexture::updateAspectRatio()
mLastWidth = client_width;
mLastHeight = client_height;
- S32 old_top = mRect.mTop;
- S32 old_left = mRect.mLeft;
+ S32 old_top = getRect().mTop;
+ S32 old_left = getRect().mLeft;
if (getHost())
{
getHost()->growToFit(view_width, view_height);
@@ -443,7 +443,7 @@ void LLPreviewTexture::updateAspectRatio()
else
{
reshape( view_width, view_height );
- S32 new_bottom = old_top - mRect.getHeight();
+ S32 new_bottom = old_top - getRect().getHeight();
setOrigin( old_left, new_bottom );
// Try to keep whole view onscreen, don't allow partial offscreen.
gFloaterView->adjustToFitScreen(this, FALSE);
@@ -454,20 +454,20 @@ void LLPreviewTexture::updateAspectRatio()
if (!mUserResized)
{
// clamp texture size to fit within actual size of floater after attempting resize
- client_width = llmin(client_width, mRect.getWidth() - horiz_pad);
- client_height = llmin(client_height, mRect.getHeight() - PREVIEW_HEADER_SIZE
+ client_width = llmin(client_width, getRect().getWidth() - horiz_pad);
+ client_height = llmin(client_height, getRect().getHeight() - PREVIEW_HEADER_SIZE
- (2 * CLIENT_RECT_VPAD) - LLPANEL_BORDER_WIDTH - info_height);
}
else
{
- client_width = mRect.getWidth() - horiz_pad;
+ client_width = getRect().getWidth() - horiz_pad;
client_height = llround(client_width * inv_aspect_ratio);
}
- S32 max_height = mRect.getHeight() - PREVIEW_BORDER - button_height
+ S32 max_height = getRect().getHeight() - PREVIEW_BORDER - button_height
- CLIENT_RECT_VPAD - info_height - CLIENT_RECT_VPAD - PREVIEW_HEADER_SIZE;
max_height = llmax(max_height, 1);
@@ -478,7 +478,7 @@ void LLPreviewTexture::updateAspectRatio()
client_width = llround(client_height * aspect_ratio);
}
- LLRect window_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
+ LLRect window_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
window_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD);
window_rect.mBottom += PREVIEW_BORDER + button_height + CLIENT_RECT_VPAD + info_height + CLIENT_RECT_VPAD;
diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp
index cc9c3fa503..9e437df2d1 100644
--- a/indra/newview/llprogressview.cpp
+++ b/indra/newview/llprogressview.cpp
@@ -74,7 +74,7 @@ LLProgressView::LLProgressView(const std::string& name, const LLRect &rect)
const S32 CANCEL_BTN_OFFSET = 16;
LLRect r;
r.setOriginAndSize(
- mRect.getWidth() - CANCEL_BTN_OFFSET - CANCEL_BTN_WIDTH, CANCEL_BTN_OFFSET,
+ getRect().getWidth() - CANCEL_BTN_OFFSET - CANCEL_BTN_WIDTH, CANCEL_BTN_OFFSET,
CANCEL_BTN_WIDTH, BTN_HEIGHT );
mCancelBtn = new LLButton(
@@ -162,7 +162,7 @@ void LLProgressView::draw()
// Make sure the progress view always fills the entire window.
S32 width = gViewerWindow->getWindowWidth();
S32 height = gViewerWindow->getWindowHeight();
- if( (width != mRect.getWidth()) || (height != mRect.getHeight()) )
+ if( (width != getRect().getWidth()) || (height != getRect().getHeight()) )
{
reshape( width, height );
}
@@ -189,14 +189,14 @@ void LLProgressView::draw()
glTranslatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f);
glScalef(1.f, view_aspect / image_aspect, 1.f);
}
- gl_rect_2d_simple_tex( mRect.getWidth(), mRect.getHeight() );
+ gl_rect_2d_simple_tex( getRect().getWidth(), getRect().getHeight() );
gStartImageGL->unbindTexture(0, GL_TEXTURE_2D);
}
else
{
LLGLSNoTexture gls_no_texture;
glColor4f(0.f, 0.f, 0.f, 1.f);
- gl_rect_2d(mRect);
+ gl_rect_2d(getRect());
}
glPopMatrix();
}
@@ -213,8 +213,8 @@ void LLProgressView::draw()
return;
}
- S32 line_x = mRect.getWidth() / 2;
- S32 line_one_y = mRect.getHeight() / 2 + 64;
+ S32 line_x = getRect().getWidth() / 2;
+ S32 line_one_y = getRect().getHeight() / 2 + 64;
const S32 LINE_SPACING = 25;
S32 line_two_y = line_one_y - LINE_SPACING;
const LLFontGL* font = LLFontGL::sSansSerif;
@@ -243,8 +243,8 @@ void LLProgressView::draw()
S32 bar_bottom = line_two_y - 30;
S32 bar_height = 18;
- S32 bar_width = mRect.getWidth() * 2 / 3;
- S32 bar_left = (mRect.getWidth() / 2) - (bar_width / 2);
+ S32 bar_width = getRect().getWidth() * 2 / 3;
+ S32 bar_left = (getRect().getWidth() / 2) - (bar_width / 2);
gl_draw_scaled_image_with_border(
bar_left + 2,
diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp
index c28623723f..d8bb7c1a61 100644
--- a/indra/newview/llremoteparcelrequest.cpp
+++ b/indra/newview/llremoteparcelrequest.cpp
@@ -44,7 +44,7 @@
#include "llview.h"
#include "message.h"
-LLRemoteParcelRequestResponder::LLRemoteParcelRequestResponder(LLViewHandle place_panel_handle)
+LLRemoteParcelRequestResponder::LLRemoteParcelRequestResponder(LLHandle<LLPanel> place_panel_handle)
{
mPlacePanelHandle = place_panel_handle;
}
@@ -53,7 +53,7 @@ void LLRemoteParcelRequestResponder::result(const LLSD& content)
{
LLUUID parcel_id = content["parcel_id"];
- LLPanelPlace* place_panelp = (LLPanelPlace*)LLPanel::getPanelByHandle(mPlacePanelHandle);
+ LLPanelPlace* place_panelp = (LLPanelPlace*)mPlacePanelHandle.get();
if(place_panelp)
{
@@ -67,7 +67,7 @@ void LLRemoteParcelRequestResponder::error(U32 status, const std::string& reason
{
llinfos << "LLRemoteParcelRequest::error("
<< status << ": " << reason << ")" << llendl;
- LLPanelPlace* place_panelp = (LLPanelPlace*)LLPanel::getPanelByHandle(mPlacePanelHandle);
+ LLPanelPlace* place_panelp = (LLPanelPlace*)mPlacePanelHandle.get();
if(place_panelp)
{
diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h
index 628994a744..8cbe3f74bf 100644
--- a/indra/newview/llremoteparcelrequest.h
+++ b/indra/newview/llremoteparcelrequest.h
@@ -35,19 +35,19 @@
#define LL_LLREMOTEPARCELREQUEST_H
#include "llhttpclient.h"
-#include "llview.h"
+#include "llpanel.h"
class LLRemoteParcelRequestResponder : public LLHTTPClient::Responder
{
public:
- LLRemoteParcelRequestResponder(LLViewHandle place_panel_handle);
+ LLRemoteParcelRequestResponder(LLHandle<LLPanel> place_panel_handle);
//If we get back a normal response, handle it here
virtual void result(const LLSD& content);
//If we get back an error (not found, etc...), handle it here
virtual void error(U32 status, const std::string& reason);
protected:
- LLViewHandle mPlacePanelHandle;
+ LLHandle<LLPanel> mPlacePanelHandle;
};
#endif // LL_LLREMOTEPARCELREQUEST_H
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 511fd73ef7..d80a9ee053 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -126,8 +126,8 @@ LLColor4 LLSelectMgr::sContextSilhouetteColor;
static LLObjectSelection *get_null_object_selection();
template<>
- const LLHandle<LLObjectSelection>::NullFunc
- LLHandle<LLObjectSelection>::sNullFunc = get_null_object_selection;
+ const LLSafeHandle<LLObjectSelection>::NullFunc
+ LLSafeHandle<LLObjectSelection>::sNullFunc = get_null_object_selection;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// struct LLDeRezInfo
@@ -2272,12 +2272,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, LLString& name)
if (identical)
{
- char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- gCacheName->getName(first_id, firstname, lastname);
- name.assign( firstname );
- name.append( " " );
- name.append( lastname );
+ gCacheName->getFullName(first_id, name);
}
else
{
@@ -2340,12 +2335,7 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, LLString& name)
}
else if(!public_owner)
{
- char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- gCacheName->getName(first_id, firstname, lastname);
- name.assign( firstname );
- name.append( " " );
- name.append( lastname );
+ gCacheName->getFullName(first_id, name);
}
else
{
@@ -2405,12 +2395,7 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, LLString& name)
BOOL public_owner = (first_id.isNull());
if(!public_owner)
{
- char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- gCacheName->getName(first_id, firstname, lastname);
- name.assign( firstname );
- name.append( " " );
- name.append( lastname );
+ gCacheName->getFullName(first_id, name);
}
else
{
@@ -4348,12 +4333,8 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use
LLFloaterReporter *reporterp = LLFloaterReporter::getReporter(report_type);
if (reporterp)
{
- char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- char last_name[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- gCacheName->getName(owner_id, first_name, last_name);
- LLString fullname(first_name);
- fullname.append(" ");
- fullname.append(last_name);
+ std::string fullname;
+ gCacheName->getFullName(owner_id, fullname);
reporterp->setPickedObjectProperties(name, fullname, owner_id);
}
}
@@ -5476,9 +5457,9 @@ LLBBox LLSelectMgr::getBBoxOfSelection() const
//-----------------------------------------------------------------------------
// canUndo()
//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::canUndo()
+BOOL LLSelectMgr::canUndo() const
{
- return mSelectedObjects->getFirstEditableObject() != NULL;
+ return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstEditableObject() != NULL; // HACK: casting away constness - MG
}
//-----------------------------------------------------------------------------
@@ -5494,9 +5475,9 @@ void LLSelectMgr::undo()
//-----------------------------------------------------------------------------
// canRedo()
//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::canRedo()
+BOOL LLSelectMgr::canRedo() const
{
- return mSelectedObjects->getFirstEditableObject() != NULL;
+ return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstEditableObject() != NULL; // HACK: casting away constness - MG
}
//-----------------------------------------------------------------------------
@@ -5512,10 +5493,10 @@ void LLSelectMgr::redo()
//-----------------------------------------------------------------------------
// canDoDelete()
//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::canDoDelete()
+BOOL LLSelectMgr::canDoDelete() const
{
// Note: Can only delete root objects (see getFirstDeleteableObject() for more info)
- return mSelectedObjects->getFirstDeleteableObject() != NULL;
+ return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstDeleteableObject() != NULL; // HACK: casting away constness - MG
}
//-----------------------------------------------------------------------------
@@ -5529,7 +5510,7 @@ void LLSelectMgr::doDelete()
//-----------------------------------------------------------------------------
// canDeselect()
//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::canDeselect()
+BOOL LLSelectMgr::canDeselect() const
{
return !mSelectedObjects->isEmpty();
}
@@ -5544,9 +5525,9 @@ void LLSelectMgr::deselect()
//-----------------------------------------------------------------------------
// canDuplicate()
//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::canDuplicate()
+BOOL LLSelectMgr::canDuplicate() const
{
- return mSelectedObjects->getFirstCopyableObject() != NULL;
+ return const_cast<LLSelectMgr*>(this)->mSelectedObjects->getFirstCopyableObject() != NULL; // HACK: casting away constness - MG
}
//-----------------------------------------------------------------------------
// duplicate()
@@ -5744,7 +5725,7 @@ LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp)
//-----------------------------------------------------------------------------
// isEmpty()
//-----------------------------------------------------------------------------
-BOOL LLObjectSelection::isEmpty()
+BOOL LLObjectSelection::isEmpty() const
{
return (mList.size() == 0);
}
@@ -6135,3 +6116,4 @@ LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_parent)
return getFirstSelectedObject(&func, get_parent);
}
+
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index 071aa15236..32c7f7617e 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -272,7 +272,7 @@ public:
void updateEffects();
void cleanupNodes();
- BOOL isEmpty();
+ BOOL isEmpty() const;
S32 getOwnershipCost(S32 &cost);
@@ -331,7 +331,7 @@ private:
ESelectType mSelectType;
};
-typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle;
+typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
class LLSelectMgr : public LLEditMenuHandler
{
@@ -360,20 +360,20 @@ public:
static void cleanupGlobals();
// LLEditMenuHandler interface
- virtual BOOL canUndo();
+ virtual BOOL canUndo() const;
virtual void undo();
- virtual BOOL canRedo();
+ virtual BOOL canRedo() const;
virtual void redo();
- virtual BOOL canDoDelete();
+ virtual BOOL canDoDelete() const;
virtual void doDelete();
virtual void deselect();
- virtual BOOL canDeselect();
+ virtual BOOL canDeselect() const;
virtual void duplicate();
- virtual BOOL canDuplicate();
+ virtual BOOL canDuplicate() const;
void clearSelections();
void update();
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 58039bf878..d64b3864b3 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -127,7 +127,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect)
mSquareMetersCommitted(0)
{
// status bar can possible overlay menus?
- mMouseOpaque = FALSE;
+ setMouseOpaque(FALSE);
setIsChrome(TRUE);
// size of day of the weeks and year
@@ -171,7 +171,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect)
childSetActionTextbox("BalanceText", onClickBalance );
// Adding Net Stat Graph
- S32 x = mRect.getWidth() - 2;
+ S32 x = getRect().getWidth() - 2;
S32 y = 0;
LLRect r;
r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1);
@@ -241,9 +241,9 @@ void LLStatusBar::draw()
{
refresh();
- if (mBgVisible)
+ if (isBackgroundVisible())
{
- gl_drop_shadow(0, mRect.getHeight(), mRect.getWidth(), 0,
+ gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
LLUI::sColorsGroup->getColor("ColorDropShadow"),
LLUI::sConfigGroup->getS32("DropShadowFloater") );
}
@@ -504,7 +504,7 @@ void LLStatusBar::refresh()
mRegionDetails.mTime = mTextTime->getText();
mRegionDetails.mBalance = mBalance;
- mRegionDetails.mAccesString = (char *)region->getSimAccessString();
+ mRegionDetails.mAccesString = region->getSimAccessString();
mRegionDetails.mPing = region->getNetDetailsForLCD();
if (parcel && !parcel->getName().empty())
{
@@ -516,7 +516,7 @@ void LLStatusBar::refresh()
// keep these around for the LCD to use
mRegionDetails.mRegionName = region->getName();
- mRegionDetails.mParcelName = (char *)parcel->getName().c_str();
+ mRegionDetails.mParcelName = parcel->getName();
mRegionDetails.mX = pos_x;
mRegionDetails.mY = pos_y;
mRegionDetails.mZ = pos_z;
@@ -526,7 +526,7 @@ void LLStatusBar::refresh()
if (parcel->isPublic())
{
- snprintf(mRegionDetails.mOwner, MAX_STRING, "Public");
+ mRegionDetails.mOwner = "Public";
}
else
{
@@ -538,16 +538,13 @@ void LLStatusBar::refresh()
}
else
{
- snprintf(mRegionDetails.mOwner, MAX_STRING, "Group Owned");
+ mRegionDetails.mOwner = "Group Owned";
}
}
else
{
// Figure out the owner's name
- char owner_first[MAX_STRING]; /*Flawfinder: ignore*/
- char owner_last[MAX_STRING]; /*Flawfinder: ignore*/
- gCacheName->getName(parcel->getOwnerID(), owner_first, owner_last);
- snprintf(mRegionDetails.mOwner, MAX_STRING, "%s %s", owner_first, owner_last); /* Flawfinder: ignore */
+ gCacheName->getFullName(parcel->getOwnerID(), mRegionDetails.mOwner);
}
}
}
@@ -566,7 +563,7 @@ void LLStatusBar::refresh()
mRegionDetails.mZ = pos_z;
mRegionDetails.mArea = 0;
mRegionDetails.mForSale = FALSE;
- snprintf(mRegionDetails.mOwner, MAX_STRING, "Unknown");
+ mRegionDetails.mOwner = "Unknown";
mRegionDetails.mTraffic = 0.0f;
}
}
@@ -575,7 +572,7 @@ void LLStatusBar::refresh()
// no region
location_name = "(Unknown)";
// keep these around for the LCD to use
- mRegionDetails.mRegionName = LLString("Unknown");
+ mRegionDetails.mRegionName = "Unknown";
mRegionDetails.mParcelName = "Unknown";
mRegionDetails.mAccesString = "Unknown";
mRegionDetails.mX = 0;
@@ -583,7 +580,7 @@ void LLStatusBar::refresh()
mRegionDetails.mZ = 0;
mRegionDetails.mArea = 0;
mRegionDetails.mForSale = FALSE;
- snprintf(mRegionDetails.mOwner, MAX_STRING, "Unknown");
+ mRegionDetails.mOwner = "Unknown";
mRegionDetails.mTraffic = 0.0f;
}
@@ -640,7 +637,7 @@ void LLStatusBar::refresh()
x += 8;
const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5);
- r.set(x+4, mRect.getHeight() - 2, PARCEL_RIGHT, 0);
+ r.set(x+4, getRect().getHeight() - 2, PARCEL_RIGHT, 0);
mTextParcelName->setRect(r);
// Set search bar visibility
@@ -841,7 +838,7 @@ static void onClickBuyLand(void*)
void LLStatusBar::setupDate()
{
// fill the day array with what's in the xui
- LLString day_list = getFormattedUIString("StatBarDaysOfWeek");
+ LLString day_list = getString("StatBarDaysOfWeek");
size_t length = day_list.size();
// quick input check
@@ -865,7 +862,7 @@ void LLStatusBar::setupDate()
}
// fill the day array with what's in the xui
- LLString month_list = getFormattedUIString( "StatBarMonthsOfYear" );
+ LLString month_list = getString( "StatBarMonthsOfYear" );
length = month_list.size();
// quick input check
diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h
index 78f744c4b5..0605246f16 100644
--- a/indra/newview/llstatusbar.h
+++ b/indra/newview/llstatusbar.h
@@ -51,30 +51,33 @@ class LLStatGraph;
class LLRegionDetails
{
public:
- LLRegionDetails()
+ LLRegionDetails() :
+ mRegionName("Unknown"),
+ mParcelName("Unknown"),
+ mAccesString("Unknown"),
+ mX(0),
+ mY(0),
+ mZ(0),
+ mArea (0),
+ mForSale(FALSE),
+ mOwner("Unknown"),
+ mTraffic(0),
+ mBalance(0),
+ mPing(0)
{
- mRegionName = LLString("Unknown");
- mParcelName = "Unknown";
- mAccesString = "Unknown";
- mX = 0;
- mY = 0;
- mZ = 0;
- mArea = 0;
- mForSale = FALSE;
- snprintf(mOwner, MAX_STRING, "Unknown");
}
- LLString mRegionName;
- char *mParcelName;
- char *mAccesString;
+ std::string mRegionName;
+ std::string mParcelName;
+ std::string mAccesString;
S32 mX;
S32 mY;
S32 mZ;
S32 mArea;
BOOL mForSale;
- char mOwner[MAX_STRING];
+ std::string mOwner;
F32 mTraffic;
S32 mBalance;
- LLString mTime;
+ std::string mTime;
U32 mPing;
};
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index c17f0007c2..7368ac9fdb 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -462,7 +462,7 @@ BOOL LLFloaterTexturePicker::postBuild()
if (!mLabel.empty())
{
- std::string pick = childGetText("pick title");
+ std::string pick = getString("pick title");
setTitle(pick + mLabel);
}
@@ -518,7 +518,7 @@ void LLFloaterTexturePicker::draw()
}
}
- if (gFocusMgr.childHasMouseCapture(mDragHandle))
+ if (gFocusMgr.childHasMouseCapture(getDragHandle()))
{
mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
}
@@ -566,9 +566,9 @@ void LLFloaterTexturePicker::draw()
// Border
LLRect border( BORDER_PAD,
- mRect.getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD,
+ getRect().getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD,
((TEX_PICKER_MIN_WIDTH / 2) - TEXTURE_INVENTORY_PADDING - HPAD) - BORDER_PAD,
- BORDER_PAD + FOOTER_HEIGHT + (mRect.getHeight() - TEX_PICKER_MIN_HEIGHT));
+ BORDER_PAD + FOOTER_HEIGHT + (getRect().getHeight() - TEX_PICKER_MIN_HEIGHT));
gl_rect_2d( border, LLColor4::black, FALSE );
@@ -908,13 +908,13 @@ LLTextureCtrl::LLTextureCtrl(
mDirty( FALSE )
{
mCaption = new LLTextBox( label,
- LLRect( 0, BTN_HEIGHT_SMALL, mRect.getWidth(), 0 ),
- NULL,
+ LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ),
+ label,
LLFontGL::sSansSerifSmall );
mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM );
addChild( mCaption );
- S32 image_top = mRect.getHeight();
+ S32 image_top = getRect().getHeight();
S32 image_bottom = BTN_HEIGHT_SMALL;
S32 image_middle = (image_top + image_bottom) / 2;
S32 line_height = llround(LLFontGL::sSansSerifSmall->getLineHeight());
@@ -922,14 +922,14 @@ LLTextureCtrl::LLTextureCtrl(
mTentativeLabel = new LLTextBox( "Multiple",
LLRect(
0, image_middle + line_height / 2,
- mRect.getWidth(), image_middle - line_height / 2 ),
- NULL,
+ getRect().getWidth(), image_middle - line_height / 2 ),
+ "Multiple",
LLFontGL::sSansSerifSmall );
mTentativeLabel->setHAlign( LLFontGL::HCENTER );
mTentativeLabel->setFollowsAll();
addChild( mTentativeLabel );
- LLRect border_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
+ LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
border_rect.mBottom += BTN_HEIGHT_SMALL;
mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN);
addChild(mBorder);
@@ -1013,7 +1013,7 @@ void LLTextureCtrl::setCaption(const LLString& caption)
void LLTextureCtrl::setCanApplyImmediately(BOOL b)
{
mCanApplyImmediately = b;
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle);
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if( floaterp )
{
floaterp->setCanApplyImmediately(b);
@@ -1031,7 +1031,7 @@ void LLTextureCtrl::setVisible( BOOL visible )
void LLTextureCtrl::setEnabled( BOOL enabled )
{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle);
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if( enabled )
{
LLString tooltip;
@@ -1061,7 +1061,7 @@ void LLTextureCtrl::setValid(BOOL valid )
mValid = valid;
if (!valid)
{
- LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle);
+ LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if (pickerp)
{
pickerp->setActive(FALSE);
@@ -1096,7 +1096,7 @@ void LLTextureCtrl::setLabel(const LLString& label)
void LLTextureCtrl::showPicker(BOOL take_focus)
{
- LLFloater* floaterp = LLFloater::getFloaterByHandle(mFloaterHandle);
+ LLFloater* floaterp = mFloaterHandle.get();
// Show the dialog
if( floaterp )
@@ -1134,7 +1134,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
void LLTextureCtrl::closeFloater()
{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle);
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if( floaterp )
{
floaterp->setOwner(NULL);
@@ -1180,7 +1180,7 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
void LLTextureCtrl::onFloaterClose()
{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle);
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if (floaterp)
{
@@ -1193,9 +1193,9 @@ void LLTextureCtrl::onFloaterClose()
void LLTextureCtrl::onFloaterCommit(ETexturePickOp op)
{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle);
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( floaterp && mEnabled)
+ if( floaterp && getEnabled())
{
mDirty = (op != TEXTURE_CANCEL);
if( floaterp->isDirty() )
@@ -1227,7 +1227,7 @@ void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id )
{
mImageItemID.setNull();
mImageAssetID = asset_id;
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle);
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if( floaterp && getEnabled() )
{
floaterp->setImageID( asset_id );
@@ -1247,7 +1247,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
// returns true, then the cast was valid, and we can perform
// the third test without problems.
LLInventoryItem* item = (LLInventoryItem*)cargo_data;
- if (mEnabled && (cargo_type == DAD_TEXTURE) && allowDrop(item))
+ if (getEnabled() && (cargo_type == DAD_TEXTURE) && allowDrop(item))
{
if (drop)
{
@@ -1290,7 +1290,7 @@ void LLTextureCtrl::draw()
}
// Border
- LLRect border( 0, mRect.getHeight(), mRect.getWidth(), BTN_HEIGHT_SMALL );
+ LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL );
gl_rect_2d( border, mBorderColor, FALSE );
// Interior
@@ -1315,7 +1315,7 @@ void LLTextureCtrl::draw()
gl_draw_x( interior, LLColor4::black );
}
- mTentativeLabel->setVisible( !mTexturep.isNull() && mTentative );
+ mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() );
LLUICtrl::draw();
}
@@ -1371,7 +1371,7 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item)
BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent)
{
- if( getVisible() && mEnabled && !called_from_parent && ' ' == uni_char )
+ if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char )
{
showPicker(TRUE);
return TRUE;
@@ -1450,3 +1450,4 @@ BOOL LLToolTexEyedropper::handleHover(S32 x, S32 y, MASK mask)
}
+
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index cad3980394..4a279d4084 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -44,6 +44,7 @@ class LLFloaterTexturePicker;
class LLInventoryItem;
class LLTextBox;
class LLViewBorder;
+class LLViewerImage;
// used for setting drag & drop callbacks.
typedef BOOL (*drag_n_drop_callback)(LLUICtrl*, LLInventoryItem*, void*);
@@ -163,7 +164,7 @@ private:
LLUUID mImageAssetID;
LLUUID mDefaultImageAssetID;
LLString mDefaultImageName;
- LLViewHandle mFloaterHandle;
+ LLHandle<LLFloater> mFloaterHandle;
LLTextBox* mTentativeLabel;
LLTextBox* mCaption;
LLString mLabel;
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index 465a40c1ef..031492e0e9 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -210,7 +210,7 @@ void LLTextureBar::draw()
mImagep->mFetchPriority);
}
- LLFontGL::sMonospace->renderUTF8(tex_str, 0, title_x1, mRect.getHeight(),
+ LLFontGL::sMonospace->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(),
color, LLFontGL::LEFT, LLFontGL::TOP);
// State
@@ -246,7 +246,7 @@ void LLTextureBar::draw()
mImagep->mFetchState;
state = llclamp(state,0,fetch_state_desc_size-1);
- LLFontGL::sMonospace->renderUTF8(fetch_state_desc[state].desc, 0, title_x2, mRect.getHeight(),
+ LLFontGL::sMonospace->renderUTF8(fetch_state_desc[state].desc, 0, title_x2, getRect().getHeight(),
fetch_state_desc[state].color,
LLFontGL::LEFT, LLFontGL::TOP);
LLGLSNoTexture gls_no_texture;
@@ -328,7 +328,7 @@ void LLTextureBar::draw()
// draw the packet data
// {
// LLString num_str = llformat("%3d/%3d", mImagep->mLastPacket+1, mImagep->mPackets);
-// LLFontGL::sMonospace->renderUTF8(num_str, 0, bar_left + 100, mRect.getHeight(), color,
+// LLFontGL::sMonospace->renderUTF8(num_str, 0, bar_left + 100, getRect().getHeight(), color,
// LLFontGL::LEFT, LLFontGL::TOP);
// }
@@ -336,7 +336,7 @@ void LLTextureBar::draw()
{
LLString num_str = llformat("%3dx%3d (%d) %7d", mImagep->getWidth(), mImagep->getHeight(),
mImagep->getDiscardLevel(), mImagep->mTextureMemory);
- LLFontGL::sMonospace->renderUTF8(num_str, 0, title_x4, mRect.getHeight(), color,
+ LLFontGL::sMonospace->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color,
LLFontGL::LEFT, LLFontGL::TOP);
}
}
@@ -727,7 +727,7 @@ void LLTextureView::draw()
mGLTexMemBar = new LLGLTexMemBar("gl texmem bar", this);
addChild(mGLTexMemBar);
- reshape(mRect.getWidth(), mRect.getHeight(), TRUE);
+ reshape(getRect().getWidth(), getRect().getHeight(), TRUE);
/*
count = gImageList.getNumImages();
@@ -806,3 +806,4 @@ BOOL LLTextureView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
return FALSE;
}
+
diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp
index cfc3f78fd9..48743aeb39 100644
--- a/indra/newview/lltool.cpp
+++ b/indra/newview/lltool.cpp
@@ -42,7 +42,6 @@
#include "lltoolfocus.h"
#include "llfocusmgr.h"
#include "llagent.h"
-#include "llviewborder.h"
extern BOOL gDebugClicks;
diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h
index 33dc4785c6..7d565f1574 100644
--- a/indra/newview/lltool.h
+++ b/indra/newview/lltool.h
@@ -51,7 +51,7 @@ public:
virtual ~LLTool();
// Hack to support LLFocusMgr
- virtual BOOL isView() { return FALSE; }
+ virtual BOOL isView() const { return FALSE; }
// Virtual functions inherited from LLMouseHandler
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp
index c80edd0eab..444a2d1524 100644
--- a/indra/newview/lltoolbar.cpp
+++ b/indra/newview/lltoolbar.cpp
@@ -389,7 +389,7 @@ void LLToolBar::updateCommunicateList()
communicate_button->addSeparator(ADD_TOP);
communicate_button->add(LLFloaterMute::getInstance()->getShortTitle(), LLSD("mute list"), ADD_TOP);
- std::set<LLViewHandle>::const_iterator floater_handle_it;
+ std::set<LLHandle<LLFloater> >::const_iterator floater_handle_it;
if (gIMMgr->getIMFloaterHandles().size() > 0)
{
@@ -398,7 +398,7 @@ void LLToolBar::updateCommunicateList()
for(floater_handle_it = gIMMgr->getIMFloaterHandles().begin(); floater_handle_it != gIMMgr->getIMFloaterHandles().end(); ++floater_handle_it)
{
- LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)LLFloater::getFloaterByHandle(*floater_handle_it);
+ LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)floater_handle_it->get();
if (im_floaterp)
{
LLString floater_title = im_floaterp->getNumUnreadMessages() > 0 ? "*" : "";
@@ -443,10 +443,10 @@ void LLToolBar::onClickCommunicate(LLUICtrl* ctrl, void* user_data)
LLFloaterChatterBox::getInstance()->addFloater(LLFloaterChat::getInstance(), FALSE);
LLUUID session_to_show;
- std::set<LLViewHandle>::const_iterator floater_handle_it;
+ std::set<LLHandle<LLFloater> >::const_iterator floater_handle_it;
for(floater_handle_it = gIMMgr->getIMFloaterHandles().begin(); floater_handle_it != gIMMgr->getIMFloaterHandles().end(); ++floater_handle_it)
{
- LLFloater* im_floaterp = LLFloater::getFloaterByHandle(*floater_handle_it);
+ LLFloater* im_floaterp = floater_handle_it->get();
if (im_floaterp)
{
if (im_floaterp->isFrontmost())
diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h
index 76a361e560..738934ebb1 100644
--- a/indra/newview/lltoolbrush.h
+++ b/indra/newview/lltoolbrush.h
@@ -74,11 +74,7 @@ public:
void modifyLandInSelectionGlobal();
virtual void undo();
- virtual BOOL canUndo() { return TRUE; }
-
- //virtual void redo();
- virtual BOOL canRedo() { return FALSE; }
-
+ virtual BOOL canUndo() const { return TRUE; }
protected:
void brush( void );
diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp
index 182ea5602e..d8f4e55b0e 100644
--- a/indra/newview/lltoolcomp.cpp
+++ b/indra/newview/lltoolcomp.cpp
@@ -173,7 +173,7 @@ void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask)
{
if (gSelectMgr->getSelection()->getObjectCount())
{
- gEditMenuHandler = gSelectMgr;
+ LLEditMenuHandler::gEditMenuHandler = gSelectMgr;
}
gToolInspect->setCurrentTool( gToolInspect->mSelectRect );
gToolInspect->mSelectRect->handleMouseDown( x, y, mask );
@@ -247,7 +247,7 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask)
{
if (gToolTranslate->mManip->getSelection()->getObjectCount())
{
- gEditMenuHandler = gSelectMgr;
+ LLEditMenuHandler::gEditMenuHandler = gSelectMgr;
}
BOOL can_move = gToolTranslate->mManip->canAffectSelection();
@@ -372,7 +372,7 @@ void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask)
{
if (gToolStretch->mManip->getSelection()->getObjectCount())
{
- gEditMenuHandler = gSelectMgr;
+ LLEditMenuHandler::gEditMenuHandler = gSelectMgr;
}
if( LLManip::LL_NO_PART != gToolStretch->mManip->getHighlightedPart() )
{
@@ -572,7 +572,7 @@ void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask)
{
if (gToolRotate->mManip->getSelection()->getObjectCount())
{
- gEditMenuHandler = gSelectMgr;
+ LLEditMenuHandler::gEditMenuHandler = gSelectMgr;
}
if( LLManip::LL_NO_PART != gToolRotate->mManip->getHighlightedPart() )
{
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index 43c8e1a8d1..6d33a9c2bc 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -51,7 +51,6 @@
#include "llstatusbar.h"
#include "lltoolmgr.h"
#include "lltoolselect.h"
-#include "llviewborder.h"
#include "llviewercamera.h"
#include "llviewerobject.h"
#include "llviewerwindow.h"
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 0c88442fd2..1bf08d9e22 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -70,7 +70,7 @@
LLToolPie *gToolPie = NULL;
LLPointer<LLViewerObject> LLToolPie::sClickActionObject;
-LLHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL;
+LLSafeHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL;
U8 LLToolPie::sClickAction = 0;
extern void handle_buy(void*);
diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h
index ffc2fb9122..1af4b26a94 100644
--- a/indra/newview/lltoolpie.h
+++ b/indra/newview/lltoolpie.h
@@ -78,7 +78,7 @@ protected:
BOOL mMouseOutsideSlop; // for this drag, has mouse moved outside slop region
static LLPointer<LLViewerObject> sClickActionObject;
static U8 sClickAction;
- static LLHandle<LLObjectSelection> sLeftClickSelection;
+ static LLSafeHandle<LLObjectSelection> sLeftClickSelection;
};
extern LLToolPie *gToolPie;
diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp
index 37c8b00ed2..3f4c823d40 100644
--- a/indra/newview/lltoolselect.cpp
+++ b/indra/newview/lltoolselect.cpp
@@ -96,7 +96,7 @@ BOOL LLToolSelect::handleDoubleClick(S32 x, S32 y, MASK mask)
}
// static
-LLHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObject *object, MASK mask, BOOL ignore_group, BOOL temp_select)
+LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObject *object, MASK mask, BOOL ignore_group, BOOL temp_select)
{
BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly");
BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly");
@@ -275,3 +275,4 @@ void LLToolSelect::onMouseCaptureLost()
}
+
diff --git a/indra/newview/lltoolselect.h b/indra/newview/lltoolselect.h
index bbf3529017..cc9168f7cc 100644
--- a/indra/newview/lltoolselect.h
+++ b/indra/newview/lltoolselect.h
@@ -49,7 +49,7 @@ public:
virtual void stopEditing();
- static LLHandle<LLObjectSelection> handleObjectSelection(LLViewerObject *object, MASK mask, BOOL ignore_group, BOOL temp_select);
+ static LLSafeHandle<LLObjectSelection> handleObjectSelection(LLViewerObject *object, MASK mask, BOOL ignore_group, BOOL temp_select);
virtual void onMouseCaptureLost();
virtual void handleDeselect();
diff --git a/indra/newview/lltoolselectland.h b/indra/newview/lltoolselectland.h
index 8abcdc33b9..f847967ac8 100644
--- a/indra/newview/lltoolselectland.h
+++ b/indra/newview/lltoolselectland.h
@@ -75,7 +75,7 @@ protected:
LLVector3d mEastNorthTop; // global coords, from drag
BOOL mLastShowParcelOwners; // store last Show Parcel Owners setting
- LLHandle<LLParcelSelection> mSelection; // hold on to a parcel selection
+ LLSafeHandle<LLParcelSelection> mSelection; // hold on to a parcel selection
};
extern LLToolSelectLand *gToolParcel;
diff --git a/indra/newview/lltoolview.cpp b/indra/newview/lltoolview.cpp
index b3f0dc4883..93729a5b91 100644
--- a/indra/newview/lltoolview.cpp
+++ b/indra/newview/lltoolview.cpp
@@ -130,7 +130,7 @@ LLRect LLToolView::getButtonRect(S32 button_index)
const S32 HORIZ_SPACING = TOOL_SIZE + 5;
const S32 VERT_SPACING = TOOL_SIZE + 14;
- S32 tools_per_row = mRect.getWidth() / HORIZ_SPACING;
+ S32 tools_per_row = getRect().getWidth() / HORIZ_SPACING;
S32 row = button_index / tools_per_row;
S32 column = button_index % tools_per_row;
@@ -196,3 +196,4 @@ void LLToolView::onClickToolButton(void* userdata)
}
+
diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp
index a63f546761..b9f2ef2ddf 100644
--- a/indra/newview/lluploaddialog.cpp
+++ b/indra/newview/lluploaddialog.cpp
@@ -78,7 +78,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg)
LLRect msg_rect;
for (int line_num=0; line_num<16; ++line_num)
{
- mLabelBox[line_num] = new LLTextBox( "Filename", msg_rect, "", font );
+ mLabelBox[line_num] = new LLTextBox( "Filename", msg_rect, "Filename", font );
addChild(mLabelBox[line_num]);
}
@@ -131,8 +131,8 @@ void LLUploadDialog::setMessage( const std::string& msg)
reshape( dialog_width, dialog_height, FALSE );
// Message
- S32 msg_x = (mRect.getWidth() - max_msg_width) / 2;
- S32 msg_y = mRect.getHeight() - VPAD - line_height;
+ S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;
+ S32 msg_y = getRect().getHeight() - VPAD - line_height;
int line_num;
for (line_num=0; line_num<16; ++line_num)
{
@@ -152,7 +152,7 @@ void LLUploadDialog::setMessage( const std::string& msg)
}
msg_lines.deleteAllData();
- centerDialog();
+ centerWithin(gViewerWindow->getRootView()->getRect());
}
LLUploadDialog::~LLUploadDialog()
@@ -165,13 +165,5 @@ LLUploadDialog::~LLUploadDialog()
LLUploadDialog::sDialog = NULL;
}
-void LLUploadDialog::centerDialog()
-{
- LLRect window_rect = gViewerWindow->getRootView()->getRect();
-
- S32 dialog_left = window_rect.mLeft + (window_rect.getWidth() - mRect.getWidth()) / 2;
- S32 dialog_bottom = window_rect.mBottom + (window_rect.getHeight() - mRect.getHeight()) / 2;
- translate( dialog_left - mRect.mLeft, dialog_bottom - mRect.mBottom );
-}
diff --git a/indra/newview/lluploaddialog.h b/indra/newview/lluploaddialog.h
index b975fd595c..06bc0f45e2 100644
--- a/indra/newview/lluploaddialog.h
+++ b/indra/newview/lluploaddialog.h
@@ -50,8 +50,6 @@ private:
LLUploadDialog( const std::string& msg);
virtual ~LLUploadDialog(); // No you can't kill it. It can only kill itself.
- void centerDialog();
-
LLTextBox* mLabelBox[16];
private:
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 7180683a86..9c81f89e99 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -114,13 +114,13 @@ BOOL LLFloaterSettingsDebug::postBuild()
childSetCommitCallback("color_swatch", onCommitSettings);
childSetUserData("color_swatch", this);
childSetAction("default_btn", onClickDefault, this);
- mComment = (LLTextEditor*)getChildByName("comment_text");
+ mComment = getChild<LLTextEditor>("comment_text");
return TRUE;
}
void LLFloaterSettingsDebug::draw()
{
- LLComboBox* settings_combo = (LLComboBox*)getChildByName("settings_combo");
+ LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo");
LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata();
updateControl(controlp);
@@ -155,7 +155,7 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
- LLComboBox* settings_combo = (LLComboBox*)floaterp->getChildByName("settings_combo");
+ LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata();
LLVector3 vector;
@@ -229,7 +229,7 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data)
void LLFloaterSettingsDebug::onClickDefault(void* user_data)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
- LLComboBox* settings_combo = (LLComboBox*)floaterp->getChildByName("settings_combo");
+ LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata();
if (controlp)
@@ -246,7 +246,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
LLSpinCtrl* spinner2 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_2");
LLSpinCtrl* spinner3 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_3");
LLSpinCtrl* spinner4 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_4");
- LLColorSwatchCtrl* color_swatch = LLUICtrlFactory::getColorSwatchByName(this, "color_swatch");
+ LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch");
if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch)
{
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index b5d30df2f4..a8f88ec036 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -473,11 +473,8 @@ void stop_moving( EKeystate s )
void start_chat( EKeystate s )
{
- if (!gChatBar->inputEditorHasFocus())
- {
- // start chat
- gChatBar->startChat(NULL);
- }
+ // start chat
+ gChatBar->startChat(NULL);
}
void bind_keyboard_functions()
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 7a86b1d67c..b8ff934f8d 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -115,9 +115,12 @@ void LLViewerMediaImpl::play(const std::string& media_url,
mMediaSource = mgr->createSourceFromMimeType(scheme, mMimeType );
if ( !mMediaSource )
{
- llwarns << "media source create failed " << media_url
- << " type " << mMimeType
- << llendl;
+ if (mMimeType != "none/none")
+ {
+ llwarns << "media source create failed " << media_url
+ << " type " << mMimeType
+ << llendl;
+ }
return;
}
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 9c94306fb7..fc9b765525 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -245,8 +245,8 @@ LLPieMenu *gPieLand = NULL;
// local constants
const LLString LANDMARK_MENU_NAME("Landmarks");
-const LLString CLIENT_MENU_NAME("Client");
-const LLString SERVER_MENU_NAME("Server");
+const LLString CLIENT_MENU_NAME("Advanced");
+const LLString SERVER_MENU_NAME("Admin");
const LLString SAVE_INTO_INVENTORY("Save Object Back to My Inventory");
const LLString SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents");
@@ -424,7 +424,6 @@ BOOL enable_dehinge(void*);
void handle_force_delete(void*);
void print_object_info(void*);
void print_agent_nvpairs(void*);
-void show_debug_menus();
void toggle_debug_menus(void*);
void toggle_map( void* user_data );
void export_info_callback(LLAssetInfo *info, void **user_data, S32 result);
@@ -613,13 +612,13 @@ void set_underclothes_menu_options()
{
if (gMenuHolder && gAgent.isTeen())
{
- gMenuHolder->getChildByName("Self Underpants", TRUE)->setVisible(FALSE);
- gMenuHolder->getChildByName("Self Undershirt", TRUE)->setVisible(FALSE);
+ gMenuHolder->getChild<LLView>("Self Underpants", TRUE)->setVisible(FALSE);
+ gMenuHolder->getChild<LLView>("Self Undershirt", TRUE)->setVisible(FALSE);
}
if (gMenuBarView && gAgent.isTeen())
{
- gMenuBarView->getChildByName("Menu Underpants", TRUE)->setVisible(FALSE);
- gMenuBarView->getChildByName("Menu Undershirt", TRUE)->setVisible(FALSE);
+ gMenuBarView->getChild<LLView>("Menu Underpants", TRUE)->setVisible(FALSE);
+ gMenuBarView->getChild<LLView>("Menu Undershirt", TRUE)->setVisible(FALSE);
}
}
@@ -656,16 +655,16 @@ void init_menus()
gPieSelf = gUICtrlFactory->buildPieMenu("menu_pie_self.xml", gMenuHolder);
// TomY TODO: what shall we do about these?
- gDetachScreenPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Detach HUD", true);
- gDetachPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Detach", true);
+ gDetachScreenPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Detach HUD", true);
+ gDetachPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Detach", true);
gPieAvatar = gUICtrlFactory->buildPieMenu("menu_pie_avatar.xml", gMenuHolder);
gPieObject = gUICtrlFactory->buildPieMenu("menu_pie_object.xml", gMenuHolder);
- gAttachScreenPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Attach HUD", true);
- gAttachPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Attach", true);
- gPieRate = (LLPieMenu*)gMenuHolder->getChildByName("Rate Menu", true);
+ gAttachScreenPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Attach HUD");
+ gAttachPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Attach");
+ gPieRate = gMenuHolder->getChild<LLPieMenu>("Rate Menu");
gPieAttachment = gUICtrlFactory->buildPieMenu("menu_pie_attachment.xml", gMenuHolder);
@@ -715,8 +714,8 @@ void init_menus()
gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost);
gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost);
- gAFKMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Away", TRUE);
- gBusyMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Busy", TRUE);
+ gAFKMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Away", TRUE);
+ gBusyMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Busy", TRUE);
gAttachSubMenu = gMenuBarView->getChildMenuByName("Attach Object", TRUE);
gDetachSubMenu = gMenuBarView->getChildMenuByName("Detach Object", TRUE);
@@ -1101,6 +1100,13 @@ void init_client_menu(LLMenuGL* menu)
menu->append(new LLMenuItemCallGL("Debug Settings", LLFloaterSettingsDebug::show, NULL, NULL));
menu->append(new LLMenuItemCheckGL("View Admin Options", &handle_admin_override_toggle, NULL, &check_admin_override, NULL, 'V', MASK_CONTROL | MASK_ALT));
+
+ menu->append(new LLMenuItemCallGL("Request Admin Status",
+ &handle_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_CONTROL));
+
+ menu->append(new LLMenuItemCallGL("Leave Admin Status",
+ &handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL));
+
menu->createJumpKeys();
}
@@ -1586,19 +1592,11 @@ void init_server_menu(LLMenuGL* menu)
&LLPanelRegionTools::onSaveState, &enable_god_customer_service, NULL));
// menu->append(new LLMenuItemCallGL("Force Join Group", handle_force_join_group));
-
-
-
- menu->appendSeparator();
+//
+// menu->appendSeparator();
//
// menu->append(new LLMenuItemCallGL( "OverlayTitle",
// &handle_show_overlay_title, &enable_god_customer_service, NULL));
-
- menu->append(new LLMenuItemCallGL("Request Admin Status",
- &handle_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_CONTROL));
-
- menu->append(new LLMenuItemCallGL("Leave Admin Status",
- &handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL));
menu->createJumpKeys();
}
@@ -2627,12 +2625,10 @@ BOOL check_admin_override(void*)
void handle_admin_override_toggle(void*)
{
- if(!gAgent.getAdminOverride())
- {
- gAgent.setAdminOverride(TRUE);
- show_debug_menus();
- }
- else gAgent.setAdminOverride(FALSE);
+ gAgent.setAdminOverride(!gAgent.getAdminOverride());
+
+ // The above may have affected which debug menus are visible
+ show_debug_menus();
}
void handle_god_mode(void*)
@@ -2649,7 +2645,6 @@ void set_god_level(U8 god_level)
{
U8 old_god_level = gAgent.getGodLevel();
gAgent.setGodLevel( god_level );
- show_debug_menus();
gIMMgr->refresh();
gParcelMgr->notifyObservers();
@@ -2681,6 +2676,9 @@ void set_god_level(U8 god_level)
LLNotifyBox::showXml("LeavingGodMode", args);
}
+
+ // changing god-level can affect which menus we see
+ show_debug_menus();
}
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
@@ -3351,9 +3349,9 @@ class LLEditDuplicate : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- if(gEditMenuHandler)
+ if(LLEditMenuHandler::gEditMenuHandler)
{
- gEditMenuHandler->duplicate();
+ LLEditMenuHandler::gEditMenuHandler->duplicate();
}
return true;
}
@@ -3363,7 +3361,7 @@ class LLEditEnableDuplicate : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = gEditMenuHandler && gEditMenuHandler->canDuplicate();
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDuplicate();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
@@ -4445,7 +4443,7 @@ class LLEditEnableCut : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = gEditMenuHandler && gEditMenuHandler->canCut();
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCut();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
@@ -4455,9 +4453,9 @@ class LLEditCut : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- if( gEditMenuHandler )
+ if( LLEditMenuHandler::gEditMenuHandler )
{
- gEditMenuHandler->cut();
+ LLEditMenuHandler::gEditMenuHandler->cut();
}
return true;
}
@@ -4467,7 +4465,7 @@ class LLEditEnableCopy : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = gEditMenuHandler && gEditMenuHandler->canCopy();
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCopy();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
@@ -4477,9 +4475,9 @@ class LLEditCopy : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- if( gEditMenuHandler )
+ if( LLEditMenuHandler::gEditMenuHandler )
{
- gEditMenuHandler->copy();
+ LLEditMenuHandler::gEditMenuHandler->copy();
}
return true;
}
@@ -4489,7 +4487,7 @@ class LLEditEnablePaste : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = gEditMenuHandler && gEditMenuHandler->canPaste();
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canPaste();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
@@ -4499,9 +4497,9 @@ class LLEditPaste : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- if( gEditMenuHandler )
+ if( LLEditMenuHandler::gEditMenuHandler )
{
- gEditMenuHandler->paste();
+ LLEditMenuHandler::gEditMenuHandler->paste();
}
return true;
}
@@ -4511,7 +4509,7 @@ class LLEditEnableDelete : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = gEditMenuHandler && gEditMenuHandler->canDoDelete();
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
@@ -4523,9 +4521,9 @@ class LLEditDelete : public view_listener_t
{
// If a text field can do a deletion, it gets precedence over deleting
// an object in the world.
- if( gEditMenuHandler && gEditMenuHandler->canDoDelete())
+ if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete())
{
- gEditMenuHandler->doDelete();
+ LLEditMenuHandler::gEditMenuHandler->doDelete();
}
// and close any pie/context menus when done
@@ -4605,7 +4603,7 @@ class LLEditEnableDeselect : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = gEditMenuHandler && gEditMenuHandler->canDeselect();
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDeselect();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
@@ -4615,9 +4613,9 @@ class LLEditDeselect : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- if( gEditMenuHandler )
+ if( LLEditMenuHandler::gEditMenuHandler )
{
- gEditMenuHandler->deselect();
+ LLEditMenuHandler::gEditMenuHandler->deselect();
}
return true;
}
@@ -4627,7 +4625,7 @@ class LLEditEnableSelectAll : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = gEditMenuHandler && gEditMenuHandler->canSelectAll();
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canSelectAll();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
@@ -4638,9 +4636,9 @@ class LLEditSelectAll : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- if( gEditMenuHandler )
+ if( LLEditMenuHandler::gEditMenuHandler )
{
- gEditMenuHandler->selectAll();
+ LLEditMenuHandler::gEditMenuHandler->selectAll();
}
return true;
}
@@ -4651,7 +4649,7 @@ class LLEditEnableUndo : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = gEditMenuHandler && gEditMenuHandler->canUndo();
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
@@ -4661,9 +4659,9 @@ class LLEditUndo : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- if( gEditMenuHandler && gEditMenuHandler->canUndo() )
+ if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo() )
{
- gEditMenuHandler->undo();
+ LLEditMenuHandler::gEditMenuHandler->undo();
}
return true;
}
@@ -4673,7 +4671,7 @@ class LLEditEnableRedo : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = gEditMenuHandler && gEditMenuHandler->canRedo();
+ bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo();
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
@@ -4683,9 +4681,9 @@ class LLEditRedo : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- if( gEditMenuHandler && gEditMenuHandler->canRedo() )
+ if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo() )
{
- gEditMenuHandler->redo();
+ LLEditMenuHandler::gEditMenuHandler->redo();
}
return true;
}
@@ -4731,8 +4729,12 @@ void show_debug_menus()
gMenuBarView->setItemVisible(CLIENT_MENU_NAME, debug);
gMenuBarView->setItemEnabled(CLIENT_MENU_NAME, debug);
- gMenuBarView->setItemVisible(SERVER_MENU_NAME, debug);
- gMenuBarView->setItemEnabled(SERVER_MENU_NAME, debug);
+
+ // Server ('Admin') menu hidden when not in godmode.
+ const bool show_server_menu = debug && (gAgent.getGodLevel() > GOD_NOT);
+ gMenuBarView->setItemVisible(SERVER_MENU_NAME, show_server_menu);
+ gMenuBarView->setItemEnabled(SERVER_MENU_NAME, show_server_menu);
+
//gMenuBarView->setItemVisible(LLString("DebugOptions"), visible);
//gMenuBarView->setItemVisible(LLString(AVI_TOOLS), visible);
};
@@ -5366,19 +5368,7 @@ class LLShowFloater : public view_listener_t
}
else if (floater_name == "help f1")
{
- gViewerHtmlHelp.show( gSavedSettings.getString("HelpHomeURL") );
- }
- else if (floater_name == "help in-world")
- {
- const bool open_app_slurls = true;
- LLFloaterHtml::getInstance()->show(
- "in-world_help", open_app_slurls );
- }
- else if (floater_name == "help additional")
- {
- const bool open_app_slurls = true;
- LLFloaterHtml::getInstance()->show(
- "additional_help", open_app_slurls );
+ gViewerHtmlHelp.show();
}
else if (floater_name == "complaint reporter")
{
@@ -5436,7 +5426,7 @@ class LLFloaterVisible : public view_listener_t
}
else if (floater_name == "chat history")
{
- new_value = LLFloaterChat::visible(NULL);
+ new_value = LLFloaterChat::instanceVisible();
}
else if (floater_name == "im")
{
@@ -7112,12 +7102,12 @@ BOOL LLViewerMenuHolderGL::hideMenus()
return handled;
}
-void LLViewerMenuHolderGL::setParcelSelection(LLHandle<LLParcelSelection> selection)
+void LLViewerMenuHolderGL::setParcelSelection(LLSafeHandle<LLParcelSelection> selection)
{
mParcelSelection = selection;
}
-void LLViewerMenuHolderGL::setObjectSelection(LLHandle<LLObjectSelection> selection)
+void LLViewerMenuHolderGL::setObjectSelection(LLSafeHandle<LLObjectSelection> selection)
{
mObjectSelection = selection;
}
@@ -7125,7 +7115,7 @@ void LLViewerMenuHolderGL::setObjectSelection(LLHandle<LLObjectSelection> select
const LLRect LLViewerMenuHolderGL::getMenuRect() const
{
- return LLRect(0, mRect.getHeight() - MENU_BAR_HEIGHT, mRect.getWidth(), STATUS_BAR_HEIGHT);
+ return LLRect(0, getRect().getHeight() - MENU_BAR_HEIGHT, getRect().getWidth(), STATUS_BAR_HEIGHT);
}
void handle_save_to_xml(void*)
@@ -7168,8 +7158,9 @@ void handle_load_from_xml(void*)
void handle_slurl_test(void*)
{
- LLFloaterHtml::getInstance()->show(
- "http://secondlife.com/app/search/slurls.html", "SLURL Test", true);
+ bool open_app_slurls = true;
+ bool open_links_externally = false;
+ LLFloaterHtml::getInstance()->show("http://secondlife.com/app/search/slurls.html", "SLURL Test", open_app_slurls, open_links_externally);
}
void handle_rebake_textures(void*)
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index 003e3efe42..21b2554ceb 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -126,14 +126,14 @@ public:
virtual BOOL hideMenus();
- void setParcelSelection(LLHandle<LLParcelSelection> selection);
- void setObjectSelection(LLHandle<LLObjectSelection> selection);
+ void setParcelSelection(LLSafeHandle<LLParcelSelection> selection);
+ void setObjectSelection(LLSafeHandle<LLObjectSelection> selection);
virtual const LLRect getMenuRect() const;
protected:
- LLHandle<LLParcelSelection> mParcelSelection;
- LLHandle<LLObjectSelection> mObjectSelection;
+ LLSafeHandle<LLParcelSelection> mParcelSelection;
+ LLSafeHandle<LLObjectSelection> mObjectSelection;
};
extern const LLString SAVE_INTO_INVENTORY;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 5e3ffb5e04..e9839d64dc 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -919,37 +919,25 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id,
gFloaterMute->selectMute(blocked_id);
}
- // purge the offer queue of any previously queued inventory offers from the same source.
- LLView::child_list_t notification_queue(*(gNotifyBoxView->getChildList()));
- for(LLView::child_list_iter_t iter = notification_queue.begin();
- iter != notification_queue.end();
- iter++)
- {
- LLNotifyBox* notification = (LLNotifyBox*)*iter;
- // scan for other inventory offers (i.e. ignore other types of notifications).
- // we can tell by looking for the associated callback they were created with.
- if(notification->getNotifyCallback() == inventory_offer_callback)
- {
- // found one.
- // safe to downcast user data because we know it's associated with offer callback.
- LLOfferInfo* offer_data = (LLOfferInfo*)notification->getUserData();
- if(offer_data == user_data)
- {
- continue; // don't remove the msg triggering us. it will be dequeued normally.
- }
- if(offer_data->mFromID == blocked_id)
- {
- gNotifyBoxView->removeChild(notification);
- }
+ // purge the message queue of any previously queued inventory offers from the same source.
+ class OfferMatcher : public LLNotifyBoxView::Matcher
+ {
+ public:
+ OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {}
+ BOOL matches(LLNotifyBox::notify_callback_t callback, void* cb_data) const
+ {
+ return callback == inventory_offer_callback && ((LLOfferInfo*)cb_data)->mFromID == blocked_id;
}
- }
+ private:
+ const LLUUID& blocked_id;
+ };
+ gNotifyBoxView->purgeMessagesMatching(OfferMatcher(blocked_id));
}
void inventory_offer_callback(S32 button, void* user_data)
{
LLChat chat;
LLString log_message;
-
LLOfferInfo* info = (LLOfferInfo*)user_data;
if(!info) return;
@@ -997,7 +985,7 @@ void inventory_offer_callback(S32 button, void* user_data)
{
if (info->mFromGroup)
{
- char group_name[MAX_STRING]; /* Flawfinder: ignore */
+ std::string group_name;
if (gCacheName->getGroupName(info->mFromID, group_name))
{
from_string = LLString("An object named '") + info->mFromName + "' owned by the group '" + group_name + "'";
@@ -1011,8 +999,7 @@ void inventory_offer_callback(S32 button, void* user_data)
}
else
{
- char first_name[MAX_STRING]; /* Flawfinder: ignore */
- char last_name[MAX_STRING]; /* Flawfinder: ignore */
+ std::string first_name, last_name;
if (gCacheName->getName(info->mFromID, first_name, last_name))
{
from_string = LLString("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name;
@@ -1213,19 +1200,19 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
// Name cache callbacks don't store userdata, so can't save
// off the LLOfferInfo. Argh. JC
BOOL name_found = FALSE;
- char first_name[MAX_STRING]; /* Flawfinder: ignore */
- char last_name[MAX_STRING]; /* Flawfinder: ignore */
if (info->mFromGroup)
{
- if (gCacheName->getGroupName(info->mFromID, first_name))
+ std::string group_name;
+ if (gCacheName->getGroupName(info->mFromID, group_name))
{
- args["[FIRST]"] = first_name;
+ args["[FIRST]"] = group_name;
args["[LAST]"] = "";
name_found = TRUE;
}
}
else
{
+ std::string first_name, last_name;
if (gCacheName->getName(info->mFromID, first_name, last_name))
{
args["[FIRST]"] = first_name;
@@ -4413,9 +4400,23 @@ void script_question_cb(S32 option, void* user_data)
notify_cautioned_script_question(cbdata, orig, allowed);
}
- if ( option == 2 )
+ if ( option == 2 ) // mute
{
gMuteListp->add(LLMute(cbdata->mItemID, cbdata->mObjectName, LLMute::OBJECT));
+
+ // purge the message queue of any previously queued requests from the same source. DEV-4879
+ class OfferMatcher : public LLNotifyBoxView::Matcher
+ {
+ public:
+ OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {}
+ BOOL matches(LLNotifyBox::notify_callback_t callback, void* cb_data) const
+ {
+ return callback == script_question_cb && ((LLScriptQuestionCBData*)cb_data)->mItemID == blocked_id;
+ }
+ private:
+ const LLUUID& blocked_id;
+ };
+ gNotifyBoxView->purgeMessagesMatching(OfferMatcher(cbdata->mItemID));
}
delete cbdata;
}
diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp
index 33c8ed919c..4c9a0aab95 100644
--- a/indra/newview/llviewerparcelmedia.cpp
+++ b/indra/newview/llviewerparcelmedia.cpp
@@ -160,7 +160,7 @@ void LLViewerParcelMedia::update(LLParcel* parcel)
// static
void LLViewerParcelMedia::play(LLParcel* parcel)
{
- llinfos << "play" << llendl;
+ lldebugs << "LLViewerParcelMedia::play" << llendl;
if (!parcel) return;
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index b5c2e81ab7..290650e251 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -590,13 +590,13 @@ void LLViewerParcelMgr::deselectLand()
mSelectedDwell = 0.f;
- notifyObservers();
-
// invalidate parcel selection so that existing users of this selection can clean up
mCurrentParcelSelection->setParcel(NULL);
mFloatingParcelSelection->setParcel(NULL);
// create new parcel selection
mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
+
+ notifyObservers(); // Notify observers *after* changing the parcel selection
}
}
@@ -1968,17 +1968,14 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which)
void LLViewerParcelMgr::deedLandToGroup()
{
- char group_name[MAX_STRING]; /* Flawfinder: ignore */
+ std::string group_name;
gCacheName->getGroupName(mCurrentParcel->getGroupID(), group_name);
LLString::format_map_t args;
args["[AREA]"] = llformat("%d", mCurrentParcel->getArea());
args["[GROUP_NAME]"] = group_name;
if(mCurrentParcel->getContributeWithDeed())
{
- char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- first_name[0] = '\0';
- char last_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- last_name[0] = '\0';
+ std::string first_name, last_name;
gCacheName->getName(mCurrentParcel->getOwnerID(), first_name, last_name);
args["[FIRST_NAME]"] = first_name;
args["[LAST_NAME]"] = last_name;
diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h
index efea18158c..f86ffe309f 100644
--- a/indra/newview/llviewerparcelmgr.h
+++ b/indra/newview/llviewerparcelmgr.h
@@ -110,7 +110,7 @@ public:
void selectCollisionParcel();
// Select the parcel at a specific point
- LLHandle<LLParcelSelection> selectParcelAt(const LLVector3d& pos_global);
+ LLSafeHandle<LLParcelSelection> selectParcelAt(const LLVector3d& pos_global);
// Take the current rectangle select, and select the parcel contained
// within it.
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index 871fc9702e..2721a626c7 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -1,6 +1,6 @@
/**
* @file llviewertexteditor.cpp
- * @brief Text editor widget to let users enter a a multi-line ASCII document.
+ * @brief Text editor widget to let users enter a multi-line document.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -145,8 +145,8 @@ public:
// return true if there are no embedded items.
bool empty();
- void bindEmbeddedChars(const LLFontGL* font);
- void unbindEmbeddedChars(const LLFontGL* font);
+ void bindEmbeddedChars(LLFontGL* font) const;
+ void unbindEmbeddedChars(LLFontGL* font) const;
BOOL insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new);
BOOL removeEmbeddedItem( llwchar ext_char );
@@ -167,12 +167,13 @@ public:
static LLInventoryItem* getEmbeddedItem(llwchar ext_char); // returns item from static list
static BOOL getEmbeddedItemSaved(llwchar ext_char); // returns whether item from static list is saved
+private:
+
struct embedded_info_t
{
LLPointer<LLInventoryItem> mItem;
BOOL mSaved;
};
-private:
typedef std::map<llwchar, embedded_info_t > item_map_t;
static item_map_t sEntries;
static std::stack<llwchar> sFreeEntries;
@@ -227,14 +228,14 @@ BOOL LLEmbeddedItems::insertEmbeddedItem( LLInventoryItem* item, llwchar* ext_ch
}
else if (sEntries.empty())
{
- wc_emb = FIRST_EMBEDDED_CHAR;
+ wc_emb = LLTextEditor::FIRST_EMBEDDED_CHAR;
}
else
{
item_map_t::iterator last = sEntries.end();
--last;
wc_emb = last->first;
- if (wc_emb >= LAST_EMBEDDED_CHAR)
+ if (wc_emb >= LLTextEditor::LAST_EMBEDDED_CHAR)
{
return FALSE;
}
@@ -265,7 +266,7 @@ BOOL LLEmbeddedItems::removeEmbeddedItem( llwchar ext_char )
// static
LLInventoryItem* LLEmbeddedItems::getEmbeddedItem(llwchar ext_char)
{
- if( ext_char >= FIRST_EMBEDDED_CHAR && ext_char <= LAST_EMBEDDED_CHAR )
+ if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR )
{
item_map_t::iterator iter = sEntries.find(ext_char);
if (iter != sEntries.end())
@@ -279,7 +280,7 @@ LLInventoryItem* LLEmbeddedItems::getEmbeddedItem(llwchar ext_char)
// static
BOOL LLEmbeddedItems::getEmbeddedItemSaved(llwchar ext_char)
{
- if( ext_char >= FIRST_EMBEDDED_CHAR && ext_char <= LAST_EMBEDDED_CHAR )
+ if( ext_char >= LLTextEditor::FIRST_EMBEDDED_CHAR && ext_char <= LLTextEditor::LAST_EMBEDDED_CHAR )
{
item_map_t::iterator iter = sEntries.find(ext_char);
if (iter != sEntries.end())
@@ -307,7 +308,7 @@ void LLEmbeddedItems::removeUnusedChars()
for (S32 i=0; i<(S32)wtext.size(); i++)
{
llwchar wc = wtext[i];
- if( wc >= FIRST_EMBEDDED_CHAR && wc <= LAST_EMBEDDED_CHAR )
+ if( wc >= LLTextEditor::FIRST_EMBEDDED_CHAR && wc <= LLTextEditor::LAST_EMBEDDED_CHAR )
{
used.erase(wc);
}
@@ -365,14 +366,14 @@ BOOL LLEmbeddedItems::hasEmbeddedItem(llwchar ext_char)
return FALSE;
}
-void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font )
+void LLEmbeddedItems::bindEmbeddedChars( LLFontGL* font ) const
{
if( sEntries.empty() )
{
return;
}
- for (std::set<llwchar>::iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1)
+ for (std::set<llwchar>::const_iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1)
{
llwchar wch = *iter1;
item_map_t::iterator iter2 = sEntries.find(wch);
@@ -431,20 +432,20 @@ void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font )
LLViewerImage* image = gImageList.getImage(LLUUID(gViewerArt.getString(img_name)), MIPMAP_FALSE, TRUE);
- ((LLFontGL*)font)->addEmbeddedChar( wch, image, item->getName() );
+ font->addEmbeddedChar( wch, image, item->getName() );
}
}
-void LLEmbeddedItems::unbindEmbeddedChars( const LLFontGL* font )
+void LLEmbeddedItems::unbindEmbeddedChars( LLFontGL* font ) const
{
if( sEntries.empty() )
{
return;
}
- for (std::set<llwchar>::iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1)
+ for (std::set<llwchar>::const_iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1)
{
- ((LLFontGL*)font)->removeEmbeddedChar(*iter1);
+ font->removeEmbeddedChar(*iter1);
}
}
@@ -490,7 +491,7 @@ void LLEmbeddedItems::markSaved()
///////////////////////////////////////////////////////////////////
-class LLTextCmdInsertEmbeddedItem : public LLTextCmd
+class LLViewerTextEditor::LLTextCmdInsertEmbeddedItem : public LLTextEditor::LLTextCmd
{
public:
LLTextCmdInsertEmbeddedItem( S32 pos, LLInventoryItem* item )
@@ -509,7 +510,7 @@ public:
{
LLWString ws;
ws.assign(1, mExtCharValue);
- *delta = insert(editor, mPos, ws );
+ *delta = insert(editor, getPosition(), ws );
return (*delta != 0);
}
return FALSE;
@@ -517,18 +518,18 @@ public:
virtual S32 undo( LLTextEditor* editor )
{
- remove(editor, mPos, 1);
- return mPos;
+ remove(editor, getPosition(), 1);
+ return getPosition();
}
virtual S32 redo( LLTextEditor* editor )
{
LLWString ws;
ws += mExtCharValue;
- insert(editor, mPos, ws );
- return mPos + 1;
+ insert(editor, getPosition(), ws );
+ return getPosition() + 1;
}
- virtual BOOL hasExtCharValue( llwchar value )
+ virtual BOOL hasExtCharValue( llwchar value ) const
{
return (value == mExtCharValue);
}
@@ -571,17 +572,17 @@ LLViewerTextEditor::LLViewerTextEditor(const LLString& name,
mEmbeddedItemList = new LLEmbeddedItems(this);
mInventoryCallback->setEditor(this);
+ // *TODO: Add right click menus for SLURLs
// Build the right click menu
// make the popup menu available
-
- LLMenuGL* menu = gUICtrlFactory->buildMenu("menu_slurl.xml", this);
- if (!menu)
- {
- menu = new LLMenuGL("");
- }
- menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor"));
- // menu->setVisible(FALSE);
- mPopupMenuHandle = menu->mViewHandle;
+ //LLMenuGL* menu = gUICtrlFactory->buildMenu("menu_slurl.xml", this);
+ //if (!menu)
+ //{
+ // menu = new LLMenuGL("");
+ //}
+ //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor"));
+ //// menu->setVisible(FALSE);
+ //mPopupMenuHandle = menu->getHandle();
}
LLViewerTextEditor::~LLViewerTextEditor()
@@ -623,7 +624,7 @@ BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* stic
return TRUE;
}
- LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
+ const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
if( cur_segment )
{
BOOL has_tool_tip = FALSE;
@@ -674,13 +675,13 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
}
BOOL start_select = TRUE;
- if( mAllowEmbeddedItems )
+ if( allowsEmbeddedItems() )
{
setCursorAtLocalPos( x, y, FALSE );
llwchar wc = 0;
if (mCursorPos < getLength())
{
- wc = mWText[mCursorPos];
+ wc = getWChar(mCursorPos);
}
LLInventoryItem* item_at_pos = LLEmbeddedItems::getEmbeddedItem(wc);
if (item_at_pos)
@@ -763,7 +764,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
}
// Delay cursor flashing
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
return handled;
}
@@ -790,12 +791,12 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask)
mLastSelectionY = y;
}
- if( y > mTextRect.mTop )
+ if( y > getTextRect().mTop )
{
mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 );
}
else
- if( y < mTextRect.mBottom )
+ if( y < getTextRect().mBottom )
{
mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 );
}
@@ -817,7 +818,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask)
LLAssetType::lookupDragAndDropType( mDragItem->getType() ),
mDragItem->getUUID(),
LLToolDragAndDrop::SOURCE_NOTECARD,
- mSourceID, mObjectID);
+ getSourceID(), mObjectID);
return gToolDragAndDrop->handleHover( x, y, mask );
}
@@ -837,7 +838,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask)
if( handled )
{
// Delay cursor flashing
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
}
// Opaque
@@ -846,7 +847,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask)
// Check to see if we're over an HTML-style link
if( !mSegments.empty() )
{
- LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
+ const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
if( cur_segment )
{
if(cur_segment->getStyle().isLink())
@@ -870,7 +871,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask)
if( !handled )
{
lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl;
- if (!mScrollbar->getVisible() || x < mRect.getWidth() - SCROLLBAR_SIZE)
+ if (!mScrollbar->getVisible() || x < getRect().getWidth() - SCROLLBAR_SIZE)
{
getWindow()->setCursor(UI_CURSOR_IBEAM);
}
@@ -894,7 +895,7 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
// let scrollbar have first dibs
handled = LLView::childrenHandleMouseUp(x, y, mask) != NULL;
- // enable I Agree checkbox if the user scrolled through entire text
+ // Used to enable I Agree checkbox if the user scrolled through entire text
BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax());
if (mOnScrollEndCallback && was_scrolled_to_bottom)
{
@@ -906,12 +907,12 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
if( mIsSelecting )
{
// Finish selection
- if( y > mTextRect.mTop )
+ if( y > getTextRect().mTop )
{
mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 );
}
else
- if( y < mTextRect.mBottom )
+ if( y < getTextRect().mBottom )
{
mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 );
}
@@ -931,7 +932,7 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
}
// Delay cursor flashing
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
if( hasMouseCapture() )
{
@@ -965,34 +966,35 @@ BOOL LLViewerTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL;
- if(! handled)
- {
- LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
- if( cur_segment )
- {
- if(cur_segment->getStyle().isLink())
- {
- handled = TRUE;
- mHTML = cur_segment->getStyle().getLinkHREF();
- }
- }
- }
- LLMenuGL* menu = (LLMenuGL*)LLView::getViewByHandle(mPopupMenuHandle);
- if(handled && menu && mParseHTML && mHTML.length() > 0)
- {
- menu->setVisible(TRUE);
- menu->arrange();
- menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(this, menu, x, y);
- mHTML = "";
- }
- else
- {
- if(menu && menu->getVisible())
- {
- menu->setVisible(FALSE);
- }
- }
+ // *TODO: Add right click menus for SLURLs
+// if(! handled)
+// {
+// const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
+// if( cur_segment )
+// {
+// if(cur_segment->getStyle().isLink())
+// {
+// handled = TRUE;
+// mHTML = cur_segment->getStyle().getLinkHREF();
+// }
+// }
+// }
+// LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
+// if(handled && menu && mParseHTML && mHTML.length() > 0)
+// {
+// menu->setVisible(TRUE);
+// menu->arrange();
+// menu->updateParent(LLMenuGL::sMenuContainer);
+// LLMenuGL::showPopup(this, menu, x, y);
+// mHTML = "";
+// }
+// else
+// {
+// if(menu && menu->getVisible())
+// {
+// menu->setVisible(FALSE);
+// }
+// }
return handled;
}
@@ -1005,9 +1007,9 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
if( !handled && mTakesNonScrollClicks)
{
- if( mAllowEmbeddedItems )
+ if( allowsEmbeddedItems() )
{
- LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
+ const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
if( cur_segment && cur_segment->getStyle().getIsEmbeddedItem() )
{
if( openEmbeddedItemAtPos( cur_segment->getStart() ) )
@@ -1054,7 +1056,7 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
mIsSelecting = FALSE;
// delay cursor flashing
- mKeystrokeTimer.reset();
+ resetKeystrokeTimer();
handled = TRUE;
}
@@ -1074,12 +1076,12 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask,
if (mTakesNonScrollClicks)
{
- if (getEnabled() && !mReadOnly)
+ if (getEnabled() && acceptsTextInput())
{
switch( cargo_type )
{
case DAD_CALLINGCARD:
- if(mAcceptCallingCardNames)
+ if(acceptsCallingCardNames())
{
if (drop)
{
@@ -1107,7 +1109,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask,
case DAD_GESTURE:
{
LLInventoryItem *item = (LLInventoryItem *)cargo_data;
- if( mAllowEmbeddedItems )
+ if( allowsEmbeddedItems() )
{
U32 mask_next = item->getPermissions().getMaskNextOwner();
if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
@@ -1208,9 +1210,9 @@ LLString LLViewerTextEditor::getEmbeddedText()
// New version (Version 2)
mEmbeddedItemList->copyUsedCharsToIndexed();
LLWString outtextw;
- for (S32 i=0; i<(S32)mWText.size(); i++)
+ for (S32 i=0; i<(S32)getWText().size(); i++)
{
- llwchar wch = mWText[i];
+ llwchar wch = getWChar(i);
if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )
{
S32 index = mEmbeddedItemList->getIndexFromEmbeddedChar(wch);
@@ -1282,21 +1284,21 @@ llwchar LLViewerTextEditor::pasteEmbeddedItem(llwchar ext_char)
return LL_UNKNOWN_CHAR; // item not found or list full
}
-void LLViewerTextEditor::bindEmbeddedChars(const LLFontGL* font)
+void LLViewerTextEditor::bindEmbeddedChars(LLFontGL* font) const
{
mEmbeddedItemList->bindEmbeddedChars( font );
}
-void LLViewerTextEditor::unbindEmbeddedChars(const LLFontGL* font)
+void LLViewerTextEditor::unbindEmbeddedChars(LLFontGL* font) const
{
mEmbeddedItemList->unbindEmbeddedChars( font );
}
-BOOL LLViewerTextEditor::getEmbeddedItemToolTipAtPos(S32 pos, LLWString &msg)
+BOOL LLViewerTextEditor::getEmbeddedItemToolTipAtPos(S32 pos, LLWString &msg) const
{
if (pos < getLength())
{
- LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem(mWText[pos]);
+ LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem(getWChar(pos));
if( item )
{
msg = utf8str_to_wstring(item->getName());
@@ -1313,10 +1315,10 @@ BOOL LLViewerTextEditor::openEmbeddedItemAtPos(S32 pos)
{
if( pos < getLength())
{
- LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem( mWText[pos] );
+ LLInventoryItem* item = LLEmbeddedItems::getEmbeddedItem( getWChar(pos) );
if( item )
{
- BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( mWText[pos] );
+ BOOL saved = LLEmbeddedItems::getEmbeddedItemSaved( getWChar(pos) );
if (saved)
{
return openEmbeddedItem(item);
@@ -1490,7 +1492,7 @@ bool LLViewerTextEditor::importStream(std::istream& str)
const std::vector<LLPointer<LLInventoryItem> >& items = nc.getItems();
mEmbeddedItemList->addItems(items);
// Actually set the text
- if (mAllowEmbeddedItems)
+ if (allowsEmbeddedItems())
{
if (nc.getVersion() == 1)
setASCIIEmbeddedText( nc.getText() );
@@ -1514,7 +1516,7 @@ void LLViewerTextEditor::copyInventory(const LLInventoryItem* item, U32 callback
bool LLViewerTextEditor::hasEmbeddedInventory()
{
- return (!(mEmbeddedItemList->empty()));
+ return ! mEmbeddedItemList->empty();
}
////////////////////////////////////////////////////////////////////////////
@@ -1577,11 +1579,9 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF
font,
allow_embedded_items);
- BOOL ignore_tabs = text_editor->mTabToNextField;
+ BOOL ignore_tabs = text_editor->tabsToNextField();
node->getAttributeBOOL("ignore_tab", ignore_tabs);
-
- text_editor->setTabToNextField(ignore_tabs);
-
+ text_editor->setTabsToNextField(ignore_tabs);
text_editor->setTextEditorParameters(node);
@@ -1589,7 +1589,7 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF
node->getAttributeBOOL("hide_scrollbar",hide_scrollbar);
text_editor->setHideScrollbarForShortDocs(hide_scrollbar);
- BOOL hide_border = !text_editor->mBorder->getVisible();
+ BOOL hide_border = !text_editor->isBorderVisible();
node->getAttributeBOOL("hide_border", hide_border);
text_editor->setBorderVisible(!hide_border);
diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h
index 02d934fc3c..237c85ad53 100644
--- a/indra/newview/llviewertexteditor.h
+++ b/indra/newview/llviewertexteditor.h
@@ -1,6 +1,6 @@
/**
* @file llviewertexteditor.h
- * @brief Text editor widget to let users enter a a multi-line document//
+ * @brief Text editor widget to let users enter a multi-line document//
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -34,17 +34,12 @@
#include "lltexteditor.h"
-class LLInventoryItem;
-class LLEmbeddedItems;
-class LLEmbeddedNotecardOpener;
//
// Classes
//
class LLViewerTextEditor : public LLTextEditor
{
- friend class LLEmbeddedItems;
- friend class LLTextCmdInsertEmbeddedItem;
public:
LLViewerTextEditor(const LLString& name,
@@ -72,7 +67,7 @@ public:
BOOL drop, EDragAndDropType cargo_type,
void *cargo_data, EAcceptance *accept, LLString& tooltip_msg);
- const LLInventoryItem* getDragItem() { return mDragItem; }
+ const class LLInventoryItem* getDragItem() const { return mDragItem; }
virtual BOOL importBuffer(const LLString& buffer);
virtual bool importStream(std::istream& str);
virtual BOOL exportBuffer(LLString& buffer);
@@ -86,9 +81,9 @@ public:
void setEmbeddedText(const LLString& instr);
LLString getEmbeddedText();
+ // Appends Second Life time, small font, grey.
+ // If this starts a line, you need to prepend a newline.
LLString appendTime(bool prepend_newline);
- // Appends Second Life time, small font, grey
- // If this starts a line, you need to prepend a newline.
void copyInventory(const LLInventoryItem* item, U32 callback_id = 0);
@@ -99,13 +94,13 @@ public:
// rather than checking if a re-load is necessary. Phoenix 2007-02-27
bool hasEmbeddedInventory();
-protected:
+private:
// Embedded object operations
virtual llwchar pasteEmbeddedItem(llwchar ext_char);
- virtual void bindEmbeddedChars(const LLFontGL* font);
- virtual void unbindEmbeddedChars(const LLFontGL* font);
+ virtual void bindEmbeddedChars(LLFontGL* font) const;
+ virtual void unbindEmbeddedChars(LLFontGL* font) const;
- BOOL getEmbeddedItemToolTipAtPos(S32 pos, LLWString &wmsg);
+ BOOL getEmbeddedItemToolTipAtPos(S32 pos, LLWString &wmsg) const;
BOOL openEmbeddedItemAtPos( S32 pos );
BOOL openEmbeddedItem(LLInventoryItem* item);
@@ -121,17 +116,24 @@ protected:
static void onCopyToInvDialog( S32 option, void* userdata );
static void onNotecardDialog( S32 option, void* userdata );
-protected:
LLPointer<LLInventoryItem> mDragItem;
BOOL mDragItemSaved;
- LLEmbeddedItems* mEmbeddedItemList;
+ class LLEmbeddedItems* mEmbeddedItemList;
LLUUID mObjectID;
LLUUID mNotecardInventoryID;
- LLPointer<LLEmbeddedNotecardOpener> mInventoryCallback;
+ LLPointer<class LLEmbeddedNotecardOpener> mInventoryCallback;
+
+ // *TODO: Add right click menus for SLURLs
+ //LLHandle<LLView> mPopupMenuHandle;
+
+ //
+ // Inner classes
+ //
+
+ class LLTextCmdInsertEmbeddedItem;
- LLViewHandle mPopupMenuHandle;
};
#endif // LL_VIEWERTEXTEDITOR_H
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 95adf32ed5..5dcf4fdb5d 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -607,6 +607,8 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
x = llround((F32)x / mDisplayScale.mV[VX]);
y = llround((F32)y / mDisplayScale.mV[VY]);
+ LLView::sMouseHandlerMessage = "";
+
if (gDebugClicks)
{
llinfos << "ViewerWindow left mouse down at " << x << "," << y << llendl;
@@ -684,7 +686,6 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
if (LLView::sDebugMouseHandling)
{
llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl;
- LLView::sMouseHandlerMessage = "";
}
return TRUE;
}
@@ -720,6 +721,8 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma
x = llround((F32)x / mDisplayScale.mV[VX]);
y = llround((F32)y / mDisplayScale.mV[VY]);
+ LLView::sMouseHandlerMessage = "";
+
if (gDebugClicks)
{
llinfos << "ViewerWindow left mouse double-click at " << x << "," << y << llendl;
@@ -768,7 +771,6 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma
if (LLView::sDebugMouseHandling)
{
llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl;
- LLView::sMouseHandlerMessage = "";
}
return TRUE;
}
@@ -802,6 +804,8 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
x = llround((F32)x / mDisplayScale.mV[VX]);
y = llround((F32)y / mDisplayScale.mV[VY]);
+ LLView::sMouseHandlerMessage = "";
+
if (gDebugClicks)
{
llinfos << "ViewerWindow left mouse up" << llendl;
@@ -868,7 +872,6 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
if (handled)
{
llinfos << "Left Mouse Up" << LLView::sMouseHandlerMessage << llendl;
- LLView::sMouseHandlerMessage = "";
}
else
{
@@ -896,6 +899,8 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
x = llround((F32)x / mDisplayScale.mV[VX]);
y = llround((F32)y / mDisplayScale.mV[VY]);
+ LLView::sMouseHandlerMessage = "";
+
if (gDebugClicks)
{
llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl;
@@ -966,7 +971,6 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
if (LLView::sDebugMouseHandling)
{
llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl;
- LLView::sMouseHandlerMessage = "";
}
return TRUE;
}
@@ -1008,6 +1012,8 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
x = llround((F32)x / mDisplayScale.mV[VX]);
y = llround((F32)y / mDisplayScale.mV[VY]);
+ LLView::sMouseHandlerMessage = "";
+
// Don't care about caps lock for mouse events.
if (gDebugClicks)
{
@@ -1074,7 +1080,6 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
if (handled)
{
llinfos << "Right Mouse Up" << LLView::sMouseHandlerMessage << llendl;
- LLView::sMouseHandlerMessage = "";
}
else
{
@@ -2641,6 +2646,8 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask)
void LLViewerWindow::handleScrollWheel(S32 clicks)
{
+ LLView::sMouseHandlerMessage = "";
+
gMouseIdleTimer.reset();
// Hide tooltips
@@ -2677,7 +2684,6 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
if (LLView::sDebugMouseHandling)
{
llinfos << "Scroll Wheel" << LLView::sMouseHandlerMessage << llendl;
- LLView::sMouseHandlerMessage = "";
}
return;
}
@@ -2719,6 +2725,8 @@ BOOL LLViewerWindow::handlePerFrameHover()
{
static std::string last_handle_msg;
+ LLView::sMouseHandlerMessage = "";
+
//RN: fix for asynchronous notification of mouse leaving window not working
LLCoordWindow mouse_pos;
mWindow->getCursorPosition(&mouse_pos);
@@ -2776,23 +2784,23 @@ BOOL LLViewerWindow::handlePerFrameHover()
{
gFocusMgr.releaseFocusIfNeeded(cur_focus);
- LLView* parent = cur_focus->getParent();
- LLView* focus_root = cur_focus->findRootMostFocusRoot();
+ LLUICtrl* parent = cur_focus->getParentUICtrl();
+ const LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
while(parent)
{
if (parent->isCtrl() &&
- (((LLUICtrl*)parent)->hasTabStop() || parent == focus_root) &&
- !((LLUICtrl*)parent)->getIsChrome() &&
+ (parent->hasTabStop() || parent == focus_root) &&
+ !parent->getIsChrome() &&
parent->isInVisibleChain() &&
parent->isInEnabledChain())
{
if (!parent->focusFirstItem())
{
- ((LLUICtrl*)parent)->setFocus(TRUE);
+ parent->setFocus(TRUE);
}
break;
}
- parent = parent->getParent();
+ parent = parent->getParentUICtrl();
}
}
else if (cur_focus->isFocusRoot())
@@ -2854,7 +2862,6 @@ BOOL LLViewerWindow::handlePerFrameHover()
last_handle_msg = LLView::sMouseHandlerMessage;
llinfos << "Hover" << LLView::sMouseHandlerMessage << llendl;
}
- LLView::sMouseHandlerMessage = "";
handled = TRUE;
}
else if (LLView::sDebugMouseHandling)
@@ -3020,7 +3027,7 @@ BOOL LLViewerWindow::handlePerFrameHover()
}
// snap floaters to top of chat bar/button strip
- LLView* chatbar_and_buttons = gOverlayBar->getChildByName("chatbar_and_buttons", TRUE);
+ LLView* chatbar_and_buttons = gOverlayBar->getChild<LLView>("chatbar_and_buttons", TRUE);
if (chatbar_and_buttons)
{
// convert top/left corner of chatbar/buttons container to gFloaterView-relative coordinates
@@ -3048,9 +3055,9 @@ BOOL LLViewerWindow::handlePerFrameHover()
mLastMousePoint = mCurrentMousePoint;
// last ditch force of edit menu to selection manager
- if (gEditMenuHandler == NULL && gSelectMgr && gSelectMgr->getSelection()->getObjectCount())
+ if (LLEditMenuHandler::gEditMenuHandler == NULL && gSelectMgr && gSelectMgr->getSelection()->getObjectCount())
{
- gEditMenuHandler = gSelectMgr;
+ LLEditMenuHandler::gEditMenuHandler = gSelectMgr;
}
if (gFloaterView->getCycleMode())
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index b188c70b70..1abc1b165c 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -325,8 +325,8 @@ void LLWorldMapView::draw()
sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(0.1f));
sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(0.1f));
- const S32 width = mRect.getWidth();
- const S32 height = mRect.getHeight();
+ const S32 width = getRect().getWidth();
+ const S32 height = getRect().getHeight();
const S32 half_width = width / 2;
const S32 half_height = height / 2;
LLVector3d camera_global = gAgent.getCameraPositionGlobal();
@@ -990,8 +990,8 @@ void LLWorldMapView::drawFrustum()
F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 );
F32 half_width_pixels = half_width_meters * meters_to_pixels;
- F32 ctr_x = mRect.getWidth() * 0.5f + sPanX;
- F32 ctr_y = mRect.getHeight() * 0.5f + sPanY;
+ F32 ctr_x = getRect().getWidth() * 0.5f + sPanX;
+ F32 ctr_y = getRect().getHeight() * 0.5f + sPanY;
LLGLSNoTexture gls_no_texture;
@@ -1027,8 +1027,8 @@ LLVector3 LLWorldMapView::globalPosToView( const LLVector3d& global_pos )
// leave Z component in meters
- pos_local.mV[VX] += mRect.getWidth() / 2 + sPanX;
- pos_local.mV[VY] += mRect.getHeight() / 2 + sPanY;
+ pos_local.mV[VX] += getRect().getWidth() / 2 + sPanX;
+ pos_local.mV[VY] += getRect().getHeight() / 2 + sPanY;
return pos_local;
}
@@ -1048,13 +1048,13 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
if( x < 0
|| y < 0
- || x >= mRect.getWidth()
- || y >= mRect.getHeight() )
+ || x >= getRect().getWidth()
+ || y >= getRect().getHeight() )
{
if (draw_arrow)
{
- drawTrackingCircle( mRect, x, y, color, 3, 15 );
- drawTrackingArrow( mRect, x, y, color );
+ drawTrackingCircle( getRect(), x, y, color, 3, 15 );
+ drawTrackingArrow( getRect(), x, y, color );
text_x = sTrackingArrowX;
text_y = sTrackingArrowY;
}
@@ -1063,7 +1063,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
else if (LLTracker::getTrackingStatus() == LLTracker::TRACKING_LOCATION &&
LLTracker::getTrackedLocationType() != LLTracker::LOCATION_NOTHING)
{
- drawTrackingCircle( mRect, x, y, color, 3, 15 );
+ drawTrackingCircle( getRect(), x, y, color, 3, 15 );
}
else
{
@@ -1073,8 +1073,8 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
// clamp text position to on-screen
const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2;
S32 half_text_width = llfloor(font->getWidthF32(label) * 0.5f);
- text_x = llclamp(text_x, half_text_width + TEXT_PADDING, mRect.getWidth() - half_text_width - TEXT_PADDING);
- text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, mRect.getHeight() - llround(font->getLineHeight()) - TEXT_PADDING - vert_offset);
+ text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING);
+ text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - llround(font->getLineHeight()) - TEXT_PADDING - vert_offset);
if (label != "")
{
@@ -1102,8 +1102,8 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
// If you change this, then you need to change LLTracker::getTrackedPositionGlobal() as well
LLVector3d LLWorldMapView::viewPosToGlobal( S32 x, S32 y )
{
- x -= llfloor((mRect.getWidth() / 2 + sPanX));
- y -= llfloor((mRect.getHeight() / 2 + sPanY));
+ x -= llfloor((getRect().getWidth() / 2 + sPanX));
+ y -= llfloor((getRect().getHeight() / 2 + sPanY));
LLVector3 pos_local( (F32)x, (F32)y, 0.f );
@@ -1448,8 +1448,8 @@ void LLWorldMapView::setDirectionPos( LLTextBox* text_box, F32 rotation )
// Rotation of 0 means x = 1, y = 0 on the unit circle.
- F32 map_half_height = mRect.getHeight() * 0.5f;
- F32 map_half_width = mRect.getWidth() * 0.5f;
+ F32 map_half_height = getRect().getHeight() * 0.5f;
+ F32 map_half_width = getRect().getWidth() * 0.5f;
F32 text_half_height = text_box->getRect().getHeight() * 0.5f;
F32 text_half_width = text_box->getRect().getWidth() * 0.5f;
F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width );
@@ -1462,8 +1462,8 @@ void LLWorldMapView::setDirectionPos( LLTextBox* text_box, F32 rotation )
void LLWorldMapView::updateDirections()
{
- S32 width = mRect.getWidth();
- S32 height = mRect.getHeight();
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
S32 text_height = mTextBoxNorth->getRect().getHeight();
S32 text_width = mTextBoxNorth->getRect().getWidth();
@@ -1695,7 +1695,7 @@ BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask )
S32 local_x, local_y;
local_x = mMouseDownX + llfloor(sPanX - mMouseDownPanX);
local_y = mMouseDownY + llfloor(sPanY - mMouseDownPanY);
- LLRect clip_rect = mRect;
+ LLRect clip_rect = getRect();
clip_rect.stretch(-8);
clip_rect.clipPointToRect(mMouseDownX, mMouseDownY, local_x, local_y);
LLUI::setCursorPositionLocal(this, local_x, local_y);