This commit is contained in:
Siana Gearz
2013-12-15 14:09:29 +01:00
27 changed files with 2148 additions and 863 deletions

View File

@@ -127,7 +127,7 @@ if (LINUX)
-pthread
)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_FORTIFY_SOURCE=2 ")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ")
# Don't catch SIGCHLD in our base application class for the viewer
# some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh!

View File

@@ -40,7 +40,9 @@ namespace LLInitParam
{
const U8* my_addr = reinterpret_cast<const U8*>(this);
const U8* block_addr = reinterpret_cast<const U8*>(enclosing_block);
mEnclosingBlockOffset = 0x7FFFffff & (U32)(my_addr - block_addr);
U32 enclosing_block_offset = 0x7FFFffff & (U32)(my_addr - block_addr);
mEnclosingBlockOffsetLow = enclosing_block_offset & 0x0000ffff;
mEnclosingBlockOffsetHigh = (enclosing_block_offset & 0x007f0000) >> 16;
}
//
@@ -112,6 +114,35 @@ namespace LLInitParam
std::copy(src_block_data.mAllParams.begin(), src_block_data.mAllParams.end(), std::back_inserter(mAllParams));
}
void BlockDescriptor::addParam(const ParamDescriptorPtr in_param, const char* char_name)
{
// create a copy of the param descriptor in mAllParams
// so other data structures can store a pointer to it
mAllParams.push_back(in_param);
ParamDescriptorPtr param(mAllParams.back());
std::string name(char_name);
if ((size_t)param->mParamHandle > mMaxParamOffset)
{
llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl;
}
if (name.empty())
{
mUnnamedParams.push_back(param);
}
else
{
// don't use insert, since we want to overwrite existing entries
mNamedParams[name] = param;
}
if (param->mValidationFunc)
{
mValidationList.push_back(std::make_pair(param->mParamHandle, param->mValidationFunc));
}
}
BlockDescriptor::BlockDescriptor()
: mMaxParamOffset(0),
mInitializationState(UNINITIALIZED),
@@ -150,7 +181,8 @@ namespace LLInitParam
bool BaseBlock::submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent)
{
if (!deserializeBlock(p, std::make_pair(name_stack.begin(), name_stack.end()), true))
Parser::name_stack_range_t range = std::make_pair(name_stack.begin(), name_stack.end());
if (!deserializeBlock(p, range, true))
{
if (!silent)
{
@@ -196,12 +228,7 @@ namespace LLInitParam
if (serialize_func)
{
const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL;
// each param descriptor remembers its serial number
// so we can inspect the same param under different names
// and see that it has the same number
name_stack.push_back(std::make_pair("", true));
serialize_func(*param, parser, name_stack, diff_param);
name_stack.pop_back();
}
}
@@ -295,7 +322,7 @@ namespace LLInitParam
return true;
}
bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool ignored)
bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack_range, bool ignored)
{
BlockDescriptor& block_data = mostDerivedBlockDescriptor();
bool names_left = name_stack_range.first != name_stack_range.second;
@@ -308,15 +335,12 @@ namespace LLInitParam
{
const std::string& top_name = name_stack_range.first->first;
ParamDescriptor::deserialize_func_t deserialize_func = NULL;
Param* paramp = NULL;
BlockDescriptor::param_map_t::iterator found_it = block_data.mNamedParams.find(top_name);
if (found_it != block_data.mNamedParams.end())
{
// find pointer to member parameter from offset table
paramp = getParamFromHandle(found_it->second->mParamHandle);
deserialize_func = found_it->second->mDeserializeFunc;
Param* paramp = getParamFromHandle(found_it->second->mParamHandle);
ParamDescriptor::deserialize_func_t deserialize_func = found_it->second->mDeserializeFunc;
Parser::name_stack_range_t new_name_stack(name_stack_range.first, name_stack_range.second);
++new_name_stack.first;
@@ -358,36 +382,6 @@ namespace LLInitParam
return false;
}
//static
void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name)
{
// create a copy of the param descriptor in mAllParams
// so other data structures can store a pointer to it
block_data.mAllParams.push_back(in_param);
ParamDescriptorPtr param(block_data.mAllParams.back());
std::string name(char_name);
if ((size_t)param->mParamHandle > block_data.mMaxParamOffset)
{
llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl;
}
if (name.empty())
{
block_data.mUnnamedParams.push_back(param);
}
else
{
// don't use insert, since we want to overwrite existing entries
block_data.mNamedParams[name] = param;
}
if (param->mValidationFunc)
{
block_data.mValidationList.push_back(std::make_pair(param->mParamHandle, param->mValidationFunc));
}
}
void BaseBlock::addSynonym(Param& param, const std::string& synonym)
{
BlockDescriptor& block_data = mostDerivedBlockDescriptor();
@@ -460,7 +454,7 @@ namespace LLInitParam
if (merge_func)
{
Param* paramp = getParamFromHandle((*it)->mParamHandle);
llassert(paramp->mEnclosingBlockOffset == (*it)->mParamHandle);
llassert(paramp->getEnclosingBlockOffset() == (*it)->mParamHandle);
some_param_changed |= merge_func(*paramp, *other_paramp, overwrite);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -223,10 +223,14 @@ LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser:
{
bool new_traversal = it->second;
LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first];
if (child_sd->isArray())
LLSD* child_sd;
if (it->first.empty())
{
child_sd = sd_to_write;
if (child_sd->isUndefined())
{
*child_sd = LLSD::emptyArray();
}
if (new_traversal)
{
// write to new element at end
@@ -240,22 +244,7 @@ LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser:
}
else
{
if (new_traversal
&& child_sd->isDefined()
&& !child_sd->isArray())
{
// copy child contents into first element of an array
LLSD new_array = LLSD::emptyArray();
new_array.append(*child_sd);
// assign array to slot that previously held the single value
*child_sd = new_array;
// return next element in that array
sd_to_write = &((*child_sd)[1]);
}
else
{
sd_to_write = child_sd;
}
sd_to_write = &(*sd_to_write)[it->first];
}
it->second = false;
}
@@ -283,8 +272,9 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI
it != sd.endArray();
++it)
{
stack.back().second = true;
stack.push_back(make_pair(std::string(), true));
readSDValues(cb, *it, stack);
stack.pop_back();
}
}
else if (sd.isUndefined())
@@ -313,8 +303,14 @@ namespace LLInitParam
{
// LLSD specialization
// block param interface
bool ParamValue<LLSD, TypeValues<LLSD>, false>::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name)
bool ParamValue<LLSD, NOT_BLOCK>::deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack, bool new_name)
{
if (name_stack.first == name_stack.second
&& p.readValue<LLSD>(mValue))
{
return true;
}
LLSD& sd = LLParamSDParserUtilities::getSDWriteNode(mValue, name_stack);
LLSD::String string;
@@ -328,15 +324,18 @@ namespace LLInitParam
}
//static
void ParamValue<LLSD, TypeValues<LLSD>, false>::serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack)
void ParamValue<LLSD, NOT_BLOCK>::serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack)
{
p.writeValue<LLSD::String>(sd.asString(), name_stack);
}
void ParamValue<LLSD, TypeValues<LLSD>, false>::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const
void ParamValue<LLSD, NOT_BLOCK>::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const
{
// read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc)
Parser::name_stack_t stack;
LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, stack);
// attempt to write LLSD out directly
if (!p.writeValue<LLSD>(mValue, name_stack))
{
// otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc)
LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack);
}
}
}

