Merge branch 'Moap' of git://github.com/Shyotl/SingularityViewer into VoiceUpdate

Conflicts:
	indra/newview/llfloateractivespeakers.h - llparticipantlist.h got changed from a panel to a layoutpanel
	indra/newview/lloverlaybar.cpp - Silly conflict, I change one line, Shyotl changes the next two.

Compile fixies:
	indra/newview/llavataractions.cpp needed to include llnotifications.h
	indra/newview/llvoicechannel.cpp needed to include llnotifications.h
This commit is contained in:
Lirusaito
2013-06-23 22:36:04 -04:00
parent 498b63be99
commit 3739639295
177 changed files with 9426 additions and 1650 deletions

View File

@@ -544,7 +544,7 @@ void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height)
// virtual
void LLButton::draw()
{
F32 alpha = mAlpha;
F32 alpha = mAlpha * getDrawContext().mAlpha;
bool flash = FALSE;
if( mFlashing )
{

View File

@@ -307,9 +307,6 @@ LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const
// static
LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("checkbox");
node->getAttributeString("name", name);
std::string label("");
node->getAttributeString("label", label);
@@ -326,7 +323,7 @@ LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
LLRect rect;
createRect(node, rect, parent, LLRect());
LLCheckBoxCtrl* checkbox = new LLCheckboxCtrl(name,
LLCheckBoxCtrl* checkbox = new LLCheckboxCtrl("checkbox",
rect,
label,
font,

View File

@@ -149,9 +149,6 @@ LLXMLNodePtr LLComboBox::getXML(bool save_children) const
// static
LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("combo_box");
node->getAttributeString("name", name);
std::string label("");
node->getAttributeString("label", label);
@@ -164,7 +161,7 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
S32 max_chars = 20;
node->getAttributeS32("max_chars", max_chars);
LLComboBox* combo_box = new LLComboBox(name,
LLComboBox* combo_box = new LLComboBox("combo_box",
rect,
label);
combo_box->setAllowTextEntry(allow_text_entry, max_chars);
@@ -1245,16 +1242,13 @@ LLXMLNodePtr LLFlyoutButton::getXML(bool save_children) const
//static
LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name = "flyout_button";
node->getAttributeString("name", name);
std::string label("");
node->getAttributeString("label", label);
LLRect rect;
createRect(node, rect, parent, LLRect());
LLFlyoutButton* flyout_button = new LLFlyoutButton(name,
LLFlyoutButton* flyout_button = new LLFlyoutButton("flyout_button",
rect,
label);

View File

@@ -52,9 +52,6 @@ void LLFilterEditor::handleKeystroke()
// static
LLView* LLFilterEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("filter_editor");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
@@ -63,7 +60,7 @@ LLView* LLFilterEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
std::string text = node->getValue().substr(0, max_text_length - 1);
LLFilterEditor* search_editor = new LLFilterEditor(name,
LLFilterEditor* search_editor = new LLFilterEditor("filter_editor",
rect,
max_text_length);

View File

@@ -58,6 +58,7 @@
#include "v2math.h"
#include "llfasttimer.h"
#include "airecursive.h"
#include "llnotifications.h"
const S32 MINIMIZED_WIDTH = 160;
const S32 CLOSE_BOX_FROM_TOP = 1;
@@ -1411,6 +1412,10 @@ void LLFloater::closeFocusedFloater()
}
}
LLNotificationPtr LLFloater::addContextualNotification(const std::string& name, const LLSD& substitutions)
{
return LLNotifications::instance().add(LLNotification::Params(name).context(mNotificationContext).substitutions(substitutions));
}
void LLFloater::onClickClose()
{

View File

@@ -40,7 +40,8 @@
#include "llpanel.h"
#include "lluuid.h"
#include "lltabcontainer.h"
#include "llnotifications.h"
#include "llnotificationcontext.h"
#include "llnotificationptr.h"
#include <set>
class LLDragHandle;
@@ -232,10 +233,7 @@ public:
// handle refocusing.
static void closeFocusedFloater();
LLNotification::Params contextualNotification(const std::string& name)
{
return LLNotification::Params(name).context(mNotificationContext);
}
LLNotificationPtr addContextualNotification(const std::string& name, const LLSD& substitutions = LLSD());
void onClickClose();
void onClickMinimize();

View File

@@ -106,7 +106,8 @@ void LLIconCtrl::draw()
{
if( mImagep.notNull() )
{
mImagep->draw(getLocalRect(), mColor );
const F32 alpha = getDrawContext().mAlpha;
mImagep->draw(getLocalRect(), mColor % alpha );
}
LLUICtrl::draw();
@@ -157,9 +158,6 @@ LLXMLNodePtr LLIconCtrl::getXML(bool save_children) const
LLView* LLIconCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("icon");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
@@ -172,7 +170,7 @@ LLView* LLIconCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
LLColor4 color(LLColor4::white);
LLUICtrlFactory::getAttributeColor(node,"color", color);
LLIconCtrl* icon = new LLIconCtrl(name, rect, image_name);
LLIconCtrl* icon = new LLIconCtrl("icon", rect, image_name);
icon->setColor(color);

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,7 @@
#define LL_LLLAYOUTSTACK_H
#include "llpanel.h"
#include "llresizebar.h"
class LLLayoutPanel;
@@ -41,73 +42,138 @@ public:
{
HORIZONTAL,
VERTICAL
} eLayoutOrientation;
} ELayoutOrientation;
LLLayoutStack(eLayoutOrientation orientation);
LLLayoutStack(ELayoutOrientation orientation, S32 border_size, bool animate, bool clip, F32 open_time_constant, F32 close_time_constant, F32 resize_bar_overlap);
virtual ~LLLayoutStack();
/*virtual*/ void draw();
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
/*virtual*/ void removeChild(LLView* ctrl);
/*virtual*/ void removeChild(LLView*);
/*virtual*/ BOOL postBuild();
/*virtual*/ bool addChild(LLView* child, S32 tab_groupdatefractuiona = 0);
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
S32 getMinWidth() const { return mMinWidth; }
S32 getMinHeight() const { return mMinHeight; }
typedef enum e_animate
{
NO_ANIMATE,
ANIMATE
} EAnimate;
void addPanel(LLPanel* panel, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize, EAnimate animate = NO_ANIMATE, S32 index = S32_MAX);
void removePanel(LLPanel* panel);
void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE);
void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE);
S32 getNumPanels() { return mPanels.size(); }
void updateLayout(BOOL force_resize = FALSE);
void updateLayout();
S32 getPanelSpacing() const { return mPanelSpacing; }
private:
void calcMinExtents();
S32 getDefaultHeight(S32 cur_height);
S32 getDefaultWidth(S32 cur_width);
static void updateClass();
const eLayoutOrientation mOrientation;
protected:
LLLayoutStack(const Params&);
friend class LLUICtrlFactory;
friend class LLLayoutPanel;
private:
void updateResizeBarLimits();
bool animatePanels();
void createResizeBar(LLLayoutPanel* panel);
const ELayoutOrientation mOrientation;
typedef std::vector<LLLayoutPanel*> e_panel_list_t;
e_panel_list_t mPanels;
LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const;
S32 mMinWidth;
S32 mMinHeight;
LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const;
LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const;
void updateFractionalSizes();
void normalizeFractionalSizes();
void updatePanelRect( LLLayoutPanel* param1, const LLRect& new_rect );
S32 mPanelSpacing;
// true if we already applied animation this frame
bool mAnimatedThisFrame;
bool mAnimate;
bool mClip;
F32 mOpenTimeConstant;
F32 mCloseTimeConstant;
bool mNeedsLayout;
S32 mResizeBarOverlap;
}; // end class LLLayoutStack
class LLLayoutPanel
{
friend class LLLayoutStack;
friend class LLUICtrlFactory;
friend struct DeletePointer;
LLLayoutPanel(LLPanel* panelp, LLLayoutStack::eLayoutOrientation orientation, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize);
class LLLayoutPanel : public LLPanel
{
friend class LLLayoutStack;
friend class LLUICtrlFactory;
public:
~LLLayoutPanel();
F32 getCollapseFactor();
LLPanel* mPanel;
S32 mMinWidth;
S32 mMinHeight;
bool mAutoResize;
bool mUserResize;
bool mCollapsed;
void initFromParams(const Params& p);
static LLView* fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *factory);
void handleReshape(const LLRect& new_rect, bool by_user);
F32 mVisibleAmt;
F32 mCollapseAmt;
LLLayoutStack::eLayoutOrientation mOrientation;
void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
void setVisible(BOOL visible);
S32 getLayoutDim() const;
S32 getTargetDim() const;
void setTargetDim(S32 value);
S32 getMinDim() const { return llmax(0, mMinDim); }
void setMinDim(S32 value) { mMinDim = value; }
S32 getExpandedMinDim() const { return mExpandedMinDim >= 0 ? mExpandedMinDim : getMinDim(); }
void setExpandedMinDim(S32 value) { mExpandedMinDim = value; }
S32 getRelevantMinDim() const
{
S32 min_dim = mMinDim;
if (!mCollapsed)
{
min_dim = getExpandedMinDim();
}
return min_dim;
}
F32 getAutoResizeFactor() const;
F32 getVisibleAmount() const;
S32 getVisibleDim() const;
LLResizeBar* getResizeBar() { return mResizeBar; }
bool isCollapsed() const { return mCollapsed;}
void setOrientation(LLLayoutStack::ELayoutOrientation orientation);
void storeOriginalDim();
void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; }
protected:
LLLayoutPanel(S32 min_dim=-1, BOOL auto_resize=TRUE, BOOL user_resize=TRUE, LLRect rect = LLRect());
/*virtual*/ BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
bool mAutoResize;
bool mUserResize;
S32 mExpandedMinDim;
S32 mMinDim;
bool mCollapsed;
F32 mVisibleAmt;
F32 mCollapseAmt;
F32 mFractionalSize;
S32 mTargetDim;
bool mIgnoreReshape;
LLLayoutStack::ELayoutOrientation mOrientation;
class LLResizeBar* mResizeBar;
};
#endif //LL_LLLAYOUTSTACK_H
#endif

View File

@@ -1702,6 +1702,7 @@ void LLLineEditor::drawMisspelled(LLRect background)
if (glggHunSpell->getSpellCheckHighlight())
{
F32 alpha = getDrawContext().mAlpha;
for (int i =0; i<(int)misspellLocations.size(); i++)
{
S32 wstart =findPixelNearestPos( misspellLocations[i]-getCursor());
@@ -1716,7 +1717,7 @@ void LLLineEditor::drawMisspelled(LLRect background)
{
wstart = maxw;
}
gGL.color4ub(255,0,0,200);
gGL.color4ub(255,0,0,200*alpha);
//3 line zig zags..
while (wstart < wend)
{
@@ -1733,6 +1734,7 @@ void LLLineEditor::drawMisspelled(LLRect background)
void LLLineEditor::draw()
{
F32 alpha = getDrawContext().mAlpha;
S32 text_len = mText.length();
std::string saved_text;
@@ -1776,7 +1778,7 @@ void LLLineEditor::draw()
bg_color = mWriteableBgColor;
}
}
gl_rect_2d(background, bg_color);
gl_rect_2d(background, bg_color % alpha);
}
#endif
@@ -1801,7 +1803,9 @@ void LLLineEditor::draw()
{
text_color = mReadOnlyFgColor;
}
LLColor4 label_color = mTentativeFgColor;
text_color %= alpha;
LLColor4 label_color = mTentativeFgColor % alpha;
if (hasPreeditString())
{
@@ -1824,7 +1828,7 @@ void LLLineEditor::draw()
background.mBottom + PREEDIT_STANDOUT_POSITION,
preedit_pixels_right - PREEDIT_STANDOUT_GAP - 1,
background.mBottom + PREEDIT_STANDOUT_POSITION - PREEDIT_STANDOUT_THICKNESS,
(text_color * PREEDIT_STANDOUT_BRIGHTNESS + bg_color * (1 - PREEDIT_STANDOUT_BRIGHTNESS)).setAlpha(1.0f));
(text_color * PREEDIT_STANDOUT_BRIGHTNESS + bg_color * (1 - PREEDIT_STANDOUT_BRIGHTNESS)).setAlpha(alpha));
}
else
{
@@ -1832,7 +1836,7 @@ void LLLineEditor::draw()
background.mBottom + PREEDIT_MARKER_POSITION,
preedit_pixels_right - PREEDIT_MARKER_GAP - 1,
background.mBottom + PREEDIT_MARKER_POSITION - PREEDIT_MARKER_THICKNESS,
(text_color * PREEDIT_MARKER_BRIGHTNESS + bg_color * (1 - PREEDIT_MARKER_BRIGHTNESS)).setAlpha(1.0f));
(text_color * PREEDIT_MARKER_BRIGHTNESS + bg_color * (1 - PREEDIT_MARKER_BRIGHTNESS)).setAlpha(alpha));
}
}
}
@@ -1874,7 +1878,7 @@ void LLLineEditor::draw()
if( (rendered_pixels_right < (F32)mMaxHPixels) && (rendered_text < text_len) )
{
LLColor4 color(1.f - bg_color.mV[0], 1.f - bg_color.mV[1], 1.f - bg_color.mV[2], 1.f);
LLColor4 color(1.f - bg_color.mV[0], 1.f - bg_color.mV[1], 1.f - bg_color.mV[2], alpha );
// selected middle
S32 width = mGLFont->getWidth(mText.getWString().c_str(), mScrollHPos + rendered_text, select_right - mScrollHPos - rendered_text);
width = llmin(width, mMaxHPixels - llround(rendered_pixels_right));
@@ -1883,7 +1887,7 @@ void LLLineEditor::draw()
rendered_text += mGLFont->render(
mText, mScrollHPos + rendered_text,
rendered_pixels_right, text_bottom,
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], 1 ),
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha ),
LLFontGL::LEFT, LLFontGL::BOTTOM,
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
@@ -1953,7 +1957,7 @@ void LLLineEditor::draw()
if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection())
{
mGLFont->render(mText, getCursor(), (F32)(cursor_left + UI_LINEEDITOR_CURSOR_THICKNESS / 2), text_bottom,
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], 1 ),
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha ),
LLFontGL::LEFT, LLFontGL::BOTTOM,
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
@@ -2551,9 +2555,6 @@ LLXMLNodePtr LLLineEditor::getXML(bool save_children) const
// static
LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("line_editor");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
@@ -2580,7 +2581,7 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
S32 border_thickness = 1;
node->getAttributeS32("border_thickness", border_thickness);
LLLineEditor* line_editor = new LLLineEditor(name,
LLLineEditor* line_editor = new LLLineEditor("line_editor",
rect,
text,
font,

View File

@@ -1928,6 +1928,7 @@ LLXMLNodePtr LLMenuGL::getXML(bool save_children) const
void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory *factory)
{
std::string name(child->getName()->mString);
if (child->hasName(LL_MENU_GL_TAG))
{
// SUBMENU
@@ -2025,7 +2026,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
for (call_child = child->getFirstChild(); call_child.notNull(); call_child = call_child->getNextSibling())
{
if (call_child->hasName("on_check"))
if (call_child->hasName("on_check") || call_child->hasName(name+".on_check"))
{
std::string callback_name;
std::string control_name;
@@ -2083,7 +2084,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
for (call_child = child->getFirstChild(); call_child.notNull(); call_child = call_child->getNextSibling())
{
if (call_child->hasName("on_click"))
if (call_child->hasName("on_click") || call_child->hasName(name+".on_click"))
{
std::string callback_name;
call_child->getAttributeString("function", callback_name);
@@ -2104,7 +2105,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
new_item->addListener(callback, "on_click", callback_data);
}
if (call_child->hasName("on_enable"))
if (call_child->hasName("on_enable") || call_child->hasName(name+".on_enable"))
{
std::string callback_name;
std::string control_name;
@@ -2148,7 +2149,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
}
new_item->setEnabledControl(control_name, parent);
}
if (call_child->hasName("on_visible"))
if (call_child->hasName("on_visible") || call_child->hasName(name+".on_visible"))
{
std::string callback_name;
std::string control_name;
@@ -2322,7 +2323,7 @@ LLView* LLMenuGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
++token_count;
}
BOOL opaque = FALSE;
BOOL opaque = TRUE;
node->getAttributeBOOL("opaque", opaque);
LLMenuGL *menu = new LLMenuGL(name, new_menu_label);
@@ -4150,13 +4151,10 @@ LLXMLNodePtr LLMenuBarGL::getXML(bool save_children) const
LLView* LLMenuBarGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("menu");
node->getAttributeString("name", name);
BOOL opaque = FALSE;
node->getAttributeBOOL("opaque", opaque);
LLMenuBarGL *menubar = new LLMenuBarGL(name);
LLMenuBarGL *menubar = new LLMenuBarGL("menu");
LLHandle<LLFloater> parent_handle;
LLFloater* parent_floater = dynamic_cast<LLFloater*>(parent);

View File

@@ -624,9 +624,6 @@ LLXMLNodePtr LLMultiSlider::getXML(bool save_children) const
//static
LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("multi_slider_bar");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
@@ -654,7 +651,7 @@ LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor
BOOL use_triangle = FALSE;
node->getAttributeBOOL("use_triangle", use_triangle);
LLMultiSlider* multiSlider = new LLMultiSlider(name,
LLMultiSlider* multiSlider = new LLMultiSlider("multi_slider_bar",
rect,
NULL,
initial_value,

View File

@@ -472,9 +472,6 @@ LLXMLNodePtr LLMultiSliderCtrl::getXML(bool save_children) const
LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("multi_slider");
node->getAttributeString("name", name);
std::string label;
node->getAttributeString("label", label);
@@ -558,7 +555,7 @@ LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa
label.assign(node->getTextContents());
}
LLMultiSliderCtrl* slider = new LLMultiSliderCtrl(name,
LLMultiSliderCtrl* slider = new LLMultiSliderCtrl("multi_slider",
rect,
label,
font,

View File

@@ -0,0 +1,59 @@
/**
* @file llnotifications.h
* @brief Notification context class, pulled out of llnotifications.h to avoid including said file in llfloater.h. (Needed, as llnotifications.h includes llevents.h, which causes issues)
* @author Q (with assistance from Richard and Coco)
*
* $LicenseInfo:firstyear=2008&license=viewergpl$
*
* Copyright (c) 2008-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LL_LLNOTIFICATION_CONTEX
#define LL_LLNOTIFICATION_CONTEX
// context data that can be looked up via a notification's payload by the display logic
// derive from this class to implement specific contexts
class LLNotificationContext : public LLInstanceTracker<LLNotificationContext, LLUUID>
{
public:
LLNotificationContext() : LLInstanceTracker<LLNotificationContext, LLUUID>(LLUUID::generateNewID())
{
}
virtual ~LLNotificationContext() {}
LLSD asLLSD() const
{
return getKey();
}
private:
};
#endif //LL_LLNOTIFICATION_CONTEX

View File

@@ -106,6 +106,7 @@
#include "llui.h"
#include "llxmlnode.h"
#include "llnotificationptr.h"
#include "llnotificationcontext.h"
typedef enum e_notification_priority
{
@@ -121,26 +122,6 @@ typedef boost::function<void (const LLSD&, const LLSD&)> LLNotificationResponder
typedef LLFunctorRegistry<LLNotificationResponder> LLNotificationFunctorRegistry;
typedef LLFunctorRegistration<LLNotificationResponder> LLNotificationFunctorRegistration;
// context data that can be looked up via a notification's payload by the display logic
// derive from this class to implement specific contexts
class LLNotificationContext : public LLInstanceTracker<LLNotificationContext, LLUUID>
{
public:
LLNotificationContext() : LLInstanceTracker<LLNotificationContext, LLUUID>(LLUUID::generateNewID())
{
}
virtual ~LLNotificationContext() {}
LLSD asLLSD() const
{
return getKey();
}
private:
};
// Contains notification form data, such as buttons and text fields along with
// manipulator functions
class LLNotificationForm

View File

@@ -58,6 +58,8 @@
#include "llnotificationsutil.h"
#include "llfasttimer.h"
#include "llnotifications.h"
// LLLayoutStack
#include "llresizebar.h"
#include "llcriticaldamp.h"

View File

@@ -142,7 +142,7 @@ public:
CommitCallbackRegistry::ScopedRegistrar& getCommitCallbackRegistrar() { return mCommitCallbackRegistrar; }
EnableCallbackRegistry::ScopedRegistrar& getEnableCallbackRegistrar() { return mEnableCallbackRegistrar; }
BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
virtual BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory);
void setPanelParameters(LLXMLNodePtr node, LLView *parentp);

View File

@@ -352,9 +352,6 @@ LLXMLNodePtr LLRadioGroup::getXML(bool save_children) const
// static
LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("radio_group");
node->getAttributeString("name", name);
U32 initial_value = 0;
node->getAttributeU32("initial_value", initial_value);
@@ -364,7 +361,7 @@ LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
LLRect rect;
createRect(node, rect, parent, LLRect());
LLRadioGroup* radio_group = new LLRadioGroup(name,
LLRadioGroup* radio_group = new LLRadioGroup("radio_group",
rect,
initial_value,
NULL,
@@ -408,10 +405,8 @@ LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
LLRect item_rect;
createRect(child, item_rect, radio_group, rect);
std::string radioname("radio");
child->getAttributeString("name", radioname);
std::string item_label = child->getTextContents();
LLRadioCtrl* radio = radio_group->addRadioButton(radioname, item_label, item_rect, font);
LLRadioCtrl* radio = radio_group->addRadioButton("radio", item_label, item_rect, font);
radio->initFromXML(child, radio_group);
}

View File

@@ -152,13 +152,10 @@ LLXMLNodePtr LLScrollingPanelList::getXML(bool save_children) const
// static
LLView* LLScrollingPanelList::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("scrolling_panel_list");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
LLScrollingPanelList* scrolling_panel_list = new LLScrollingPanelList(name, rect);
LLScrollingPanelList* scrolling_panel_list = new LLScrollingPanelList("scrolling_panel_list", rect);
scrolling_panel_list->initFromXML(node, parent);
return scrolling_panel_list;
}

View File

@@ -3104,9 +3104,6 @@ void LLScrollListCtrl::setScrollListParameters(LLXMLNodePtr node)
// static
LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("scroll_list");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
@@ -3132,7 +3129,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
node->getAttributeBOOL("mouse_wheel_opaque", mouse_wheel_opaque);
LLScrollListCtrl* scroll_list = new LLScrollListCtrl(
name,
"scroll_list",
rect,
NULL,
multi_select,

View File

@@ -147,9 +147,6 @@ void LLSearchEditor::handleKeystroke()
// static
LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("search_editor");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
@@ -158,7 +155,7 @@ LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
std::string text = node->getValue().substr(0, max_text_length - 1);
LLSearchEditor* search_editor = new LLSearchEditor(name,
LLSearchEditor* search_editor = new LLSearchEditor("search_editor",
rect,
max_text_length);

View File

@@ -250,6 +250,8 @@ BOOL LLSlider::handleKeyHere(KEY key, MASK mask)
void LLSlider::draw()
{
F32 alpha = getDrawContext().mAlpha;
// since thumb image might still be decoding, need thumb to accomodate image size
updateThumbRect();
@@ -258,31 +260,47 @@ void LLSlider::draw()
// drawing solids requires texturing be disabled
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
F32 opacity = getEnabled() ? 1.f : 0.3f;
LLColor4 center_color = (mThumbCenterColor % opacity);
// Track
LLRect track_rect(mThumbImage->getWidth() / 2,
getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2),
getRect().getWidth() - mThumbImage->getWidth() / 2,
getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) );
LLRect highlight_rect(track_rect.mLeft, track_rect.mTop, mThumbRect.getCenterX(), track_rect.mBottom);
mTrackImage->draw(track_rect);
mTrackHighlightImage->draw(highlight_rect);
mTrackImage->draw(track_rect, LLColor4::white % alpha);
mTrackHighlightImage->draw(highlight_rect, LLColor4::white % alpha);
// Thumb
if( hasMouseCapture() )
{
// Show ghost where thumb was before dragging began.
mThumbImage->draw(mDragStartThumbRect, mThumbCenterColor % 0.3f);
}
if (hasFocus())
{
// Draw focus highlighting.
mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor() % alpha, gFocusMgr.getFocusFlashWidth());
}
if( hasMouseCapture() )
{
// Show ghost where thumb was before dragging began.
if (mThumbImage.notNull())
{
mThumbImage->draw(mDragStartThumbRect, mThumbCenterColor % (0.3f * alpha));
mThumbImage->draw(mThumbRect, mThumbOutlineColor % alpha);
}
}
else if(!getEnabled())
{
if (mThumbImage.notNull())
{
mThumbImage->draw(mThumbRect, mThumbCenterColor % (0.3f * alpha));
}
}
else
{
if (mThumbImage.notNull())
{
mThumbImage->draw(mThumbRect, mThumbCenterColor % alpha);
}
}
// Fill in the thumb.
mThumbImage->draw(mThumbRect, hasMouseCapture() ? mThumbOutlineColor : center_color);
LLUICtrl::draw();
}
@@ -325,9 +343,6 @@ boost::signals2::connection LLSlider::setMouseUpCallback( const commit_signal_t:
//static
LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory)
{
std::string name("slider_bar");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
@@ -346,7 +361,7 @@ LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFacto
BOOL volume = node->hasName("volume_slider") ? TRUE : FALSE;
node->getAttributeBOOL("volume", volume);
LLSlider* slider = new LLSlider(name,
LLSlider* slider = new LLSlider("slider_bar",
rect,
NULL,
initial_value,

View File

@@ -96,9 +96,9 @@ private:
S32 mMouseOffset;
LLRect mDragStartThumbRect;
LLUIImage* mThumbImage;
LLUIImage* mTrackImage;
LLUIImage* mTrackHighlightImage;
LLPointer<LLUIImage> mThumbImage;
LLPointer<LLUIImage> mTrackImage;
LLPointer<LLUIImage> mTrackHighlightImage;
LLRect mThumbRect;
LLColor4 mTrackColor;

View File

@@ -403,9 +403,6 @@ LLXMLNodePtr LLSliderCtrl::getXML(bool save_children) const
LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("slider");
node->getAttributeString("name", name);
std::string label;
node->getAttributeString("label", label);
@@ -480,7 +477,7 @@ LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
label.assign(node->getTextContents());
}
LLSliderCtrl* slider = new LLSliderCtrl(name,
LLSliderCtrl* slider = new LLSliderCtrl("slider",
rect,
label,
font,

View File

@@ -519,9 +519,6 @@ LLXMLNodePtr LLSpinCtrl::getXML(bool save_children) const
LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("spinner");
node->getAttributeString("name", name);
std::string label;
node->getAttributeString("label", label);
@@ -556,7 +553,7 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
label.assign( node->getValue() );
}
LLSpinCtrl* spinner = new LLSpinCtrl(name,
LLSpinCtrl* spinner = new LLSpinCtrl("spinner",
rect,
label,
font,

View File

@@ -197,12 +197,16 @@ void LLTextBox::setWrappedText(const LLStringExplicit& in_text, F32 max_width)
{
max_width = (F32)getRect().getWidth();
}
if(max_width <= 0.0f)
{
return; //It makes no sense to try to wrap text to fit zero-width columns. (In fact, it causes infinite recursion in the following while loop!)
}
LLWString wtext = utf8str_to_wstring(in_text);
LLWString final_wtext;
LLWString::size_type cur = 0;;
LLWString::size_type len = wtext.size();
LLWString::size_type len = wtext.length();
while (cur < len)
{
@@ -282,6 +286,7 @@ BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text
void LLTextBox::draw()
{
F32 alpha = getDrawContext().mAlpha;
if (mBorderVisible)
{
gl_rect_2d_offset_local(getLocalRect(), 2, FALSE);
@@ -292,12 +297,12 @@ 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, getRect().getHeight(), getRect().getWidth(), 0,
color_drop_shadow, drop_shadow_tooltip);
color_drop_shadow % alpha, drop_shadow_tooltip);
}
if (mBackgroundVisible)
{
gl_rect_2d( getLocalRect(), mBackgroundColor );
gl_rect_2d( getLocalRect(), mBackgroundColor % alpha );
}
S32 text_x = 0;
@@ -320,16 +325,16 @@ void LLTextBox::draw()
{
if(mHasHover)
{
drawText( text_x, text_y, mHoverColor );
drawText( text_x, text_y, mHoverColor % alpha );
}
else
{
drawText( text_x, text_y, mTextColor );
drawText( text_x, text_y, mTextColor % alpha );
}
}
else
{
drawText( text_x, text_y, mDisabledColor );
drawText( text_x, text_y, mDisabledColor % alpha );
}
if (sDebugRects)
@@ -382,6 +387,69 @@ void LLTextBox::reshapeToFitText()
reshape( width + 2 * mHPad, height + 2 * mVPad );
}
// virtual
void LLTextBox::initFromXML(LLXMLNodePtr node, LLView* parent)
{
LLUICtrl::initFromXML(node, parent);
LLFontGL* font = LLView::selectFont(node);
if(font)
mFontGL = font;
setText(node->getTextContents());
LLFontGL::HAlign halign = LLView::selectFontHAlign(node);
setHAlign(halign);
node->getAttributeS32("line_spacing", mLineSpacing);
std::string font_style;
if (node->getAttributeString("font-style", font_style))
{
mFontStyle = LLFontGL::getStyleFromString(font_style);
}
if (node->getAttributeString("font-shadow", font_style))
{
if(font_style == "soft")
mFontShadow = LLFontGL::DROP_SHADOW_SOFT;
else if(font_style == "hard")
mFontShadow = LLFontGL::DROP_SHADOW;
else
mFontShadow = LLFontGL::NO_SHADOW;
}
BOOL mouse_opaque = getMouseOpaque();
if (node->getAttributeBOOL("mouse_opaque", mouse_opaque))
{
setMouseOpaque(mouse_opaque);
}
if(node->hasAttribute("text_color"))
{
LLColor4 color;
LLUICtrlFactory::getAttributeColor(node, "text_color", color);
setColor(color);
}
if(node->hasAttribute("hover_color"))
{
LLColor4 color;
LLUICtrlFactory::getAttributeColor(node, "hover_color", color);
setHoverColor(color);
setHoverActive(true);
}
BOOL hover_active = FALSE;
if(node->getAttributeBOOL("hover", hover_active))
{
setHoverActive(hover_active);
}
node->getAttributeBOOL("use_ellipses", mUseEllipses);
}
// virtual
LLXMLNodePtr LLTextBox::getXML(bool save_children) const
{
@@ -411,68 +479,8 @@ LLXMLNodePtr LLTextBox::getXML(bool save_children) const
// static
LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("text_box");
node->getAttributeString("name", name);
LLFontGL* font = LLView::selectFont(node);
std::string text = node->getTextContents();
LLTextBox* text_box = new LLTextBox(name,
LLRect(),
text,
font,
FALSE);
LLFontGL::HAlign halign = LLView::selectFontHAlign(node);
text_box->setHAlign(halign);
LLTextBox* text_box = new LLTextBox("text_box", LLRect(), "" , NULL, FALSE);
text_box->initFromXML(node, parent);
node->getAttributeS32("line_spacing", text_box->mLineSpacing);
std::string font_style;
if (node->getAttributeString("font-style", font_style))
{
text_box->mFontStyle = LLFontGL::getStyleFromString(font_style);
}
if (node->getAttributeString("font-shadow", font_style))
{
if(font_style == "soft")
text_box->mFontShadow = LLFontGL::DROP_SHADOW_SOFT;
else if(font_style == "hard")
text_box->mFontShadow = LLFontGL::DROP_SHADOW;
else
text_box->mFontShadow = LLFontGL::NO_SHADOW;
}
BOOL mouse_opaque = text_box->getMouseOpaque();
if (node->getAttributeBOOL("mouse_opaque", mouse_opaque))
{
text_box->setMouseOpaque(mouse_opaque);
}
if(node->hasAttribute("text_color"))
{
LLColor4 color;
LLUICtrlFactory::getAttributeColor(node, "text_color", color);
text_box->setColor(color);
}
if(node->hasAttribute("hover_color"))
{
LLColor4 color;
LLUICtrlFactory::getAttributeColor(node, "hover_color", color);
text_box->setHoverColor(color);
text_box->setHoverActive(true);
}
BOOL hover_active = FALSE;
if(node->getAttributeBOOL("hover", hover_active))
{
text_box->setHoverActive(hover_active);
}
return text_box;
}

View File

@@ -63,6 +63,7 @@ public:
virtual ~LLTextBox() {}
virtual void initFromXML(LLXMLNodePtr node, LLView* parent);
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);

View File

@@ -4748,9 +4748,6 @@ LLXMLNodePtr LLTextEditor::getXML(bool save_children) const
// static
LLView* LLTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("text_editor");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
@@ -4764,7 +4761,7 @@ LLView* LLTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
std::string text = node->getTextContents().substr(0, max_text_length - 1);
LLTextEditor* text_editor = new LLTextEditor(name,
LLTextEditor* text_editor = new LLTextEditor("text_editor",
rect,
max_text_length,
text,

View File

@@ -48,6 +48,8 @@ LLUICtrl::LLUICtrl() :
mCommitCallback(NULL),
mValidateCallback(NULL),
mCallbackUserData(NULL),
mMouseEnterSignal(NULL),
mMouseLeaveSignal(NULL),
mTentative(FALSE),
mTabStop(TRUE),
mIsChrome(FALSE)
@@ -66,6 +68,8 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque
mViewModel(LLViewModelPtr(new LLViewModel)),
mValidateCallback( NULL ),
mCallbackUserData( NULL ),
mMouseEnterSignal(NULL),
mMouseLeaveSignal(NULL),
mTentative( FALSE ),
mTabStop( TRUE ),
mIsChrome(FALSE)
@@ -88,6 +92,25 @@ LLUICtrl::~LLUICtrl()
delete mValidateSignal;
}
// virtual
void LLUICtrl::onMouseEnter(S32 x, S32 y, MASK mask)
{
if (mMouseEnterSignal)
{
(*mMouseEnterSignal)(this, getValue());
}
}
// virtual
void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask)
{
if(mMouseLeaveSignal)
{
(*mMouseLeaveSignal)(this, getValue());
}
}
void LLUICtrl::onCommit()
{
if( mCommitCallback )
@@ -462,6 +485,10 @@ BOOL LLUICtrl::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect
void LLUICtrl::initFromXML(LLXMLNodePtr node, LLView* parent)
{
std::string name;
if(node->getAttributeString("name", name))
setName(name);
BOOL has_tab_stop = hasTabStop();
node->getAttributeBOOL("tab_stop", has_tab_stop);
@@ -470,20 +497,36 @@ void LLUICtrl::initFromXML(LLXMLNodePtr node, LLView* parent)
std::string str = node->getName()->mString;
std::string attrib_str;
LLXMLNodePtr child_node;
if(node->getChild((str+".commit_callback").c_str(),child_node,false))
//Since so many other callback 'types' piggyback off of the commitcallback registrar as well as use the same callback signature
//we can assemble a nice little static list to iterate down instead of copy-pasting mostly similar code for each instance.
//Validate/enable callbacks differ, as it uses its own registry/callback signature. This could be worked around with a template, but keeping
//all the code local to this scope is more beneficial.
typedef boost::signals2::connection (LLUICtrl::*commit_fn)( const commit_signal_t::slot_type& cb );
static std::pair<std::string,commit_fn> sCallbackRegistryMap[3] =
{
if(child_node->getAttributeString("function",attrib_str))
std::pair<std::string,commit_fn>(".commit_callback",&LLUICtrl::setCommitCallback),
std::pair<std::string,commit_fn>(".mouseenter_callback",&LLUICtrl::setMouseEnterCallback),
std::pair<std::string,commit_fn>(".mouseleave_callback",&LLUICtrl::setMouseLeaveCallback)
};
for(S32 i= 0; i < sizeof(sCallbackRegistryMap)/sizeof(sCallbackRegistryMap[0]);++i)
{
if(node->getChild((str+sCallbackRegistryMap[i].first).c_str(),child_node,false))
{
commit_callback_t* func = (CommitCallbackRegistry::getValue(attrib_str));
if (func)
if(child_node->getAttributeString("function",attrib_str))
{
if(child_node->getAttributeString("parameter",attrib_str))
setCommitCallback(boost::bind((*func), this, LLSD(attrib_str)));
else
setCommitCallback(commit_signal_t::slot_type(*func));
commit_callback_t* func = (CommitCallbackRegistry::getValue(attrib_str));
if (func)
{
if(child_node->getAttributeString("parameter",attrib_str))
(this->*sCallbackRegistryMap[i].second)(boost::bind((*func), this, LLSD(attrib_str)));
else
(this->*sCallbackRegistryMap[i].second)(commit_signal_t::slot_type(*func));
}
}
}
}
if(node->getChild((str+".validate_callback").c_str(),child_node,false))
{
if(child_node->getAttributeString("function",attrib_str))
@@ -587,3 +630,15 @@ boost::signals2::connection LLUICtrl::setValidateCallback( const enable_signal_t
if (!mValidateSignal) mValidateSignal = new enable_signal_t();
return mValidateSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setMouseEnterCallback( const commit_signal_t::slot_type& cb )
{
if (!mMouseEnterSignal) mMouseEnterSignal = new commit_signal_t();
return mMouseEnterSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setMouseLeaveCallback( const commit_signal_t::slot_type& cb )
{
if (!mMouseLeaveSignal) mMouseLeaveSignal = new commit_signal_t();
return mMouseLeaveSignal->connect(cb);
}

View File

@@ -70,6 +70,8 @@ public:
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
/*virtual*/ BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
/*virtual*/ BOOL isCtrl() const;
/*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
// From LLFocusableElement
/*virtual*/ void setFocus( BOOL b );
@@ -127,7 +129,9 @@ public:
//Start using these!
boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb );
boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb );
// *TODO: Deprecate; for backwards compatability only:
//Keeping userdata around with legacy setCommitCallback because it's used ALL OVER THE PLACE.
void* getCallbackUserData() const { return mCallbackUserData; }
@@ -162,6 +166,9 @@ protected:
commit_signal_t* mCommitSignal;
enable_signal_t* mValidateSignal;
commit_signal_t* mMouseEnterSignal;
commit_signal_t* mMouseLeaveSignal;
LLViewModelPtr mViewModel;
void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata );

View File

@@ -102,11 +102,8 @@ public:
static LLView *fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("pad");
node->getAttributeString("name", name);
LLUICtrlLocate *new_ctrl = new LLUICtrlLocate();
new_ctrl->setName(name);
new_ctrl->setName("pad");
new_ctrl->initFromXML(node, parent);
return new_ctrl;
}

View File

@@ -74,6 +74,7 @@ BOOL LLView::sForceReshape = FALSE;
LLView* LLView::sEditingUIView = NULL;
S32 LLView::sLastLeftXML = S32_MIN;
S32 LLView::sLastBottomXML = S32_MIN;
std::vector<LLViewDrawContext*> LLViewDrawContext::sDrawContextStack;
LLView::DrilldownFunc LLView::sDrilldown =
boost::bind(&LLView::pointInView, _1, _2, _3, HIT_TEST_USE_BOUNDING_RECT);
@@ -677,6 +678,16 @@ BOOL LLView::handleHover(S32 x, S32 y, MASK mask)
}
void LLView::onMouseEnter(S32 x, S32 y, MASK mask)
{
//llinfos << "Mouse entered " << getName() << llendl;
}
void LLView::onMouseLeave(S32 x, S32 y, MASK mask)
{
//llinfos << "Mouse left " << getName() << llendl;
}
std::string LLView::getShowNamesToolTip()
{
LLView* view = getParent();
@@ -2481,6 +2492,56 @@ void LLView::parseFollowsFlags(const LLView::Params& params)
}
}
LLView::tree_iterator_t LLView::beginTreeDFS()
{
return tree_iterator_t(this,
boost::bind(boost::mem_fn(&LLView::beginChild), _1),
boost::bind(boost::mem_fn(&LLView::endChild), _1));
}
LLView::tree_iterator_t LLView::endTreeDFS()
{
// an empty iterator is an "end" iterator
return tree_iterator_t();
}
LLView::tree_post_iterator_t LLView::beginTreeDFSPost()
{
return tree_post_iterator_t(this,
boost::bind(boost::mem_fn(&LLView::beginChild), _1),
boost::bind(boost::mem_fn(&LLView::endChild), _1));
}
LLView::tree_post_iterator_t LLView::endTreeDFSPost()
{
// an empty iterator is an "end" iterator
return tree_post_iterator_t();
}
LLView::bfs_tree_iterator_t LLView::beginTreeBFS()
{
return bfs_tree_iterator_t(this,
boost::bind(boost::mem_fn(&LLView::beginChild), _1),
boost::bind(boost::mem_fn(&LLView::endChild), _1));
}
LLView::bfs_tree_iterator_t LLView::endTreeBFS()
{
// an empty iterator is an "end" iterator
return bfs_tree_iterator_t();
}
LLView::root_to_view_iterator_t LLView::beginRootToView()
{
return root_to_view_iterator_t(this, boost::bind(&LLView::getParent, _1));
}
LLView::root_to_view_iterator_t LLView::endRootToView()
{
return root_to_view_iterator_t();
}
// static
U32 LLView::createRect(LLXMLNodePtr node, LLRect &rect, LLView* parent_view, const LLRect &required_rect)
{
@@ -2944,6 +3005,32 @@ S32 LLView::notifyParent(const LLSD& info)
return parent->notifyParent(info);
return 0;
}
bool LLView::notifyChildren(const LLSD& info)
{
bool ret = false;
BOOST_FOREACH(LLView* childp, mChildList)
{
ret = ret || childp->notifyChildren(info);
}
return ret;
}
// convenient accessor for draw context
const LLViewDrawContext& LLView::getDrawContext()
{
return LLViewDrawContext::getCurrentContext();
}
const LLViewDrawContext& LLViewDrawContext::getCurrentContext()
{
static LLViewDrawContext default_context;
if (sDrawContextStack.empty())
return default_context;
return *sDrawContextStack.back();
}
LLView* LLView::createWidget(LLXMLNodePtr xml_node) const
{
// forward requests to ui ctrl factory

View File

@@ -55,6 +55,7 @@
#include "lluistring.h"
#include "llcursortypes.h"
#include "llinitparam.h"
#include "lltreeiterators.h"
#include "llfocusmgr.h"
#include <boost/unordered_map.hpp>
#include "ailist.h"
@@ -130,6 +131,35 @@ public:
}
};
// maintains render state during traversal of UI tree
class LLViewDrawContext
{
public:
F32 mAlpha;
LLViewDrawContext(F32 alpha = 1.f)
: mAlpha(alpha)
{
if (!sDrawContextStack.empty())
{
LLViewDrawContext* context_top = sDrawContextStack.back();
// merge with top of stack
mAlpha *= context_top->mAlpha;
}
sDrawContextStack.push_back(this);
}
~LLViewDrawContext()
{
sDrawContextStack.pop_back();
}
static const LLViewDrawContext& getCurrentContext();
private:
static std::vector<LLViewDrawContext*> sDrawContextStack;
};
class LLView
: public LLMouseHandler, // handles mouse events
public LLFocusableElement, // handles keyboard events
@@ -378,7 +408,24 @@ public:
BOOL hasAncestor(const LLView* parentp) const;
BOOL hasChild(const std::string& childname, BOOL recurse = FALSE) const;
BOOL childHasKeyboardFocus( const std::string& childname ) const;
// these iterators are used for collapsing various tree traversals into for loops
typedef LLTreeDFSIter<LLView, child_list_const_iter_t> tree_iterator_t;
tree_iterator_t beginTreeDFS();
tree_iterator_t endTreeDFS();
typedef LLTreeDFSPostIter<LLView, child_list_const_iter_t> tree_post_iterator_t;
tree_post_iterator_t beginTreeDFSPost();
tree_post_iterator_t endTreeDFSPost();
typedef LLTreeBFSIter<LLView, child_list_const_iter_t> bfs_tree_iterator_t;
bfs_tree_iterator_t beginTreeBFS();
bfs_tree_iterator_t endTreeBFS();
typedef LLTreeDownIter<LLView> root_to_view_iterator_t;
root_to_view_iterator_t beginRootToView();
root_to_view_iterator_t endRootToView();
//
// UTILITIES
@@ -489,6 +536,9 @@ public:
virtual LLView* childFromPoint(S32 x, S32 y, bool recur=false);
// view-specific handlers
virtual void onMouseEnter(S32 x, S32 y, MASK mask);
virtual void onMouseLeave(S32 x, S32 y, MASK mask);
template <class T> T* findChild(const std::string& name)
{
return getChild<T>(name,true,false);
@@ -607,6 +657,16 @@ public:
//send custom notification to LLView parent
virtual S32 notifyParent(const LLSD& info);
//send custom notification to all view childrend
// return true if _any_ children return true. otherwise false.
virtual bool notifyChildren(const LLSD& info);
//send custom notification to current view
virtual S32 notify(const LLSD& info) { return 0;};
static const LLViewDrawContext& getDrawContext();
protected:
void drawDebugRect();
void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE);

View File

@@ -104,6 +104,8 @@ void LLViewBorder::draw()
void LLViewBorder::drawOnePixelLines()
{
F32 alpha = getDrawContext().mAlpha;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLColor4 top_color = mHighlightLight;
@@ -138,6 +140,9 @@ void LLViewBorder::drawOnePixelLines()
S32 right = getRect().getWidth();
S32 bottom = 0;
top_color %= alpha;
bottom_color %= alpha;
gGL.color4fv( top_color.mV );
gl_line_2d(left, bottom, left, top);
gl_line_2d(left, top, right, top);