View File

@@ -1112,6 +1112,13 @@ std::string LLFontGL::nameFromFont(const LLFontGL* fontp)
return fontp->mFontDescriptor.getName();
}
// static
std::string LLFontGL::sizeFromFont(const LLFontGL* fontp)
{
return fontp->getFontDesc().getSize();
}
// static
std::string LLFontGL::nameFromHAlign(LLFontGL::HAlign align)
{
@@ -1228,6 +1235,41 @@ LLFontGL* LLFontGL::getFont(const LLFontDescriptor& desc)
return sFontRegistry->getFont(desc);
}
// static
LLFontGL* LLFontGL::getFontByName(const std::string& name)
{
// check for most common fonts first
if (name == "SANSSERIF")
{
return getFontSansSerif();
}
else if (name == "SANSSERIF_SMALL")
{
return getFontSansSerifSmall();
}
else if (name == "SANSSERIF_BIG")
{
return getFontSansSerifBig();
}
else if (name == "SMALL" || name == "OCRA")
{
// *BUG: Should this be "MONOSPACE"? Do we use "OCRA" anymore?
// Does "SMALL" mean "SERIF"?
return getFontMonospace();
}
else
{
return NULL;
}
}
//static
LLFontGL* LLFontGL::getFontDefault()
{
return getFontSansSerif(); // Fallback to sans serif as default font
}
// static
std::string LLFontGL::getFontPathSystem()
{

View File

@@ -171,7 +171,9 @@ public:
// Takes a string with potentially several flags, i.e. "NORMAL|BOLD|ITALIC"
static U8 getStyleFromString(const std::string &style);
static std::string getStringFromStyle(U8 style);
static std::string nameFromFont(const LLFontGL* fontp);
static std::string sizeFromFont(const LLFontGL* fontp);
static std::string nameFromHAlign(LLFontGL::HAlign align);
static LLFontGL::HAlign hAlignFromName(const std::string& name);
@@ -201,6 +203,9 @@ public:
static LLFontGL* getFontSansSerifBold();
static LLFontGL* getFontExtChar();
static LLFontGL* getFont(const LLFontDescriptor& desc);
// Use with legacy names like "SANSSERIF_SMALL" or "OCRA"
static LLFontGL* getFontByName(const std::string& name);
static LLFontGL* getFontDefault(); // default fallback font
static std::string getFontPathLocal();
static std::string getFontPathSystem();

View File

@@ -40,68 +40,56 @@
#include "llcontrol.h"
#include "llui.h"
#include "lluictrlfactory.h"
const F32 RESOLUTION_BUMP = 1.f;
#include "lluiimage.h"
static LLRegisterWidget<LLIconCtrl> r("icon");
LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const LLUUID &image_id)
: LLUICtrl(name,
rect,
FALSE, // mouse opaque
NULL,
FOLLOWS_LEFT | FOLLOWS_TOP),
mColor( LLColor4::white )
LLIconCtrl::Params::Params()
: image("image_name"),
color("color"),
// use_draw_context_alpha("use_draw_context_alpha", true),
scale_image("scale_image"),
min_width("min_width", 0),
min_height("min_height", 0)
{}
LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p)
: LLUICtrl(p),
mColor(p.color()),
mImagep(p.image),
// mUseDrawContextAlpha(p.use_draw_context_alpha),
mPriority(0),
mMinWidth(p.min_width),
mMinHeight(p.min_height)
{
setImage( image_id );
setTabStop(FALSE);
if (mImagep.notNull())
{
LLUICtrl::setValue(mImagep->getName());
}
setTabStop(false);
}
LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name)
LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name, const S32& min_width, const S32& min_height)
: LLUICtrl(name,
rect,
FALSE, // mouse opaque
NULL,
FOLLOWS_LEFT | FOLLOWS_TOP),
mColor( LLColor4::white ),
mImageName(image_name)
mPriority(0),
mMinWidth(min_width),
mMinHeight(min_height)
{
setImage( image_name );
setValue( image_name );
setTabStop(FALSE);
}
LLIconCtrl::~LLIconCtrl()
{
mImagep = NULL;
}
void LLIconCtrl::setImage(const std::string& image_name)
{
//RN: support UUIDs masquerading as strings
if (LLUUID::validate(image_name))
{
mImageID = LLUUID(image_name);
setImage(mImageID);
}
else
{
mImageName = image_name;
mImagep = LLUI::getUIImage(image_name);
mImageID.setNull();
}
}
void LLIconCtrl::setImage(const LLUUID& image_id)
{
mImageName.clear();
mImagep = LLUI::getUIImageByID(image_id);
mImageID = image_id;
}
void LLIconCtrl::draw()
{
if( mImagep.notNull() )
@@ -120,23 +108,40 @@ void LLIconCtrl::setAlpha(F32 alpha)
}
// virtual
// value might be a string or a UUID
void LLIconCtrl::setValue(const LLSD& value )
{
if (value.isUUID())
LLSD tvalue(value);
if (value.isString() && LLUUID::validate(value.asString()))
{
setImage(value.asUUID());
//RN: support UUIDs masquerading as strings
tvalue = LLSD(LLUUID(value.asString()));
}
LLUICtrl::setValue(tvalue);
if (tvalue.isUUID())
{
mImagep = LLUI::getUIImageByID(tvalue.asUUID(), mPriority);
}
else
{
setImage(value.asString());
mImagep = LLUI::getUIImage(tvalue.asString(), mPriority);
}
if (mImagep.notNull()
&& mImagep->getImage().notNull()
&& mMinWidth
&& mMinHeight)
{
mImagep->getImage()->setKnownDrawSize(llmax(mMinWidth, mImagep->getWidth()), llmax(mMinHeight, mImagep->getHeight()));
}
}
// virtual
LLSD LLIconCtrl::getValue() const
std::string LLIconCtrl::getImageName() const
{
LLSD ret = getImage();
return ret;
if (getValue().isString())
return getValue().asString();
else
return std::string();
}
// virtual
@@ -146,11 +151,14 @@ LLXMLNodePtr LLIconCtrl::getXML(bool save_children) const
node->setName(LL_ICON_CTRL_TAG);
if (mImageName != "")
if (!getImageName().empty())
{
node->createChild("image_name", TRUE)->setStringValue(mImageName);
node->createChild("image_name", TRUE)->setStringValue(getImageName());
}
if (mMinWidth) node->createChild("min_width", true)->setIntValue(mMinWidth);
if (mMinHeight) node->createChild("min_height", true)->setIntValue(mMinHeight);
node->createChild("color", TRUE)->setFloatValue(4, mColor.mV);
return node;
@@ -170,7 +178,18 @@ LLView* LLIconCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
LLColor4 color(LLColor4::white);
LLUICtrlFactory::getAttributeColor(node,"color", color);
LLIconCtrl* icon = new LLIconCtrl("icon", rect, image_name);
S32 min_width = 0, min_height = 0;
if (node->hasAttribute("min_width"))
{
node->getAttributeS32("min_width", min_width);
}
if (node->hasAttribute("min_height"))
{
node->getAttributeS32("min_height", min_height);
}
LLIconCtrl* icon = new LLIconCtrl("icon", rect, image_name, min_width, min_height);
icon->setColor(color);

View File

@@ -49,33 +49,55 @@ class LLIconCtrl
: public LLUICtrl
{
public:
LLIconCtrl(const std::string& name, const LLRect &rect, const LLUUID &image_id);
LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name);
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<LLUIImage*> image;
Optional<LLUIColor> color;
// Optional<bool> use_draw_context_alpha;
Optional<S32> min_width,
min_height;
Ignored scale_image;
Params();
};
protected:
LLIconCtrl(const Params&);
friend class LLUICtrlFactory;
public:
LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name, const S32& min_width = 0, const S32& min_height = 0);
virtual ~LLIconCtrl();
// llview overrides
virtual void draw();
void setImage(const std::string& image_name);
void setImage(const LLUUID& image_name);
const LLUUID &getImage() const { return mImageID; }
std::string getImageName() const { return mImageName; }
// Takes a UUID, wraps get/setImage
// lluictrl overrides
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
/*virtual*/ void setAlpha(F32 alpha);
std::string getImageName() const;
void setColor(const LLColor4& color) { mColor = color; }
void setImage(LLPointer<LLUIImage> image) { mImagep = image; }
const LLPointer<LLUIImage> getImage() { return mImagep; }
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
protected:
S32 mPriority;
//the output size of the icon image if set.
S32 mMinWidth,
mMinHeight;
// If set to true (default), use the draw context transparency.
// If false, will use transparency returned by getCurrentTransparency(). See STORM-698.
//bool mUseDrawContextAlpha;
private:
LLColor4 mColor;
std::string mImageName;
LLUUID mImageID;
LLPointer<LLUIImage> mImagep;
};

View File

@@ -1508,8 +1508,9 @@ LLNotificationPtr LLNotifications::add(AIAlert::Error const& error, int type, un
// Allow LLNotifications::add, LLNotifications::cancel and LLNotifications::update
// to be called from any thread.
struct UpdateItem
class UpdateItem
{
public:
char const* sigtype;
LLNotificationPtr pNotif;
UpdateItem(char const* st, LLNotificationPtr const& np) : sigtype(st), pNotif(np) { }

View File

@@ -96,7 +96,7 @@ int const access_increment = 1000;
static void log_sStringTemplates_accesses(void)
{
llinfos << "LLTrans::getString/findString called " << sStringTemplates_accesses << " in total." << llendl;
lldebugs << "LLTrans::getString/findString called " << sStringTemplates_accesses << " in total." << llendl;
}
//static

View File

@@ -313,3 +313,227 @@ void LLUI::setQAMode(BOOL b)
LLUI::sQAMode = b;
}
namespace LLInitParam
{
ParamValue<LLUIColor>::ParamValue(const LLUIColor& color)
: super_t(color),
red("red"),
green("green"),
blue("blue"),
alpha("alpha"),
control("")
{
updateBlockFromValue(false);
}
void ParamValue<LLUIColor>::updateValueFromBlock()
{
if (control.isProvided() && !control().empty())
{
updateValue(LLUI::sColorsGroup->controlExists(control) ? LLUI::sColorsGroup->getColor(control) : LLUI::sConfigGroup->getColor(control)); // Singu Note: Most of our colors will be in sColorsGroup (skin), but some may be moved to settings for users.
}
else
{
updateValue(LLColor4(red, green, blue, alpha));
}
}
void ParamValue<LLUIColor>::updateBlockFromValue(bool make_block_authoritative)
{
LLColor4 color = getValue();
red.set(color.mV[VRED], make_block_authoritative);
green.set(color.mV[VGREEN], make_block_authoritative);
blue.set(color.mV[VBLUE], make_block_authoritative);
alpha.set(color.mV[VALPHA], make_block_authoritative);
control.set("", make_block_authoritative);
}
bool ParamCompare<const LLFontGL*, false>::equals(const LLFontGL* a, const LLFontGL* b)
{
return !(a->getFontDesc() < b->getFontDesc())
&& !(b->getFontDesc() < a->getFontDesc());
}
ParamValue<const LLFontGL*>::ParamValue(const LLFontGL* fontp)
: super_t(fontp),
name("name"),
size("size"),
style("style")
{
if (!fontp)
{
updateValue(LLFontGL::getFontDefault());
}
addSynonym(name, "");
updateBlockFromValue(false);
}
void ParamValue<const LLFontGL*>::updateValueFromBlock()
{
const LLFontGL* res_fontp = LLFontGL::getFontByName(name);
if (res_fontp)
{
updateValue(res_fontp);
return;
}
U8 fontstyle = 0;
fontstyle = LLFontGL::getStyleFromString(style());
LLFontDescriptor desc(name(), size(), fontstyle);
const LLFontGL* fontp = LLFontGL::getFont(desc);
if (fontp)
{
updateValue(fontp);
}
else
{
updateValue(LLFontGL::getFontDefault());
}
}
void ParamValue<const LLFontGL*>::updateBlockFromValue(bool make_block_authoritative)
{
if (getValue())
{
name.set(LLFontGL::nameFromFont(getValue()), make_block_authoritative);
size.set(LLFontGL::sizeFromFont(getValue()), make_block_authoritative);
style.set(LLFontGL::getStringFromStyle(getValue()->getFontDesc().getStyle()), make_block_authoritative);
}
}
ParamValue<LLRect>::ParamValue(const LLRect& rect)
: super_t(rect),
left("left"),
top("top"),
right("right"),
bottom("bottom"),
width("width"),
height("height")
{
updateBlockFromValue(false);
}
void ParamValue<LLRect>::updateValueFromBlock()
{
LLRect rect;
//calculate from params
// prefer explicit left and right
if (left.isProvided() && right.isProvided())
{
rect.mLeft = left;
rect.mRight = right;
}
// otherwise use width along with specified side, if any
else if (width.isProvided())
{
// only right + width provided
if (right.isProvided())
{
rect.mRight = right;
rect.mLeft = right - width;
}
else // left + width, or just width
{
rect.mLeft = left;
rect.mRight = left + width;
}
}
// just left, just right, or none
else
{
rect.mLeft = left;
rect.mRight = right;
}
// prefer explicit bottom and top
if (bottom.isProvided() && top.isProvided())
{
rect.mBottom = bottom;
rect.mTop = top;
}
// otherwise height along with specified side, if any
else if (height.isProvided())
{
// top + height provided
if (top.isProvided())
{
rect.mTop = top;
rect.mBottom = top - height;
}
// bottom + height or just height
else
{
rect.mBottom = bottom;
rect.mTop = bottom + height;
}
}
// just bottom, just top, or none
else
{
rect.mBottom = bottom;
rect.mTop = top;
}
updateValue(rect);
}
void ParamValue<LLRect>::updateBlockFromValue(bool make_block_authoritative)
{
// because of the ambiguity in specifying a rect by position and/or dimensions
// we use the lowest priority pairing so that any valid pairing in xui
// will override those calculated from the rect object
// in this case, that is left+width and bottom+height
LLRect& value = getValue();
right.set(value.mRight, false);
left.set(value.mLeft, make_block_authoritative);
width.set(value.getWidth(), make_block_authoritative);
top.set(value.mTop, false);
bottom.set(value.mBottom, make_block_authoritative);
height.set(value.getHeight(), make_block_authoritative);
}
ParamValue<LLCoordGL>::ParamValue(const LLCoordGL& coord)
: super_t(coord),
x("x"),
y("y")
{
updateBlockFromValue(false);
}
void ParamValue<LLCoordGL>::updateValueFromBlock()
{
updateValue(LLCoordGL(x, y));
}
void ParamValue<LLCoordGL>::updateBlockFromValue(bool make_block_authoritative)
{
x.set(getValue().mX, make_block_authoritative);
y.set(getValue().mY, make_block_authoritative);
}
void TypeValues<LLFontGL::HAlign>::declareValues()
{
declare("left", LLFontGL::LEFT);
declare("right", LLFontGL::RIGHT);
declare("center", LLFontGL::HCENTER);
}
void TypeValues<LLFontGL::VAlign>::declareValues()
{
declare("top", LLFontGL::TOP);
declare("center", LLFontGL::VCENTER);
declare("baseline", LLFontGL::BASELINE);
declare("bottom", LLFontGL::BOTTOM);
}
void TypeValues<LLFontGL::ShadowType>::declareValues()
{
declare("none", LLFontGL::NO_SHADOW);
declare("hard", LLFontGL::DROP_SHADOW);
declare("soft", LLFontGL::DROP_SHADOW_SOFT);
}
}

View File

@@ -32,12 +32,18 @@
#include "llcontrol.h"
#include "llcoord.h"
#include "v2math.h"
#include "llinitparam.h"
#include "llregistry.h"
#include "llrender2dutils.h"
#include "llpointer.h"
#include "lluicolor.h"
#include "lluiimage.h"
#include <boost/signals2.hpp>
// for initparam specialization
#include "llfontgl.h"
// LLUIFactory
#include "llsd.h"
@@ -504,4 +510,99 @@ protected:
template <typename T> T* LLParamBlock<T>::sBlock = NULL;
namespace LLInitParam
{
template<>
class ParamValue<LLRect>
: public CustomParamValue<LLRect>
{
typedef CustomParamValue<LLRect> super_t;
public:
Optional<S32> left,
top,
right,
bottom,
width,
height;
ParamValue(const LLRect& value);
void updateValueFromBlock();
void updateBlockFromValue(bool make_block_authoritative);
};
template<>
class ParamValue<LLUIColor>
: public CustomParamValue<LLUIColor>
{
typedef CustomParamValue<LLUIColor> super_t;
public:
Optional<F32> red,
green,
blue,
alpha;
Optional<std::string> control;
ParamValue(const LLUIColor& color);
void updateValueFromBlock();
void updateBlockFromValue(bool make_block_authoritative);
};
template<>
class ParamValue<const LLFontGL*>
: public CustomParamValue<const LLFontGL* >
{
typedef CustomParamValue<const LLFontGL*> super_t;
public:
Optional<std::string> name,
size,
style;
ParamValue(const LLFontGL* value);
void updateValueFromBlock();
void updateBlockFromValue(bool make_block_authoritative);
};
template<>
struct TypeValues<LLFontGL::HAlign> : public TypeValuesHelper<LLFontGL::HAlign>
{
static void declareValues();
};
template<>
struct TypeValues<LLFontGL::VAlign> : public TypeValuesHelper<LLFontGL::VAlign>
{
static void declareValues();
};
template<>
struct TypeValues<LLFontGL::ShadowType> : public TypeValuesHelper<LLFontGL::ShadowType>
{
static void declareValues();
};
template<>
struct ParamCompare<const LLFontGL*, false>
{
static bool equals(const LLFontGL* a, const LLFontGL* b);
};
template<>
class ParamValue<LLCoordGL>
: public CustomParamValue<LLCoordGL>
{
typedef CustomParamValue<LLCoordGL> super_t;
public:
Optional<S32> x,
y;
ParamValue(const LLCoordGL& val);
void updateValueFromBlock();
void updateBlockFromValue(bool make_block_authoritative);
};
}
#endif

View File

@@ -31,7 +31,6 @@
* $/LicenseInfo$
*/
//#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include "lluictrl.h"
#include "llfocusmgr.h"
@@ -39,10 +38,69 @@
static LLRegisterWidget<LLUICtrl> r("ui_ctrl");
// NOTE: the LLFocusableElement implementation has been moved to llfocusmgr.cpp, to mirror the header where the class is defined.
LLUICtrl::CallbackParam::CallbackParam()
: name("name"),
function_name("function"),
parameter("parameter"),
control_name("control") // Shortcut to control -> "control_name" for backwards compatability
{
addSynonym(parameter, "userdata");
}
LLUICtrl::LLUICtrl() :
mViewModel(LLViewModelPtr(new LLViewModel)),
LLUICtrl::EnableControls::EnableControls()
: enabled("enabled_control"),
disabled("disabled_control")
{}
LLUICtrl::ControlVisibility::ControlVisibility()
: visible("visibility_control"),
invisible("invisibility_control")
{
addSynonym(visible, "visiblity_control");
addSynonym(invisible, "invisiblity_control");
}
LLUICtrl::Params::Params()
: tab_stop("tab_stop", true),
chrome("chrome", false),
requests_front("requests_front", false),
label("label"),
initial_value("value"),
init_callback("init_callback"),
commit_callback("commit_callback"),
validate_callback("validate_callback"),
mouseenter_callback("mouseenter_callback"),
mouseleave_callback("mouseleave_callback"),
control_name("control_name"),
font("font", LLFontGL::getFontSansSerif()),
font_halign("halign"),
font_valign("valign"),
length("length"), // ignore LLXMLNode cruft
type("type") // ignore LLXMLNode cruft
{
addSynonym(initial_value, "initial_value");
}
// NOTE: the LLFocusableElement implementation has been moved from here to llfocusmgr.cpp.
//static
const LLUICtrl::Params& LLUICtrl::getDefaultParams()
{
// Singu Note: We diverge here, not using LLUICtrlFactory::getDefaultParams
static const Params p;
return p;
}
LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel)
: LLView(p),
mIsChrome(FALSE),
mRequestsFront(p.requests_front),
mTabStop(TRUE),
mTentative(FALSE),
mViewModel(viewmodel),
mEnabledControlVariable(NULL),
mDisabledControlVariable(NULL),
mMakeVisibleControlVariable(NULL),
mMakeInvisibleControlVariable(NULL),
mCommitSignal(NULL),
@@ -54,22 +112,110 @@ LLUICtrl::LLUICtrl() :
mRightMouseDownSignal(NULL),
mRightMouseUpSignal(NULL),
mDoubleClickSignal(NULL),
mTentative(FALSE),
mTabStop(TRUE),
mIsChrome(FALSE),
mCommitOnReturn(FALSE)
{
}
void LLUICtrl::initFromParams(const Params& p)
{
LLView::initFromParams(p);
mRequestsFront = p.requests_front;
setIsChrome(p.chrome);
if(p.enabled_controls.isProvided())
{
if (p.enabled_controls.enabled.isChosen())
{
LLControlVariable* control = findControl(p.enabled_controls.enabled);
if (control)
setEnabledControlVariable(control);
}
else if(p.enabled_controls.disabled.isChosen())
{
LLControlVariable* control = findControl(p.enabled_controls.disabled);
if (control)
setDisabledControlVariable(control);
}
}
if(p.controls_visibility.isProvided())
{
if (p.controls_visibility.visible.isChosen())
{
LLControlVariable* control = findControl(p.controls_visibility.visible);
if (control)
setMakeVisibleControlVariable(control);
}
else if (p.controls_visibility.invisible.isChosen())
{
LLControlVariable* control = findControl(p.controls_visibility.invisible);
if (control)
setMakeInvisibleControlVariable(control);
}
}
setTabStop(p.tab_stop);
if (p.initial_value.isProvided()
&& !p.control_name.isProvided())
{
setValue(p.initial_value);
}
if (p.commit_callback.isProvided())
{
setCommitCallback(initCommitCallback(p.commit_callback));
}
if (p.validate_callback.isProvided())
{
setValidateCallback(initEnableCallback(p.validate_callback));
}
if (p.init_callback.isProvided())
{
if (p.init_callback.function.isProvided())
{
p.init_callback.function()(this, p.init_callback.parameter);
}
else
{
commit_callback_t* initfunc = (CommitCallbackRegistry::getValue(p.init_callback.function_name));
if (initfunc)
{
(*initfunc)(this, p.init_callback.parameter);
}
}
}
if(p.mouseenter_callback.isProvided())
{
setMouseEnterCallback(initCommitCallback(p.mouseenter_callback));
}
if(p.mouseleave_callback.isProvided())
{
setMouseLeaveCallback(initCommitCallback(p.mouseleave_callback));
}
}
LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque,
commit_callback_t commit_callback,
U32 reshape)
: // can't make this automatically follow top and left, breaks lots
// of buttons in the UI. JC 7/20/2002
LLView( name, rect, mouse_opaque, reshape ),
mIsChrome(FALSE),
mRequestsFront(false),
mTabStop( TRUE ),
mTentative( FALSE ),
mViewModel(LLViewModelPtr(new LLViewModel)),
mEnabledControlVariable(NULL),
mDisabledControlVariable(NULL),
mMakeVisibleControlVariable(NULL),
mMakeInvisibleControlVariable(NULL),
mCommitSignal(NULL),
mValidateSignal(NULL),
mViewModel(LLViewModelPtr(new LLViewModel)),
mMouseEnterSignal(NULL),
mMouseLeaveSignal(NULL),
mMouseDownSignal(NULL),
@@ -77,9 +223,6 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque
mRightMouseDownSignal(NULL),
mRightMouseUpSignal(NULL),
mDoubleClickSignal(NULL),
mTentative( FALSE ),
mTabStop( TRUE ),
mIsChrome(FALSE),
mCommitOnReturn(FALSE)
{
if(commit_callback)
@@ -107,6 +250,66 @@ LLUICtrl::~LLUICtrl()
delete mDoubleClickSignal;
}
void default_commit_handler(LLUICtrl* ctrl, const LLSD& param)
{}
bool default_enable_handler(LLUICtrl* ctrl, const LLSD& param)
{
return true;
}
LLUICtrl::commit_signal_t::slot_type LLUICtrl::initCommitCallback(const CommitCallbackParam& cb)
{
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
return boost::bind(cb.function(), _1, cb.parameter);
else
return cb.function();
}
else
{
std::string function_name = cb.function_name;
commit_callback_t* func = (CommitCallbackRegistry::getValue(function_name));
if (func)
{
if (cb.parameter.isProvided())
return boost::bind((*func), _1, cb.parameter);
else
return commit_signal_t::slot_type(*func);
}
else if (!function_name.empty())
{
llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl;
}
}
return default_commit_handler;
}
LLUICtrl::enable_signal_t::slot_type LLUICtrl::initEnableCallback(const EnableCallbackParam& cb)
{
// Set the callback function
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
return boost::bind(cb.function(), this, cb.parameter);
else
return cb.function();
}
else
{
enable_callback_t* func = (EnableCallbackRegistry::getValue(cb.function_name));
if (func)
{
if (cb.parameter.isProvided())
return boost::bind((*func), this, cb.parameter);
else
return enable_signal_t::slot_type(*func);
}
}
return default_enable_handler;
}
// virtual
void LLUICtrl::onMouseEnter(S32 x, S32 y, MASK mask)
@@ -130,6 +333,7 @@ void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask)
BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleMouseDown(x,y,mask);
if (mMouseDownSignal)
{
(*mMouseDownSignal)(this,x,y,mask);
@@ -227,6 +431,66 @@ LLViewModel* LLUICtrl::getViewModel() const
return mViewModel;
}
//virtual
BOOL LLUICtrl::postBuild()
{
//
// Find all of the children that want to be in front and move them to the front
//
if (getChildCount() > 0)
{
std::vector<LLUICtrl*> childrenToMoveToFront;
for (LLView::child_list_const_iter_t child_it = beginChild(); child_it != endChild(); ++child_it)
{
LLUICtrl* uictrl = dynamic_cast<LLUICtrl*>(*child_it);
if (uictrl && uictrl->mRequestsFront)
{
childrenToMoveToFront.push_back(uictrl);
}
}
for (std::vector<LLUICtrl*>::iterator it = childrenToMoveToFront.begin(); it != childrenToMoveToFront.end(); ++it)
{
sendChildToFront(*it);
}
}
return LLView::postBuild();
}
void LLUICtrl::setEnabledControlVariable(LLControlVariable* control)
{
if (mEnabledControlVariable)
{
mEnabledControlConnection.disconnect(); // disconnect current signal
mEnabledControlVariable = NULL;
}
if (control)
{
mEnabledControlVariable = control;
mEnabledControlConnection = mEnabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("enabled")));
setEnabled(mEnabledControlVariable->getValue().asBoolean());
}
}
void LLUICtrl::setDisabledControlVariable(LLControlVariable* control)
{
if (mDisabledControlVariable)
{
mDisabledControlConnection.disconnect(); // disconnect current signal
mDisabledControlVariable = NULL;
}
if (control)
{
mDisabledControlVariable = control;
mDisabledControlConnection = mDisabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("disabled")));
setEnabled(!(mDisabledControlVariable->getValue().asBoolean()));
}
}
void LLUICtrl::setMakeVisibleControlVariable(LLControlVariable* control)
{
if (mMakeVisibleControlVariable)
@@ -262,7 +526,17 @@ bool LLUICtrl::controlListener(const LLSD& newvalue, LLHandle<LLUICtrl> handle,
LLUICtrl* ctrl = handle.get();
if (ctrl)
{
if (type == "visible")
if (type == "enabled")
{
ctrl->setEnabled(newvalue.asBoolean());
return true;
}
else if(type =="disabled")
{
ctrl->setEnabled(!newvalue.asBoolean());
return true;
}
else if (type == "visible")
{
ctrl->setVisible(newvalue.asBoolean());
return true;
@@ -383,7 +657,6 @@ void LLUICtrl::setIsChrome(BOOL is_chrome)
// virtual
BOOL LLUICtrl::getIsChrome() const
{
LLView* parent_ctrl = getParent();
while(parent_ctrl)
{
@@ -533,6 +806,7 @@ BOOL LLUICtrl::focusLastItem(BOOL prefer_text_fields)
return FALSE;
}
BOOL LLUICtrl::focusNextItem(BOOL text_fields_only)
{
// this assumes that this method is called on the focus root.
@@ -618,6 +892,8 @@ void LLUICtrl::initFromXML(LLXMLNodePtr node, LLView* parent)
setTabStop(has_tab_stop);
node->getAttributeBOOL("requests_front", mRequestsFront);
std::string str = node->getName()->mString;
std::string attrib_str;
LLXMLNodePtr child_node;
@@ -667,6 +943,20 @@ void LLUICtrl::initFromXML(LLXMLNodePtr node, LLView* parent)
}
LLView::initFromXML(node, parent);
if (node->getAttributeString("enabled_control", attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
if (control)
setEnabledControlVariable(control);
}
if (node->getAttributeString("disabled_control", attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
if (control)
setDisabledControlVariable(control);
}
if(node->getAttributeString("visibility_control",attrib_str) || node->getAttributeString("visiblity_control",attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
@@ -727,6 +1017,7 @@ boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function<b
if (!mValidateSignal) mValidateSignal = new enable_signal_t();
return mValidateSignal->connect(boost::bind(cb, _2));
}
// virtual
void LLUICtrl::setTentative(BOOL b)
{
@@ -756,6 +1047,16 @@ void LLUICtrl::setMinValue(LLSD min_value)
void LLUICtrl::setMaxValue(LLSD max_value)
{ }
boost::signals2::connection LLUICtrl::setCommitCallback(const CommitCallbackParam& cb)
{
return setCommitCallback(initCommitCallback(cb));
}
boost::signals2::connection LLUICtrl::setValidateCallback(const EnableCallbackParam& cb)
{
return setValidateCallback(initEnableCallback(cb));
}
boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb )
{
if (!mCommitSignal) mCommitSignal = new commit_signal_t();

View File

@@ -34,13 +34,13 @@
#ifndef LL_LLUICTRL_H
#define LL_LLUICTRL_H
#include "llview.h"
#include "llrect.h"
#include "llsd.h"
#include <boost/function.hpp>
#include <boost/signals2.hpp>
#include "llinitparam.h"
#include "llview.h"
#include "llviewmodel.h" // *TODO move dependency to .cpp file
class LLUICtrl
@@ -49,20 +49,102 @@ class LLUICtrl
public:
typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> commit_callback_t;
typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> commit_signal_t;
// *TODO: add xml support for this type of signal in the future
typedef boost::signals2::signal<void (LLUICtrl* ctrl, S32 x, S32 y, MASK mask)> mouse_signal_t;
typedef boost::function<bool (LLUICtrl* ctrl, const LLSD& param)> enable_callback_t;
typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> enable_signal_t;
LLUICtrl();
struct CallbackParam : public LLInitParam::Block<CallbackParam>
{
Ignored name;
Optional<std::string> function_name;
Optional<LLSD> parameter;
Optional<std::string> control_name;
CallbackParam();
};
struct CommitCallbackParam : public LLInitParam::Block<CommitCallbackParam, CallbackParam >
{
Optional<commit_callback_t> function;
};
// also used for visible callbacks
struct EnableCallbackParam : public LLInitParam::Block<EnableCallbackParam, CallbackParam >
{
Optional<enable_callback_t> function;
};
struct EnableControls : public LLInitParam::ChoiceBlock<EnableControls>
{
Alternative<std::string> enabled;
Alternative<std::string> disabled;
EnableControls();
};
struct ControlVisibility : public LLInitParam::ChoiceBlock<ControlVisibility>
{
Alternative<std::string> visible;
Alternative<std::string> invisible;
ControlVisibility();
};
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Optional<std::string> label;
Optional<bool> tab_stop,
chrome,
requests_front;
Optional<LLSD> initial_value;
Optional<CommitCallbackParam> init_callback,
commit_callback;
Optional<EnableCallbackParam> validate_callback;
Optional<CommitCallbackParam> mouseenter_callback,
mouseleave_callback;
Optional<std::string> control_name;
Optional<EnableControls> enabled_controls;
Optional<ControlVisibility> controls_visibility;
// font params
Optional<const LLFontGL*> font;
Optional<LLFontGL::HAlign> font_halign;
Optional<LLFontGL::VAlign> font_valign;
// cruft from LLXMLNode implementation
Ignored type,
length;
Params();
};
/*virtual*/ ~LLUICtrl();
void initFromParams(const Params& p);
static const Params& getDefaultParams();
LLUICtrl(const Params& p = getDefaultParams(),
const LLViewModelPtr& viewmodel=LLViewModelPtr(new LLViewModel));
// Singu Note: This constructor is deprecated:
LLUICtrl( const std::string& name, const LLRect rect = LLRect(), BOOL mouse_opaque = TRUE,
commit_callback_t commit_callback = NULL,
U32 reshape=FOLLOWS_NONE);
/*virtual*/ ~LLUICtrl();
commit_signal_t::slot_type initCommitCallback(const CommitCallbackParam& cb);
enable_signal_t::slot_type initEnableCallback(const EnableCallbackParam& cb);
// We need this virtual so we can override it with derived versions
virtual LLViewModel* getViewModel() const;
// We shouldn't ever need to set this directly
//virtual void setViewModel(const LLViewModelPtr&);
virtual BOOL postBuild();
public:
// LLView interface
/*virtual*/ void initFromXML(LLXMLNodePtr node, LLView* parent);
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
@@ -87,6 +169,9 @@ public:
virtual class LLCtrlSelectionInterface* getSelectionInterface();
virtual class LLCtrlListInterface* getListInterface();
virtual class LLCtrlScrollInterface* getScrollInterface();
void setEnabledControlVariable(LLControlVariable* control);
void setDisabledControlVariable(LLControlVariable* control);
void setMakeVisibleControlVariable(LLControlVariable* control);
void setMakeInvisibleControlVariable(LLControlVariable* control);
@@ -113,6 +198,9 @@ public:
// Default to no-op:
virtual void onTabInto();
// Clear any user-provided input (text in a text editor, checked checkbox,
// selected radio button, etc.). Defaults to no-op.
virtual void clear();
virtual void setColor(const LLColor4& color);
virtual void setAlpha(F32 alpha);
@@ -121,7 +209,7 @@ public:
BOOL focusNextItem(BOOL text_entry_only);
BOOL focusPrevItem(BOOL text_entry_only);
virtual BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
BOOL focusLastItem(BOOL prefer_text_fields = FALSE);
// Non Virtuals
@@ -136,10 +224,13 @@ public:
void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; }
BOOL getCommitOnReturn() const { return mCommitOnReturn; }
boost::signals2::connection setCommitCallback(const CommitCallbackParam& cb);
boost::signals2::connection setValidateCallback(const EnableCallbackParam& cb);
//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 );
@@ -192,14 +283,19 @@ protected:
LLViewModelPtr mViewModel;
LLControlVariable* mEnabledControlVariable;
boost::signals2::connection mEnabledControlConnection;
LLControlVariable* mDisabledControlVariable;
boost::signals2::connection mDisabledControlConnection;
LLControlVariable* mMakeVisibleControlVariable;
boost::signals2::connection mMakeVisibleControlConnection;
LLControlVariable* mMakeInvisibleControlVariable;
boost::signals2::connection mMakeInvisibleControlConnection;
private:
BOOL mTabStop;
BOOL mIsChrome;
BOOL mRequestsFront;
BOOL mTabStop;
BOOL mTentative;
bool mCommitOnReturn;

View File

@@ -17,7 +17,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
<integer>0</integer>
</map>
<key>PhoenixIMAnnounceStealFocus</key>
<map>
@@ -223,13 +223,13 @@
<key>zmm_mlfov</key>
<map>
<key>Comment</key>
<string>1=Normal, Under 1 Zoom Out, Over 1 Zoom in </string>
<string>Adjusted when scrolling back and forth while holding rightclick in mouselook (Zoomed in &lt; 1.037 &lt; Zoomed out)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1</real>
<real>0.5</real>
</map>
<key>AllowLargeSounds</key>
@@ -763,6 +763,39 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>LiruMouselookHidesFloaters</key>
<map>
<key>Comment</key>
<string>Whether or not floaters open during third person will be hidden while in mouselook</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>1</boolean>
</map>
<key>LiruMouselookHidesMenubar</key>
<map>
<key>Comment</key>
<string>Whether or not the main menu bar will be hidden in mouselook</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>1</boolean>
</map>
<key>LiruMouselookHidesNotices</key>
<map>
<key>Comment</key>
<string>Whether or not notices will be hidden in mouselook</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>0</boolean>
</map>
<key>LiruMouselookMenu</key>
<map>
<key>Comment</key>
@@ -6153,6 +6186,28 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>EnableNongestureSounds</key>
<map>
<key>Comment</key>
<string>Play sounds from non-gestures</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>EnableNongestureSoundsSelf</key>
<map>
<key>Comment</key>
<string>Play sounds from your non-gestures when EnableNongestureSounds is false. (Useless otherwise)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>EnableMouselook</key>
<map>
<key>Comment</key>

View File

@@ -52,6 +52,7 @@
#include "llmoveview.h"
#include "llchatbar.h"
#include "llnotificationsutil.h"
#include "llnotify.h" // For hiding notices(gNotifyBoxView) in mouselook
#include "llparcel.h"
#include "llrendersphere.h"
#include "llsdmessage.h"
@@ -2043,6 +2044,8 @@ void LLAgent::endAnimationUpdateUI()
gMenuBarView->setVisible(TRUE);
gStatusBar->setVisibleForMouselook(true);
// Show notices
gNotifyBoxView->setVisible(true);
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
@@ -2053,7 +2056,7 @@ void LLAgent::endAnimationUpdateUI()
}
// Only pop if we have pushed...
if (TRUE == mViewsPushed)
if (mViewsPushed)
{
LLFloaterView::skip_list_t skip_list;
skip_list.insert(LLFloaterMap::getInstance());
@@ -2134,9 +2137,11 @@ void LLAgent::endAnimationUpdateUI()
if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
{
// hide menus
gMenuBarView->setVisible(FALSE);
gMenuBarView->setVisible(!gSavedSettings.getBOOL("LiruMouselookHidesMenubar"));
gStatusBar->setVisibleForMouselook(false);
if (gSavedSettings.getBOOL("LiruMouselookHidesNotices"))
gNotifyBoxView->setVisible(false);
// clear out camera lag effect
gAgentCamera.clearCameraLag();
@@ -2146,7 +2151,7 @@ void LLAgent::endAnimationUpdateUI()
LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset);
mViewsPushed = TRUE;
mViewsPushed = gSavedSettings.getBOOL("LiruMouselookHidesFloaters");
if (mMouselookModeInSignal)
{
@@ -2155,9 +2160,12 @@ void LLAgent::endAnimationUpdateUI()
// hide all floaters except the mini map
LLFloaterView::skip_list_t skip_list;
skip_list.insert(LLFloaterMap::getInstance());
gFloaterView->pushVisibleAll(FALSE, skip_list);
if (mViewsPushed) // Singu Note: Only hide if the setting is true.
{
LLFloaterView::skip_list_t skip_list;
skip_list.insert(LLFloaterMap::getInstance());
gFloaterView->pushVisibleAll(FALSE, skip_list);
}
if( gMorphView )
{

View File

@@ -1252,26 +1252,35 @@ void LLFloaterAvatarList::setFocusAvatar(const LLUUID& id)
}
}
// Simple function to decrement iterators, wrapping back if needed
template<typename T>
T prev_iter(const T& cur, const T& begin, const T& end)
{
return ((cur == begin) ? end : cur) - 1;
}
template<typename T>
void decrement_focus_target(T begin, T end, BOOL marked_only)
{
T iter = begin;
while(iter != end && !(*iter)->isFocused()) ++iter;
if(iter == end)
return;
T prev_iter = iter;
while(prev_iter != begin)
for (T iter = begin; iter != end; ++iter)
{
const LLAvatarListEntry& entry = *((--prev_iter)->get());
if(entry.isInList() && (entry.isMarked() || !marked_only) && gAgentCamera.lookAtObject(entry.getID(), false))
LLAvatarListEntry& old = *(iter->get());
if (!old.isFocused()) continue;
for (T prev = prev_iter(iter, begin, end); prev != iter; prev = prev_iter(prev, begin, end))
{
(*iter)->setFocus(FALSE);
(*prev_iter)->setFocus(TRUE);
gAgentCamera.lookAtObject((*prev_iter)->getID(), false);
return;
LLAvatarListEntry& entry = *(prev->get());
if (!entry.isInList()) continue;
if (marked_only && !entry.isMarked()) continue;
if (gAgentCamera.lookAtObject(entry.getID(), false))
{
old.setFocus(false);
entry.setFocus(true);
return;
}
}
// Nothing else to focus
break;
}
gAgentCamera.lookAtObject((*iter)->getID(), false);
}
void LLFloaterAvatarList::focusOnPrev(BOOL marked_only)

View File

@@ -418,6 +418,7 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id)
std::string fullname;
BOOL have_name = LLAvatarNameCache::getPNSName(agent_id, fullname);
if (!have_name) gCacheName->getFullName(agent_id, fullname);
LLSD element;
element["id"] = agent_id;
@@ -426,9 +427,11 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id)
friend_column["value"] = fullname;
friend_column["font"] = "SANSSERIF";
friend_column["font-style"] = "NORMAL";
/* Singu TODO: Liru will fix this up to actually work later
static const LLCachedControl<LLColor4> sDefaultColor(gColors, "DefaultListText");
static const LLCachedControl<LLColor4> sMutedColor("AscentMutedColor");
friend_column["color"] = ll_sd_from_color4(LLAvatarActions::isBlocked(agent_id) ? sMutedColor : sDefaultColor);
friend_column["color"] = LLAvatarActions::isBlocked(agent_id) ? sMutedColor : sDefaultColor;
*/
LLSD& online_status_column = element["columns"][LIST_ONLINE_STATUS];
online_status_column["column"] = "icon_online_status";
@@ -503,6 +506,7 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh
std::string fullname;
BOOL have_name = LLAvatarNameCache::getPNSName(agent_id, fullname);
if (!have_name) gCacheName->getFullName(agent_id, fullname);
// Name of the status icon to use
std::string statusIcon;

View File

@@ -4275,7 +4275,7 @@ void LLModelPreview::updateStatusMessages()
std::string img = lod_status_image[upload_status[lod]];
LLIconCtrl* icon = mFMP->getChild<LLIconCtrl>(lod_icon_name[lod]);
icon->setVisible(true);
icon->setImage(img);
icon->setValue(img);
if (upload_status[lod] >= 2)
{
@@ -4286,7 +4286,7 @@ void LLModelPreview::updateStatusMessages()
{
mFMP->childSetText("lod_status_message_text", mFMP->getString(message));
icon = mFMP->getChild<LLIconCtrl>("lod_status_message_icon");
icon->setImage(img);
icon->setValue(img);
}
updateLodControls(lod);

View File

@@ -163,7 +163,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
{
icon = new LLIconCtrl(std::string("icon"),
LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH),
group_insignia);
group_insignia.asString());
}
else
{

View File

@@ -1390,7 +1390,7 @@ void LLFloaterIMPanel::sendTypingState(bool typing)
return;
// Don't want to send typing indicators to multiple people, potentially too
// much network traffic. Only send in person-to-person IMs.
if (mSessionType == P2P_SESSION) return;
if (mSessionType != P2P_SESSION) return;
std::string name;
gAgent.buildFullname(name);

View File

@@ -293,7 +293,7 @@ void LLMediaRemoteCtrl::enableMediaButtons()
mMusicIcon->setColor(music_icon_color);
if(!media_icon_name.empty())
{
media_icon->setImage(media_icon_name);
media_icon->setValue(media_icon_name);
}
media_play_btn->setEnabled(play_media_enabled);

View File

@@ -310,7 +310,7 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item)
inv_item->getFlags(),
item_is_multi );
mCreateInventoryIcon->setImage(icon_name);
mCreateInventoryIcon->setValue(icon_name);
mCreateInventoryIcon->setVisible(TRUE);
std::stringstream ss;
@@ -541,7 +541,7 @@ void LLPanelGroupNotices::showNotice(const std::string& subject,
std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType,
LLInventoryType::IT_TEXTURE);
mViewInventoryIcon->setImage(icon_name);
mViewInventoryIcon->setValue(icon_name);
mViewInventoryIcon->setVisible(TRUE);
std::stringstream ss;

View File

@@ -94,10 +94,10 @@ void LLViewChildren::setBadge(const std::string& id, Badge badge, bool visible)
switch (badge)
{
default:
case BADGE_OK: child->setImage(std::string("badge_ok.j2c")); break;
case BADGE_NOTE: child->setImage(std::string("badge_note.j2c")); break;
case BADGE_WARN: child->setImage(std::string("badge_warn.j2c")); break;
case BADGE_ERROR: child->setImage(std::string("badge_error.j2c")); break;
case BADGE_OK: child->setValue(std::string("badge_ok.j2c")); break;
case BADGE_NOTE: child->setValue(std::string("badge_note.j2c")); break;
case BADGE_WARN: child->setValue(std::string("badge_warn.j2c")); break;
case BADGE_ERROR: child->setValue(std::string("badge_error.j2c")); break;
}
}
}

View File

@@ -5287,10 +5287,19 @@ void process_sound_trigger(LLMessageSystem *msg, void **)
}
// Don't play sounds from gestures if they are not enabled.
if (object_id == owner_id && !gSavedSettings.getBOOL("EnableGestureSounds"))
if (object_id == owner_id)
{
// Don't mute own gestures, if they're not muted.
if (owner_id != gAgentID || !gSavedSettings.getBOOL("EnableGestureSoundsSelf"))
if (!gSavedSettings.getBOOL("EnableGestureSounds"))
{
// Don't mute own gestures, if they're not muted.
if (owner_id != gAgentID || !gSavedSettings.getBOOL("EnableGestureSoundsSelf"))
return;
}
}
else if (!gSavedSettings.getBOOL("EnableNongestureSounds"))
{
// Don't mute own non-gestures, if they're not muted.
if (owner_id != gAgentID || !gSavedSettings.getBOOL("EnableNongestureSoundsSelf"))
return;
}

View File

@@ -154,7 +154,7 @@ void LLVoiceRemoteCtrl::draw()
LLIconCtrl* icon = mVoiceVolIcon;
if (icon)
{
icon->setImage(talk_blip_image);
icon->setValue(talk_blip_image);
}
LLFloater* voice_floater = LLFloaterChatterBox::getInstance()->getCurrentVoiceFloater();
@@ -185,7 +185,7 @@ void LLVoiceRemoteCtrl::draw()
LLIconCtrl* voice_channel_icon = findChild<LLIconCtrl>("voice_channel_icon");
if (voice_channel_icon && voice_floater)
{
voice_channel_icon->setImage(voice_floater->getString("voice_icon"));
voice_channel_icon->setValue(voice_floater->getString("voice_icon"));
}
if (voice_channel_bg)

View File

@@ -5,6 +5,10 @@
<slider_bar bottom="-26" follows="top" height="16" increment="0.25" initial_val="2" left="276" max_val="15" min_val="0" name="mouse_sensitivity" width="128"/>
<check_box bottom_delta="-18" follows="top" height="16" label="Invert Mouse" left="148" name="invert_mouse"/>
<check_box bottom_delta="-18" follows="top" height="16" initial_value="false" label="Show Avatar in Mouselook" name="first_person_avatar_visible"/>
<text bottom_delta="-18" follows="top" height="16" name="UI Hidden in mouselook:">UI Hidden in mouselook:</text>
<check_box bottom_delta="-18" follows="top" height="16" control_name="LiruMouselookHidesFloaters" name="mouselook_hides_floaters" label="Floaters"/>
<check_box left_delta="80" bottom_delta="0" follows="top" height="16" control_name="LiruMouselookHidesNotices" name="mouselook_hides_notices" label="Notices"/>
<check_box left="148" bottom_delta="-18" follows="top" height="16" control_name="LiruMouselookHidesMenubar" name="mouselook_hides_menubar" label="Menubar"/>
<text bottom_delta="-30" follows="top" height="10" left="10" name=" Movement Options:">Movement Options:</text>
<check_box bottom_delta="-6" follows="top" height="16" label="Fly/land on holding up/down" left="148" name="automatic_fly"/>
<check_box bottom_delta="-18" follows="top" height="16" label="Allow crouch toggle by holding shift" name="crouch_toggle" control_name="SGShiftCrouchToggle"/>
@@ -13,7 +17,8 @@
<slider bottom_delta="-6" can_edit_text="true" decimal_digits="2" follows="top" width="128" height="16" increment=".025" initial_val="1.57" left="276" max_val="2.97" min_val=".17" name="camera_fov" value="60"/>
<text bottom_delta="-14" follows="top" height="10" left="148" name="Camera Follow Distance:" width="128">Camera Follow Distance:</text>
<slider bottom_delta="-6" can_edit_text="true" control_name="CameraOffsetScale" decimal_digits="2" follows="top" height="16" increment=".025" initial_val="1" left="276" min_val=".5" max_val="3" name="camera_offset_scale" value="1" width="128"/>
<check_box bottom_delta="-24" follows="top" initial_value="false" label="Automatic Edit Camera Movement" left="148" name="edit_camera_movement" tool_tip="Use automatic camera positioning when entering and exiting edit mode"/>
<check_box bottom_delta="-20" follows="top" left="148" control_name="SinguOffsetScrollKeys" label="Scrolling with control and/or shift held adjusts camera position" name="scroll_keys"/>
<check_box bottom_delta="-18" follows="top" label="Automatic Edit Camera Movement" name="edit_camera_movement" tool_tip="Use automatic camera positioning when entering and exiting edit mode"/>
<check_box bottom_delta="-18" follows="top" height="16" initial_value="false" label="Automatic Appearance Camera Movement" left="148" name="appearance_camera_movement" tool_tip="Use automatic camera positioning while in edit mode"/>
<check_box bottom_delta="-18" follows="top" height="16" initial_value="false" label="Unsit Avatar on Camera Reset" left="148" name="unsit_on_camera_reset" tool_tip="Stand up automatically when you press Esc and the camera switches to third person mode"/>
<check_box bottom_delta="-18" follows="top" height="16" label="Disable Camera Constraints" left="148" control_name="DisableCameraConstraints" name="DisableCameraConstraints" tool_tip="Prevent the camera from automatically zooming when you approach walls, objects, etc., too closely."/>