--HG--
branch : product-engine
master
Dmitry Zaporozhan 2009-11-20 19:24:07 +02:00
commit d0c1593d85
418 changed files with 47022 additions and 46391 deletions

View File

@ -23,12 +23,11 @@ else (STANDALONE)
endif (STANDALONE)
if (GOOGLE_PERFTOOLS_FOUND)
set(USE_GOOGLE_PERFTOOLS ON CACHE BOOL "Build with Google PerfTools support.")
# XXX Disable temporarily, until we have compilation issues on 64-bit
# Etch sorted.
set(USE_GOOGLE_PERFTOOLS OFF CACHE BOOL "Build with Google PerfTools support.")
endif (GOOGLE_PERFTOOLS_FOUND)
# XXX Disable temporarily, until we have compilation issues on 64-bit
# Etch sorted.
set(USE_GOOGLE_PERFTOOLS OFF)
if (WINDOWS)
# *TODO -reenable this once we get server usage sorted out
#set(USE_GOOGLE_PERFTOOLS ON)

View File

@ -1,111 +1,111 @@
#!/usr/bin/python
"""\
@file run_build_test.py
@author Nat Goodspeed
@date 2009-09-03
@brief Helper script to allow CMake to run some command after setting
environment variables.
CMake has commands to run an external program. But remember that each CMake
command must be backed by multiple build-system implementations. Unfortunately
it seems CMake can't promise that every target build system can set specified
environment variables before running the external program of interest.
This helper script is a workaround. It simply sets the requested environment
variables and then executes the program specified on the rest of its command
line.
Example:
python run_build_test.py -DFOO=bar myprog somearg otherarg
sets environment variable FOO=bar, then runs:
myprog somearg otherarg
$LicenseInfo:firstyear=2009&license=internal$
Copyright (c) 2009, Linden Research, Inc.
$/LicenseInfo$
"""
import os
import sys
import subprocess
def main(command, libpath=[], vars={}):
"""Pass:
command is a sequence (e.g. a list) of strings. The first item in the list
must be the command name, the rest are its arguments.
libpath is a sequence of directory pathnames. These will be appended to
the platform-specific dynamic library search path environment variable.
vars is a dict of arbitrary (var, value) pairs to be added to the
environment before running 'command'.
This function runs the specified command, waits for it to terminate and
returns its return code. This will be negative if the command terminated
with a signal, else it will be the process's specified exit code.
"""
# Handle platform-dependent libpath first.
if sys.platform == "win32":
lpvars = ["PATH"]
elif sys.platform == "darwin":
lpvars = ["LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH"]
elif sys.platform.startswith("linux"):
lpvars = ["LD_LIBRARY_PATH"]
else:
# No idea what the right pathname might be! But only crump if this
# feature is requested.
if libpath:
raise NotImplemented("run_build_test: unknown platform %s" % sys.platform)
lpvars = []
for var in lpvars:
# Split the existing path. Bear in mind that the variable in question
# might not exist; instead of KeyError, just use an empty string.
dirs = os.environ.get(var, "").split(os.pathsep)
# Append the sequence in libpath
## print "%s += %r" % (var, libpath)
dirs.extend(libpath)
# Now rebuild the path string. This way we use a minimum of separators
# -- and we avoid adding a pointless separator when libpath is empty.
os.environ[var] = os.pathsep.join(dirs)
# Now handle arbitrary environment variables. The tricky part is ensuring
# that all the keys and values we try to pass are actually strings.
## if vars:
## print "Setting:"
## for key, value in vars.iteritems():
## print "%s=%s" % (key, value)
os.environ.update(dict([(str(key), str(value)) for key, value in vars.iteritems()]))
# Run the child process.
## print "Running: %s" % " ".join(command)
return subprocess.call(command)
if __name__ == "__main__":
from optparse import OptionParser
parser = OptionParser(usage="usage: %prog [options] command args...")
# We want optparse support for the options we ourselves handle -- but we
# DO NOT want it looking at options for the executable we intend to run,
# rejecting them as invalid because we don't define them. So configure the
# parser to stop looking for options as soon as it sees the first
# positional argument (traditional Unix syntax).
parser.disable_interspersed_args()
parser.add_option("-D", "--define", dest="vars", default=[], action="append",
metavar="VAR=value",
help="Add VAR=value to the env variables defined")
parser.add_option("-l", "--libpath", dest="libpath", default=[], action="append",
metavar="DIR",
help="Add DIR to the platform-dependent DLL search path")
opts, args = parser.parse_args()
# What we have in opts.vars is a list of strings of the form "VAR=value"
# or possibly just "VAR". What we want is a dict. We can build that dict by
# constructing a list of ["VAR", "value"] pairs -- so split each
# "VAR=value" string on the '=' sign (but only once, in case we have
# "VAR=some=user=string"). To handle the case of just "VAR", append "" to
# the list returned by split(), then slice off anything after the pair we
# want.
rc = main(command=args, libpath=opts.libpath,
vars=dict([(pair.split('=', 1) + [""])[:2] for pair in opts.vars]))
if rc not in (None, 0):
print >>sys.stderr, "Failure running: %s" % " ".join(args)
print >>sys.stderr, "Error: %s" % rc
sys.exit((rc < 0) and 255 or rc)
#!/usr/bin/python
"""\
@file run_build_test.py
@author Nat Goodspeed
@date 2009-09-03
@brief Helper script to allow CMake to run some command after setting
environment variables.
CMake has commands to run an external program. But remember that each CMake
command must be backed by multiple build-system implementations. Unfortunately
it seems CMake can't promise that every target build system can set specified
environment variables before running the external program of interest.
This helper script is a workaround. It simply sets the requested environment
variables and then executes the program specified on the rest of its command
line.
Example:
python run_build_test.py -DFOO=bar myprog somearg otherarg
sets environment variable FOO=bar, then runs:
myprog somearg otherarg
$LicenseInfo:firstyear=2009&license=internal$
Copyright (c) 2009, Linden Research, Inc.
$/LicenseInfo$
"""
import os
import sys
import subprocess
def main(command, libpath=[], vars={}):
"""Pass:
command is a sequence (e.g. a list) of strings. The first item in the list
must be the command name, the rest are its arguments.
libpath is a sequence of directory pathnames. These will be appended to
the platform-specific dynamic library search path environment variable.
vars is a dict of arbitrary (var, value) pairs to be added to the
environment before running 'command'.
This function runs the specified command, waits for it to terminate and
returns its return code. This will be negative if the command terminated
with a signal, else it will be the process's specified exit code.
"""
# Handle platform-dependent libpath first.
if sys.platform == "win32":
lpvars = ["PATH"]
elif sys.platform == "darwin":
lpvars = ["LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH"]
elif sys.platform.startswith("linux"):
lpvars = ["LD_LIBRARY_PATH"]
else:
# No idea what the right pathname might be! But only crump if this
# feature is requested.
if libpath:
raise NotImplemented("run_build_test: unknown platform %s" % sys.platform)
lpvars = []
for var in lpvars:
# Split the existing path. Bear in mind that the variable in question
# might not exist; instead of KeyError, just use an empty string.
dirs = os.environ.get(var, "").split(os.pathsep)
# Append the sequence in libpath
## print "%s += %r" % (var, libpath)
dirs.extend(libpath)
# Now rebuild the path string. This way we use a minimum of separators
# -- and we avoid adding a pointless separator when libpath is empty.
os.environ[var] = os.pathsep.join(dirs)
# Now handle arbitrary environment variables. The tricky part is ensuring
# that all the keys and values we try to pass are actually strings.
## if vars:
## print "Setting:"
## for key, value in vars.iteritems():
## print "%s=%s" % (key, value)
os.environ.update(dict([(str(key), str(value)) for key, value in vars.iteritems()]))
# Run the child process.
## print "Running: %s" % " ".join(command)
return subprocess.call(command)
if __name__ == "__main__":
from optparse import OptionParser
parser = OptionParser(usage="usage: %prog [options] command args...")
# We want optparse support for the options we ourselves handle -- but we
# DO NOT want it looking at options for the executable we intend to run,
# rejecting them as invalid because we don't define them. So configure the
# parser to stop looking for options as soon as it sees the first
# positional argument (traditional Unix syntax).
parser.disable_interspersed_args()
parser.add_option("-D", "--define", dest="vars", default=[], action="append",
metavar="VAR=value",
help="Add VAR=value to the env variables defined")
parser.add_option("-l", "--libpath", dest="libpath", default=[], action="append",
metavar="DIR",
help="Add DIR to the platform-dependent DLL search path")
opts, args = parser.parse_args()
# What we have in opts.vars is a list of strings of the form "VAR=value"
# or possibly just "VAR". What we want is a dict. We can build that dict by
# constructing a list of ["VAR", "value"] pairs -- so split each
# "VAR=value" string on the '=' sign (but only once, in case we have
# "VAR=some=user=string"). To handle the case of just "VAR", append "" to
# the list returned by split(), then slice off anything after the pair we
# want.
rc = main(command=args, libpath=opts.libpath,
vars=dict([(pair.split('=', 1) + [""])[:2] for pair in opts.vars]))
if rc not in (None, 0):
print >>sys.stderr, "Failure running: %s" % " ".join(args)
print >>sys.stderr, "Error: %s" % rc
sys.exit((rc < 0) and 255 or rc)

View File

@ -9,6 +9,7 @@ include(Linking)
include(Boost)
include(Pth)
include(LLSharedLibs)
include(GooglePerfTools)
include(Copy3rdPartyLibs)
include_directories(
@ -259,6 +260,7 @@ target_link_libraries(
${BOOST_PROGRAM_OPTIONS_LIBRARY}
${BOOST_REGEX_LIBRARY}
${PTH_LIBRARIES}
${GOOGLE_PERFTOOLS_LIBRARIES}
)
add_dependencies(llcommon stage_third_party_libs)

View File

@ -1,63 +1,63 @@
/**
* @file llallocator.h
* @brief Declaration of the LLAllocator class.
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 2009-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_LLALLOCATOR_H
#define LL_LLALLOCATOR_H
#include <string>
#include "llmemtype.h"
#include "llallocator_heap_profile.h"
class LL_COMMON_API LLAllocator {
friend class LLMemoryView;
friend class LLMemType;
private:
static void pushMemType(S32 type);
static S32 popMemType();
public:
void setProfilingEnabled(bool should_enable);
static bool isProfiling();
LLAllocatorHeapProfile const & getProfile();
private:
std::string getRawProfile();
private:
LLAllocatorHeapProfile mProf;
};
#endif // LL_LLALLOCATOR_H
/**
* @file llallocator.h
* @brief Declaration of the LLAllocator class.
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 2009-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_LLALLOCATOR_H
#define LL_LLALLOCATOR_H
#include <string>
#include "llmemtype.h"
#include "llallocator_heap_profile.h"
class LL_COMMON_API LLAllocator {
friend class LLMemoryView;
friend class LLMemType;
private:
static void pushMemType(S32 type);
static S32 popMemType();
public:
void setProfilingEnabled(bool should_enable);
static bool isProfiling();
LLAllocatorHeapProfile const & getProfile();
private:
std::string getRawProfile();
private:
LLAllocatorHeapProfile mProf;
};
#endif // LL_LLALLOCATOR_H

View File

@ -1,149 +1,149 @@
/**
* @file llcoros.h
* @author Nat Goodspeed
* @date 2009-06-02
* @brief Manage running boost::coroutine instances
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
* Copyright (c) 2009, Linden Research, Inc.
* $/LicenseInfo$
*/
#if ! defined(LL_LLCOROS_H)
#define LL_LLCOROS_H
#include <boost/coroutine/coroutine.hpp>
#include "llsingleton.h"
#include <boost/ptr_container/ptr_map.hpp>
#include <string>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/iteration/local.hpp>
#include <stdexcept>
/**
* Registry of named Boost.Coroutine instances
*
* The Boost.Coroutine library supports the general case of a coroutine
* accepting arbitrary parameters and yielding multiple (sets of) results. For
* such use cases, it's natural for the invoking code to retain the coroutine
* instance: the consumer repeatedly calls into the coroutine, perhaps passing
* new parameter values, prompting it to yield its next result.
*
* Our typical coroutine usage is different, though. For us, coroutines
* provide an alternative to the @c Responder pattern. Our typical coroutine
* has @c void return, invoked in fire-and-forget mode: the handler for some
* user gesture launches the coroutine and promptly returns to the main loop.
* The coroutine initiates some action that will take multiple frames (e.g. a
* capability request), waits for its result, processes it and silently steals
* away.
*
* This usage poses two (related) problems:
*
* # Who should own the coroutine instance? If it's simply local to the
* handler code that launches it, return from the handler will destroy the
* coroutine object, terminating the coroutine.
* # Once the coroutine terminates, in whatever way, who's responsible for
* cleaning up the coroutine object?
*
* LLCoros is a Singleton collection of currently-active coroutine instances.
* Each has a name. You ask LLCoros to launch a new coroutine with a suggested
* name prefix; from your prefix it generates a distinct name, registers the
* new coroutine and returns the actual name.
*
* The name can be used to kill off the coroutine prematurely, if needed. It
* can also provide diagnostic info: we can look up the name of the
* currently-running coroutine.
*
* Finally, the next frame ("mainloop" event) after the coroutine terminates,
* LLCoros will notice its demise and destroy it.
*/
class LL_COMMON_API LLCoros: public LLSingleton<LLCoros>
{
public:
/// Canonical boost::coroutines::coroutine signature we use
typedef boost::coroutines::coroutine<void()> coro;
/// Canonical 'self' type
typedef coro::self self;
/**
* Create and start running a new coroutine with specified name. The name
* string you pass is a suggestion; it will be tweaked for uniqueness. The
* actual name is returned to you.
*
* Usage looks like this, for (e.g.) two coroutine parameters:
* @code
* class MyClass
* {
* public:
* ...
* // Do NOT NOT NOT accept reference params other than 'self'!
* // Pass by value only!
* void myCoroutineMethod(LLCoros::self& self, std::string, LLSD);
* ...
* };
* ...
* std::string name = LLCoros::instance().launch(
* "mycoro", boost::bind(&MyClass::myCoroutineMethod, this, _1,
* "somestring", LLSD(17));
* @endcode
*
* Your function/method must accept LLCoros::self& as its first parameter.
* It can accept any other parameters you want -- but ONLY BY VALUE!
* Other reference parameters are a BAD IDEA! You Have Been Warned. See
* DEV-32777 comments for an explanation.
*
* Pass a callable that accepts the single LLCoros::self& parameter. It
* may work to pass a free function whose only parameter is 'self'; for
* all other cases use boost::bind(). Of course, for a non-static class
* method, the first parameter must be the class instance. Use the
* placeholder _1 for the 'self' parameter. Any other parameters should be
* passed via the bind() expression.
*
* launch() tweaks the suggested name so it won't collide with any
* existing coroutine instance, creates the coroutine instance, registers
* it with the tweaked name and runs it until its first wait. At that
* point it returns the tweaked name.
*/
template <typename CALLABLE>
std::string launch(const std::string& prefix, const CALLABLE& callable)
{
return launchImpl(prefix, new coro(callable));
}
/**
* Abort a running coroutine by name. Normally, when a coroutine either
* runs to completion or terminates with an exception, LLCoros quietly
* cleans it up. This is for use only when you must explicitly interrupt
* one prematurely. Returns @c true if the specified name was found and
* still running at the time.
*/
bool kill(const std::string& name);
/**
* From within a coroutine, pass its @c self object to look up the
* (tweaked) name string by which this coroutine is registered. Returns
* the empty string if not found (e.g. if the coroutine was launched by
* hand rather than using LLCoros::launch()).
*/
template <typename COROUTINE_SELF>
std::string getName(const COROUTINE_SELF& self) const
{
return getNameByID(self.get_id());
}
/// getName() by self.get_id()
std::string getNameByID(const void* self_id) const;
private:
friend class LLSingleton<LLCoros>;
LLCoros();
std::string launchImpl(const std::string& prefix, coro* newCoro);
std::string generateDistinctName(const std::string& prefix) const;
bool cleanup(const LLSD&);
typedef boost::ptr_map<std::string, coro> CoroMap;
CoroMap mCoros;
};
#endif /* ! defined(LL_LLCOROS_H) */
/**
* @file llcoros.h
* @author Nat Goodspeed
* @date 2009-06-02
* @brief Manage running boost::coroutine instances
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
* Copyright (c) 2009, Linden Research, Inc.
* $/LicenseInfo$
*/
#if ! defined(LL_LLCOROS_H)
#define LL_LLCOROS_H
#include <boost/coroutine/coroutine.hpp>
#include "llsingleton.h"
#include <boost/ptr_container/ptr_map.hpp>
#include <string>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/iteration/local.hpp>
#include <stdexcept>
/**
* Registry of named Boost.Coroutine instances
*
* The Boost.Coroutine library supports the general case of a coroutine
* accepting arbitrary parameters and yielding multiple (sets of) results. For
* such use cases, it's natural for the invoking code to retain the coroutine
* instance: the consumer repeatedly calls into the coroutine, perhaps passing
* new parameter values, prompting it to yield its next result.
*
* Our typical coroutine usage is different, though. For us, coroutines
* provide an alternative to the @c Responder pattern. Our typical coroutine
* has @c void return, invoked in fire-and-forget mode: the handler for some
* user gesture launches the coroutine and promptly returns to the main loop.
* The coroutine initiates some action that will take multiple frames (e.g. a
* capability request), waits for its result, processes it and silently steals
* away.
*
* This usage poses two (related) problems:
*
* # Who should own the coroutine instance? If it's simply local to the
* handler code that launches it, return from the handler will destroy the
* coroutine object, terminating the coroutine.
* # Once the coroutine terminates, in whatever way, who's responsible for
* cleaning up the coroutine object?
*
* LLCoros is a Singleton collection of currently-active coroutine instances.
* Each has a name. You ask LLCoros to launch a new coroutine with a suggested
* name prefix; from your prefix it generates a distinct name, registers the
* new coroutine and returns the actual name.
*
* The name can be used to kill off the coroutine prematurely, if needed. It
* can also provide diagnostic info: we can look up the name of the
* currently-running coroutine.
*
* Finally, the next frame ("mainloop" event) after the coroutine terminates,
* LLCoros will notice its demise and destroy it.
*/
class LL_COMMON_API LLCoros: public LLSingleton<LLCoros>
{
public:
/// Canonical boost::coroutines::coroutine signature we use
typedef boost::coroutines::coroutine<void()> coro;
/// Canonical 'self' type
typedef coro::self self;
/**
* Create and start running a new coroutine with specified name. The name
* string you pass is a suggestion; it will be tweaked for uniqueness. The
* actual name is returned to you.
*
* Usage looks like this, for (e.g.) two coroutine parameters:
* @code
* class MyClass
* {
* public:
* ...
* // Do NOT NOT NOT accept reference params other than 'self'!
* // Pass by value only!
* void myCoroutineMethod(LLCoros::self& self, std::string, LLSD);
* ...
* };
* ...
* std::string name = LLCoros::instance().launch(
* "mycoro", boost::bind(&MyClass::myCoroutineMethod, this, _1,
* "somestring", LLSD(17));
* @endcode
*
* Your function/method must accept LLCoros::self& as its first parameter.
* It can accept any other parameters you want -- but ONLY BY VALUE!
* Other reference parameters are a BAD IDEA! You Have Been Warned. See
* DEV-32777 comments for an explanation.
*
* Pass a callable that accepts the single LLCoros::self& parameter. It
* may work to pass a free function whose only parameter is 'self'; for
* all other cases use boost::bind(). Of course, for a non-static class
* method, the first parameter must be the class instance. Use the
* placeholder _1 for the 'self' parameter. Any other parameters should be
* passed via the bind() expression.
*
* launch() tweaks the suggested name so it won't collide with any
* existing coroutine instance, creates the coroutine instance, registers
* it with the tweaked name and runs it until its first wait. At that
* point it returns the tweaked name.
*/
template <typename CALLABLE>
std::string launch(const std::string& prefix, const CALLABLE& callable)
{
return launchImpl(prefix, new coro(callable));
}
/**
* Abort a running coroutine by name. Normally, when a coroutine either
* runs to completion or terminates with an exception, LLCoros quietly
* cleans it up. This is for use only when you must explicitly interrupt
* one prematurely. Returns @c true if the specified name was found and
* still running at the time.
*/
bool kill(const std::string& name);
/**
* From within a coroutine, pass its @c self object to look up the
* (tweaked) name string by which this coroutine is registered. Returns
* the empty string if not found (e.g. if the coroutine was launched by
* hand rather than using LLCoros::launch()).
*/
template <typename COROUTINE_SELF>
std::string getName(const COROUTINE_SELF& self) const
{
return getNameByID(self.get_id());
}
/// getName() by self.get_id()
std::string getNameByID(const void* self_id) const;
private:
friend class LLSingleton<LLCoros>;
LLCoros();
std::string launchImpl(const std::string& prefix, coro* newCoro);
std::string generateDistinctName(const std::string& prefix) const;
bool cleanup(const LLSD&);
typedef boost::ptr_map<std::string, coro> CoroMap;
CoroMap mCoros;
};
#endif /* ! defined(LL_LLCOROS_H) */

View File

@ -1,317 +1,317 @@
/**
* @file llfasttimer.h
* @brief Declaration of a fast timer.
*
* $LicenseInfo:firstyear=2004&license=viewergpl$
*
* Copyright (c) 2004-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_FASTTIMER_H
#define LL_FASTTIMER_H
#include "llinstancetracker.h"
#define FAST_TIMER_ON 1
#if LL_WINDOWS
// shift off lower 8 bits for lower resolution but longer term timing
// on 1Ghz machine, a 32-bit word will hold ~1000 seconds of timing
inline U32 get_cpu_clock_count_32()
{
U32 ret_val;
__asm
{
_emit 0x0f
_emit 0x31
shr eax,8
shl edx,24
or eax, edx
mov dword ptr [ret_val], eax
}
return ret_val;
}
// return full timer value, still shifted by 8 bits
inline U64 get_cpu_clock_count_64()
{
U64 ret_val;
__asm
{
_emit 0x0f
_emit 0x31
mov eax,eax
mov edx,edx
mov dword ptr [ret_val+4], edx
mov dword ptr [ret_val], eax
}
return ret_val >> 8;
}
#endif // LL_WINDOWS
#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__))
inline U32 get_cpu_clock_count_32()
{
U64 x;
__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
return (U32)x >> 8;
}
inline U32 get_cpu_clock_count_64()
{
U64 x;
__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
return x >> 8;
}
#endif
#if ( LL_DARWIN && !(defined(__i386__) || defined(__amd64__))) || (LL_SOLARIS && defined(__sparc__))
//
// Mac PPC (deprecated) & Solaris SPARC implementation of CPU clock
//
// Just use gettimeofday implementation for now
inline U32 get_cpu_clock_count_32()
{
return (U32)get_clock_count();
}
inline U32 get_cpu_clock_count_64()
{
return get_clock_count();
}
#endif
class LLMutex;
#include <queue>
#include "llsd.h"
class LL_COMMON_API LLFastTimer
{
public:
// stores a "named" timer instance to be reused via multiple LLFastTimer stack instances
class LL_COMMON_API NamedTimer
: public LLInstanceTracker<NamedTimer>
{
friend class DeclareTimer;
public:
~NamedTimer();
enum { HISTORY_NUM = 60 };
const std::string& getName() const { return mName; }
NamedTimer* getParent() const { return mParent; }
void setParent(NamedTimer* parent);
S32 getDepth();
std::string getToolTip(S32 history_index = -1);
typedef std::vector<NamedTimer*>::const_iterator child_const_iter;
child_const_iter beginChildren();
child_const_iter endChildren();
std::vector<NamedTimer*>& getChildren();
void setCollapsed(bool collapsed) { mCollapsed = collapsed; }
bool getCollapsed() const { return mCollapsed; }
U32 getCountAverage() const { return mCountAverage; }
U32 getCallAverage() const { return mCallAverage; }
U32 getHistoricalCount(S32 history_index = 0) const;
U32 getHistoricalCalls(S32 history_index = 0) const;
static NamedTimer& getRootNamedTimer();
struct FrameState
{
FrameState(NamedTimer* timerp);
U32 mSelfTimeCounter;
U32 mCalls;
FrameState* mParent; // info for caller timer
FrameState* mLastCaller; // used to bootstrap tree construction
NamedTimer* mTimer;
U16 mActiveCount; // number of timers with this ID active on stack
bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame
};
S32 getFrameStateIndex() const { return mFrameStateIndex; }
FrameState& getFrameState() const;
private:
friend class LLFastTimer;
friend class NamedTimerFactory;
//
// methods
//
NamedTimer(const std::string& name);
// recursive call to gather total time from children
static void accumulateTimings();
// updates cumulative times and hierarchy,
// can be called multiple times in a frame, at any point
static void processTimes();
static void buildHierarchy();
static void resetFrame();
static void reset();
//
// members
//
S32 mFrameStateIndex;
std::string mName;
U32 mTotalTimeCounter;
U32 mCountAverage;
U32 mCallAverage;
U32* mCountHistory;
U32* mCallHistory;
// tree structure
NamedTimer* mParent; // NamedTimer of caller(parent)
std::vector<NamedTimer*> mChildren;
bool mCollapsed; // don't show children
bool mNeedsSorting; // sort children whenever child added
};
// used to statically declare a new named timer
class LL_COMMON_API DeclareTimer
: public LLInstanceTracker<DeclareTimer>
{
public:
DeclareTimer(const std::string& name, bool open);
DeclareTimer(const std::string& name);
static void updateCachedPointers();
// convertable to NamedTimer::FrameState for convenient usage of LLFastTimer(declared_timer)
operator NamedTimer::FrameState&() { return *mFrameState; }
private:
NamedTimer& mTimer;
NamedTimer::FrameState* mFrameState;
};
public:
static LLMutex* sLogLock;
static std::queue<LLSD> sLogQueue;
static BOOL sLog;
static BOOL sMetricLog;
typedef std::vector<NamedTimer::FrameState> info_list_t;
static info_list_t& getFrameStateList();
enum RootTimerMarker { ROOT };
LLFastTimer(RootTimerMarker);
LLFastTimer(NamedTimer::FrameState& timer)
: mFrameState(&timer)
{
#if FAST_TIMER_ON
NamedTimer::FrameState* frame_state = &timer;
U32 cur_time = get_cpu_clock_count_32();
mStartSelfTime = cur_time;
mStartTotalTime = cur_time;
frame_state->mActiveCount++;
frame_state->mCalls++;
// keep current parent as long as it is active when we are
frame_state->mMoveUpTree |= (frame_state->mParent->mActiveCount == 0);
mLastTimer = sCurTimer;
sCurTimer = this;
#endif
}
~LLFastTimer()
{
#if FAST_TIMER_ON
NamedTimer::FrameState* frame_state = mFrameState;
U32 cur_time = get_cpu_clock_count_32();
frame_state->mSelfTimeCounter += cur_time - mStartSelfTime;
frame_state->mActiveCount--;
LLFastTimer* last_timer = mLastTimer;
sCurTimer = last_timer;
// store last caller to bootstrap tree creation
frame_state->mLastCaller = last_timer->mFrameState;
// we are only tracking self time, so subtract our total time delta from parents
U32 total_time = cur_time - mStartTotalTime;
last_timer->mStartSelfTime += total_time;
#endif
}
// call this once a frame to reset timers
static void nextFrame();
// dumps current cumulative frame stats to log
// call nextFrame() to reset timers
static void dumpCurTimes();
// call this to reset timer hierarchy, averages, etc.
static void reset();
static U64 countsPerSecond();
static S32 getLastFrameIndex() { return sLastFrameIndex; }
static S32 getCurFrameIndex() { return sCurFrameIndex; }
static void writeLog(std::ostream& os);
static const NamedTimer* getTimerByName(const std::string& name);
public:
static bool sPauseHistory;
static bool sResetHistory;
private:
typedef std::vector<LLFastTimer*> timer_stack_t;
static LLFastTimer* sCurTimer;
static S32 sCurFrameIndex;
static S32 sLastFrameIndex;
static U64 sLastFrameTime;
static info_list_t* sTimerInfos;
U32 mStartSelfTime; // start time + time of all child timers
U32 mStartTotalTime; // start time + time of all child timers
NamedTimer::FrameState* mFrameState;
LLFastTimer* mLastTimer;
};
#endif // LL_LLFASTTIMER_H
/**
* @file llfasttimer.h
* @brief Declaration of a fast timer.
*
* $LicenseInfo:firstyear=2004&license=viewergpl$
*
* Copyright (c) 2004-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_FASTTIMER_H
#define LL_FASTTIMER_H
#include "llinstancetracker.h"
#define FAST_TIMER_ON 1
#if LL_WINDOWS
// shift off lower 8 bits for lower resolution but longer term timing
// on 1Ghz machine, a 32-bit word will hold ~1000 seconds of timing
inline U32 get_cpu_clock_count_32()
{
U32 ret_val;
__asm
{
_emit 0x0f
_emit 0x31
shr eax,8
shl edx,24
or eax, edx
mov dword ptr [ret_val], eax
}
return ret_val;
}
// return full timer value, still shifted by 8 bits
inline U64 get_cpu_clock_count_64()
{
U64 ret_val;
__asm
{
_emit 0x0f
_emit 0x31
mov eax,eax
mov edx,edx
mov dword ptr [ret_val+4], edx
mov dword ptr [ret_val], eax
}
return ret_val >> 8;
}
#endif // LL_WINDOWS
#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__))
inline U32 get_cpu_clock_count_32()
{
U64 x;
__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
return (U32)x >> 8;
}
inline U32 get_cpu_clock_count_64()
{
U64 x;
__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
return x >> 8;
}
#endif
#if ( LL_DARWIN && !(defined(__i386__) || defined(__amd64__))) || (LL_SOLARIS && defined(__sparc__))
//
// Mac PPC (deprecated) & Solaris SPARC implementation of CPU clock
//
// Just use gettimeofday implementation for now
inline U32 get_cpu_clock_count_32()
{
return (U32)get_clock_count();
}
inline U32 get_cpu_clock_count_64()
{
return get_clock_count();
}
#endif
class LLMutex;
#include <queue>
#include "llsd.h"
class LL_COMMON_API LLFastTimer
{
public:
// stores a "named" timer instance to be reused via multiple LLFastTimer stack instances
class LL_COMMON_API NamedTimer
: public LLInstanceTracker<NamedTimer>
{
friend class DeclareTimer;
public:
~NamedTimer();
enum { HISTORY_NUM = 60 };
const std::string& getName() const { return mName; }
NamedTimer* getParent() const { return mParent; }
void setParent(NamedTimer* parent);
S32 getDepth();
std::string getToolTip(S32 history_index = -1);
typedef std::vector<NamedTimer*>::const_iterator child_const_iter;
child_const_iter beginChildren();
child_const_iter endChildren();
std::vector<NamedTimer*>& getChildren();
void setCollapsed(bool collapsed) { mCollapsed = collapsed; }
bool getCollapsed() const { return mCollapsed; }
U32 getCountAverage() const { return mCountAverage; }
U32 getCallAverage() const { return mCallAverage; }
U32 getHistoricalCount(S32 history_index = 0) const;
U32 getHistoricalCalls(S32 history_index = 0) const;
static NamedTimer& getRootNamedTimer();
struct FrameState
{
FrameState(NamedTimer* timerp);
U32 mSelfTimeCounter;
U32 mCalls;
FrameState* mParent; // info for caller timer
FrameState* mLastCaller; // used to bootstrap tree construction
NamedTimer* mTimer;
U16 mActiveCount; // number of timers with this ID active on stack
bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame
};
S32 getFrameStateIndex() const { return mFrameStateIndex; }
FrameState& getFrameState() const;
private:
friend class LLFastTimer;
friend class NamedTimerFactory;
//
// methods
//
NamedTimer(const std::string& name);
// recursive call to gather total time from children
static void accumulateTimings();
// updates cumulative times and hierarchy,
// can be called multiple times in a frame, at any point
static void processTimes();
static void buildHierarchy();
static void resetFrame();
static void reset();
//
// members
//
S32 mFrameStateIndex;
std::string mName;
U32 mTotalTimeCounter;
U32 mCountAverage;
U32 mCallAverage;
U32* mCountHistory;
U32* mCallHistory;
// tree structure
NamedTimer* mParent; // NamedTimer of caller(parent)
std::vector<NamedTimer*> mChildren;
bool mCollapsed; // don't show children
bool mNeedsSorting; // sort children whenever child added
};
// used to statically declare a new named timer
class LL_COMMON_API DeclareTimer
: public LLInstanceTracker<DeclareTimer>
{
public:
DeclareTimer(const std::string& name, bool open);
DeclareTimer(const std::string& name);
static void updateCachedPointers();
// convertable to NamedTimer::FrameState for convenient usage of LLFastTimer(declared_timer)
operator NamedTimer::FrameState&() { return *mFrameState; }
private:
NamedTimer& mTimer;
NamedTimer::FrameState* mFrameState;
};
public:
static LLMutex* sLogLock;
static std::queue<LLSD> sLogQueue;
static BOOL sLog;
static BOOL sMetricLog;
typedef std::vector<NamedTimer::FrameState> info_list_t;
static info_list_t& getFrameStateList();
enum RootTimerMarker { ROOT };
LLFastTimer(RootTimerMarker);
LLFastTimer(NamedTimer::FrameState& timer)
: mFrameState(&timer)
{
#if FAST_TIMER_ON
NamedTimer::FrameState* frame_state = &timer;
U32 cur_time = get_cpu_clock_count_32();
mStartSelfTime = cur_time;
mStartTotalTime = cur_time;
frame_state->mActiveCount++;
frame_state->mCalls++;
// keep current parent as long as it is active when we are
frame_state->mMoveUpTree |= (frame_state->mParent->mActiveCount == 0);
mLastTimer = sCurTimer;
sCurTimer = this;
#endif
}
~LLFastTimer()
{
#if FAST_TIMER_ON
NamedTimer::FrameState* frame_state = mFrameState;
U32 cur_time = get_cpu_clock_count_32();
frame_state->mSelfTimeCounter += cur_time - mStartSelfTime;
frame_state->mActiveCount--;
LLFastTimer* last_timer = mLastTimer;
sCurTimer = last_timer;
// store last caller to bootstrap tree creation
frame_state->mLastCaller = last_timer->mFrameState;
// we are only tracking self time, so subtract our total time delta from parents
U32 total_time = cur_time - mStartTotalTime;
last_timer->mStartSelfTime += total_time;
#endif
}
// call this once a frame to reset timers
static void nextFrame();
// dumps current cumulative frame stats to log
// call nextFrame() to reset timers
static void dumpCurTimes();
// call this to reset timer hierarchy, averages, etc.
static void reset();
static U64 countsPerSecond();
static S32 getLastFrameIndex() { return sLastFrameIndex; }
static S32 getCurFrameIndex() { return sCurFrameIndex; }
static void writeLog(std::ostream& os);
static const NamedTimer* getTimerByName(const std::string& name);
public:
static bool sPauseHistory;
static bool sResetHistory;
private:
typedef std::vector<LLFastTimer*> timer_stack_t;
static LLFastTimer* sCurTimer;
static S32 sCurFrameIndex;
static S32 sLastFrameIndex;
static U64 sLastFrameTime;
static info_list_t* sTimerInfos;
U32 mStartSelfTime; // start time + time of all child timers
U32 mStartTotalTime; // start time + time of all child timers
NamedTimer::FrameState* mFrameState;
LLFastTimer* mLastTimer;
};
#endif // LL_LLFASTTIMER_H

View File

@ -1,65 +1,65 @@
/**
* @file llmemory.h
* @brief Memory allocation/deallocation header-stuff goes here.
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-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 LLMEMORY_H
#define LLMEMORY_H
extern S32 gTotalDAlloc;
extern S32 gTotalDAUse;
extern S32 gDACount;
extern void* ll_allocate (size_t size);
extern void ll_release (void *p);
class LL_COMMON_API LLMemory
{
public:
static void initClass();
static void cleanupClass();
static void freeReserve();
// Return the resident set size of the current process, in bytes.
// Return value is zero if not known.
static U64 getCurrentRSS();
private:
static char* reserveMem;
};
// LLRefCount moved to llrefcount.h
// LLPointer moved to llpointer.h
// LLSafeHandle moved to llsafehandle.h
// LLSingleton moved to llsingleton.h
#endif
/**
* @file llmemory.h
* @brief Memory allocation/deallocation header-stuff goes here.
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-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 LLMEMORY_H
#define LLMEMORY_H
extern S32 gTotalDAlloc;
extern S32 gTotalDAUse;
extern S32 gDACount;
extern void* ll_allocate (size_t size);
extern void ll_release (void *p);
class LL_COMMON_API LLMemory
{
public:
static void initClass();
static void cleanupClass();
static void freeReserve();
// Return the resident set size of the current process, in bytes.
// Return value is zero if not known.
static U64 getCurrentRSS();
private:
static char* reserveMem;
};
// LLRefCount moved to llrefcount.h
// LLPointer moved to llpointer.h
// LLSafeHandle moved to llsafehandle.h
// LLSingleton moved to llsingleton.h
#endif

View File

@ -1,248 +1,248 @@
/**
* @file llmemtype.h
* @brief Runtime memory usage debugging utilities.
*
* $LicenseInfo:firstyear=2005&license=viewergpl$
*
* Copyright (c) 2005-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_MEMTYPE_H
#define LL_MEMTYPE_H
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#include "linden_common.h"
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// WARNING: Never commit with MEM_TRACK_MEM == 1
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#define MEM_TRACK_MEM (0 && LL_WINDOWS)
#include <vector>
#define MEM_TYPE_NEW(T)
class LL_COMMON_API LLMemType
{
public:
// class we'll initialize all instances of as
// static members of MemType. Then use
// to construct any new mem type.
class LL_COMMON_API DeclareMemType
{
public:
DeclareMemType(char const * st);
~DeclareMemType();
S32 mID;
char const * mName;
// array so we can map an index ID to Name
static std::vector<char const *> mNameList;
};
LLMemType(DeclareMemType& dt);
~LLMemType();
static char const * getNameFromID(S32 id);
static DeclareMemType MTYPE_INIT;
static DeclareMemType MTYPE_STARTUP;
static DeclareMemType MTYPE_MAIN;
static DeclareMemType MTYPE_FRAME;
static DeclareMemType MTYPE_GATHER_INPUT;
static DeclareMemType MTYPE_JOY_KEY;
static DeclareMemType MTYPE_IDLE;
static DeclareMemType MTYPE_IDLE_PUMP;
static DeclareMemType MTYPE_IDLE_NETWORK;
static DeclareMemType MTYPE_IDLE_UPDATE_REGIONS;
static DeclareMemType MTYPE_IDLE_UPDATE_VIEWER_REGION;
static DeclareMemType MTYPE_IDLE_UPDATE_SURFACE;
static DeclareMemType MTYPE_IDLE_UPDATE_PARCEL_OVERLAY;
static DeclareMemType MTYPE_IDLE_AUDIO;
static DeclareMemType MTYPE_CACHE_PROCESS_PENDING;
static DeclareMemType MTYPE_CACHE_PROCESS_PENDING_ASKS;
static DeclareMemType MTYPE_CACHE_PROCESS_PENDING_REPLIES;
static DeclareMemType MTYPE_MESSAGE_CHECK_ALL;
static DeclareMemType MTYPE_MESSAGE_PROCESS_ACKS;
static DeclareMemType MTYPE_RENDER;
static DeclareMemType MTYPE_SLEEP;
static DeclareMemType MTYPE_NETWORK;
static DeclareMemType MTYPE_PHYSICS;
static DeclareMemType MTYPE_INTERESTLIST;
static DeclareMemType MTYPE_IMAGEBASE;
static DeclareMemType MTYPE_IMAGERAW;
static DeclareMemType MTYPE_IMAGEFORMATTED;
static DeclareMemType MTYPE_APPFMTIMAGE;
static DeclareMemType MTYPE_APPRAWIMAGE;
static DeclareMemType MTYPE_APPAUXRAWIMAGE;
static DeclareMemType MTYPE_DRAWABLE;
static DeclareMemType MTYPE_OBJECT;
static DeclareMemType MTYPE_OBJECT_PROCESS_UPDATE;
static DeclareMemType MTYPE_OBJECT_PROCESS_UPDATE_CORE;
static DeclareMemType MTYPE_DISPLAY;
static DeclareMemType MTYPE_DISPLAY_UPDATE;
static DeclareMemType MTYPE_DISPLAY_UPDATE_CAMERA;
static DeclareMemType MTYPE_DISPLAY_UPDATE_GEOM;
static DeclareMemType MTYPE_DISPLAY_SWAP;
static DeclareMemType MTYPE_DISPLAY_UPDATE_HUD;
static DeclareMemType MTYPE_DISPLAY_GEN_REFLECTION;
static DeclareMemType MTYPE_DISPLAY_IMAGE_UPDATE;
static DeclareMemType MTYPE_DISPLAY_STATE_SORT;
static DeclareMemType MTYPE_DISPLAY_SKY;
static DeclareMemType MTYPE_DISPLAY_RENDER_GEOM;
static DeclareMemType MTYPE_DISPLAY_RENDER_FLUSH;
static DeclareMemType MTYPE_DISPLAY_RENDER_UI;
static DeclareMemType MTYPE_DISPLAY_RENDER_ATTACHMENTS;
static DeclareMemType MTYPE_VERTEX_DATA;
static DeclareMemType MTYPE_VERTEX_CONSTRUCTOR;
static DeclareMemType MTYPE_VERTEX_DESTRUCTOR;
static DeclareMemType MTYPE_VERTEX_CREATE_VERTICES;
static DeclareMemType MTYPE_VERTEX_CREATE_INDICES;
static DeclareMemType MTYPE_VERTEX_DESTROY_BUFFER;
static DeclareMemType MTYPE_VERTEX_DESTROY_INDICES;
static DeclareMemType MTYPE_VERTEX_UPDATE_VERTS;
static DeclareMemType MTYPE_VERTEX_UPDATE_INDICES;
static DeclareMemType MTYPE_VERTEX_ALLOCATE_BUFFER;
static DeclareMemType MTYPE_VERTEX_RESIZE_BUFFER;
static DeclareMemType MTYPE_VERTEX_MAP_BUFFER;
static DeclareMemType MTYPE_VERTEX_MAP_BUFFER_VERTICES;
static DeclareMemType MTYPE_VERTEX_MAP_BUFFER_INDICES;
static DeclareMemType MTYPE_VERTEX_UNMAP_BUFFER;
static DeclareMemType MTYPE_VERTEX_SET_STRIDE;
static DeclareMemType MTYPE_VERTEX_SET_BUFFER;
static DeclareMemType MTYPE_VERTEX_SETUP_VERTEX_BUFFER;
static DeclareMemType MTYPE_VERTEX_CLEANUP_CLASS;
static DeclareMemType MTYPE_SPACE_PARTITION;
static DeclareMemType MTYPE_PIPELINE;
static DeclareMemType MTYPE_PIPELINE_INIT;
static DeclareMemType MTYPE_PIPELINE_CREATE_BUFFERS;
static DeclareMemType MTYPE_PIPELINE_RESTORE_GL;
static DeclareMemType MTYPE_PIPELINE_UNLOAD_SHADERS;
static DeclareMemType MTYPE_PIPELINE_LIGHTING_DETAIL;
static DeclareMemType MTYPE_PIPELINE_GET_POOL_TYPE;
static DeclareMemType MTYPE_PIPELINE_ADD_POOL;
static DeclareMemType MTYPE_PIPELINE_ALLOCATE_DRAWABLE;
static DeclareMemType MTYPE_PIPELINE_ADD_OBJECT;
static DeclareMemType MTYPE_PIPELINE_CREATE_OBJECTS;
static DeclareMemType MTYPE_PIPELINE_UPDATE_MOVE;
static DeclareMemType MTYPE_PIPELINE_UPDATE_GEOM;
static DeclareMemType MTYPE_PIPELINE_MARK_VISIBLE;
static DeclareMemType MTYPE_PIPELINE_MARK_MOVED;
static DeclareMemType MTYPE_PIPELINE_MARK_SHIFT;
static DeclareMemType MTYPE_PIPELINE_SHIFT_OBJECTS;
static DeclareMemType MTYPE_PIPELINE_MARK_TEXTURED;
static DeclareMemType MTYPE_PIPELINE_MARK_REBUILD;
static DeclareMemType MTYPE_PIPELINE_UPDATE_CULL;
static DeclareMemType MTYPE_PIPELINE_STATE_SORT;
static DeclareMemType MTYPE_PIPELINE_POST_SORT;
static DeclareMemType MTYPE_PIPELINE_RENDER_HUD_ELS;
static DeclareMemType MTYPE_PIPELINE_RENDER_HL;
static DeclareMemType MTYPE_PIPELINE_RENDER_GEOM;
static DeclareMemType MTYPE_PIPELINE_RENDER_GEOM_DEFFERRED;
static DeclareMemType MTYPE_PIPELINE_RENDER_GEOM_POST_DEF;
static DeclareMemType MTYPE_PIPELINE_RENDER_GEOM_SHADOW;
static DeclareMemType MTYPE_PIPELINE_RENDER_SELECT;
static DeclareMemType MTYPE_PIPELINE_REBUILD_POOLS;
static DeclareMemType MTYPE_PIPELINE_QUICK_LOOKUP;
static DeclareMemType MTYPE_PIPELINE_RENDER_OBJECTS;
static DeclareMemType MTYPE_PIPELINE_GENERATE_IMPOSTOR;
static DeclareMemType MTYPE_PIPELINE_RENDER_BLOOM;
static DeclareMemType MTYPE_UPKEEP_POOLS;
static DeclareMemType MTYPE_AVATAR;
static DeclareMemType MTYPE_AVATAR_MESH;
static DeclareMemType MTYPE_PARTICLES;
static DeclareMemType MTYPE_REGIONS;
static DeclareMemType MTYPE_INVENTORY;
static DeclareMemType MTYPE_INVENTORY_DRAW;
static DeclareMemType MTYPE_INVENTORY_BUILD_NEW_VIEWS;
static DeclareMemType MTYPE_INVENTORY_DO_FOLDER;
static DeclareMemType MTYPE_INVENTORY_POST_BUILD;
static DeclareMemType MTYPE_INVENTORY_FROM_XML;
static DeclareMemType MTYPE_INVENTORY_CREATE_NEW_ITEM;
static DeclareMemType MTYPE_INVENTORY_VIEW_INIT;
static DeclareMemType MTYPE_INVENTORY_VIEW_SHOW;
static DeclareMemType MTYPE_INVENTORY_VIEW_TOGGLE;
static DeclareMemType MTYPE_ANIMATION;
static DeclareMemType MTYPE_VOLUME;
static DeclareMemType MTYPE_PRIMITIVE;
static DeclareMemType MTYPE_SCRIPT;
static DeclareMemType MTYPE_SCRIPT_RUN;
static DeclareMemType MTYPE_SCRIPT_BYTECODE;
static DeclareMemType MTYPE_IO_PUMP;
static DeclareMemType MTYPE_IO_TCP;
static DeclareMemType MTYPE_IO_BUFFER;
static DeclareMemType MTYPE_IO_HTTP_SERVER;
static DeclareMemType MTYPE_IO_SD_SERVER;
static DeclareMemType MTYPE_IO_SD_CLIENT;
static DeclareMemType MTYPE_IO_URL_REQUEST;
static DeclareMemType MTYPE_DIRECTX_INIT;
static DeclareMemType MTYPE_TEMP1;
static DeclareMemType MTYPE_TEMP2;
static DeclareMemType MTYPE_TEMP3;
static DeclareMemType MTYPE_TEMP4;
static DeclareMemType MTYPE_TEMP5;
static DeclareMemType MTYPE_TEMP6;
static DeclareMemType MTYPE_TEMP7;
static DeclareMemType MTYPE_TEMP8;
static DeclareMemType MTYPE_TEMP9;
static DeclareMemType MTYPE_OTHER; // Special; used by display code
S32 mTypeIndex;
};
//----------------------------------------------------------------------------
#endif
/**
* @file llmemtype.h
* @brief Runtime memory usage debugging utilities.
*
* $LicenseInfo:firstyear=2005&license=viewergpl$
*
* Copyright (c) 2005-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_MEMTYPE_H
#define LL_MEMTYPE_H
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#include "linden_common.h"
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// WARNING: Never commit with MEM_TRACK_MEM == 1
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#define MEM_TRACK_MEM (0 && LL_WINDOWS)
#include <vector>
#define MEM_TYPE_NEW(T)
class LL_COMMON_API LLMemType
{
public:
// class we'll initialize all instances of as
// static members of MemType. Then use
// to construct any new mem type.
class LL_COMMON_API DeclareMemType
{
public:
DeclareMemType(char const * st);
~DeclareMemType();
S32 mID;
char const * mName;
// array so we can map an index ID to Name
static std::vector<char const *> mNameList;
};
LLMemType(DeclareMemType& dt);
~LLMemType();
static char const * getNameFromID(S32 id);
static DeclareMemType MTYPE_INIT;
static DeclareMemType MTYPE_STARTUP;
static DeclareMemType MTYPE_MAIN;
static DeclareMemType MTYPE_FRAME;
static DeclareMemType MTYPE_GATHER_INPUT;
static DeclareMemType MTYPE_JOY_KEY;
static DeclareMemType MTYPE_IDLE;
static DeclareMemType MTYPE_IDLE_PUMP;
static DeclareMemType MTYPE_IDLE_NETWORK;
static DeclareMemType MTYPE_IDLE_UPDATE_REGIONS;
static DeclareMemType MTYPE_IDLE_UPDATE_VIEWER_REGION;
static DeclareMemType MTYPE_IDLE_UPDATE_SURFACE;
static DeclareMemType MTYPE_IDLE_UPDATE_PARCEL_OVERLAY;
static DeclareMemType MTYPE_IDLE_AUDIO;
static DeclareMemType MTYPE_CACHE_PROCESS_PENDING;
static DeclareMemType MTYPE_CACHE_PROCESS_PENDING_ASKS;
static DeclareMemType MTYPE_CACHE_PROCESS_PENDING_REPLIES;
static DeclareMemType MTYPE_MESSAGE_CHECK_ALL;
static DeclareMemType MTYPE_MESSAGE_PROCESS_ACKS;
static DeclareMemType MTYPE_RENDER;
static DeclareMemType MTYPE_SLEEP;
static DeclareMemType MTYPE_NETWORK;
static DeclareMemType MTYPE_PHYSICS;
static DeclareMemType MTYPE_INTERESTLIST;
static DeclareMemType MTYPE_IMAGEBASE;
static DeclareMemType MTYPE_IMAGERAW;
static DeclareMemType MTYPE_IMAGEFORMATTED;
static DeclareMemType MTYPE_APPFMTIMAGE;
static DeclareMemType MTYPE_APPRAWIMAGE;
static DeclareMemType MTYPE_APPAUXRAWIMAGE;
static DeclareMemType MTYPE_DRAWABLE;
static DeclareMemType MTYPE_OBJECT;
static DeclareMemType MTYPE_OBJECT_PROCESS_UPDATE;
static DeclareMemType MTYPE_OBJECT_PROCESS_UPDATE_CORE;
static DeclareMemType MTYPE_DISPLAY;
static DeclareMemType MTYPE_DISPLAY_UPDATE;
static DeclareMemType MTYPE_DISPLAY_UPDATE_CAMERA;
static DeclareMemType MTYPE_DISPLAY_UPDATE_GEOM;
static DeclareMemType MTYPE_DISPLAY_SWAP;
static DeclareMemType MTYPE_DISPLAY_UPDATE_HUD;
static DeclareMemType MTYPE_DISPLAY_GEN_REFLECTION;
static DeclareMemType MTYPE_DISPLAY_IMAGE_UPDATE;
static DeclareMemType MTYPE_DISPLAY_STATE_SORT;
static DeclareMemType MTYPE_DISPLAY_SKY;
static DeclareMemType MTYPE_DISPLAY_RENDER_GEOM;
static DeclareMemType MTYPE_DISPLAY_RENDER_FLUSH;
static DeclareMemType MTYPE_DISPLAY_RENDER_UI;
static DeclareMemType MTYPE_DISPLAY_RENDER_ATTACHMENTS;
static DeclareMemType MTYPE_VERTEX_DATA;
static DeclareMemType MTYPE_VERTEX_CONSTRUCTOR;
static DeclareMemType MTYPE_VERTEX_DESTRUCTOR;
static DeclareMemType MTYPE_VERTEX_CREATE_VERTICES;
static DeclareMemType MTYPE_VERTEX_CREATE_INDICES;
static DeclareMemType MTYPE_VERTEX_DESTROY_BUFFER;
static DeclareMemType MTYPE_VERTEX_DESTROY_INDICES;
static DeclareMemType MTYPE_VERTEX_UPDATE_VERTS;
static DeclareMemType MTYPE_VERTEX_UPDATE_INDICES;
static DeclareMemType MTYPE_VERTEX_ALLOCATE_BUFFER;
static DeclareMemType MTYPE_VERTEX_RESIZE_BUFFER;
static DeclareMemType MTYPE_VERTEX_MAP_BUFFER;
static DeclareMemType MTYPE_VERTEX_MAP_BUFFER_VERTICES;
static DeclareMemType MTYPE_VERTEX_MAP_BUFFER_INDICES;
static DeclareMemType MTYPE_VERTEX_UNMAP_BUFFER;
static DeclareMemType MTYPE_VERTEX_SET_STRIDE;
static DeclareMemType MTYPE_VERTEX_SET_BUFFER;
static DeclareMemType MTYPE_VERTEX_SETUP_VERTEX_BUFFER;
static DeclareMemType MTYPE_VERTEX_CLEANUP_CLASS;
static DeclareMemType MTYPE_SPACE_PARTITION;
static DeclareMemType MTYPE_PIPELINE;
static DeclareMemType MTYPE_PIPELINE_INIT;
static DeclareMemType MTYPE_PIPELINE_CREATE_BUFFERS;
static DeclareMemType MTYPE_PIPELINE_RESTORE_GL;
static DeclareMemType MTYPE_PIPELINE_UNLOAD_SHADERS;
static DeclareMemType MTYPE_PIPELINE_LIGHTING_DETAIL;
static DeclareMemType MTYPE_PIPELINE_GET_POOL_TYPE;
static DeclareMemType MTYPE_PIPELINE_ADD_POOL;
static DeclareMemType MTYPE_PIPELINE_ALLOCATE_DRAWABLE;
static DeclareMemType MTYPE_PIPELINE_ADD_OBJECT;
static DeclareMemType MTYPE_PIPELINE_CREATE_OBJECTS;
static DeclareMemType MTYPE_PIPELINE_UPDATE_MOVE;
static DeclareMemType MTYPE_PIPELINE_UPDATE_GEOM;
static DeclareMemType MTYPE_PIPELINE_MARK_VISIBLE;
static DeclareMemType MTYPE_PIPELINE_MARK_MOVED;
static DeclareMemType MTYPE_PIPELINE_MARK_SHIFT;
static DeclareMemType MTYPE_PIPELINE_SHIFT_OBJECTS;
static DeclareMemType MTYPE_PIPELINE_MARK_TEXTURED;
static DeclareMemType MTYPE_PIPELINE_MARK_REBUILD;
static DeclareMemType MTYPE_PIPELINE_UPDATE_CULL;
static DeclareMemType MTYPE_PIPELINE_STATE_SORT;
static DeclareMemType MTYPE_PIPELINE_POST_SORT;
static DeclareMemType MTYPE_PIPELINE_RENDER_HUD_ELS;
static DeclareMemType MTYPE_PIPELINE_RENDER_HL;
static DeclareMemType MTYPE_PIPELINE_RENDER_GEOM;
static DeclareMemType MTYPE_PIPELINE_RENDER_GEOM_DEFFERRED;
static DeclareMemType MTYPE_PIPELINE_RENDER_GEOM_POST_DEF;
static DeclareMemType MTYPE_PIPELINE_RENDER_GEOM_SHADOW;
static DeclareMemType MTYPE_PIPELINE_RENDER_SELECT;
static DeclareMemType MTYPE_PIPELINE_REBUILD_POOLS;
static DeclareMemType MTYPE_PIPELINE_QUICK_LOOKUP;
static DeclareMemType MTYPE_PIPELINE_RENDER_OBJECTS;
static DeclareMemType MTYPE_PIPELINE_GENERATE_IMPOSTOR;
static DeclareMemType MTYPE_PIPELINE_RENDER_BLOOM;
static DeclareMemType MTYPE_UPKEEP_POOLS;
static DeclareMemType MTYPE_AVATAR;
static DeclareMemType MTYPE_AVATAR_MESH;
static DeclareMemType MTYPE_PARTICLES;
static DeclareMemType MTYPE_REGIONS;
static DeclareMemType MTYPE_INVENTORY;
static DeclareMemType MTYPE_INVENTORY_DRAW;
static DeclareMemType MTYPE_INVENTORY_BUILD_NEW_VIEWS;
static DeclareMemType MTYPE_INVENTORY_DO_FOLDER;
static DeclareMemType MTYPE_INVENTORY_POST_BUILD;
static DeclareMemType MTYPE_INVENTORY_FROM_XML;
static DeclareMemType MTYPE_INVENTORY_CREATE_NEW_ITEM;
static DeclareMemType MTYPE_INVENTORY_VIEW_INIT;
static DeclareMemType MTYPE_INVENTORY_VIEW_SHOW;
static DeclareMemType MTYPE_INVENTORY_VIEW_TOGGLE;
static DeclareMemType MTYPE_ANIMATION;
static DeclareMemType MTYPE_VOLUME;
static DeclareMemType MTYPE_PRIMITIVE;
static DeclareMemType MTYPE_SCRIPT;
static DeclareMemType MTYPE_SCRIPT_RUN;
static DeclareMemType MTYPE_SCRIPT_BYTECODE;
static DeclareMemType MTYPE_IO_PUMP;
static DeclareMemType MTYPE_IO_TCP;
static DeclareMemType MTYPE_IO_BUFFER;
static DeclareMemType MTYPE_IO_HTTP_SERVER;
static DeclareMemType MTYPE_IO_SD_SERVER;
static DeclareMemType MTYPE_IO_SD_CLIENT;
static DeclareMemType MTYPE_IO_URL_REQUEST;
static DeclareMemType MTYPE_DIRECTX_INIT;
static DeclareMemType MTYPE_TEMP1;
static DeclareMemType MTYPE_TEMP2;
static DeclareMemType MTYPE_TEMP3;
static DeclareMemType MTYPE_TEMP4;
static DeclareMemType MTYPE_TEMP5;
static DeclareMemType MTYPE_TEMP6;
static DeclareMemType MTYPE_TEMP7;
static DeclareMemType MTYPE_TEMP8;
static DeclareMemType MTYPE_TEMP9;
static DeclareMemType MTYPE_OTHER; // Special; used by display code
S32 mTypeIndex;
};
//----------------------------------------------------------------------------
#endif

View File

@ -1,169 +1,169 @@
/**
* @file llpreprocessor.h
* @brief This file should be included in all Linden Lab files and
* should only contain special preprocessor directives
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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 LLPREPROCESSOR_H
#define LLPREPROCESSOR_H
// Figure out endianness of platform
#ifdef LL_LINUX
#define __ENABLE_WSTRING
#include <endian.h>
#endif // LL_LINUX
#if LL_SOLARIS
# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported.
# define LL_BIG_ENDIAN 1
# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed
# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API
# endif
# include <sys/isa_defs.h> // ensure we know which end is up
#endif // LL_SOLARIS
#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386)))
#define LL_LITTLE_ENDIAN 1
#else
#define LL_BIG_ENDIAN 1
#endif
// Per-compiler switches
#ifdef __GNUC__
#define LL_FORCE_INLINE inline __attribute__((always_inline))
#else
#define LL_FORCE_INLINE __forceinline
#endif
// Figure out differences between compilers
#if defined(__GNUC__)
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#ifndef LL_GNUC
#define LL_GNUC 1
#endif
#elif defined(__MSVC_VER__) || defined(_MSC_VER)
#ifndef LL_MSVC
#define LL_MSVC 1
#endif
#if _MSC_VER < 1400
#define LL_MSVC7 //Visual C++ 2003 or earlier
#endif
#endif
// Deal with minor differences on Unixy OSes.
#if LL_DARWIN || LL_LINUX
// Different name, same functionality.
#define stricmp strcasecmp
#define strnicmp strncasecmp
// Not sure why this is different, but...
#ifndef MAX_PATH
#define MAX_PATH PATH_MAX
#endif // not MAX_PATH
#endif
// Static linking with apr on windows needs to be declared.
#if LL_WINDOWS && !LL_COMMON_LINK_SHARED
#ifndef APR_DECLARE_STATIC
#define APR_DECLARE_STATIC // For APR on Windows
#endif
#ifndef APU_DECLARE_STATIC
#define APU_DECLARE_STATIC // For APR util on Windows
#endif
#endif
#if defined(LL_WINDOWS)
#define BOOST_REGEX_NO_LIB 1
#define CURL_STATICLIB 1
#ifndef XML_STATIC
#define XML_STATIC
#endif
#endif // LL_WINDOWS
// Deal with VC6 problems
#if LL_MSVC
#pragma warning( 3 : 4701 ) // "local variable used without being initialized" Treat this as level 3, not level 4.
#pragma warning( 3 : 4702 ) // "unreachable code" Treat this as level 3, not level 4.
#pragma warning( 3 : 4189 ) // "local variable initialized but not referenced" Treat this as level 3, not level 4.
//#pragma warning( 3 : 4018 ) // "signed/unsigned mismatch" Treat this as level 3, not level 4.
#pragma warning( 3 : 4263 ) // 'function' : member function does not override any base class virtual member function
#pragma warning( 3 : 4264 ) // "'virtual_function' : no override available for virtual member function from base 'class'; function is hidden"
#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual"
#pragma warning( 3 : 4266 ) // 'function' : no override available for virtual member function from base 'type'; function is hidden
#pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored
#pragma warning( disable : 4284 ) // silly MS warning deep inside their <map> include file
#pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
#pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
#pragma warning( disable : 4996 ) // warning: deprecated
// level 4 warnings that we need to disable:
#pragma warning (disable : 4100) // unreferenced formal parameter
#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) )
#pragma warning (disable : 4244) // possible loss of data on conversions
#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template
#pragma warning (disable : 4512) // assignment operator could not be generated
#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) )
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
#endif // LL_MSVC
#if LL_WINDOWS
#define LL_DLLEXPORT __declspec(dllexport)
#define LL_DLLIMPORT __declspec(dllimport)
#elif LL_LINUX
#define LL_DLLEXPORT __attribute__ ((visibility("default")))
#define LL_DLLIMPORT
#else
#define LL_DLLEXPORT
#define LL_DLLIMPORT
#endif // LL_WINDOWS
#if LL_COMMON_LINK_SHARED
// CMake automagically defines llcommon_EXPORTS only when building llcommon
// sources, and only when llcommon is a shared library (i.e. when
// LL_COMMON_LINK_SHARED). We must still test LL_COMMON_LINK_SHARED because
// otherwise we can't distinguish between (non-llcommon source) and (llcommon
// not shared).
# if defined(llcommon_EXPORTS)
# define LL_COMMON_API LL_DLLEXPORT
# else //llcommon_EXPORTS
# define LL_COMMON_API LL_DLLIMPORT
# endif //llcommon_EXPORTS
#else // LL_COMMON_LINK_SHARED
# define LL_COMMON_API
#endif // LL_COMMON_LINK_SHARED
#endif // not LL_LINDEN_PREPROCESSOR_H
/**
* @file llpreprocessor.h
* @brief This file should be included in all Linden Lab files and
* should only contain special preprocessor directives
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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 LLPREPROCESSOR_H
#define LLPREPROCESSOR_H
// Figure out endianness of platform
#ifdef LL_LINUX
#define __ENABLE_WSTRING
#include <endian.h>
#endif // LL_LINUX
#if LL_SOLARIS
# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported.
# define LL_BIG_ENDIAN 1
# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed
# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API
# endif
# include <sys/isa_defs.h> // ensure we know which end is up
#endif // LL_SOLARIS
#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386)))
#define LL_LITTLE_ENDIAN 1
#else
#define LL_BIG_ENDIAN 1
#endif
// Per-compiler switches
#ifdef __GNUC__
#define LL_FORCE_INLINE inline __attribute__((always_inline))
#else
#define LL_FORCE_INLINE __forceinline
#endif
// Figure out differences between compilers
#if defined(__GNUC__)
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#ifndef LL_GNUC
#define LL_GNUC 1
#endif
#elif defined(__MSVC_VER__) || defined(_MSC_VER)
#ifndef LL_MSVC
#define LL_MSVC 1
#endif
#if _MSC_VER < 1400
#define LL_MSVC7 //Visual C++ 2003 or earlier
#endif
#endif
// Deal with minor differences on Unixy OSes.
#if LL_DARWIN || LL_LINUX
// Different name, same functionality.
#define stricmp strcasecmp
#define strnicmp strncasecmp
// Not sure why this is different, but...
#ifndef MAX_PATH
#define MAX_PATH PATH_MAX
#endif // not MAX_PATH
#endif
// Static linking with apr on windows needs to be declared.
#if LL_WINDOWS && !LL_COMMON_LINK_SHARED
#ifndef APR_DECLARE_STATIC
#define APR_DECLARE_STATIC // For APR on Windows
#endif
#ifndef APU_DECLARE_STATIC
#define APU_DECLARE_STATIC // For APR util on Windows
#endif
#endif
#if defined(LL_WINDOWS)
#define BOOST_REGEX_NO_LIB 1
#define CURL_STATICLIB 1
#ifndef XML_STATIC
#define XML_STATIC
#endif
#endif // LL_WINDOWS
// Deal with VC6 problems
#if LL_MSVC
#pragma warning( 3 : 4701 ) // "local variable used without being initialized" Treat this as level 3, not level 4.
#pragma warning( 3 : 4702 ) // "unreachable code" Treat this as level 3, not level 4.
#pragma warning( 3 : 4189 ) // "local variable initialized but not referenced" Treat this as level 3, not level 4.
//#pragma warning( 3 : 4018 ) // "signed/unsigned mismatch" Treat this as level 3, not level 4.
#pragma warning( 3 : 4263 ) // 'function' : member function does not override any base class virtual member function
#pragma warning( 3 : 4264 ) // "'virtual_function' : no override available for virtual member function from base 'class'; function is hidden"
#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual"
#pragma warning( 3 : 4266 ) // 'function' : no override available for virtual member function from base 'type'; function is hidden
#pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored
#pragma warning( disable : 4284 ) // silly MS warning deep inside their <map> include file
#pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
#pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
#pragma warning( disable : 4996 ) // warning: deprecated
// level 4 warnings that we need to disable:
#pragma warning (disable : 4100) // unreferenced formal parameter
#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) )
#pragma warning (disable : 4244) // possible loss of data on conversions
#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template
#pragma warning (disable : 4512) // assignment operator could not be generated
#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) )
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
#endif // LL_MSVC
#if LL_WINDOWS
#define LL_DLLEXPORT __declspec(dllexport)
#define LL_DLLIMPORT __declspec(dllimport)
#elif LL_LINUX
#define LL_DLLEXPORT __attribute__ ((visibility("default")))
#define LL_DLLIMPORT
#else
#define LL_DLLEXPORT
#define LL_DLLIMPORT
#endif // LL_WINDOWS
#if LL_COMMON_LINK_SHARED
// CMake automagically defines llcommon_EXPORTS only when building llcommon
// sources, and only when llcommon is a shared library (i.e. when
// LL_COMMON_LINK_SHARED). We must still test LL_COMMON_LINK_SHARED because
// otherwise we can't distinguish between (non-llcommon source) and (llcommon
// not shared).
# if defined(llcommon_EXPORTS)
# define LL_COMMON_API LL_DLLEXPORT
# else //llcommon_EXPORTS
# define LL_COMMON_API LL_DLLIMPORT
# endif //llcommon_EXPORTS
#else // LL_COMMON_LINK_SHARED
# define LL_COMMON_API
#endif // LL_COMMON_LINK_SHARED
#endif // not LL_LINDEN_PREPROCESSOR_H

View File

@ -1,142 +1,142 @@
/**
* @file llstacktrace.cpp
* @brief stack tracing functionality
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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$
*/
#include "linden_common.h"
#include "llstacktrace.h"
#ifdef LL_WINDOWS
#include <iostream>
#include <sstream>
#include "windows.h"
#include "Dbghelp.h"
typedef USHORT NTAPI RtlCaptureStackBackTrace_Function(
IN ULONG frames_to_skip,
IN ULONG frames_to_capture,
OUT PVOID *backtrace,
OUT PULONG backtrace_hash);
static RtlCaptureStackBackTrace_Function* const RtlCaptureStackBackTrace_fn =
(RtlCaptureStackBackTrace_Function*)
GetProcAddress(GetModuleHandleA("ntdll.dll"), "RtlCaptureStackBackTrace");
bool ll_get_stack_trace(std::vector<std::string>& lines)
{
const S32 MAX_STACK_DEPTH = 32;
const S32 STRING_NAME_LENGTH = 200;
const S32 FRAME_SKIP = 2;
static BOOL symbolsLoaded = false;
static BOOL firstCall = true;
HANDLE hProc = GetCurrentProcess();
// load the symbols if they're not loaded
if(!symbolsLoaded && firstCall)
{
symbolsLoaded = SymInitialize(hProc, NULL, true);
firstCall = false;
}
// if loaded, get the call stack
if(symbolsLoaded)
{
// create the frames to hold the addresses
void* frames[MAX_STACK_DEPTH];
memset(frames, 0, sizeof(void*)*MAX_STACK_DEPTH);
S32 depth = 0;
// get the addresses
depth = RtlCaptureStackBackTrace_fn(FRAME_SKIP, MAX_STACK_DEPTH, frames, NULL);
IMAGEHLP_LINE64 line;
memset(&line, 0, sizeof(IMAGEHLP_LINE64));
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
// create something to hold address info
PIMAGEHLP_SYMBOL64 pSym;
pSym = (PIMAGEHLP_SYMBOL64)malloc(sizeof(IMAGEHLP_SYMBOL64) + STRING_NAME_LENGTH);
memset(pSym, 0, sizeof(IMAGEHLP_SYMBOL64) + STRING_NAME_LENGTH);
pSym->MaxNameLength = STRING_NAME_LENGTH;
pSym->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
// get address info for each address frame
// and store
for(S32 i=0; i < depth; i++)
{
std::stringstream stack_line;
BOOL ret;
DWORD64 addr = (DWORD64)frames[i];
ret = SymGetSymFromAddr64(hProc, addr, 0, pSym);
if(ret)
{
stack_line << pSym->Name << " ";
}
DWORD dummy;
ret = SymGetLineFromAddr64(hProc, addr, &dummy, &line);
if(ret)
{
std::string file_name = line.FileName;
std::string::size_type index = file_name.rfind("\\");
stack_line << file_name.substr(index + 1, file_name.size()) << ":" << line.LineNumber;
}
lines.push_back(stack_line.str());
}
free(pSym);
// TODO: figure out a way to cleanup symbol loading
// Not hugely necessary, however.
//SymCleanup(hProc);
return true;
}
else
{
lines.push_back("Stack Trace Failed. PDB symbol info not loaded");
}
return false;
}
#else
bool ll_get_stack_trace(std::vector<std::string>& lines)
{
return false;
}
#endif
/**
* @file llstacktrace.cpp
* @brief stack tracing functionality
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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$
*/
#include "linden_common.h"
#include "llstacktrace.h"
#ifdef LL_WINDOWS
#include <iostream>
#include <sstream>
#include "windows.h"
#include "Dbghelp.h"
typedef USHORT NTAPI RtlCaptureStackBackTrace_Function(
IN ULONG frames_to_skip,
IN ULONG frames_to_capture,
OUT PVOID *backtrace,
OUT PULONG backtrace_hash);
static RtlCaptureStackBackTrace_Function* const RtlCaptureStackBackTrace_fn =
(RtlCaptureStackBackTrace_Function*)
GetProcAddress(GetModuleHandleA("ntdll.dll"), "RtlCaptureStackBackTrace");
bool ll_get_stack_trace(std::vector<std::string>& lines)
{
const S32 MAX_STACK_DEPTH = 32;
const S32 STRING_NAME_LENGTH = 200;
const S32 FRAME_SKIP = 2;
static BOOL symbolsLoaded = false;
static BOOL firstCall = true;
HANDLE hProc = GetCurrentProcess();
// load the symbols if they're not loaded
if(!symbolsLoaded && firstCall)
{
symbolsLoaded = SymInitialize(hProc, NULL, true);
firstCall = false;
}
// if loaded, get the call stack
if(symbolsLoaded)
{
// create the frames to hold the addresses
void* frames[MAX_STACK_DEPTH];
memset(frames, 0, sizeof(void*)*MAX_STACK_DEPTH);
S32 depth = 0;
// get the addresses
depth = RtlCaptureStackBackTrace_fn(FRAME_SKIP, MAX_STACK_DEPTH, frames, NULL);
IMAGEHLP_LINE64 line;
memset(&line, 0, sizeof(IMAGEHLP_LINE64));
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
// create something to hold address info
PIMAGEHLP_SYMBOL64 pSym;
pSym = (PIMAGEHLP_SYMBOL64)malloc(sizeof(IMAGEHLP_SYMBOL64) + STRING_NAME_LENGTH);
memset(pSym, 0, sizeof(IMAGEHLP_SYMBOL64) + STRING_NAME_LENGTH);
pSym->MaxNameLength = STRING_NAME_LENGTH;
pSym->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
// get address info for each address frame
// and store
for(S32 i=0; i < depth; i++)
{
std::stringstream stack_line;
BOOL ret;
DWORD64 addr = (DWORD64)frames[i];
ret = SymGetSymFromAddr64(hProc, addr, 0, pSym);
if(ret)
{
stack_line << pSym->Name << " ";
}
DWORD dummy;
ret = SymGetLineFromAddr64(hProc, addr, &dummy, &line);
if(ret)
{
std::string file_name = line.FileName;
std::string::size_type index = file_name.rfind("\\");
stack_line << file_name.substr(index + 1, file_name.size()) << ":" << line.LineNumber;
}
lines.push_back(stack_line.str());
}
free(pSym);
// TODO: figure out a way to cleanup symbol loading
// Not hugely necessary, however.
//SymCleanup(hProc);
return true;
}
else
{
lines.push_back("Stack Trace Failed. PDB symbol info not loaded");
}
return false;
}
#else
bool ll_get_stack_trace(std::vector<std::string>& lines)
{
return false;
}
#endif

View File

@ -1,44 +1,44 @@
/**
* @file llstacktrace.h
* @brief stack trace functions
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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_LLSTACKTRACE_H
#define LL_LLSTACKTRACE_H
#include "stdtypes.h"
#include <vector>
#include <string>
LL_COMMON_API bool ll_get_stack_trace(std::vector<std::string>& lines);
#endif
/**
* @file llstacktrace.h
* @brief stack trace functions
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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_LLSTACKTRACE_H
#define LL_LLSTACKTRACE_H
#include "stdtypes.h"
#include <vector>
#include <string>
LL_COMMON_API bool ll_get_stack_trace(std::vector<std::string>& lines);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -107,6 +107,7 @@ public:
std::string getLabel() const;
void setFont( const LLFontGL* font ) { mFont = font; }
const LLFontGL* getFont() { return mFont; }
virtual void setControlName(const std::string& control_name, LLView* context);

View File

@ -84,8 +84,8 @@ void LLLineEditor::PrevalidateNamedFuncs::declareValues()
declare("non_negative_s32", LLLineEditor::prevalidateNonNegativeS32);
declare("alpha_num", LLLineEditor::prevalidateAlphaNum);
declare("alpha_num_space", LLLineEditor::prevalidateAlphaNumSpace);
declare("printable_not_pipe", LLLineEditor::prevalidatePrintableNotPipe);
declare("printable_no_space", LLLineEditor::prevalidatePrintableNoSpace);
declare("ascii_printable_no_pipe", LLLineEditor::prevalidateASCIIPrintableNoPipe);
declare("ascii_printable_no_space", LLLineEditor::prevalidateASCIIPrintableNoSpace);
}
LLLineEditor::Params::Params()
@ -2186,20 +2186,28 @@ BOOL LLLineEditor::prevalidateAlphaNumSpace(const LLWString &str)
return rv;
}
// Used for most names of things stored on the server, due to old file-formats
// that used the pipe (|) for multiline text storage. Examples include
// inventory item names, parcel names, object names, etc.
// static
BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
BOOL LLLineEditor::prevalidateASCIIPrintableNoPipe(const LLWString &str)
{
BOOL rv = TRUE;
S32 len = str.length();
if(len == 0) return rv;
while(len--)
{
if('|' == str[len])
llwchar wc = str[len];
if (wc < 0x20
|| wc > 0x7f
|| wc == '|')
{
rv = FALSE;
break;
}
if(!((' ' == str[len]) || LLStringOps::isAlnum((char)str[len]) || LLStringOps::isPunct((char)str[len])))
if(!(wc == ' '
|| LLStringOps::isAlnum((char)wc)
|| LLStringOps::isPunct((char)wc) ) )
{
rv = FALSE;
break;
@ -2209,15 +2217,19 @@ BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
}
// Used for avatar names
// static
BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
BOOL LLLineEditor::prevalidateASCIIPrintableNoSpace(const LLWString &str)
{
BOOL rv = TRUE;
S32 len = str.length();
if(len == 0) return rv;
while(len--)
{
if(LLStringOps::isSpace(str[len]))
llwchar wc = str[len];
if (wc < 0x20
|| wc > 0x7f
|| LLStringOps::isSpace(wc))
{
rv = FALSE;
break;
@ -2232,6 +2244,7 @@ BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
return rv;
}
// static
BOOL LLLineEditor::prevalidateASCII(const LLWString &str)
{

View File

@ -235,8 +235,8 @@ public:
static BOOL prevalidateNonNegativeS32(const LLWString &str);
static BOOL prevalidateAlphaNum(const LLWString &str );
static BOOL prevalidateAlphaNumSpace(const LLWString &str );
static BOOL prevalidatePrintableNotPipe(const LLWString &str);
static BOOL prevalidatePrintableNoSpace(const LLWString &str);
static BOOL prevalidateASCIIPrintableNoPipe(const LLWString &str);
static BOOL prevalidateASCIIPrintableNoSpace(const LLWString &str);
static BOOL prevalidateASCII(const LLWString &str);
static BOOL postvalidateFloat(const std::string &str);

View File

@ -143,6 +143,12 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
if( valid_rect.localPointInRect( screen_x, screen_y ) && mResizingView )
{
// undock floater when user resize it
if (((LLFloater*)getParent())->isDocked())
{
((LLFloater*)getParent())->setDocked(false, false);
}
// Resize the parent
LLRect orig_rect = mResizingView->getRect();
LLRect scaled_rect = orig_rect;

View File

@ -391,7 +391,7 @@ void LLTabContainer::draw()
mNextArrowBtn->setFlashing( TRUE );
}
}
}
}
idx++;
}

View File

@ -2380,6 +2380,14 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt
width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
// if last character is a newline, then return true, forcing line break
llwchar last_char = text[mStart + first_char + num_chars - 1];
LLUIImagePtr image = mStyle->getImage();
if( image.notNull())
{
width += image->getWidth();
height = llmax(height, image->getHeight());
}
return num_chars >= 1 && last_char == '\n';
}

View File

@ -531,13 +531,13 @@ private:
// this wasn't required in 1.xx viewer but we have to manually
// work the Windows message pump now
#if defined( LL_WINDOWS )
MSG msg;
while ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
GetMessage( &msg, NULL, 0, 0 );
TranslateMessage( &msg );
DispatchMessage( &msg );
};
MSG msg;
while ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
GetMessage( &msg, NULL, 0, 0 );
TranslateMessage( &msg );
DispatchMessage( &msg );
};
#endif
MCIdle( mMovieController );

View File

@ -1,291 +1,291 @@
<?xml version="1.0" ?>
<llsd>
<map>
<key>FirstAppearance</key>
<map>
<key>Comment</key>
<string>Enables FirstAppearance warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstAttach</key>
<map>
<key>Comment</key>
<string>Enables FirstAttach warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstBalanceDecrease</key>
<map>
<key>Comment</key>
<string>Enables FirstBalanceDecrease warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstBalanceIncrease</key>
<map>
<key>Comment</key>
<string>Enables FirstBalanceIncrease warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstBuild</key>
<map>
<key>Comment</key>
<string>Enables FirstBuild warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstDebugMenus</key>
<map>
<key>Comment</key>
<string>Enables FirstDebugMenus warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstFlexible</key>
<map>
<key>Comment</key>
<string>Enables FirstFlexible warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstGoTo</key>
<map>
<key>Comment</key>
<string>Enables FirstGoTo warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstInventory</key>
<map>
<key>Comment</key>
<string>Enables FirstInventory warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstLeftClickNoHit</key>
<map>
<key>Comment</key>
<string>Enables FirstLeftClickNoHit warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstMap</key>
<map>
<key>Comment</key>
<string>Enables FirstMap warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstMedia</key>
<map>
<key>Comment</key>
<string>Enables FirstMedia warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstOverrideKeys</key>
<map>
<key>Comment</key>
<string>Enables FirstOverrideKeys warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstSandbox</key>
<map>
<key>Comment</key>
<string>Enables FirstSandbox warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstSculptedPrim</key>
<map>
<key>Comment</key>
<string>Enables FirstSculptedPrim warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstSit</key>
<map>
<key>Comment</key>
<string>Enables FirstSit warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstStreamingMusic</key>
<map>
<key>Comment</key>
<string>Enables FirstStreamingMusic warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstStreamingVideo</key>
<map>
<key>Comment</key>
<string>Enables FirstStreamingVideo warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstTeleport</key>
<map>
<key>Comment</key>
<string>Enables FirstTeleport warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstVoice</key>
<map>
<key>Comment</key>
<string>Enables FirstVoice warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>AboutDirectX9</key>
<map>
<key>Comment</key>
<string>Enables AboutDirectX9 warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>BrowserLaunch</key>
<map>
<key>Comment</key>
<string>Enables BrowserLaunch warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>DeedObject</key>
<map>
<key>Comment</key>
<string>Enables DeedObject warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>NewClassified</key>
<map>
<key>Comment</key>
<string>Enables NewClassified warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>QuickTimeInstalled</key>
<map>
<key>Comment</key>
<string>Enables QuickTimeInstalled warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>ReturnToOwner</key>
<map>
<key>Comment</key>
<string>Enables ReturnToOwner warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
</map>
</llsd>
<?xml version="1.0" ?>
<llsd>
<map>
<key>FirstAppearance</key>
<map>
<key>Comment</key>
<string>Enables FirstAppearance warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstAttach</key>
<map>
<key>Comment</key>
<string>Enables FirstAttach warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstBalanceDecrease</key>
<map>
<key>Comment</key>
<string>Enables FirstBalanceDecrease warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstBalanceIncrease</key>
<map>
<key>Comment</key>
<string>Enables FirstBalanceIncrease warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstBuild</key>
<map>
<key>Comment</key>
<string>Enables FirstBuild warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstDebugMenus</key>
<map>
<key>Comment</key>
<string>Enables FirstDebugMenus warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstFlexible</key>
<map>
<key>Comment</key>
<string>Enables FirstFlexible warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstGoTo</key>
<map>
<key>Comment</key>
<string>Enables FirstGoTo warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstInventory</key>
<map>
<key>Comment</key>
<string>Enables FirstInventory warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstLeftClickNoHit</key>
<map>
<key>Comment</key>
<string>Enables FirstLeftClickNoHit warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstMap</key>
<map>
<key>Comment</key>
<string>Enables FirstMap warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstMedia</key>
<map>
<key>Comment</key>
<string>Enables FirstMedia warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstOverrideKeys</key>
<map>
<key>Comment</key>
<string>Enables FirstOverrideKeys warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstSandbox</key>
<map>
<key>Comment</key>
<string>Enables FirstSandbox warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstSculptedPrim</key>
<map>
<key>Comment</key>
<string>Enables FirstSculptedPrim warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstSit</key>
<map>
<key>Comment</key>
<string>Enables FirstSit warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstStreamingMusic</key>
<map>
<key>Comment</key>
<string>Enables FirstStreamingMusic warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstStreamingVideo</key>
<map>
<key>Comment</key>
<string>Enables FirstStreamingVideo warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstTeleport</key>
<map>
<key>Comment</key>
<string>Enables FirstTeleport warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstVoice</key>
<map>
<key>Comment</key>
<string>Enables FirstVoice warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>AboutDirectX9</key>
<map>
<key>Comment</key>
<string>Enables AboutDirectX9 warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>BrowserLaunch</key>
<map>
<key>Comment</key>
<string>Enables BrowserLaunch warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>DeedObject</key>
<map>
<key>Comment</key>
<string>Enables DeedObject warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>NewClassified</key>
<map>
<key>Comment</key>
<string>Enables NewClassified warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>QuickTimeInstalled</key>
<map>
<key>Comment</key>
<string>Enables QuickTimeInstalled warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>ReturnToOwner</key>
<map>
<key>Comment</key>
<string>Enables ReturnToOwner warning dialog</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
</map>
</llsd>

View File

@ -3620,7 +3620,7 @@
<key>Value</key>
<string />
</map>
<key>IMInChatConsole</key>
<key>IMInChat</key>
<map>
<key>Comment</key>
<string>Copy IM into chat console</string>
@ -3629,17 +3629,6 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>IMInChatHistory</key>
<map>
<key>Comment</key>
<string>Copy IM into chat history</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>IMShowTimestamps</key>
@ -9645,116 +9634,6 @@
<key>Value</key>
<string>00000000-0000-0000-0000-000000000000</string>
</map>
<key>UISndPieMenuAppear</key>
<map>
<key>Comment</key>
<string>Sound file for opening pie menu (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>8eaed61f-92ff-6485-de83-4dcc938a478e</string>
</map>
<key>UISndPieMenuHide</key>
<map>
<key>Comment</key>
<string>Sound file for closing pie menu (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>00000000-0000-0000-0000-000000000000</string>
</map>
<key>UISndPieMenuSliceHighlight0</key>
<map>
<key>Comment</key>
<string>Sound file for selecting pie menu item 0 (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>d9f73cf8-17b4-6f7a-1565-7951226c305d</string>
</map>
<key>UISndPieMenuSliceHighlight1</key>
<map>
<key>Comment</key>
<string>Sound file for selecting pie menu item 1 (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>f6ba9816-dcaf-f755-7b67-51b31b6233e5</string>
</map>
<key>UISndPieMenuSliceHighlight2</key>
<map>
<key>Comment</key>
<string>Sound file for selecting pie menu item 2 (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>7aff2265-d05b-8b72-63c7-dbf96dc2f21f</string>
</map>
<key>UISndPieMenuSliceHighlight3</key>
<map>
<key>Comment</key>
<string>Sound file for selecting pie menu item 3 (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>09b2184e-8601-44e2-afbb-ce37434b8ba1</string>
</map>
<key>UISndPieMenuSliceHighlight4</key>
<map>
<key>Comment</key>
<string>Sound file for selecting pie menu item 4 (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>bbe4c7fc-7044-b05e-7b89-36924a67593c</string>
</map>
<key>UISndPieMenuSliceHighlight5</key>
<map>
<key>Comment</key>
<string>Sound file for selecting pie menu item 5 (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>d166039b-b4f5-c2ec-4911-c85c727b016c</string>
</map>
<key>UISndPieMenuSliceHighlight6</key>
<map>
<key>Comment</key>
<string>Sound file for selecting pie menu item 6 (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>242af82b-43c2-9a3b-e108-3b0c7e384981</string>
</map>
<key>UISndPieMenuSliceHighlight7</key>
<map>
<key>Comment</key>
<string>Sound file for selecting pie menu item 7 (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>c1f334fb-a5be-8fe7-22b3-29631c21cf0b</string>
</map>
<key>UISndSnapshot</key>
<map>
<key>Comment</key>

View File

@ -22,17 +22,6 @@
<key>Value</key>
<string>|TOKEN COPY BusyModeResponse|</string>
</map>
<key>IMLogOptions</key>
<map>
<key>Comment</key>
<string>Log options for Instant Messages</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>2</integer>
</map>
<key>InstantMessageLogFolder</key>
<map>
<key>Comment</key>
@ -75,18 +64,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>LogChatIM</key>
<map>
<key>Comment</key>
<string>Log Incoming Instant Messages with Chat</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>LogTimestamp</key>
<map>
@ -97,7 +75,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>1</integer>
</map>
<key>LogInstantMessages</key>
<map>

View File

@ -6326,7 +6326,7 @@ void LLAgent::sendAgentSetAppearance()
msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
}
msg->nextBlockFast(_PREHASH_ObjectData);
mAvatarObject->packTEMessage( gMessageSystem );
mAvatarObject->sendAppearanceMessage( gMessageSystem );
}
else
{

View File

@ -653,11 +653,13 @@ LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index)
void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearable *wearable)
{
if (!getWearable(type,index))
LLWearable *old_wearable = getWearable(type,index);
if (!old_wearable)
{
pushWearable(type,wearable);
return;
}
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
{
@ -672,6 +674,7 @@ void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearab
else
{
wearable_vec[index] = wearable;
old_wearable->setLabelUpdated();
mAvatarObject->wearableUpdated(wearable->getType());
}
}
@ -688,6 +691,7 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl
{
mWearableDatas[type].push_back(wearable);
mAvatarObject->wearableUpdated(wearable->getType());
wearable->setLabelUpdated();
return mWearableDatas[type].size()-1;
}
return MAX_WEARABLES_PER_TYPE;
@ -717,6 +721,7 @@ void LLAgentWearables::popWearable(const EWearableType type, U32 index)
{
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
mAvatarObject->wearableUpdated(wearable->getType());
wearable->setLabelUpdated();
}
}
@ -1412,14 +1417,10 @@ void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_rem
for (S32 i=max_entry; i>=0; i--)
{
LLWearable* old_wearable = getWearable(type,i);
const LLUUID &item_id = getWearableItemID(type,i);
popWearable(type,i);
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
LLAppearanceManager::instance().removeItemLinks(item_id,false);
//queryWearableCache(); // moved below
if (old_wearable)
{
popWearable(old_wearable);
old_wearable->removeFromAvatar(TRUE);
}
}
@ -1428,16 +1429,11 @@ void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_rem
else
{
LLWearable* old_wearable = getWearable(type, index);
const LLUUID &item_id = getWearableItemID(type,index);
popWearable(type, index);
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
LLAppearanceManager::instance().removeItemLinks(item_id,false);
//queryWearableCache(); // moved below
if (old_wearable)
{
popWearable(old_wearable);
old_wearable->removeFromAvatar(TRUE);
}
}
@ -1499,7 +1495,6 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
continue;
}
gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
// Assumes existing wearables are not dirty.
if (old_wearable->isDirty())
{
@ -1508,9 +1503,9 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
}
}
setWearable(type,0,new_wearable);
if (new_wearable)
new_wearable->setItemID(new_item->getUUID());
setWearable(type,0,new_wearable);
}
std::vector<LLWearable*> wearables_being_removed;

View File

@ -363,6 +363,35 @@ LLUUID LLAppearanceManager::getCOF()
return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
}
const LLViewerInventoryItem* LLAppearanceManager::getCurrentOutfitLink()
{
const LLUUID& current_outfit_cat = getCOF();
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
// Can't search on FT_OUTFIT since links to categories return FT_CATEGORY for type since they don't
// return preferred type.
LLIsType is_category( LLAssetType::AT_CATEGORY );
gInventory.collectDescendentsIf(current_outfit_cat,
cat_array,
item_array,
false,
is_category,
false);
for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
iter != item_array.end();
iter++)
{
const LLViewerInventoryItem *item = (*iter);
const LLViewerInventoryCategory *cat = item->getLinkedCategory();
if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
{
return item;
}
}
return NULL;
}
// Update appearance from outfit folder.
void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, bool append)
{
@ -531,20 +560,28 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
linkAll(cof, gest_items, link_waiter);
// Add link to outfit if category is an outfit.
LLViewerInventoryCategory* catp = gInventory.getCategory(category);
const LLViewerInventoryCategory* catp = gInventory.getCategory(category);
LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
if (!append && catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
{
link_inventory_item(gAgent.getID(), category, cof, catp->getName(),
LLAssetType::AT_LINK_FOLDER, link_waiter);
// Update the current outfit name of the appearance sidepanel.
LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
if (panel_appearance)
{
panel_appearance->refreshCurrentOutfitName(catp->getName());
}
}
else
{
// Update the current outfit name of the appearance sidepanel.
if (panel_appearance)
{
panel_appearance->refreshCurrentOutfitName();
}
}
}
void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append)
@ -579,7 +616,6 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder,
if(wearables.count() > 0)
{
gAgentWearables.setWearableOutfit(items, wearables, !append);
gInventory.notifyObservers();
}
delete holder;
@ -819,15 +855,23 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor
(a->getWearableType() == b->getWearableType()));
}
void LLAppearanceManager::addItemLink( LLInventoryItem* item, bool do_update )
void LLAppearanceManager::addCOFItemLink(const LLUUID &item_id, bool do_update )
{
LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
const LLInventoryItem *item = gInventory.getItem(item_id);
addCOFItemLink(item);
}
void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_update )
{
const LLViewerInventoryItem *vitem = dynamic_cast<const LLViewerInventoryItem*>(item);
if (!vitem)
{
llwarns << "not an llviewerinventoryitem, failed" << llendl;
return;
}
gInventory.addChangedMask(LLInventoryObserver::LABEL, vitem->getLinkedUUID());
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
gInventory.collectDescendents(LLAppearanceManager::getCOF(),
@ -839,7 +883,7 @@ void LLAppearanceManager::addItemLink( LLInventoryItem* item, bool do_update )
{
// Are these links to the same object?
const LLViewerInventoryItem* inv_item = item_array.get(i).get();
if (inv_item->getLinkedUUID() == item->getLinkedUUID())
if (inv_item->getLinkedUUID() == vitem->getLinkedUUID())
{
linked_already = true;
}
@ -850,7 +894,6 @@ void LLAppearanceManager::addItemLink( LLInventoryItem* item, bool do_update )
{
gAgentWearables.removeWearable(inv_item->getWearableType(),true,0);
gInventory.purgeObject(inv_item->getUUID());
gInventory.notifyObservers();
}
}
if (linked_already)
@ -886,8 +929,10 @@ void LLAppearanceManager::addEnsembleLink( LLInventoryCategory* cat, bool do_upd
#endif
}
void LLAppearanceManager::removeItemLinks(const LLUUID& item_id, bool do_update)
void LLAppearanceManager::removeCOFItemLinks(const LLUUID& item_id, bool do_update)
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
gInventory.collectDescendents(LLAppearanceManager::getCOF(),
@ -899,7 +944,8 @@ void LLAppearanceManager::removeItemLinks(const LLUUID& item_id, bool do_update)
const LLInventoryItem* item = item_array.get(i).get();
if (item->getLinkedUUID() == item_id)
{
gInventory.purgeObject(item_array.get(i)->getUUID());
const LLUUID& item_id = item_array.get(i)->getUUID();
gInventory.purgeObject(item_id);
}
}
if (do_update)
@ -978,18 +1024,13 @@ void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg)
void LLAppearanceManager::registerAttachment(const LLUUID& item_id)
{
mRegisteredAttachments.insert(item_id);
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
//dumpAttachmentSet(mRegisteredAttachments,"after register:");
if (mAttachmentInvLinkEnabled)
{
LLViewerInventoryItem *item = gInventory.getItem(item_id);
if (item)
{
//LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Adding attachment link:");
LLAppearanceManager::addItemLink(item,false); // Add COF link for item.
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
gInventory.notifyObservers();
}
//LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Adding attachment link:");
LLAppearanceManager::addCOFItemLink(item_id, false); // Add COF link for item.
}
else
{
@ -1000,15 +1041,14 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id)
void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id)
{
mRegisteredAttachments.erase(item_id);
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
//dumpAttachmentSet(mRegisteredAttachments,"after unregister:");
if (mAttachmentInvLinkEnabled)
{
//LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Removing attachment link:");
LLAppearanceManager::removeItemLinks(item_id, false);
// BAP - needs to change for label to track link.
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
gInventory.notifyObservers();
LLAppearanceManager::removeCOFItemLinks(item_id, false);
}
else
{
@ -1023,13 +1063,7 @@ void LLAppearanceManager::linkRegisteredAttachments()
++it)
{
LLUUID item_id = *it;
LLViewerInventoryItem *item = gInventory.getItem(item_id);
if (item)
{
addItemLink(item, false);
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
gInventory.notifyObservers();
}
addCOFItemLink(item_id, false);
}
mRegisteredAttachments.clear();
}

View File

@ -54,12 +54,6 @@ public:
void wearOutfitByName(const std::string& name);
void changeOutfit(bool proceed, const LLUUID& category, bool append);
// Add COF link to individual item.
void addItemLink(LLInventoryItem* item, bool do_update = true);
// Add COF link to ensemble folder.
void addEnsembleLink(LLInventoryCategory* item, bool do_update = true);
// Copy all items in a category.
void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
LLPointer<LLInventoryCallback> cb);
@ -67,8 +61,8 @@ public:
// Find the Current Outfit folder.
LLUUID getCOF();
// Remove COF entries
void removeItemLinks(const LLUUID& item_id, bool do_update = true);
// Finds the folder link to the currently worn outfit
const LLViewerInventoryItem *getCurrentOutfitLink();
void updateAgentWearables(LLWearableHoldingPattern* holder, bool append);
@ -87,6 +81,16 @@ public:
LLInventoryModel::item_array_t& items,
LLPointer<LLInventoryCallback> cb);
// Add COF link to individual item.
void addCOFItemLink(const LLUUID& item_id, bool do_update = true);
void addCOFItemLink(const LLInventoryItem *item, bool do_update = true);
// Remove COF entries
void removeCOFItemLinks(const LLUUID& item_id, bool do_update = true);
// Add COF link to ensemble folder.
void addEnsembleLink(LLInventoryCategory* item, bool do_update = true);
protected:
LLAppearanceManager();
~LLAppearanceManager();

View File

@ -3534,6 +3534,7 @@ void LLAppViewer::idle()
gEventNotifier.update();
gIdleCallbacks.callFunctions();
gInventory.notifyObservers();
}
if (gDisconnected)
@ -4185,7 +4186,7 @@ void LLAppViewer::loadEventHostModule(S32 listen_port)
if(dso_path == "")
{
llwarns << "QAModeEventHost requested but module \"" << dso_name << "\" not found!" << llendl;
llerrs << "QAModeEventHost requested but module \"" << dso_name << "\" not found!" << llendl;
return;
}
@ -4213,7 +4214,7 @@ void LLAppViewer::loadEventHostModule(S32 listen_port)
if(status != 0)
{
llwarns << "problem loading eventhost plugin, status: " << status << llendl;
llerrs << "problem loading eventhost plugin, status: " << status << llendl;
}
mPlugins.insert(eventhost_dso_handle);

View File

@ -189,6 +189,19 @@ void LLAvatarActions::startIM(const LLUUID& id)
make_ui_sound("UISndStartIM");
}
// static
void LLAvatarActions::endIM(const LLUUID& id)
{
if (id.isNull())
return;
LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id);
if (session_id != LLUUID::null)
{
gIMMgr->leaveSession(session_id);
}
}
// static
void LLAvatarActions::startCall(const LLUUID& id)
{

View File

@ -73,6 +73,11 @@ public:
*/
static void startIM(const LLUUID& id);
/**
* End instant messaging session.
*/
static void endIM(const LLUUID& id);
/**
* Start an avatar-to-avatar voice call with another user
*/

View File

@ -48,6 +48,7 @@
LLBottomTray::LLBottomTray(const LLSD&)
: mChicletPanel(NULL),
mSysWell(NULL),
mSpeakPanel(NULL),
mSpeakBtn(NULL),
mNearbyChatBar(NULL),
mToolbarStack(NULL)
@ -304,6 +305,7 @@ BOOL LLBottomTray::postBuild()
mSnapshotPanel = getChild<LLPanel>("snapshot_panel");
setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4));
mSpeakPanel = getChild<LLPanel>("speak_panel");
mSpeakBtn = getChild<LLSpeakButton>("talk");
// Speak button should be initially disabled because
@ -320,6 +322,7 @@ BOOL LLBottomTray::postBuild()
mObjectDefaultWidthMap[RS_BUTTON_GESTURES] = mGesturePanel->getRect().getWidth();
mObjectDefaultWidthMap[RS_BUTTON_MOVEMENT] = mMovementPanel->getRect().getWidth();
mObjectDefaultWidthMap[RS_BUTTON_CAMERA] = mCamPanel->getRect().getWidth();
mObjectDefaultWidthMap[RS_BUTTON_SPEAK] = mSpeakPanel->getRect().getWidth();
return TRUE;
}
@ -476,7 +479,7 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width)
S32 buttons_freed_width = 0;
if (still_should_be_processed)
{
processShrinkButtons(&delta_width);
processShrinkButtons(&delta_width, &buttons_freed_width);
if (delta_width < 0)
{
@ -532,38 +535,43 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
const S32 available_width_chiclet = chiclet_panel_width - chiclet_panel_min_width;
// how many room we have to show hidden buttons
S32 available_width = delta_width + chatbar_available_shrink_width + available_width_chiclet;
S32 buttons_required_width = 0; //How many room will take shown buttons
S32 total_available_width = delta_width + chatbar_available_shrink_width + available_width_chiclet;
lldebugs << "Processing extending, available width:"
<< ", chatbar - " << chatbar_available_shrink_width
<< ", chiclets - " << available_width_chiclet
<< ", total - " << total_available_width
<< llendl;
S32 available_width = total_available_width;
if (available_width > 0)
{
lldebugs << "Trying to process: RS_BUTTON_GESTURES" << llendl;
processShowButton(RS_BUTTON_GESTURES, &available_width, &buttons_required_width);
processShowButton(RS_BUTTON_GESTURES, &available_width);
}
if (available_width > 0)
{
lldebugs << "Trying to process: RS_BUTTON_MOVEMENT" << llendl;
processShowButton(RS_BUTTON_MOVEMENT, &available_width, &buttons_required_width);
processShowButton(RS_BUTTON_MOVEMENT, &available_width);
}
if (available_width > 0)
{
lldebugs << "Trying to process: RS_BUTTON_CAMERA" << llendl;
processShowButton(RS_BUTTON_CAMERA, &available_width, &buttons_required_width);
processShowButton(RS_BUTTON_CAMERA, &available_width);
}
if (available_width > 0)
{
lldebugs << "Trying to process: RS_BUTTON_SNAPSHOT" << llendl;
processShowButton(RS_BUTTON_SNAPSHOT, &available_width, &buttons_required_width);
processShowButton(RS_BUTTON_SNAPSHOT, &available_width);
}
// if we have to show some buttons but width increasing is not enough...
if (buttons_required_width > 0 && delta_width < buttons_required_width)
processExtendButtons(&available_width);
// if we have to show/extend some buttons but resized delta width is not enough...
S32 processed_width = total_available_width - available_width;
if (processed_width > delta_width)
{
// ... let's shrink nearby chat & chiclet panels
S32 required_to_process_width = buttons_required_width;
S32 required_to_process_width = processed_width;
// 1. use delta width of resizing
required_to_process_width -= delta_width;
@ -593,9 +601,8 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
}
// shown buttons take some space, rest should be processed by nearby chatbar & chiclet panels
delta_width -= buttons_required_width;
delta_width -= processed_width;
processExtendButtons(&delta_width);
// how many space can nearby chatbar take?
S32 chatbar_panel_width_ = mNearbyChatBar->getRect().getWidth();
@ -603,13 +610,21 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
{
S32 delta_panel_max = chatbar_panel_max_width - chatbar_panel_width_;
S32 delta_panel = llmin(delta_width, delta_panel_max);
lldebugs << "Unprocesed delta width: " << delta_width
<< ", can be applied to chatbar: " << delta_panel_max
<< ", will be applied: " << delta_panel
<< llendl;
delta_width -= delta_panel_max;
mNearbyChatBar->reshape(chatbar_panel_width_ + delta_panel, mNearbyChatBar->getRect().getHeight());
log(mNearbyChatBar, "applied unprocessed delta width");
}
}
bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width, S32* buttons_required_width)
bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width)
{
lldebugs << "Trying to show object type: " << shown_object_type << llendl;
LLPanel* panel = mStateProcessedObjectMap[shown_object_type];
if (NULL == panel)
{
@ -625,12 +640,11 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* availa
if (can_be_shown)
{
*available_width -= required_width;
*buttons_required_width += required_width;
setTrayButtonVisible(shown_object_type, true);
lldebugs << "processing object type: " << shown_object_type
<< ", buttons_required_width: " << *buttons_required_width
lldebugs << "processed object type: " << shown_object_type
<< ", rest available width: " << *available_width
<< llendl;
mResizeState &= ~shown_object_type;
}
@ -640,6 +654,8 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* availa
void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width)
{
lldebugs << "Trying to hide object type: " << processed_object_type << llendl;
LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
if (NULL == panel)
{
@ -666,7 +682,7 @@ void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* re
}
}
void LLBottomTray::processShrinkButtons(S32* required_width)
void LLBottomTray::processShrinkButtons(S32* required_width, S32* buttons_freed_width)
{
processShrinkButton(RS_BUTTON_CAMERA, required_width);
@ -678,9 +694,44 @@ void LLBottomTray::processShrinkButtons(S32* required_width)
{
processShrinkButton(RS_BUTTON_GESTURES, required_width);
}
if (*required_width < 0)
{
S32 panel_min_width = 0;
std::string panel_name = mSpeakPanel->getName();
bool success = mToolbarStack->getPanelMinSize(panel_name, &panel_min_width, NULL);
if (!success)
{
lldebugs << "Panel was not found to get its min width: " << panel_name << llendl;
}
else
{
//
mSpeakBtn->setLabelVisible(false);
S32 panel_width = mSpeakPanel->getRect().getWidth();
S32 possible_shrink_width = panel_width - panel_min_width;
if (possible_shrink_width > 0)
{
mSpeakPanel->reshape(panel_width - possible_shrink_width, mSpeakPanel->getRect().getHeight());
*required_width += possible_shrink_width;
if (*required_width > 0)
{
*buttons_freed_width += *required_width;
}
lldebugs << "Shrunk panel: " << panel_name
<< ", shrunk width: " << possible_shrink_width
<< ", rest width to process: " << *required_width
<< llendl;
}
}
}
}
void LLBottomTray::processShrinkButton(EResizeState processed_object_type, /*const std::string& panel_name, */S32* required_width)
void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32* required_width)
{
LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
if (NULL == panel)
@ -729,6 +780,9 @@ void LLBottomTray::processShrinkButton(EResizeState processed_object_type, /*con
void LLBottomTray::processExtendButtons(S32* available_width)
{
// do not allow extending any buttons if we have some buttons hidden
if (mResizeState & RS_BUTTONS_CAN_BE_HIDDEN) return;
processExtendButton(RS_BUTTON_GESTURES, available_width);
if (*available_width > 0)
@ -739,6 +793,25 @@ void LLBottomTray::processExtendButtons(S32* available_width)
{
processExtendButton(RS_BUTTON_MOVEMENT, available_width);
}
if (*available_width > 0)
{
S32 panel_max_width = mObjectDefaultWidthMap[RS_BUTTON_SPEAK];
S32 panel_width = mSpeakPanel->getRect().getWidth();
S32 possible_extend_width = panel_max_width - panel_width;
if (possible_extend_width > 0 && possible_extend_width <= *available_width)
{
mSpeakBtn->setLabelVisible(true);
mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight());
log(mSpeakBtn, "speak button is extended");
*available_width -= possible_extend_width;
lldebugs << "Extending panel: " << mSpeakPanel->getName()
<< ", extended width: " << possible_extend_width
<< ", rest width to process: " << *available_width
<< llendl;
}
}
}
void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32* available_width)

View File

@ -98,12 +98,18 @@ private:
, RS_BUTTON_MOVEMENT = 0x0010
, RS_BUTTON_GESTURES = 0x0020
, RS_BUTTON_SPEAK = 0x0040
/**
* Specifies buttons which can be hidden when bottom tray is shrunk.
* They are: Gestures, Movement (Move), Camera (View), Snapshot
*/
, RS_BUTTONS_CAN_BE_HIDDEN = RS_BUTTON_SNAPSHOT | RS_BUTTON_CAMERA | RS_BUTTON_MOVEMENT | RS_BUTTON_GESTURES
}EResizeState;
S32 processWidthDecreased(S32 delta_width);
void processWidthIncreased(S32 delta_width);
void log(LLView* panel, const std::string& descr);
bool processShowButton(EResizeState shown_object_type, S32* available_width, S32* buttons_required_width);
bool processShowButton(EResizeState shown_object_type, S32* available_width);
void processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width);
/**
@ -112,7 +118,7 @@ private:
* @param - required_width - width which buttons can use to be shrunk. It is a negative value.
* It is increased on the value processed by buttons.
*/
void processShrinkButtons(S32* required_width);
void processShrinkButtons(S32* required_width, S32* buttons_freed_width);
void processShrinkButton(EResizeState processed_object_type, S32* required_width);
/**
@ -175,6 +181,7 @@ protected:
LLChicletPanel* mChicletPanel;
LLNotificationChiclet* mSysWell;
LLPanel* mSpeakPanel;
LLSpeakButton* mSpeakBtn;
LLNearbyChatBar* mNearbyChatBar;
LLLayoutStack* mToolbarStack;

View File

@ -126,7 +126,7 @@ void LLChannelManager::onLoginCompleted()
gViewerWindow->getRootView()->addChild(mStartUpChannel);
// init channel's position and size
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
mStartUpChannel->init(channel_right_bound - channel_width, channel_right_bound);
mStartUpChannel->setMouseDownCallback(boost::bind(&LLSysWellWindow::onStartUpToastClick, LLFloaterReg::getTypedInstance<LLSysWellWindow>("syswell_window"), _2, _3, _4));

View File

@ -187,8 +187,18 @@ void LLNearbyChatToastPanel::init(LLSD& notification)
msg_text->setText(mFromName, style_params);
}
mText = mText.substr(3);
style_params.font.style = "UNDERLINE";
style_params.font.style = "ITALIC";
#define INFINITE_REFLOW_BUG 0
#if INFINITE_REFLOW_BUG
// This causes LLTextBase::reflow() to infinite loop until the viewer
// runs out of memory, throws a bad_alloc exception from std::vector
// in mLineInfoList, and the main loop catches it and continues.
// It appears to be caused by addText() adding a line separator in the
// middle of a line. See EXT-2579, EXT-1949
msg_text->addText(mText,style_params);
#else
msg_text->appendText(mText, FALSE, style_params);
#endif
}
else
{

View File

@ -1,34 +1,34 @@
/**
* @file llchiclet.cpp
* @brief LLChiclet class implementation
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-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$
*/
* @file llchiclet.cpp
* @brief LLChiclet class implementation
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-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$
*/
#include "llviewerprecompiledheaders.h" // must be first include
#include "llchiclet.h"
@ -475,6 +475,10 @@ void LLIMP2PChiclet::onMenuItemClicked(const LLSD& user_data)
{
LLAvatarActions::requestFriendshipDialog(other_participant_id);
}
else if("end" == level)
{
LLAvatarActions::endIM(other_participant_id);
}
}
//////////////////////////////////////////////////////////////////////////
@ -769,12 +773,16 @@ void LLIMGroupChiclet::onMenuItemClicked(const LLSD& user_data)
if("group chat" == level)
{
LLGroupActions::startChat(group_id);
LLGroupActions::startIM(group_id);
}
else if("info" == level)
{
LLGroupActions::show(group_id);
}
else if("end" == level)
{
LLGroupActions::endIM(group_id);
}
}
@ -915,34 +923,45 @@ void LLChicletPanel::onCurrentVoiceChannelChanged(const LLUUID& session_id)
s_previous_active_voice_session_id = session_id;
}
S32 LLChicletPanel::calcChickletPanleWidth()
{
S32 res = 0;
for (chiclet_list_t::iterator it = mChicletList.begin(); it
!= mChicletList.end(); it++)
{
res = (*it)->getRect().getWidth() + getChicletPadding();
}
return res;
}
bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index)
{
if(mScrollArea->addChild(chiclet))
{
// chicklets should be aligned to right edge of scroll panel
S32 offset = 0;
// chiclets should be aligned to right edge of scroll panel
S32 left_shift = 0;
if (!canScrollLeft())
{
offset = mScrollArea->getRect().getWidth()
- chiclet->getRect().getWidth() - calcChickletPanleWidth();
// init left shift for the first chiclet in the list...
if (mChicletList.empty())
{
// ...start from the right border of the scroll area for the first added chiclet
left_shift = mScrollArea->getRect().getWidth();
}
else
{
// ... start from the left border of the first chiclet minus padding
left_shift = getChiclet(0)->getRect().mLeft - getChicletPadding();
}
// take into account width of the being added chiclet
left_shift -= chiclet->getRequiredRect().getWidth();
// if we overflow the scroll area we do not need to shift chiclets
if (left_shift < 0)
{
left_shift = 0;
}
}
mChicletList.insert(mChicletList.begin() + index, chiclet);
getChiclet(0)->translate(offset, 0);
// shift first chiclet to place it in correct position.
// rest ones will be placed in arrange()
if (!canScrollLeft())
{
getChiclet(0)->translate(left_shift - getChiclet(0)->getRect().mLeft, 0);
}
chiclet->setLeftButtonClickCallback(boost::bind(&LLChicletPanel::onChicletClick, this, _1, _2));
chiclet->setChicletSizeChangedCallback(boost::bind(&LLChicletPanel::onChicletSizeChanged, this, _1, index));

View File

@ -1,34 +1,34 @@
/**
* @file llchiclet.h
* @brief LLChiclet class header file
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-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$
*/
* @file llchiclet.h
* @brief LLChiclet class header file
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-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_LLCHICLET_H
#define LL_LLCHICLET_H
@ -44,9 +44,9 @@ class LLVoiceControlPanel;
class LLMenuGL;
class LLIMFloater;
/*
/**
* Class for displaying amount of messages/notifications(unread).
*/
*/
class LLChicletNotificationCounterCtrl : public LLTextBox
{
public:
@ -57,30 +57,30 @@ public:
{};
};
/*
/**
* Sets number of notifications
*/
*/
virtual void setCounter(S32 counter);
/*
/**
* Returns number of notifications
*/
*/
virtual S32 getCounter() const { return mCounter; }
/*
/**
* Returns width, required to display amount of notifications in text form.
* Width is the only valid value.
*/
*/
/*virtual*/ LLRect getRequiredRect();
/*
/**
* Sets number of notifications using LLSD
*/
*/
/*virtual*/ void setValue(const LLSD& value);
/*
/**
* Returns number of notifications wrapped in LLSD
*/
*/
/*virtual*/ LLSD getValue() const;
protected:
@ -94,9 +94,9 @@ private:
S32 mInitialWidth;
};
/*
/**
* Class for displaying avatar's icon in P2P chiclet.
*/
*/
class LLChicletAvatarIconCtrl : public LLAvatarIconCtrl
{
public:
@ -147,9 +147,9 @@ protected:
std::string mDefaultIcon;
};
/*
/**
* Class for displaying of speaker's voice indicator
*/
*/
class LLChicletSpeakerCtrl : public LLOutputMonitorCtrl
{
public:
@ -164,7 +164,7 @@ protected:
friend class LLUICtrlFactory;
};
/*
/**
* Base class for all chiclets.
*/
class LLChiclet : public LLUICtrl
@ -180,59 +180,59 @@ public:
/*virtual*/ ~LLChiclet();
/*
/**
* Associates chat session id with chiclet.
*/
*/
virtual void setSessionId(const LLUUID& session_id) { mSessionId = session_id; }
/*
/**
* Returns associated chat session.
*/
*/
virtual const LLUUID& getSessionId() const { return mSessionId; }
/*
/**
* Sets number of unread notifications.
*/
*/
virtual void setCounter(S32 counter) = 0;
/*
/**
* Returns number of unread notifications.
*/
*/
virtual S32 getCounter() = 0;
/*
/**
* Sets show counter state.
*/
*/
virtual void setShowCounter(bool show) { mShowCounter = show; }
/*
/**
* Returns show counter state.
*/
*/
virtual bool getShowCounter() {return mShowCounter;};
/*
/**
* Connects chiclet clicked event with callback.
*/
*/
/*virtual*/ boost::signals2::connection setLeftButtonClickCallback(
const commit_callback_t& cb);
typedef boost::function<void (LLChiclet* ctrl, const LLSD& param)>
chiclet_size_changed_callback_t;
/*
/**
* Connects chiclets size changed event with callback.
*/
*/
virtual boost::signals2::connection setChicletSizeChangedCallback(
const chiclet_size_changed_callback_t& cb);
/*
/**
* Sets IM Session id using LLSD
*/
*/
/*virtual*/ LLSD getValue() const;
/*
/**
* Returns IM Session id using LLSD
*/
*/
/*virtual*/ void setValue(const LLSD& value);
protected:
@ -240,14 +240,14 @@ protected:
friend class LLUICtrlFactory;
LLChiclet(const Params& p);
/*
/**
* Notifies subscribers about click on chiclet.
*/
*/
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
/*
/**
* Notifies subscribers about chiclet size changed event.
*/
*/
virtual void onChicletSizeChanged();
private:
@ -263,11 +263,11 @@ private:
};
/*
* Base class for Instant Message chiclets.
* IMChiclet displays icon, number of unread messages(optional)
* and voice chat status(optional).
*/
/**
* Base class for Instant Message chiclets.
* IMChiclet displays icon, number of unread messages(optional)
* and voice chat status(optional).
*/
class LLIMChiclet : public LLChiclet
{
public:
@ -288,50 +288,50 @@ public:
/*virtual*/ ~LLIMChiclet() {};
/*
/**
* Sets IM session name. This name will be displayed in chiclet tooltip.
*/
*/
virtual void setIMSessionName(const std::string& name) { setToolTip(name); }
/*
/**
* Sets id of person/group user is chatting with.
* Session id should be set before calling this
*/
*/
virtual void setOtherParticipantId(const LLUUID& other_participant_id) { mOtherParticipantId = other_participant_id; }
/*
/**
* Gets id of person/group user is chatting with.
*/
virtual LLUUID getOtherParticipantId() { return mOtherParticipantId; }
/*
* Init Speaker Control with speaker's ID
*/
/**
* Init Speaker Control with speaker's ID
*/
virtual void initSpeakerControl();
/*
/**
* set status (Shows/Hide) for voice control.
*/
*/
virtual void setShowSpeaker(bool show);
/*
/**
* Returns voice chat status control visibility.
*/
*/
virtual bool getShowSpeaker() {return mShowSpeaker;};
/*
* Shows/Hides for voice control for a chiclet.
*/
/**
* Shows/Hides for voice control for a chiclet.
*/
virtual void toggleSpeakerControl();
/*
* Shows/hides overlay icon concerning new unread messages.
*/
/**
* Shows/hides overlay icon concerning new unread messages.
*/
virtual void setShowNewMessagesIcon(bool show);
/*
* Returns visibility of overlay icon concerning new unread messages.
*/
/**
* Returns visibility of overlay icon concerning new unread messages.
*/
virtual bool getShowNewMessagesIcon();
virtual void draw();
@ -418,45 +418,45 @@ public:
/* virtual */ void setOtherParticipantId(const LLUUID& other_participant_id);
/*
* Sets number of unread messages. Will update chiclet's width if number text
* exceeds size of counter and notify it's parent about size change.
*/
/**
* Sets number of unread messages. Will update chiclet's width if number text
* exceeds size of counter and notify it's parent about size change.
*/
/*virtual*/ void setCounter(S32);
/*
* Init Speaker Control with speaker's ID
*/
/**
* Init Speaker Control with speaker's ID
*/
/*virtual*/ void initSpeakerControl();
/*
* Returns number of unread messages.
*/
/**
* Returns number of unread messages.
*/
/*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); }
protected:
LLIMP2PChiclet(const Params& p);
friend class LLUICtrlFactory;
/*
* Creates chiclet popup menu. Will create P2P or Group IM Chat menu
* based on other participant's id.
*/
/**
* Creates chiclet popup menu. Will create P2P or Group IM Chat menu
* based on other participant's id.
*/
virtual void createPopupMenu();
/*
* Processes clicks on chiclet popup menu.
*/
/**
* Processes clicks on chiclet popup menu.
*/
virtual void onMenuItemClicked(const LLSD& user_data);
/*
* Displays popup menu.
*/
/**
* Displays popup menu.
*/
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
/*
* Enables/disables menus based on relationship with other participant.
*/
/**
* Enables/disables menus based on relationship with other participant.
*/
virtual void updateMenuItems();
private:
@ -492,39 +492,39 @@ public:
*/
/*virtual*/ void setSessionId(const LLUUID& session_id);
/*
* Sets number of unread messages. Will update chiclet's width if number text
* exceeds size of counter and notify it's parent about size change.
*/
/**
* Sets number of unread messages. Will update chiclet's width if number text
* exceeds size of counter and notify it's parent about size change.
*/
/*virtual*/ void setCounter(S32);
/*
* Keep Speaker Control with actual speaker's ID
*/
/**
* Keep Speaker Control with actual speaker's ID
*/
/*virtual*/ void draw();
/*
* Init Speaker Control with speaker's ID
*/
/**
* Init Speaker Control with speaker's ID
*/
/*virtual*/ void initSpeakerControl();
/*
* Returns number of unread messages.
*/
/**
* Returns number of unread messages.
*/
/*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); }
protected:
LLAdHocChiclet(const Params& p);
friend class LLUICtrlFactory;
/*
* Displays popup menu.
*/
/**
* Displays popup menu.
*/
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
/*
* Finds a current speaker and resets the SpeakerControl with speaker's ID
*/
/**
* Finds a current speaker and resets the SpeakerControl with speaker's ID
*/
/*virtual*/ void switchToCurrentSpeaker();
private:
@ -593,9 +593,9 @@ public:
*/
/*virtual*/ void setSessionId(const LLUUID& session_id);
/*
* Keep Speaker Control with actual speaker's ID
*/
/**
* Keep Speaker Control with actual speaker's ID
*/
/*virtual*/ void draw();
/**
@ -604,20 +604,20 @@ public:
*/
/*virtual*/ void changed(LLGroupChange gc);
/*
* Sets number of unread messages. Will update chiclet's width if number text
* exceeds size of counter and notify it's parent about size change.
*/
/**
* Sets number of unread messages. Will update chiclet's width if number text
* exceeds size of counter and notify it's parent about size change.
*/
/*virtual*/ void setCounter(S32);
/*
* Init Speaker Control with speaker's ID
*/
/**
* Init Speaker Control with speaker's ID
*/
/*virtual*/ void initSpeakerControl();
/*
* Returns number of unread messages.
*/
/**
* Returns number of unread messages.
*/
/*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); }
~LLIMGroupChiclet();
@ -626,25 +626,25 @@ protected:
LLIMGroupChiclet(const Params& p);
friend class LLUICtrlFactory;
/*
* Finds a current speaker and resets the SpeakerControl with speaker's ID
*/
/**
* Finds a current speaker and resets the SpeakerControl with speaker's ID
*/
/*virtual*/ void switchToCurrentSpeaker();
/*
* Creates chiclet popup menu. Will create P2P or Group IM Chat menu
* based on other participant's id.
*/
/**
* Creates chiclet popup menu. Will create P2P or Group IM Chat menu
* based on other participant's id.
*/
virtual void createPopupMenu();
/*
* Processes clicks on chiclet popup menu.
*/
/**
* Processes clicks on chiclet popup menu.
*/
virtual void onMenuItemClicked(const LLSD& user_data);
/*
* Displays popup menu.
*/
/**
* Displays popup menu.
*/
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
private:
@ -653,10 +653,10 @@ private:
LLMenuGL* mPopupMenu;
};
/*
/**
* Implements notification chiclet. Used to display total amount of unread messages
* across all IM sessions, total amount of system notifications.
*/
*/
class LLNotificationChiclet : public LLChiclet
{
public:
@ -700,10 +700,10 @@ protected:
S32 mCounter;
};
/*
/**
* Storage class for all IM chiclets. Provides mechanism to display,
* scroll, create, remove chiclets.
*/
*/
class LLChicletPanel : public LLPanel
{
public:
@ -720,62 +720,62 @@ public:
virtual ~LLChicletPanel();
/*
/**
* Creates chiclet and adds it to chiclet list at specified index.
*/
*/
template<class T> T* createChiclet(const LLUUID& session_id, S32 index);
/*
/**
* Creates chiclet and adds it to chiclet list at right.
*/
*/
template<class T> T* createChiclet(const LLUUID& session_id);
/*
/**
* Returns pointer to chiclet of specified type at specified index.
*/
*/
template<class T> T* getChiclet(S32 index);
/*
/**
* Returns pointer to LLChiclet at specified index.
*/
*/
LLChiclet* getChiclet(S32 index) { return getChiclet<LLChiclet>(index); }
/*
/**
* Searches a chiclet using IM session id.
*/
*/
template<class T> T* findChiclet(const LLUUID& im_session_id);
/*
/**
* Returns number of hosted chiclets.
*/
*/
S32 getChicletCount() {return mChicletList.size();};
/*
/**
* Returns index of chiclet in list.
*/
*/
S32 getChicletIndex(const LLChiclet* chiclet);
/*
/**
* Removes chiclet by index.
*/
*/
void removeChiclet(S32 index);
/*
/**
* Removes chiclet by pointer.
*/
*/
void removeChiclet(LLChiclet* chiclet);
/*
/**
* Removes chiclet by IM session id.
*/
*/
void removeChiclet(const LLUUID& im_session_id);
/*
/**
* Removes all chiclets.
*/
*/
void removeAll();
/*
/**
* Scrolls the panel to the specified chiclet
*/
void scrollToChiclet(const LLChiclet* chiclet);
@ -785,14 +785,14 @@ public:
/*virtual*/ BOOL postBuild();
/*
* Handler for the Voice Client's signal. Finds a corresponding chiclet and toggles its SpeakerControl
*/
/**
* Handler for the Voice Client's signal. Finds a corresponding chiclet and toggles its SpeakerControl
*/
void onCurrentVoiceChannelChanged(const LLUUID& session_id);
/*
/**
* Reshapes controls and rearranges chiclets if needed.
*/
*/
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE );
/*virtual*/ void draw();
@ -803,100 +803,107 @@ protected:
LLChicletPanel(const Params&p);
friend class LLUICtrlFactory;
S32 calcChickletPanleWidth();
/*
* Adds chiclet to list and rearranges all chiclets.
*/
/**
* Adds chiclet to list and rearranges all chiclets.
* They should be right aligned, most recent right. See EXT-1293
*
* It calculates position of the first chiclet in the list. Other chiclets are placed in arrange().
*
* @see arrange()
*/
bool addChiclet(LLChiclet*, S32 index);
/*
* Arranges chiclets.
*/
/**
* Arranges chiclets to have them in correct positions.
*
* Method bases on assumption that first chiclet has correct rect and starts from the its position.
*
* @see addChiclet()
*/
void arrange();
/*
/**
* Returns true if chiclets can be scrolled right.
*/
*/
bool canScrollRight();
/*
* Returns true if chiclets can be scrolled left.
*/
/**
* Returns true if chiclets can be scrolled left.
*/
bool canScrollLeft();
/*
* Shows or hides chiclet scroll buttons if chiclets can or can not be scrolled.
*/
/**
* Shows or hides chiclet scroll buttons if chiclets can or can not be scrolled.
*/
void showScrollButtonsIfNeeded();
/*
/**
* Shifts chiclets left or right.
*/
*/
void shiftChiclets(S32 offset, S32 start_index = 0);
/*
/**
* Removes gaps between first chiclet and scroll area left side,
* last chiclet and scroll area right side.
*/
*/
void trimChiclets();
/*
/**
* Scrolls chiclets to right or left.
*/
*/
void scroll(S32 offset);
/*
/**
* Verifies that chiclets can be scrolled left, then calls scroll()
*/
*/
void scrollLeft();
/*
/**
* Verifies that chiclets can be scrolled right, then calls scroll()
*/
*/
void scrollRight();
/*
/**
* Callback for left scroll button clicked
*/
*/
void onLeftScrollClick();
/*
* Callback for right scroll button clicked
*/
/**
* Callback for right scroll button clicked
*/
void onRightScrollClick();
/*
* Callback for right scroll button held down event
*/
/**
* Callback for right scroll button held down event
*/
void onLeftScrollHeldDown();
/*
/**
* Callback for left scroll button held down event
*/
void onRightScrollHeldDown();
/*
/**
* Callback for mouse wheel scrolled, calls scrollRight() or scrollLeft()
*/
*/
BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
/*
/**
* Notifies subscribers about click on chiclet.
* Do not place any code here, instead subscribe on event (see setChicletClickedCallback).
*/
*/
void onChicletClick(LLUICtrl*ctrl,const LLSD&param);
/*
/**
* Callback for chiclet size changed event, rearranges chiclets.
*/
*/
void onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param);
typedef std::vector<LLChiclet*> chiclet_list_t;
/*
/**
* Removes chiclet from scroll area and chiclet list.
*/
*/
void removeChiclet(chiclet_list_t::iterator it);
S32 getChicletPadding() { return mChicletPadding; }

View File

@ -180,16 +180,12 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4&
edit->blockUndo();
}
void log_chat_text(const LLChat& chat)
{
LLLogChat::saveHistory(std::string("chat"), chat.mFromName, chat.mFromID, chat.mText);
}
// static
void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file)
{
if ( (gSavedPerAccountSettings.getS32("IMLogOptions")!=LOG_IM) && log_to_file)
if (log_to_file && (gSavedPerAccountSettings.getBOOL("LogChat")))
{
log_chat_text(chat);
LLLogChat::saveHistory("chat", chat.mFromName, chat.mFromID, chat.mText);
}
LLColor4 color = get_text_color(chat);
@ -305,55 +301,27 @@ void LLFloaterChat::onClickToggleShowMute(LLUICtrl* caller, void *data)
}
// Put a line of chat in all the right places
void LLFloaterChat::addChat(const LLChat& chat,
BOOL from_instant_message,
BOOL local_agent)
void LLFloaterChat::addChat(const LLChat& chat, BOOL from_instant_message, BOOL local_agent)
{
LLColor4 text_color = get_text_color(chat);
BOOL invisible_script_debug_chat = ((gSavedSettings.getBOOL("ShowScriptErrors") == FALSE) ||
(chat.mChatType == CHAT_TYPE_DEBUG_MSG
&& (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1)));
if (!invisible_script_debug_chat
&& !chat.mMuted
&& gConsole
&& !local_agent)
{
F32 size = CHAT_MSG_SIZE;
if (chat.mSourceType == CHAT_SOURCE_SYSTEM)
{
text_color = LLUIColorTable::instance().getColor("SystemChatColor");
}
else if(from_instant_message)
{
text_color = LLUIColorTable::instance().getColor("IMChatColor");
size = INSTANT_MSG_SIZE;
}
// Disabling the console for 2.0 - SJB
#if 0
// We display anything if it's not an IM. If it's an IM, check pref...
if ( !from_instant_message || gSavedSettings.getBOOL("IMInChatConsole") )
{
gConsole->addLine(chat.mText, size, text_color);
}
#endif
}
if(from_instant_message && (gSavedPerAccountSettings.getS32("IMLogOptions")== LOG_BOTH_TOGETHER))
log_chat_text(chat);
if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory"))
addChatHistory(chat,false);
triggerAlerts(chat.mText);
// Add the sender to the list of people with which we've recently interacted.
if(chat.mSourceType == CHAT_SOURCE_AGENT && chat.mFromID.notNull())
LLRecentPeople::instance().add(chat.mFromID);
if(!from_instant_message)
addChatHistory(chat);
bool add_chat = true;
bool log_chat = true;
if(from_instant_message)
{
if (!gSavedSettings.getBOOL("IMInChat"))
add_chat = false;
//log_chat = false;
}
if (add_chat)
{
addChatHistory(chat, log_chat);
}
}
// Moved from lltextparser.cpp to break llui/llaudio library dependency.

View File

@ -45,14 +45,6 @@ class LLChat;
class LLPanelActiveSpeakers;
class LLLogChat;
enum ELogOptions
{
LOG_CHAT = 0,
LOG_IM = 1,
LOG_BOTH_TOGETHER = 2,
LOG_BOTH_SEPARATE = 3
};
class LLFloaterChat : public LLFloater
{
public:

View File

@ -34,32 +34,24 @@
#include "llfloatergesture.h"
#include "lldir.h"
#include "llinventory.h"
#include "llmultigesture.h"
#include "llinventorybridge.h"
#include "llinventorymodel.h"
#include "llinventoryclipboard.h"
#include "llagent.h"
#include "llviewerwindow.h"
#include "llbutton.h"
#include "llcombobox.h"
#include "llappearancemgr.h"
#include "llclipboard.h"
#include "llgesturemgr.h"
#include "llinventorymodel.h"
#include "llinventorypanel.h"
#include "llfloaterinventory.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
#include "llmenugl.h"
#include "llmultigesture.h"
#include "llpreviewgesture.h"
#include "llresizehandle.h"
#include "llscrollbar.h"
#include "llscrollcontainer.h"
#include "llscrolllistctrl.h"
#include "lltextbox.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
#include "llviewergesture.h"
#include "llviewertexturelist.h"
#include "llviewermenu.h"
#include "llviewerinventory.h"
#include "llvoavatar.h"
#include "llviewercontrol.h"
BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b )
@ -77,6 +69,35 @@ public:
private:
LLFloaterGesture* mFloater;
};
//-----------------------------
// GestureCallback
//-----------------------------
class GestureShowCallback : public LLInventoryCallback
{
public:
void fire(const LLUUID &inv_item)
{
LLPreviewGesture::show(inv_item, LLUUID::null);
}
};
class GestureCopiedCallback : public LLInventoryCallback
{
private:
LLFloaterGesture* mFloater;
public:
GestureCopiedCallback(LLFloaterGesture* floater): mFloater(floater)
{}
void fire(const LLUUID &inv_item)
{
if(mFloater)
{
mFloater->addGesture(inv_item,NULL,mFloater->getChild<LLScrollListCtrl>("gesture_list"));
}
}
};
//---------------------------------------------------------------------------
// LLFloaterGesture
@ -86,7 +107,13 @@ LLFloaterGesture::LLFloaterGesture(const LLSD& key)
{
mObserver = new LLFloaterGestureObserver(this);
LLGestureManager::instance().addObserver(mObserver);
//LLUICtrlFactory::getInstance()->buildFloater(this, "floater_gesture.xml");
mCommitCallbackRegistrar.add("Gesture.Action.ToogleActiveState", boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
mCommitCallbackRegistrar.add("Gesture.Action.ShowPreview", boost::bind(&LLFloaterGesture::onClickEdit, this));
mCommitCallbackRegistrar.add("Gesture.Action.CopyPast", boost::bind(&LLFloaterGesture::onCopyPastAction, this, _2));
mCommitCallbackRegistrar.add("Gesture.Action.SaveToCOF", boost::bind(&LLFloaterGesture::addToCurrentOutFit, this));
mEnableCallbackRegistrar.add("Gesture.EnableAction", boost::bind(&LLFloaterGesture::isActionEnabled, this, _2));
}
void LLFloaterGesture::done()
@ -151,19 +178,18 @@ BOOL LLFloaterGesture::postBuild()
label = getTitle();
setTitle(label);
getChild<LLUICtrl>("gesture_list")->setCommitCallback(boost::bind(&LLFloaterGesture::onCommitList, this));
getChild<LLScrollListCtrl>("gesture_list")->setDoubleClickCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
getChild<LLUICtrl>("inventory_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickInventory, this));
mGestureList = getChild<LLScrollListCtrl>("gesture_list");
mGestureList->setCommitCallback(boost::bind(&LLFloaterGesture::onCommitList, this));
mGestureList->setDoubleClickCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
getChild<LLUICtrl>("edit_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickEdit, this));
getChild<LLUICtrl>("play_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
getChild<LLUICtrl>("stop_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
getChild<LLButton>("activate_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
getChild<LLUICtrl>("new_gesture_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickNew, this));
getChild<LLButton>("del_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onDeleteSelected, this));
childSetVisible("play_btn", true);
childSetVisible("stop_btn", false);
@ -178,14 +204,13 @@ BOOL LLFloaterGesture::postBuild()
buildGestureList();
childSetFocus("gesture_list");
mGestureList->setFocus(TRUE);
LLCtrlListInterface *list = getGestureList();
if (list)
if (mGestureList)
{
const BOOL ascending = TRUE;
list->sortByColumn(std::string("name"), ascending);
list->selectFirstItem();
mGestureList->sortByColumn(std::string("name"), ascending);
mGestureList->selectFirstItem();
}
// Update button labels
@ -199,18 +224,17 @@ void LLFloaterGesture::refreshAll()
{
buildGestureList();
LLCtrlListInterface *list = getGestureList();
if (!list) return;
if (!mGestureList) return;
if (mSelectedID.isNull())
{
list->selectFirstItem();
mGestureList->selectFirstItem();
}
else
{
if (! list->setCurrentByID(mSelectedID))
if (! mGestureList->setCurrentByID(mSelectedID))
{
list->selectFirstItem();
mGestureList->selectFirstItem();
}
}
@ -220,20 +244,16 @@ void LLFloaterGesture::refreshAll()
void LLFloaterGesture::buildGestureList()
{
LLCtrlListInterface *list = getGestureList();
LLCtrlScrollInterface *scroll = childGetScrollInterface("gesture_list");
if (! (list && scroll)) return;
LLUUID selected_item = list->getCurrentID();
std::vector<LLUUID> selected_items;
getSelectedIds(selected_items);
LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL;
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
mGestureList->deleteAllItems();
LLGestureManager::item_map_t::const_iterator it;
const LLGestureManager::item_map_t& active_gestures = LLGestureManager::instance().getActiveGestures();
for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
{
addGesture(it->first,it->second, list);
addGesture(it->first,it->second, mGestureList);
}
if (gInventory.isCategoryComplete(mGestureFolderID))
{
@ -249,16 +269,17 @@ void LLFloaterGesture::buildGestureList()
if (active_gestures.find(item->getUUID()) == active_gestures.end())
{
// if gesture wasn't loaded yet, we can display only name
addGesture(item->getUUID(), NULL, list);
addGesture(item->getUUID(), NULL, mGestureList);
}
}
}
// attempt to preserve scroll position through re-builds
// since we do re-build any time anything dirties
if(list->selectByValue(LLSD(selected_item)))
for(std::vector<LLUUID>::iterator it = selected_items.begin(); it != selected_items.end(); it++)
{
scroll->scrollToShowSelected();
mGestureList->selectByID(*it);
}
mGestureList->scrollToShowSelected();
}
void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gesture,LLCtrlListInterface * list )
@ -346,33 +367,59 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur
list->addElement(element, ADD_BOTTOM);
}
void LLFloaterGesture::onClickInventory()
void LLFloaterGesture::getSelectedIds(std::vector<LLUUID>& ids)
{
LLCtrlListInterface *list = getGestureList();
if (!list) return;
const LLUUID& item_id = list->getCurrentID();
std::vector<LLScrollListItem*> items = mGestureList->getAllSelected();
for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++)
{
ids.push_back((*it)->getUUID());
}
}
LLFloaterInventory* inv = LLFloaterInventory::showAgentInventory();
if (!inv) return;
inv->getPanel()->setSelection(item_id, TRUE);
bool LLFloaterGesture::isActionEnabled(const LLSD& command)
{
// paste copy_uuid edit_gesture
std::string command_name = command.asString();
if("paste" == command_name)
{
if(!LLInventoryClipboard::instance().hasContents())
return false;
LLDynamicArray<LLUUID> ids;
LLInventoryClipboard::instance().retrieve(ids);
for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
{
LLInventoryItem* item = gInventory.getItem(*it);
if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
{
return true;
}
}
return false;
}
else if("copy_uuid" == command_name || "edit_gesture" == command_name
|| "inspect" == command_name)
{
return mGestureList->getAllSelected().size() == 1;
}
return true;
}
void LLFloaterGesture::onClickPlay()
{
LLCtrlListInterface *list = getGestureList();
if (!list) return;
const LLUUID& item_id = list->getCurrentID();
const LLUUID& item_id = mGestureList->getCurrentID();
if(item_id.isNull()) return;
LL_DEBUGS("Gesture")<<" Trying to play gesture id: "<< item_id <<LL_ENDL;
if(!LLGestureManager::instance().isGestureActive(item_id))
{
// we need to inform server about gesture activating to be consistent with LLPreviewGesture.
// we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboBox.
BOOL inform_server = TRUE;
BOOL deactivate_similar = FALSE;
LLGestureManager::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id));
LLGestureManager::instance().activateGestureWithAsset(item_id, gInventory.getItem(item_id)->getAssetUUID(), inform_server, deactivate_similar);
LL_DEBUGS("Gesture")<< "Activating gesture with inventory ID: " << item_id <<LL_ENDL;
LLGestureManager::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id));
}
else
{
@ -380,15 +427,6 @@ void LLFloaterGesture::onClickPlay()
}
}
class GestureShowCallback : public LLInventoryCallback
{
public:
void fire(const LLUUID &inv_item)
{
LLPreviewGesture::show(inv_item, LLUUID::null);
}
};
void LLFloaterGesture::onClickNew()
{
LLPointer<LLInventoryCallback> cb = new GestureShowCallback();
@ -399,27 +437,96 @@ void LLFloaterGesture::onClickNew()
void LLFloaterGesture::onActivateBtnClick()
{
LLCtrlListInterface* list = getGestureList();
LLUUID gesture_inv_id = list->getSelectedValue();
std::vector<LLUUID> ids;
getSelectedIds(ids);
if(ids.empty())
return;
LLGestureManager* gm = LLGestureManager::getInstance();
if(gm->isGestureActive(gesture_inv_id))
std::vector<LLUUID>::const_iterator it = ids.begin();
BOOL first_gesture_state = gm->isGestureActive(*it);
BOOL is_mixed = FALSE;
while( ++it != ids.end() )
{
gm->deactivateGesture(gesture_inv_id);
if(first_gesture_state != gm->isGestureActive(*it))
{
is_mixed = TRUE;
break;
}
}
else
for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
{
gm->activateGesture(gesture_inv_id);
if(is_mixed)
{
gm->activateGesture(*it);
}
else
{
if(first_gesture_state)
{
gm->deactivateGesture(*it);
}
else
{
gm->activateGesture(*it);
}
}
}
}
void LLFloaterGesture::onCopyPastAction(const LLSD& command)
{
std::string command_name = command.asString();
// since we select this comman inventory item had already arrived .
if("copy_gesture" == command_name)
{
std::vector<LLUUID> ids;
getSelectedIds(ids);
// make sure that clopboard is empty
LLInventoryClipboard::instance().reset();
for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
{
LLInventoryItem* item = gInventory.getItem(*it);
if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
{
LLInventoryClipboard::instance().add(item->getUUID());
}
}
}
else if ("paste" == command_name)
{
LLInventoryClipboard& clipbord = LLInventoryClipboard::instance();
LLDynamicArray<LLUUID> ids;
clipbord.retrieve(ids);
if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID))
return;
LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID);
LLPointer<GestureCopiedCallback> cb = new GestureCopiedCallback(this);
for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
{
LLInventoryItem* item = gInventory.getItem(*it);
LLStringUtil::format_map_t string_args;
string_args["[COPY_NAME]"] = item->getName();
if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
{
LL_DEBUGS("Gesture")<< "Copying gesture " << item->getName() << " "<< item->getUUID() << " into "
<< gesture_dir->getName() << " "<< gesture_dir->getUUID() << LL_ENDL;
copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(),
gesture_dir->getUUID(), getString("copy_name", string_args), cb);
}
}
clipbord.reset();
}
else if ("copy_uuid" == command_name)
{
gClipboard.copyFromString(utf8str_to_wstring(mGestureList->getCurrentID().asString()), mGestureList->getCurrentID());
}
}
void LLFloaterGesture::onClickEdit()
{
LLCtrlListInterface *list = getGestureList();
if (!list) return;
const LLUUID& item_id = list->getCurrentID();
const LLUUID& item_id = mGestureList->getCurrentID();
LLInventoryItem* item = gInventory.getItem(item_id);
if (!item) return;
@ -433,7 +540,7 @@ void LLFloaterGesture::onClickEdit()
void LLFloaterGesture::onCommitList()
{
const LLUUID& item_id = childGetValue("gesture_list").asUUID();
const LLUUID& item_id = mGestureList->getCurrentID();
mSelectedID = item_id;
if (LLGestureManager::instance().isGesturePlaying(item_id))
@ -447,8 +554,60 @@ void LLFloaterGesture::onCommitList()
childSetVisible("stop_btn", false);
}
}
void LLFloaterGesture::onDeleteSelected()
{
std::vector<LLUUID> ids;
getSelectedIds(ids);
if(ids.empty())
return;
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
LLGestureManager* gm = LLGestureManager::getInstance();
for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
{
const LLUUID& selected_item = *it;
LLInventoryItem* inv_item = gInventory.getItem(selected_item);
if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_GESTURE)
{
if(gm->isGestureActive(selected_item))
{
gm->deactivateGesture(selected_item);
}
LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1);
update.push_back(old_folder);
LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1);
update.push_back(new_folder);
gInventory.accountForUpdate(update);
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
new_item->setParent(trash_id);
// no need to restamp it though it's a move into trash because
// it's a brand new item already.
new_item->updateParentOnServer(FALSE);
gInventory.updateItem(new_item);
}
}
gInventory.notifyObservers();
buildGestureList();
}
void LLFloaterGesture::addToCurrentOutFit()
{
std::vector<LLUUID> ids;
getSelectedIds(ids);
LLAppearanceManager* am = LLAppearanceManager::getInstance();
for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
{
am->addCOFItemLink(*it);
}
}
void LLFloaterGesture::playGesture(LLUUID item_id)
{
LL_DEBUGS("Gesture")<<"Playing gesture "<< item_id<<LL_ENDL;
if (LLGestureManager::instance().isGesturePlaying(item_id))
{
LLGestureManager::instance().stopGesture(item_id);

View File

@ -36,11 +36,10 @@
#ifndef LL_LLFLOATERGESTURE_H
#define LL_LLFLOATERGESTURE_H
#include <vector>
#include "llfloater.h"
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
#include "lldarray.h"
class LLScrollContainer;
class LLView;
@ -53,6 +52,7 @@ class LLScrollListCtrl;
class LLFloaterGestureObserver;
class LLFloaterGestureInventoryObserver;
class LLMultiGesture;
class LLMenuGL;
class LLFloaterGesture
: public LLFloater, LLInventoryFetchDescendentsObserver
@ -65,26 +65,46 @@ public:
virtual BOOL postBuild();
virtual void done ();
void refreshAll();
/**
* @brief Add new scrolllistitem into gesture_list.
* @param item_id inventory id of gesture
* @param gesture can be NULL , if item was not loaded yet
*/
void addGesture(const LLUUID& item_id, LLMultiGesture* gesture, LLCtrlListInterface * list);
protected:
// Reads from the gesture manager's list of active gestures
// and puts them in this list.
void buildGestureList();
void addGesture(const LLUUID& item_id, LLMultiGesture* gesture, LLCtrlListInterface * list);
void onClickInventory();
void playGesture(LLUUID item_id);
private:
void addToCurrentOutFit();
/**
* @brief This method is using to collect selected items.
* In some places gesture_list can be rebuilt by gestureObservers during iterating data from LLScrollListCtrl::getAllSelected().
* Therefore we have to copy these items to avoid viewer crash.
* @see LLFloaterGesture::onActivateBtnClick
*/
void getSelectedIds(std::vector<LLUUID>& ids);
bool isActionEnabled(const LLSD& command);
/**
* @brief Activation rules:
* According to Gesture Spec:
* 1. If all selected gestures are active: set to inactive
* 2. If all selected gestures are inactive: set to active
* 3. If selected gestures are in a mixed state: set all to active
*/
void onActivateBtnClick();
void onClickEdit();
void onClickPlay();
void onClickNew();
void onCommitList();
void playGesture(LLUUID item_id);
LLCtrlListInterface* getGestureList() const
{
return childGetListInterface("gesture_list");
}
void onActivateBtnClick();
protected:
void onCopyPastAction(const LLSD& command);
void onDeleteSelected();
LLUUID mSelectedID;
LLUUID mGestureFolderID;
LLScrollListCtrl* mGestureList;
LLFloaterGestureObserver* mObserver;
};

View File

@ -415,7 +415,7 @@ LLPanelRegionTools::LLPanelRegionTools()
BOOL LLPanelRegionTools::postBuild()
{
getChild<LLLineEditor>("region name")->setKeystrokeCallback(onChangeSimName, this);
childSetPrevalidate("region name", &LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("region name", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
childSetPrevalidate("estate", &LLLineEditor::prevalidatePositiveS32);
childSetPrevalidate("parentestate", &LLLineEditor::prevalidatePositiveS32);
childDisable("parentestate");

View File

@ -327,7 +327,7 @@ void LLPanelGroups::startIM()
if (group_list && (group_id = group_list->getCurrentID()).notNull())
{
LLGroupActions::startChat(group_id);
LLGroupActions::startIM(group_id);
}
}

View File

@ -64,10 +64,7 @@ BOOL LLFloaterInventory::postBuild()
void LLFloaterInventory::draw()
{
if (LLInventoryModel::isEverythingFetched())
{
updateTitle();
}
updateTitle();
LLFloater::draw();
}
@ -85,10 +82,14 @@ void LLFloaterInventory::updateTitle()
{
setTitle(getString("TitleFetching", string_args));
}
else
else if (LLInventoryModel::isEverythingFetched())
{
setTitle(getString("TitleCompleted", string_args));
}
else
{
setTitle(getString("Title"));
}
}
void LLFloaterInventory::changed(U32 mask)

View File

@ -347,13 +347,14 @@ BOOL LLPanelLandGeneral::postBuild()
{
mEditName = getChild<LLLineEditor>("Name");
mEditName->setCommitCallback(onCommitAny, this);
childSetPrevalidate("Name", LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("Name", LLLineEditor::prevalidateASCIIPrintableNoPipe);
mEditDesc = getChild<LLTextEditor>("Description");
mEditDesc->setCommitOnFocusLost(TRUE);
mEditDesc->setCommitCallback(onCommitAny, this);
childSetPrevalidate("Description", LLLineEditor::prevalidatePrintableNotPipe);
// No prevalidate function - historically the prevalidate function was broken,
// allowing residents to put in characters like U+2661 WHITE HEART SUIT, so
// preserve that ability.
mTextSalePending = getChild<LLTextBox>("SalePending");
mTextOwnerLabel = getChild<LLTextBox>("Owner:");

View File

@ -83,7 +83,6 @@ BOOL LLFloaterMap::postBuild()
{
mMap = getChild<LLNetMap>("Net Map");
mMap->setScale(gSavedSettings.getF32("MiniMapScale"));
mMap->setRotateMap(gSavedSettings.getBOOL( "MiniMapRotate" ));
mMap->setToolTipMsg(getString("ToolTipMsg"));
sendChildToBack(mMap);
@ -178,7 +177,8 @@ void LLFloaterMap::draw()
{
F32 rotation = 0;
if( mMap->getRotateMap() )
static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
if( rotate_map )
{
// rotate subsequent draws to agent rotation
rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );

View File

@ -111,7 +111,7 @@ BOOL LLFloaterNameDesc::postBuild()
if (NameEditor)
{
NameEditor->setMaxTextLength(DB_INV_ITEM_NAME_STR_LEN);
NameEditor->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe);
NameEditor->setPrevalidate(&LLLineEditor::prevalidateASCIIPrintableNoPipe);
}
y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
@ -123,7 +123,7 @@ BOOL LLFloaterNameDesc::postBuild()
if (DescEditor)
{
DescEditor->setMaxTextLength(DB_INV_ITEM_DESC_STR_LEN);
DescEditor->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe);
DescEditor->setPrevalidate(&LLLineEditor::prevalidateASCIIPrintableNoPipe);
}
y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);

View File

@ -338,7 +338,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this));
mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this));
mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this));
mCommitCallbackRegistrar.add("Pref.Logging", boost::bind(&LLFloaterPreference::onCommitLogging, this));
mCommitCallbackRegistrar.add("Pref.UpdateMeterText", boost::bind(&LLFloaterPreference::updateMeterText, this, _1));
mCommitCallbackRegistrar.add("Pref.HardwareSettings", boost::bind(&LLFloaterPreference::onOpenHardwareSettings, this));
mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this));
@ -1133,27 +1132,6 @@ void LLFloaterPreference::onClickLogPath()
gSavedPerAccountSettings.setString("InstantMessageLogFolder",chat_log_top_folder);
}
void LLFloaterPreference::onCommitLogging()
{
enableHistory();
}
void LLFloaterPreference::enableHistory()
{
if (childGetValue("log_instant_messages").asBoolean())
{
childEnable("ChatIMLogs");
childEnable("log_path_button");
childEnable("show_timestamps_check_im");
}
else
{
childDisable("ChatIMLogs");
childDisable("log_path_button");
childDisable("show_timestamps_check_im");
}
}
void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email)
{
mGotPersonalInfo = true;
@ -1193,7 +1171,12 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im
// childSetText("busy_response", gSavedSettings.getString("BusyModeResponse2"));
enableHistory();
childEnable("log_nearby_chat");
childEnable("log_instant_messages");
childEnable("show_timestamps_check_im");
childEnable("log_path_string");
childEnable("log_path_button");
std::string display_email(email);
childSetText("email_address",display_email);

View File

@ -115,7 +115,6 @@ public:
void setAllIgnored();
void onClickLogPath();
void enableHistory();
void onCommitLogging();
void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email);
void refreshEnabledState();
void disableUnavailableSettings();

View File

@ -130,9 +130,9 @@ BOOL LLFloaterProperties::postBuild()
{
// build the UI
// item name & description
childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidateASCIIPrintableNoPipe);
getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitName,this));
childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidateASCIIPrintableNoPipe);
getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLFloaterProperties:: onCommitDescription, this));
// Creator information
getChild<LLUICtrl>("BtnCreator")->setCommitCallback(boost::bind(&LLFloaterProperties::onClickCreator,this));

View File

@ -220,7 +220,7 @@ LLFolderView::LLFolderView(const Params& p)
params.font(getLabelFontForStyle(LLFontGL::NORMAL));
params.max_length_bytes(DB_INV_ITEM_NAME_STR_LEN);
params.commit_callback.function(boost::bind(&LLFolderView::commitRename, this, _2));
params.prevalidate_callback(&LLLineEditor::prevalidatePrintableNotPipe);
params.prevalidate_callback(&LLLineEditor::prevalidateASCIIPrintableNoPipe);
params.commit_on_focus_lost(true);
params.visible(false);
mRenamer = LLUICtrlFactory::create<LLLineEditor> (params);

View File

@ -1253,6 +1253,10 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter)
// filter self only on first pass through
LLFolderViewItem::filter( filter );
}
if (mDontShowInHierarchy)
{
setOpen();
}
}
if (getRoot()->getDebugFilters())
@ -2494,11 +2498,13 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde
{
static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
static const LLUUID& landmarks_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
LLUUID a_uuid = a->getParentFolder()->getListener()->getUUID();
LLUUID b_uuid = b->getParentFolder()->getListener()->getUUID();
if (a_uuid == favorites_folder_id && b_uuid == favorites_folder_id)
if ((a_uuid == favorites_folder_id && b_uuid == favorites_folder_id) ||
(a_uuid == landmarks_folder_id && b_uuid == landmarks_folder_id))
{
// *TODO: mantipov: probably it is better to add an appropriate method to LLFolderViewItem
// or to LLInvFVBridge

View File

@ -60,6 +60,9 @@
// Longest time, in seconds, to wait for all animations to stop playing
const F32 MAX_WAIT_ANIM_SECS = 30.f;
// If this gesture is a link, get the base gesture that this link points to,
// otherwise just return this id.
static const LLUUID& get_linked_uuid(const LLUUID& item_id);
// Lightweight constructor.
// init() does the heavy lifting.
@ -213,6 +216,8 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
BOOL inform_server,
BOOL deactivate_similar)
{
const LLUUID& base_item_id = get_linked_uuid(item_id);
if( !gAssetStorage )
{
llwarns << "LLGestureManager::activateGestureWithAsset without valid gAssetStorage" << llendl;
@ -233,13 +238,13 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
// For now, put NULL into the item map. We'll build a gesture
// class object when the asset data arrives.
mActive[item_id] = NULL;
mActive[base_item_id] = NULL;
// Copy the UUID
if (asset_id.notNull())
{
LLLoadInfo* info = new LLLoadInfo;
info->mItemID = item_id;
info->mItemID = base_item_id;
info->mInformServer = inform_server;
info->mDeactivateSimilar = deactivate_similar;
@ -259,7 +264,8 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
void LLGestureManager::deactivateGesture(const LLUUID& item_id)
{
item_map_t::iterator it = mActive.find(item_id);
const LLUUID& base_item_id = get_linked_uuid(item_id);
item_map_t::iterator it = mActive.find(base_item_id);
if (it == mActive.end())
{
llwarns << "deactivateGesture for inactive gesture " << item_id << llendl;
@ -279,7 +285,7 @@ void LLGestureManager::deactivateGesture(const LLUUID& item_id)
}
mActive.erase(it);
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
gInventory.addChangedMask(LLInventoryObserver::LABEL, base_item_id);
// Inform the database of this change
LLMessageSystem* msg = gMessageSystem;
@ -301,6 +307,7 @@ void LLGestureManager::deactivateGesture(const LLUUID& item_id)
void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id)
{
const LLUUID& base_in_item_id = get_linked_uuid(in_item_id);
std::vector<LLUUID> gest_item_ids;
// Deactivate all gestures that match
@ -312,7 +319,7 @@ void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUI
// Don't deactivate the gesture we are looking for duplicates of
// (for replaceGesture)
if (!gest || item_id == in_item_id)
if (!gest || item_id == base_in_item_id)
{
// legal, can have null pointers in list
++it;
@ -387,14 +394,17 @@ void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUI
BOOL LLGestureManager::isGestureActive(const LLUUID& item_id)
{
item_map_t::iterator it = mActive.find(item_id);
const LLUUID& base_item_id = get_linked_uuid(item_id);
item_map_t::iterator it = mActive.find(base_item_id);
return (it != mActive.end());
}
BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id)
{
item_map_t::iterator it = mActive.find(item_id);
const LLUUID& base_item_id = get_linked_uuid(item_id);
item_map_t::iterator it = mActive.find(base_item_id);
if (it == mActive.end()) return FALSE;
LLMultiGesture* gesture = (*it).second;
@ -405,19 +415,21 @@ BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id)
void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id)
{
item_map_t::iterator it = mActive.find(item_id);
const LLUUID& base_item_id = get_linked_uuid(item_id);
item_map_t::iterator it = mActive.find(base_item_id);
if (it == mActive.end())
{
llwarns << "replaceGesture for inactive gesture " << item_id << llendl;
llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl;
return;
}
LLMultiGesture* old_gesture = (*it).second;
stopGesture(old_gesture);
mActive.erase(item_id);
mActive.erase(base_item_id);
mActive[item_id] = new_gesture;
mActive[base_item_id] = new_gesture;
delete old_gesture;
old_gesture = NULL;
@ -428,7 +440,7 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new
mDeactivateSimilarNames.clear();
LLLoadInfo* info = new LLLoadInfo;
info->mItemID = item_id;
info->mItemID = base_item_id;
info->mInformServer = TRUE;
info->mDeactivateSimilar = FALSE;
@ -445,16 +457,18 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new
void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id)
{
item_map_t::iterator it = LLGestureManager::instance().mActive.find(item_id);
const LLUUID& base_item_id = get_linked_uuid(item_id);
item_map_t::iterator it = LLGestureManager::instance().mActive.find(base_item_id);
if (it == mActive.end())
{
llwarns << "replaceGesture for inactive gesture " << item_id << llendl;
llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl;
return;
}
// mActive owns this gesture pointer, so clean up memory.
LLMultiGesture* gesture = (*it).second;
LLGestureManager::instance().replaceGesture(item_id, gesture, new_asset_id);
LLGestureManager::instance().replaceGesture(base_item_id, gesture, new_asset_id);
}
void LLGestureManager::playGesture(LLMultiGesture* gesture)
@ -478,7 +492,9 @@ void LLGestureManager::playGesture(LLMultiGesture* gesture)
// Convenience function that looks up the item_id for you.
void LLGestureManager::playGesture(const LLUUID& item_id)
{
item_map_t::iterator it = mActive.find(item_id);
const LLUUID& base_item_id = get_linked_uuid(item_id);
item_map_t::iterator it = mActive.find(base_item_id);
if (it == mActive.end()) return;
LLMultiGesture* gesture = (*it).second;
@ -1074,7 +1090,9 @@ void LLGestureManager::stopGesture(LLMultiGesture* gesture)
void LLGestureManager::stopGesture(const LLUUID& item_id)
{
item_map_t::iterator it = mActive.find(item_id);
const LLUUID& base_item_id = get_linked_uuid(item_id);
item_map_t::iterator it = mActive.find(base_item_id);
if (it == mActive.end()) return;
LLMultiGesture* gesture = (*it).second;
@ -1171,3 +1189,15 @@ void LLGestureManager::done()
}
notifyObservers();
}
// static
const LLUUID& get_linked_uuid(const LLUUID &item_id)
{
LLViewerInventoryItem* item = gInventory.getItem(item_id);
if (item && item->getIsLinkType())
{
return item->getLinkedUUID();
}
return item_id;
}

View File

@ -272,7 +272,7 @@ void LLGroupActions::closeGroup(const LLUUID& group_id)
// static
void LLGroupActions::startChat(const LLUUID& group_id)
void LLGroupActions::startIM(const LLUUID& group_id)
{
if (group_id.isNull())
return;
@ -298,6 +298,19 @@ void LLGroupActions::startChat(const LLUUID& group_id)
}
}
// static
void LLGroupActions::endIM(const LLUUID& group_id)
{
if (group_id.isNull())
return;
LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id);
if (session_id != LLUUID::null)
{
gIMMgr->leaveSession(session_id);
}
}
// static
bool LLGroupActions::isInGroup(const LLUUID& group_id)
{

View File

@ -88,7 +88,12 @@ public:
/**
* Start group instant messaging session.
*/
static void startChat(const LLUUID& group_id);
static void startIM(const LLUUID& group_id);
/**
* End group instant messaging session.
*/
static void endIM(const LLUUID& group_id);
/// Returns if the current user is a member of the group
static bool isInGroup(const LLUUID& group_id);

View File

@ -106,10 +106,10 @@ void LLIMFloater::onFocusReceived()
// virtual
void LLIMFloater::onClose(bool app_quitting)
{
if (!gIMMgr->hasSession(mSessionID)) return;
setTyping(false);
gIMMgr->leaveSession(mSessionID);
// SJB: We want the close button to hide the session window, not end it
// *NOTE: Yhis is functional, but not ideal - it's still closing the floater; we really want to change the behavior of the X button instead.
//gIMMgr->leaveSession(mSessionID);
}
/* static */
@ -358,7 +358,7 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
void LLIMFloater::getAllowedRect(LLRect& rect)
{
rect = gViewerWindow->getWorldViewRectRaw();
rect = gViewerWindow->getWorldViewRectScaled();
}
void LLIMFloater::setDocked(bool docked, bool pop_on_undock)
@ -495,12 +495,12 @@ void LLIMFloater::updateMessages()
if (from.size() > 0)
{
append_style_params.font.style = "ITALIC";
chat.mText = from + " ";
chat.mText = from;
mChatHistory->appendWidgetMessage(chat, append_style_params);
}
message = message.substr(3);
append_style_params.font.style = "UNDERLINE";
append_style_params.font.style = "ITALIC";
mChatHistory->appendText(message, FALSE, append_style_params);
}
else

View File

@ -58,7 +58,7 @@ LLIMHandler::~LLIMHandler()
//--------------------------------------------------------------------------
void LLIMHandler::initChannel()
{
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
}

View File

@ -395,21 +395,15 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from,
bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text)
{
S32 im_log_option = gSavedPerAccountSettings.getS32("IMLogOptions");
if (im_log_option != LOG_CHAT)
if (gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
{
if(im_log_option == LOG_BOTH_TOGETHER)
{
LLLogChat::saveHistory(std::string("chat"), from, from_id, utf8_text);
return true;
}
else
{
LLLogChat::saveHistory(LLIMModel::getInstance()->getName(session_id), from, from_id, utf8_text);
return true;
}
LLLogChat::saveHistory(LLIMModel::getInstance()->getName(session_id), from, from_id, utf8_text);
return true;
}
else
{
return false;
}
return false;
}
bool LLIMModel::proccessOnlineOfflineNotification(
@ -1100,7 +1094,7 @@ LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) :
void LLOutgoingCallDialog::getAllowedRect(LLRect& rect)
{
rect = gViewerWindow->getWorldViewRectRaw();
rect = gViewerWindow->getWorldViewRectScaled();
}
void LLOutgoingCallDialog::onOpen(const LLSD& key)
@ -1213,7 +1207,7 @@ BOOL LLIncomingCallDialog::postBuild()
void LLIncomingCallDialog::getAllowedRect(LLRect& rect)
{
rect = gViewerWindow->getWorldViewRectRaw();
rect = gViewerWindow->getWorldViewRectScaled();
}
void LLIncomingCallDialog::onOpen(const LLSD& key)

File diff suppressed because it is too large Load Diff

View File

@ -204,8 +204,6 @@ protected:
const LLUUID& new_parent,
BOOL restamp);
void removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch);
void renameLinkedItems(const LLUUID &item_id, const std::string& new_name);
protected:
LLHandle<LLPanel> mInventoryPanel;
const LLUUID mUUID; // item id

View File

@ -1,136 +1,136 @@
/**
* @file llinventoryfunctions.h
* @brief Miscellaneous inventory-related functions and classes
* class definition
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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_LLINVENTORYFUNCTIONS_H
#define LL_LLINVENTORYFUNCTIONS_H
#include "llassetstorage.h"
#include "lldarray.h"
#include "llfloater.h"
#include "llinventory.h"
#include "llinventoryfilter.h"
#include "llfolderview.h"
#include "llinventorymodel.h"
#include "lluictrlfactory.h"
#include <set>
class LLFolderViewItem;
class LLInventoryFilter;
class LLInventoryModel;
class LLInventoryPanel;
class LLInvFVBridge;
class LLInventoryFVBridgeBuilder;
class LLMenuBarGL;
class LLCheckBoxCtrl;
class LLSpinCtrl;
class LLScrollContainer;
class LLTextBox;
class LLIconCtrl;
class LLSaveFolderState;
class LLFilterEditor;
class LLTabContainer;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// This is a collection of miscellaneous functions and classes
// that don't fit cleanly into any other class header.
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryState
{
public:
// HACK: Until we can route this info through the instant message hierarchy
static BOOL sWearNewClothing;
static LLUUID sWearNewClothingTransactionID; // wear all clothing in this transaction
};
class LLSelectFirstFilteredItem : public LLFolderViewFunctor
{
public:
LLSelectFirstFilteredItem() : mItemSelected(FALSE) {}
virtual ~LLSelectFirstFilteredItem() {}
virtual void doFolder(LLFolderViewFolder* folder);
virtual void doItem(LLFolderViewItem* item);
BOOL wasItemSelected() { return mItemSelected; }
protected:
BOOL mItemSelected;
};
class LLOpenFilteredFolders : public LLFolderViewFunctor
{
public:
LLOpenFilteredFolders() {}
virtual ~LLOpenFilteredFolders() {}
virtual void doFolder(LLFolderViewFolder* folder);
virtual void doItem(LLFolderViewItem* item);
};
class LLSaveFolderState : public LLFolderViewFunctor
{
public:
LLSaveFolderState() : mApply(FALSE) {}
virtual ~LLSaveFolderState() {}
virtual void doFolder(LLFolderViewFolder* folder);
virtual void doItem(LLFolderViewItem* item) {}
void setApply(BOOL apply);
void clearOpenFolders() { mOpenFolders.clear(); }
protected:
std::set<LLUUID> mOpenFolders;
BOOL mApply;
};
class LLOpenFoldersWithSelection : public LLFolderViewFunctor
{
public:
LLOpenFoldersWithSelection() {}
virtual ~LLOpenFoldersWithSelection() {}
virtual void doFolder(LLFolderViewFolder* folder);
virtual void doItem(LLFolderViewItem* item);
};
const std::string& get_item_icon_name(LLAssetType::EType asset_type,
LLInventoryType::EType inventory_type,
U32 attachment_point,
BOOL item_is_multi );
LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
LLInventoryType::EType inventory_type,
U32 attachment_point,
BOOL item_is_multi );
#endif // LL_LLINVENTORYFUNCTIONS_H
/**
* @file llinventoryfunctions.h
* @brief Miscellaneous inventory-related functions and classes
* class definition
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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_LLINVENTORYFUNCTIONS_H
#define LL_LLINVENTORYFUNCTIONS_H
#include "llassetstorage.h"
#include "lldarray.h"
#include "llfloater.h"
#include "llinventory.h"
#include "llinventoryfilter.h"
#include "llfolderview.h"
#include "llinventorymodel.h"
#include "lluictrlfactory.h"
#include <set>
class LLFolderViewItem;
class LLInventoryFilter;
class LLInventoryModel;
class LLInventoryPanel;
class LLInvFVBridge;
class LLInventoryFVBridgeBuilder;
class LLMenuBarGL;
class LLCheckBoxCtrl;
class LLSpinCtrl;
class LLScrollContainer;
class LLTextBox;
class LLIconCtrl;
class LLSaveFolderState;
class LLFilterEditor;
class LLTabContainer;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// This is a collection of miscellaneous functions and classes
// that don't fit cleanly into any other class header.
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryState
{
public:
// HACK: Until we can route this info through the instant message hierarchy
static BOOL sWearNewClothing;
static LLUUID sWearNewClothingTransactionID; // wear all clothing in this transaction
};
class LLSelectFirstFilteredItem : public LLFolderViewFunctor
{
public:
LLSelectFirstFilteredItem() : mItemSelected(FALSE) {}
virtual ~LLSelectFirstFilteredItem() {}
virtual void doFolder(LLFolderViewFolder* folder);
virtual void doItem(LLFolderViewItem* item);
BOOL wasItemSelected() { return mItemSelected; }
protected:
BOOL mItemSelected;
};
class LLOpenFilteredFolders : public LLFolderViewFunctor
{
public:
LLOpenFilteredFolders() {}
virtual ~LLOpenFilteredFolders() {}
virtual void doFolder(LLFolderViewFolder* folder);
virtual void doItem(LLFolderViewItem* item);
};
class LLSaveFolderState : public LLFolderViewFunctor
{
public:
LLSaveFolderState() : mApply(FALSE) {}
virtual ~LLSaveFolderState() {}
virtual void doFolder(LLFolderViewFolder* folder);
virtual void doItem(LLFolderViewItem* item) {}
void setApply(BOOL apply);
void clearOpenFolders() { mOpenFolders.clear(); }
protected:
std::set<LLUUID> mOpenFolders;
BOOL mApply;
};
class LLOpenFoldersWithSelection : public LLFolderViewFunctor
{
public:
LLOpenFoldersWithSelection() {}
virtual ~LLOpenFoldersWithSelection() {}
virtual void doFolder(LLFolderViewFolder* folder);
virtual void doItem(LLFolderViewItem* item);
};
const std::string& get_item_icon_name(LLAssetType::EType asset_type,
LLInventoryType::EType inventory_type,
U32 attachment_point,
BOOL item_is_multi );
LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
LLInventoryType::EType inventory_type,
U32 attachment_point,
BOOL item_is_multi );
#endif // LL_LLINVENTORYFUNCTIONS_H

View File

@ -509,7 +509,7 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id,
}
}
void LLInventoryModel::updateLinkedItems(const LLUUID& object_id)
void LLInventoryModel::addChangedMaskForLinks(const LLUUID& object_id, U32 mask)
{
const LLInventoryObject *obj = getObject(object_id);
if (!obj || obj->getIsLinkType())
@ -532,7 +532,7 @@ void LLInventoryModel::updateLinkedItems(const LLUUID& object_id)
cat_iter++)
{
LLViewerInventoryCategory *linked_cat = (*cat_iter);
addChangedMask(LLInventoryObserver::LABEL, linked_cat->getUUID());
addChangedMask(mask, linked_cat->getUUID());
};
for (LLInventoryModel::item_array_t::iterator iter = item_array.begin();
@ -540,9 +540,8 @@ void LLInventoryModel::updateLinkedItems(const LLUUID& object_id)
iter++)
{
LLViewerInventoryItem *linked_item = (*iter);
addChangedMask(LLInventoryObserver::LABEL, linked_item->getUUID());
addChangedMask(mask, linked_item->getUUID());
};
notifyObservers();
}
const LLUUID& LLInventoryModel::getLinkedItemID(const LLUUID& object_id) const
@ -1133,6 +1132,14 @@ void LLInventoryModel::notifyObservers(const std::string service_name)
llwarns << "Call was made to notifyObservers within notifyObservers!" << llendl;
return;
}
if ((mModifyMask == LLInventoryObserver::NONE) && (service_name == ""))
{
mModifyMask = LLInventoryObserver::NONE;
mChangedItemIDs.clear();
return;
}
mIsNotifyObservers = TRUE;
for (observer_list_t::iterator iter = mObservers.begin();
iter != mObservers.end(); )
@ -1180,7 +1187,7 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
// not sure what else might need to be accounted for this.
if (mModifyMask & LLInventoryObserver::LABEL)
{
updateLinkedItems(referent);
addChangedMaskForLinks(referent, LLInventoryObserver::LABEL);
}
}

View File

@ -167,8 +167,6 @@ public:
// Assumes item_id is itself not a linked item.
item_array_t collectLinkedItems(const LLUUID& item_id,
const LLUUID& start_folder_id = LLUUID::null);
// Updates all linked items pointing to this id.
void updateLinkedItems(const LLUUID& object_id);
// Get the inventoryID that this item points to, else just return item_id
const LLUUID& getLinkedItemID(const LLUUID& object_id) const;
@ -440,6 +438,9 @@ protected:
bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting);
// Updates all linked items pointing to this id.
void addChangedMaskForLinks(const LLUUID& object_id, U32 mask);
protected:
cat_array_t* getUnlockedCatArray(const LLUUID& id);
item_array_t* getUnlockedItemArray(const LLUUID& id);

File diff suppressed because it is too large Load Diff

View File

@ -374,22 +374,34 @@ void LLLandmarkActions::onRegionResponseNameAndCoords(region_name_and_coords_cal
bool LLLandmarkActions::getLandmarkGlobalPos(const LLUUID& landmarkInventoryItemID, LLVector3d& posGlobal)
{
LLLandmark* landmark = LLLandmarkActions::getLandmark(landmarkInventoryItemID);
LLViewerInventoryItem* item = gInventory.getItem(landmarkInventoryItemID);
if (NULL == item)
return false;
const LLUUID& asset_id = item->getAssetUUID();
LLLandmark* landmark = gLandmarkList.getAsset(asset_id, NULL);
if (NULL == landmark)
return false;
return landmark->getGlobalPos(posGlobal);
}
LLLandmark* LLLandmarkActions::getLandmark(const LLUUID& landmarkInventoryItemID)
LLLandmark* LLLandmarkActions::getLandmark(const LLUUID& landmarkInventoryItemID, LLLandmarkList::loaded_callback_t cb)
{
LLViewerInventoryItem* item = gInventory.getItem(landmarkInventoryItemID);
if (NULL == item)
return NULL;
const LLUUID& asset_id = item->getAssetUUID();
return gLandmarkList.getAsset(asset_id, NULL);
LLLandmark* landmark = gLandmarkList.getAsset(asset_id, cb);
if (landmark)
{
return landmark;
}
return NULL;
}
void LLLandmarkActions::copySLURLtoClipboard(const LLUUID& landmarkInventoryItemID)

View File

@ -35,7 +35,10 @@
#include "llinventorymodel.h"
#include "lllandmarklist.h"
class LLLandmark;
/**
* @brief Provides helper functions to manage landmarks
*/
@ -112,10 +115,11 @@ public:
/**
* @brief Retrieve a landmark from gLandmarkList by inventory item's id
* If a landmark is not currently in the gLandmarkList a callback "cb" is called when it is loaded.
*
* @return pointer to loaded landmark from gLandmarkList or NULL if landmark does not exist or wasn't loaded.
*/
static LLLandmark* getLandmark(const LLUUID& landmarkInventoryItemID);
static LLLandmark* getLandmark(const LLUUID& landmarkInventoryItemID, LLLandmarkList::loaded_callback_t cb = NULL);
/**
* @brief Performs standard action of copying of SLURL from landmark to user's clipboard.

View File

@ -96,9 +96,6 @@ void LLLogChat::saveHistory(const std::string& filename,
const LLUUID& from_id,
const std::string& line)
{
if (!gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
return;
if(!filename.size())
{
llinfos << "Filename is Empty!" << llendl;

View File

@ -265,8 +265,8 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
BOOL result = FALSE;
F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom;
F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeightScaled() - 0.5f) / gAgent.mHUDCurZoom;
F32 mouse_x = ((F32)x / gViewerWindow->getWorldViewWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom;
F32 mouse_y = ((F32)y / gViewerWindow->getWorldViewHeightScaled() - 0.5f) / gAgent.mHUDCurZoom;
LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin);
LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y);

View File

@ -1107,8 +1107,11 @@ BOOL LLManipRotate::updateVisiblity()
mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag;
mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm;
mCenterScreen.set((S32)((0.5f - mRotationCenter.mdV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewWidthRaw()),
(S32)((mRotationCenter.mdV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightRaw()));
// x axis range is (-aspect * 0.5f, +aspect * 0.5)
// y axis range is (-0.5, 0.5)
// so use getWorldViewHeightRaw as scale factor when converting to pixel coordinates
mCenterScreen.set((S32)((0.5f - center.mV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()),
(S32)((center.mV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightScaled()));
visible = TRUE;
}
else
@ -1624,8 +1627,8 @@ void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_
{
if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD)
{
F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewWidthRaw()) - 0.5f) / gAgent.mHUDCurZoom;
F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewHeightRaw()) - 0.5f) / gAgent.mHUDCurZoom;
F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewRectScaled().getWidth()) - 0.5f) / gAgent.mHUDCurZoom;
F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewRectScaled().getHeight()) - 0.5f) / gAgent.mHUDCurZoom;
*ray_pt = LLVector3(-1.f, -mouse_x, mouse_y);
*ray_dir = LLVector3(1.f, 0.f, 0.f);
@ -1699,7 +1702,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y )
F32 dist_y = mouse_dir_y.normVec();
F32 dist_z = mouse_dir_z.normVec();
F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeightRaw();
F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeightScaled();
if (llabs(dist_x - mRadiusMeters) * llmax(0.05f, proj_rot_x_axis) < distance_threshold)
{

View File

@ -102,17 +102,17 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
setCaretColor( (unsigned int)color.mV[0], (unsigned int)color.mV[1], (unsigned int)color.mV[2] );
}
setIgnoreUIScale(p.ignore_ui_scale());
setIgnoreUIScale(p.ignore_ui_scale);
setHomePageUrl(p.start_url());
setHomePageUrl(p.start_url);
setBorderVisible(p.border_visible());
setBorderVisible(p.border_visible);
mHideLoading = p.hide_loading();
mHideLoading = p.hide_loading;
setDecoupleTextureSize(p.decouple_texture_size());
setDecoupleTextureSize(p.decouple_texture_size);
setTextureSize(p.texture_width(), p.texture_height());
setTextureSize(p.texture_width, p.texture_height);
if(!getDecoupleTextureSize())
{
@ -735,13 +735,13 @@ void LLMediaCtrl::draw()
{
// max width, adjusted height
width = r.getWidth();
height = llmin(llmax(S32(width / media_aspect), 0), r.getHeight());
height = llmin(llmax(llround(width / media_aspect), 0), r.getHeight());
}
else
{
// max height, adjusted width
height = r.getHeight();
width = llmin(llmax(S32(height * media_aspect), 0), r.getWidth());
width = llmin(llmax(llround(height * media_aspect), 0), r.getWidth());
}
}
else
@ -759,6 +759,14 @@ void LLMediaCtrl::draw()
x_offset = (r.getWidth() - width) / 2;
y_offset = (r.getHeight() - height) / 2;
if(mIgnoreUIScale)
{
x_offset = llround((F32)x_offset * LLUI::sGLScaleFactor.mV[VX]);
y_offset = llround((F32)y_offset * LLUI::sGLScaleFactor.mV[VY]);
width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]);
height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]);
}
// draw the browser
gGL.setSceneBlendType(LLRender::BT_REPLACE);
gGL.begin( LLRender::QUADS );

View File

@ -371,67 +371,87 @@ BOOL LLMediaDataClient::QueueTimer::tick()
}
LLMediaDataClient::PriorityQueue &queue = *(mMDC->pRequestQueue);
if (queue.empty())
if(!queue.empty())
{
LL_DEBUGS("LLMediaDataClient") << "queue empty: " << queue << LL_ENDL;
return TRUE;
LL_INFOS("LLMediaDataClient") << "QueueTimer::tick() started, queue is: " << queue << LL_ENDL;
}
LL_INFOS("LLMediaDataClient") << "QueueTimer::tick() started, queue is: " << queue << LL_ENDL;
// Peel one off of the items from the queue, and execute request
request_ptr_t request = queue.top();
llassert(!request.isNull());
const LLMediaDataClientObject *object = (request.isNull()) ? NULL : request->getObject();
bool performed_request = false;
bool error = false;
llassert(NULL != object);
if (NULL != object && object->hasMedia())
// quick retry loop for cases where we shouldn't wait for the next timer tick
while(true)
{
std::string url = request->getCapability();
if (!url.empty())
if (queue.empty())
{
const LLSD &sd_payload = request->getPayload();
LL_INFOS("LLMediaDataClient") << "Sending request for " << *request << LL_ENDL;
LL_DEBUGS("LLMediaDataClient") << "queue empty: " << queue << LL_ENDL;
return TRUE;
}
// Peel one off of the items from the queue, and execute request
request_ptr_t request = queue.top();
llassert(!request.isNull());
const LLMediaDataClientObject *object = (request.isNull()) ? NULL : request->getObject();
bool performed_request = false;
bool error = false;
llassert(NULL != object);
// Call the subclass for creating the responder
LLHTTPClient::post(url, sd_payload, mMDC->createResponder(request));
performed_request = true;
if(object->isDead())
{
// This object has been marked dead. Pop it and move on to the next item in the queue immediately.
LL_INFOS("LLMediaDataClient") << "Skipping " << *request << ": object is dead!" << LL_ENDL;
queue.pop();
continue; // jump back to the start of the quick retry loop
}
if (NULL != object && object->hasMedia())
{
std::string url = request->getCapability();
if (!url.empty())
{
const LLSD &sd_payload = request->getPayload();
LL_INFOS("LLMediaDataClient") << "Sending request for " << *request << LL_ENDL;
// Call the subclass for creating the responder
LLHTTPClient::post(url, sd_payload, mMDC->createResponder(request));
performed_request = true;
}
else {
LL_INFOS("LLMediaDataClient") << "NOT Sending request for " << *request << ": empty cap url!" << LL_ENDL;
}
}
else {
LL_INFOS("LLMediaDataClient") << "NOT Sending request for " << *request << ": empty cap url!" << LL_ENDL;
if (request.isNull())
{
LL_WARNS("LLMediaDataClient") << "Not Sending request: NULL request!" << LL_ENDL;
}
else if (NULL == object)
{
LL_WARNS("LLMediaDataClient") << "Not Sending request for " << *request << " NULL object!" << LL_ENDL;
}
else if (!object->hasMedia())
{
LL_WARNS("LLMediaDataClient") << "Not Sending request for " << *request << " hasMedia() is false!" << LL_ENDL;
}
error = true;
}
}
else {
if (request.isNull())
bool exceeded_retries = request->getRetryCount() > mMDC->mMaxNumRetries;
if (performed_request || exceeded_retries || error) // Try N times before giving up
{
LL_WARNS("LLMediaDataClient") << "Not Sending request: NULL request!" << LL_ENDL;
if (exceeded_retries)
{
LL_WARNS("LLMediaDataClient") << "Could not send request " << *request << " for "
<< mMDC->mMaxNumRetries << " tries...popping object id " << object->getID() << LL_ENDL;
// XXX Should we bring up a warning dialog??
}
queue.pop();
}
else if (NULL == object)
{
LL_WARNS("LLMediaDataClient") << "Not Sending request for " << *request << " NULL object!" << LL_ENDL;
else {
request->incRetryCount();
}
else if (!object->hasMedia())
{
LL_WARNS("LLMediaDataClient") << "Not Sending request for " << *request << " hasMedia() is false!" << LL_ENDL;
}
error = true;
}
bool exceeded_retries = request->getRetryCount() > mMDC->mMaxNumRetries;
if (performed_request || exceeded_retries || error) // Try N times before giving up
{
if (exceeded_retries)
{
LL_WARNS("LLMediaDataClient") << "Could not send request " << *request << " for "
<< mMDC->mMaxNumRetries << " tries...popping object id " << object->getID() << LL_ENDL;
// XXX Should we bring up a warning dialog??
}
queue.pop();
}
else {
request->incRetryCount();
}
// end of quick retry loop -- any cases where we want to loop will use 'continue' to jump back to the start.
break;
}
LL_DEBUGS("LLMediaDataClient") << "QueueTimer::tick() finished, queue is now: " << (*(mMDC->pRequestQueue)) << LL_ENDL;
return queue.empty();

View File

@ -62,6 +62,8 @@ public:
virtual F64 getTotalMediaInterest() const = 0;
// Return the given cap url
virtual std::string getCapabilityUrl(const std::string &name) const = 0;
// Return whether the object has been marked dead
virtual bool isDead() const = 0;
// smart pointer
typedef LLPointer<LLMediaDataClientObject> ptr_t;

View File

@ -177,7 +177,7 @@ void LLNearbyChat::addMessage(const LLChat& chat)
}
message = message.substr(3);
append_style_params.font.style = "UNDERLINE";
append_style_params.font.style = "ITALIC";
mChatHistory->appendText(message, FALSE, append_style_params);
}
else
@ -222,5 +222,5 @@ void LLNearbyChat::setRect (const LLRect &rect)
void LLNearbyChat::getAllowedRect(LLRect& rect)
{
rect = gViewerWindow->getWorldViewRectRaw();
rect = gViewerWindow->getWorldViewRectScaled();
}

View File

@ -92,7 +92,6 @@ LLNetMap::LLNetMap (const Params & p)
mObjectImagep(),
mClosestAgentToCursor(),
mClosestAgentAtLastRightClick(),
mRotateMap(FALSE),
mToolTipMsg()
{
mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
@ -175,7 +174,8 @@ void LLNetMap::draw()
gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
if( mRotateMap )
static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
if( rotate_map )
{
// rotate subsequent draws to agent rotation
rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
@ -408,7 +408,7 @@ void LLNetMap::draw()
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
if( mRotateMap )
if( rotate_map )
{
gGL.color4fv((map_frustum_color()).mV);
@ -454,7 +454,8 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos )
pos_local.mV[VY] *= mPixelsPerMeter;
// leave Z component in meters
if( mRotateMap )
static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
if( rotate_map )
{
F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
@ -502,7 +503,8 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )
F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
if( mRotateMap )
static LLUICachedControl<bool> rotate_map("MiniMapRotate", true);
if( rotate_map )
{
LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
pos_local.rotVec( rot );

View File

@ -80,9 +80,7 @@ public:
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
void setScale( F32 scale );
void setRotateMap( BOOL b ) { mRotateMap = b; }
void setToolTipMsg(const std::string& msg) { mToolTipMsg = msg; }
BOOL getRotateMap( ) { return mRotateMap; }
void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius );
private:
@ -122,7 +120,6 @@ private:
LLUUID mClosestAgentToCursor;
LLUUID mClosestAgentAtLastRightClick;
BOOL mRotateMap;
std::string mToolTipMsg;
};

View File

@ -66,7 +66,7 @@ LLAlertHandler::~LLAlertHandler()
//--------------------------------------------------------------------------
void LLAlertHandler::initChannel()
{
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().getWidth() / 2;
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().getWidth() / 2;
mChannel->init(channel_right_bound, channel_right_bound);
}

View File

@ -61,7 +61,7 @@ LLGroupHandler::~LLGroupHandler()
//--------------------------------------------------------------------------
void LLGroupHandler::initChannel()
{
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
}

View File

@ -65,7 +65,7 @@ LLOfferHandler::~LLOfferHandler()
//--------------------------------------------------------------------------
void LLOfferHandler::initChannel()
{
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
}

View File

@ -65,7 +65,7 @@ LLScriptHandler::~LLScriptHandler()
//--------------------------------------------------------------------------
void LLScriptHandler::initChannel()
{
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
}

View File

@ -60,7 +60,7 @@ LLTipHandler::~LLTipHandler()
//--------------------------------------------------------------------------
void LLTipHandler::initChannel()
{
S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
}

View File

@ -213,6 +213,7 @@ void LLPanelGroupGeneral::setupCtrls(LLPanel* panel_group)
}
mFounderName = panel_group->getChild<LLNameBox>("founder_name");
mGroupNameEditor = panel_group->getChild<LLLineEditor>("group_name_editor");
mGroupNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII );
}
// static

View File

@ -195,7 +195,7 @@ void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id)
childSetEnabled("teleport_btn", FALSE);
childSetEnabled("pay_btn", FALSE);
getChild<LLTextBox>("avatar_name")->setValue(im_session->mName);
getChild<LLTextBox>("avatar_name")->setValue(im_session->mName);
}
else
{

View File

@ -352,6 +352,8 @@ void LLPanelLandmarkInfo::createLandmark(const LLUUID& folder_id)
}
LLStringUtil::replaceChar(desc, '\n', ' ');
LLViewerInventoryItem::insertDefaultSortField(name);
// If no folder chosen use the "Landmarks" folder.
LLLandmarkActions::createLandmarkHere(name, desc,
folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));

View File

@ -148,20 +148,13 @@ void LLLandmarksPanel::onShowOnMap()
llwarns << "There are no selected list. No actions are performed." << llendl;
return;
}
LLLandmark* landmark = getCurSelectedLandmark();
if (!landmark)
return;
LLVector3d landmark_global_pos;
if (!landmark->getGlobalPos(landmark_global_pos))
return;
LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
if (!landmark_global_pos.isExactlyZero() && worldmap_instance)
{
worldmap_instance->trackLocation(landmark_global_pos);
LLFloaterReg::showInstance("world_map", "center");
}
// Disable the "Map" button because loading landmark can take some time.
// During this time the button is useless. It will be enabled on callback finish
// or upon switching to other item.
mShowOnMapBtn->setEnabled(FALSE);
doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doShowOnMap, this, _1));
}
// virtual
@ -256,15 +249,18 @@ bool LLLandmarksPanel::isReceivedFolderSelected() const
return false;
}
LLLandmark* LLLandmarksPanel::getCurSelectedLandmark() const
{
void LLLandmarksPanel::doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb)
{
LLFolderViewItem* cur_item = getCurSelectedItem();
if(cur_item && cur_item->getListener()->getInventoryType() == LLInventoryType::IT_LANDMARK)
{
return LLLandmarkActions::getLandmark(cur_item->getListener()->getUUID());
LLLandmark* landmark = LLLandmarkActions::getLandmark(cur_item->getListener()->getUUID(), cb);
if (landmark)
{
cb(landmark);
}
}
return NULL;
}
LLFolderViewItem* LLLandmarksPanel::getCurSelectedItem() const
@ -294,45 +290,11 @@ void LLLandmarksPanel::processParcelInfo(const LLParcelData& parcel_data)
// We have to make request to sever to get parcel_id and snaption_id.
if(isLandmarkSelected())
{
LLLandmark* landmark = getCurSelectedLandmark();
LLFolderViewItem* cur_item = getCurSelectedItem();
LLUUID id = cur_item->getListener()->getUUID();
LLInventoryItem* inv_item = mCurrentSelectedList->getModel()->getItem(id);
if(landmark)
{
LLPanelPickEdit* panel_pick = LLPanelPickEdit::create();
LLVector3d landmark_global_pos;
landmark->getGlobalPos(landmark_global_pos);
// let's toggle pick panel into panel places
LLPanel* panel_places = LLSideTray::getInstance()->getChild<LLPanel>("panel_places");//-> sidebar_places
panel_places->addChild(panel_pick);
LLRect paren_rect(panel_places->getRect());
panel_pick->reshape(paren_rect.getWidth(),paren_rect.getHeight(), TRUE);
panel_pick->setRect(paren_rect);
panel_pick->onOpen(LLSD());
LLPickData data;
data.pos_global = landmark_global_pos;
data.name = cur_item->getName();
data.desc = inv_item->getDescription();
data.snapshot_id = parcel_data.snapshot_id;
data.parcel_id = parcel_data.parcel_id;
panel_pick->setPickData(&data);
LLSD params;
params["parcel_id"] =parcel_data.parcel_id;
/* set exit callback to get back onto panel places
in callback we will make cleaning up( delete pick_panel instance,
remove landmark panel from observer list
*/
panel_pick->setExitCallback(boost::bind(&LLLandmarksPanel::onPickPanelExit,this,
panel_pick, panel_places,params));
panel_pick->setSaveCallback(boost::bind(&LLLandmarksPanel::onPickPanelExit,this,
panel_pick, panel_places,params));
panel_pick->setCancelCallback(boost::bind(&LLLandmarksPanel::onPickPanelExit,this,
panel_pick, panel_places,params));
}
LLInventoryItem* inv_item = mCurrentSelectedList->getModel()->getItem(id);
doActionOnCurSelectedLandmark(boost::bind(
&LLLandmarksPanel::doProcessParcelInfo, this, _1, cur_item, inv_item, parcel_data));
}
}
@ -747,42 +709,7 @@ void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
}
else if ("create_pick" == command_name)
{
LLLandmark* landmark = getCurSelectedLandmark();
if(!landmark) return;
LLViewerRegion* region = gAgent.getRegion();
if (!region) return;
LLGlobalVec pos_global;
LLUUID region_id;
landmark->getGlobalPos(pos_global);
landmark->getRegionID(region_id);
LLVector3 region_pos((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
(F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
(F32)pos_global.mdV[VZ]);
LLSD body;
std::string url = region->getCapability("RemoteParcelRequest");
if (!url.empty())
{
body["location"] = ll_sd_from_vector3(region_pos);
if (!region_id.isNull())
{
body["region_id"] = region_id;
}
if (!pos_global.isExactlyZero())
{
U64 region_handle = to_region_handle(pos_global);
body["region_handle"] = ll_sd_from_U64(region_handle);
}
LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle()));
}
else
{
llwarns << "Can't create pick for landmark for region" << region_id
<< ". Region: " << region->getName()
<< " does not support RemoteParcelRequest" << llendl;
}
doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doCreatePick, this, _1));
}
}
@ -931,6 +858,97 @@ void LLLandmarksPanel::updateFilteredAccordions()
mDirtyFilter = false;
}
void LLLandmarksPanel::doShowOnMap(LLLandmark* landmark)
{
LLVector3d landmark_global_pos;
if (!landmark->getGlobalPos(landmark_global_pos))
return;
LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
if (!landmark_global_pos.isExactlyZero() && worldmap_instance)
{
worldmap_instance->trackLocation(landmark_global_pos);
LLFloaterReg::showInstance("world_map", "center");
}
mShowOnMapBtn->setEnabled(TRUE);
}
void LLLandmarksPanel::doProcessParcelInfo(LLLandmark* landmark,
LLFolderViewItem* cur_item,
LLInventoryItem* inv_item,
const LLParcelData& parcel_data)
{
LLPanelPickEdit* panel_pick = LLPanelPickEdit::create();
LLVector3d landmark_global_pos;
landmark->getGlobalPos(landmark_global_pos);
// let's toggle pick panel into panel places
LLPanel* panel_places = LLSideTray::getInstance()->getChild<LLPanel>("panel_places");//-> sidebar_places
panel_places->addChild(panel_pick);
LLRect paren_rect(panel_places->getRect());
panel_pick->reshape(paren_rect.getWidth(),paren_rect.getHeight(), TRUE);
panel_pick->setRect(paren_rect);
panel_pick->onOpen(LLSD());
LLPickData data;
data.pos_global = landmark_global_pos;
data.name = cur_item->getName();
data.desc = inv_item->getDescription();
data.snapshot_id = parcel_data.snapshot_id;
data.parcel_id = parcel_data.parcel_id;
panel_pick->setPickData(&data);
LLSD params;
params["parcel_id"] = parcel_data.parcel_id;
/* set exit callback to get back onto panel places
in callback we will make cleaning up( delete pick_panel instance,
remove landmark panel from observer list
*/
panel_pick->setExitCallback(boost::bind(&LLLandmarksPanel::onPickPanelExit,this,
panel_pick, panel_places,params));
panel_pick->setSaveCallback(boost::bind(&LLLandmarksPanel::onPickPanelExit,this,
panel_pick, panel_places,params));
panel_pick->setCancelCallback(boost::bind(&LLLandmarksPanel::onPickPanelExit,this,
panel_pick, panel_places,params));
}
void LLLandmarksPanel::doCreatePick(LLLandmark* landmark)
{
LLViewerRegion* region = gAgent.getRegion();
if (!region) return;
LLGlobalVec pos_global;
LLUUID region_id;
landmark->getGlobalPos(pos_global);
landmark->getRegionID(region_id);
LLVector3 region_pos((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
(F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
(F32)pos_global.mdV[VZ]);
LLSD body;
std::string url = region->getCapability("RemoteParcelRequest");
if (!url.empty())
{
body["location"] = ll_sd_from_vector3(region_pos);
if (!region_id.isNull())
{
body["region_id"] = region_id;
}
if (!pos_global.isExactlyZero())
{
U64 region_handle = to_region_handle(pos_global);
body["region_handle"] = ll_sd_from_U64(region_handle);
}
LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle()));
}
else
{
llwarns << "Can't create pick for landmark for region" << region_id
<< ". Region: " << region->getName()
<< " does not support RemoteParcelRequest" << llendl;
}
}
//////////////////////////////////////////////////////////////////////////
// HELPER FUNCTIONS

View File

@ -37,6 +37,7 @@
// newview
#include "llinventorymodel.h"
#include "lllandmarklist.h"
#include "llpanelplacestab.h"
#include "llpanelpick.h"
#include "llremoteparcelrequest.h"
@ -68,7 +69,7 @@ protected:
*/
bool isLandmarkSelected() const;
bool isReceivedFolderSelected() const;
LLLandmark* getCurSelectedLandmark() const;
void doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb);
LLFolderViewItem* getCurSelectedItem() const;
void updateSortOrder(LLInventoryPanel* panel, bool byDate);
@ -127,6 +128,16 @@ private:
*/
void updateFilteredAccordions();
/**
* Landmark actions callbacks. Fire when a landmark is loaded from the list.
*/
void doShowOnMap(LLLandmark* landmark);
void doProcessParcelInfo(LLLandmark* landmark,
LLFolderViewItem* cur_item,
LLInventoryItem* inv_item,
const LLParcelData& parcel_data);
void doCreatePick(LLLandmark* landmark);
private:
LLInventorySubTreePanel* mFavoritesInventoryPanel;
LLInventorySubTreePanel* mLandmarksInventoryPanel;

View File

@ -210,8 +210,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
}
#if !USE_VIEWER_AUTH
childSetPrevalidate("first_name_edit", LLLineEditor::prevalidatePrintableNoSpace);
childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace);
childSetPrevalidate("first_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace);
childSetPrevalidate("last_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace);
childSetCommitCallback("password_edit", mungePassword, this);
getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);

File diff suppressed because it is too large Load Diff

View File

@ -1,149 +1,149 @@
/**
* @file llpanelmaininventory.h
* @brief llpanelmaininventory.h
* class definition
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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_LLPANELMAININVENTORY_H
#define LL_LLPANELMAININVENTORY_H
#include "llpanel.h"
#include "llinventoryobserver.h"
#include "llfolderview.h"
class LLFolderViewItem;
class LLInventoryPanel;
class LLSaveFolderState;
class LLFilterEditor;
class LLTabContainer;
class LLFloaterInventoryFinder;
class LLMenuGL;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLPanelMainInventory
//
// This is a panel used to view and control an agent's inventory,
// including all the fixin's (e.g. AllItems/RecentItems tabs, filter floaters).
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLPanelMainInventory : public LLPanel, LLInventoryObserver
{
public:
friend class LLFloaterInventoryFinder;
LLPanelMainInventory();
~LLPanelMainInventory();
BOOL postBuild();
virtual BOOL handleKeyHere(KEY key, MASK mask);
// Inherited functionality
/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg);
/*virtual*/ void changed(U32 mask);
LLInventoryPanel* getPanel() { return mActivePanel; }
LLInventoryPanel* getActivePanel() { return mActivePanel; }
const LLInventoryPanel* getActivePanel() const { return mActivePanel; }
const std::string& getFilterText() const { return mFilterText; }
void setSelectCallback(const LLFolderView::signal_t::slot_type& cb);
protected:
//
// Misc functions
//
void setFilterTextFromFilter();
void startSearch();
void toggleFindOptions();
void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action);
static BOOL filtersVisible(void* user_data);
void onClearSearch();
static void onFoldersByName(void *user_data);
static BOOL checkFoldersByName(void *user_data);
void onFilterEdit(const std::string& search_string );
static BOOL incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward);
void onFilterSelected();
const std::string getFilterSubString();
void setFilterSubString(const std::string& string);
// menu callbacks
void doToSelected(const LLSD& userdata);
void closeAllFolders();
void newWindow();
void doCreate(const LLSD& userdata);
void resetFilters();
void setSortBy(const LLSD& userdata);
private:
LLFloaterInventoryFinder* getFinder();
LLFilterEditor* mFilterEditor;
LLTabContainer* mFilterTabs;
LLHandle<LLFloater> mFinderHandle;
LLInventoryPanel* mActivePanel;
LLSaveFolderState* mSavedFolderState;
std::string mFilterText;
//////////////////////////////////////////////////////////////////////////////////
// List Commands //
protected:
void initListCommandsHandlers();
void updateListCommands();
void onGearButtonClick();
void onAddButtonClick();
void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
void onTrashButtonClick();
void onClipboardAction(const LLSD& userdata);
BOOL isActionEnabled(const LLSD& command_name);
void onCustomAction(const LLSD& command_name);
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
private:
LLPanel* mListCommands;
LLMenuGL* mMenuGearDefault;
LLMenuGL* mMenuAdd;
// List Commands //
////////////////////////////////////////////////////////////////////////////////
};
#endif // LL_LLPANELMAININVENTORY_H
/**
* @file llpanelmaininventory.h
* @brief llpanelmaininventory.h
* class definition
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-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_LLPANELMAININVENTORY_H
#define LL_LLPANELMAININVENTORY_H
#include "llpanel.h"
#include "llinventoryobserver.h"
#include "llfolderview.h"
class LLFolderViewItem;
class LLInventoryPanel;
class LLSaveFolderState;
class LLFilterEditor;
class LLTabContainer;
class LLFloaterInventoryFinder;
class LLMenuGL;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLPanelMainInventory
//
// This is a panel used to view and control an agent's inventory,
// including all the fixin's (e.g. AllItems/RecentItems tabs, filter floaters).
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLPanelMainInventory : public LLPanel, LLInventoryObserver
{
public:
friend class LLFloaterInventoryFinder;
LLPanelMainInventory();
~LLPanelMainInventory();
BOOL postBuild();
virtual BOOL handleKeyHere(KEY key, MASK mask);
// Inherited functionality
/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg);
/*virtual*/ void changed(U32 mask);
LLInventoryPanel* getPanel() { return mActivePanel; }
LLInventoryPanel* getActivePanel() { return mActivePanel; }
const LLInventoryPanel* getActivePanel() const { return mActivePanel; }
const std::string& getFilterText() const { return mFilterText; }
void setSelectCallback(const LLFolderView::signal_t::slot_type& cb);
protected:
//
// Misc functions
//
void setFilterTextFromFilter();
void startSearch();
void toggleFindOptions();
void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action);
static BOOL filtersVisible(void* user_data);
void onClearSearch();
static void onFoldersByName(void *user_data);
static BOOL checkFoldersByName(void *user_data);
void onFilterEdit(const std::string& search_string );
static BOOL incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward);
void onFilterSelected();
const std::string getFilterSubString();
void setFilterSubString(const std::string& string);
// menu callbacks
void doToSelected(const LLSD& userdata);
void closeAllFolders();
void newWindow();
void doCreate(const LLSD& userdata);
void resetFilters();
void setSortBy(const LLSD& userdata);
private:
LLFloaterInventoryFinder* getFinder();
LLFilterEditor* mFilterEditor;
LLTabContainer* mFilterTabs;
LLHandle<LLFloater> mFinderHandle;
LLInventoryPanel* mActivePanel;
LLSaveFolderState* mSavedFolderState;
std::string mFilterText;
//////////////////////////////////////////////////////////////////////////////////
// List Commands //
protected:
void initListCommandsHandlers();
void updateListCommands();
void onGearButtonClick();
void onAddButtonClick();
void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
void onTrashButtonClick();
void onClipboardAction(const LLSD& userdata);
BOOL isActionEnabled(const LLSD& command_name);
void onCustomAction(const LLSD& command_name);
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
private:
LLPanel* mListCommands;
LLMenuGL* mMenuGearDefault;
LLMenuGL* mMenuAdd;
// List Commands //
////////////////////////////////////////////////////////////////////////////////
};
#endif // LL_LLPANELMAININVENTORY_H

View File

@ -1,345 +1,345 @@
/**
* @file llpanelmediasettingssecurity.cpp
* @brief LLPanelMediaSettingsSecurity class implementation
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 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$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloaterreg.h"
#include "llpanelmediasettingssecurity.h"
#include "llpanelcontents.h"
#include "llcheckboxctrl.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
#include "llwindow.h"
#include "llviewerwindow.h"
#include "llsdutil.h"
#include "llselectmgr.h"
#include "llmediaentry.h"
#include "llfloaterwhitelistentry.h"
#include "llfloatermediasettings.h"
////////////////////////////////////////////////////////////////////////////////
//
LLPanelMediaSettingsSecurity::LLPanelMediaSettingsSecurity() :
mParent( NULL )
{
mCommitCallbackRegistrar.add("Media.whitelistAdd", boost::bind(&LLPanelMediaSettingsSecurity::onBtnAdd, this));
mCommitCallbackRegistrar.add("Media.whitelistDelete", boost::bind(&LLPanelMediaSettingsSecurity::onBtnDel, this));
// build dialog from XML
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_media_settings_security.xml");
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLPanelMediaSettingsSecurity::postBuild()
{
mEnableWhiteList = getChild< LLCheckBoxCtrl >( LLMediaEntry::WHITELIST_ENABLE_KEY );
mWhiteListList = getChild< LLScrollListCtrl >( LLMediaEntry::WHITELIST_KEY );
setDefaultBtn("whitelist_add");
return true;
}
////////////////////////////////////////////////////////////////////////////////
// virtual
LLPanelMediaSettingsSecurity::~LLPanelMediaSettingsSecurity()
{
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::draw()
{
// housekeeping
LLPanel::draw();
// if list is empty, disable DEL button and checkbox to enable use of list
if ( mWhiteListList->isEmpty() )
{
childSetEnabled( "whitelist_del", false );
childSetEnabled( LLMediaEntry::WHITELIST_KEY, false );
childSetEnabled( LLMediaEntry::WHITELIST_ENABLE_KEY, false );
}
else
{
childSetEnabled( "whitelist_del", true );
childSetEnabled( LLMediaEntry::WHITELIST_KEY, true );
childSetEnabled( LLMediaEntry::WHITELIST_ENABLE_KEY, true );
};
// if nothing is selected, disable DEL button
if ( mWhiteListList->getSelectedValue().asString().empty() )
{
childSetEnabled( "whitelist_del", false );
}
else
{
childSetEnabled( "whitelist_del", true );
};
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::initValues( void* userdata, const LLSD& media_settings , bool editable)
{
LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
if ( LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo )
{
if(LLFloaterMediaSettings::getInstance()->mMultipleMedia)
{
self->clearValues(self, editable);
// only show multiple
return;
}
}
else
{
if(LLFloaterMediaSettings::getInstance()->mMultipleValidMedia)
{
self->clearValues(self, editable);
// only show multiple
return;
}
}
std::string base_key( "" );
std::string tentative_key( "" );
struct
{
std::string key_name;
LLUICtrl* ctrl_ptr;
std::string ctrl_type;
} data_set [] =
{
{ LLMediaEntry::WHITELIST_ENABLE_KEY, self->mEnableWhiteList, "LLCheckBoxCtrl" },
{ LLMediaEntry::WHITELIST_KEY, self->mWhiteListList, "LLScrollListCtrl" },
{ "", NULL , "" }
};
for( int i = 0; data_set[ i ].key_name.length() > 0; ++i )
{
base_key = std::string( data_set[ i ].key_name );
tentative_key = base_key + std::string( LLPanelContents::TENTATIVE_SUFFIX );
// TODO: CP - I bet there is a better way to do this using Boost
if ( media_settings[ base_key ].isDefined() )
{
if ( data_set[ i ].ctrl_type == "LLCheckBoxCtrl" )
{
static_cast< LLCheckBoxCtrl* >( data_set[ i ].ctrl_ptr )->
setValue( media_settings[ base_key ].asBoolean() );
}
else
if ( data_set[ i ].ctrl_type == "LLScrollListCtrl" )
{
// get control
LLScrollListCtrl* list = static_cast< LLScrollListCtrl* >( data_set[ i ].ctrl_ptr );
list->deleteAllItems();
// points to list of white list URLs
LLSD url_list = media_settings[ base_key ];
// iterate over them and add to scroll list
LLSD::array_iterator iter = url_list.beginArray();
while( iter != url_list.endArray() )
{
// TODO: is iter guaranteed to be valid here?
std::string url = *iter;
list->addSimpleElement( url );
++iter;
};
};
data_set[ i ].ctrl_ptr->setEnabled(editable);
data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );
};
};
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::clearValues( void* userdata , bool editable)
{
LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
self->mEnableWhiteList->clear();
self->mWhiteListList->deleteAllItems();
self->mEnableWhiteList->setEnabled(editable);
self->mWhiteListList->setEnabled(editable);
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::preApply()
{
// no-op
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in )
{
fill_me_in[LLMediaEntry::WHITELIST_ENABLE_KEY] = mEnableWhiteList->getValue();
// iterate over white list and extract items
std::vector< LLScrollListItem* > white_list_items = mWhiteListList->getAllData();
std::vector< LLScrollListItem* >::iterator iter = white_list_items.begin();
// *NOTE: need actually set the key to be an emptyArray(), or the merge
// we do with this LLSD will think there's nothing to change.
fill_me_in[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
while( iter != white_list_items.end() )
{
std::string white_list_url = (*iter)->getValue().asString();
fill_me_in[ LLMediaEntry::WHITELIST_KEY ].append( white_list_url );
++iter;
};
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::postApply()
{
// no-op
}
///////////////////////////////////////////////////////////////////////////////
// Try to make a valid URL if a fragment (
// white list list box widget and build a list to test against. Can also
const std::string LLPanelMediaSettingsSecurity::makeValidUrl( const std::string& src_url )
{
// use LLURI to determine if we have a valid scheme
LLURI candidate_url( src_url );
if ( candidate_url.scheme().empty() )
{
// build a URL comprised of default scheme and the original fragment
const std::string default_scheme( "http://" );
return default_scheme + src_url;
};
// we *could* test the "default scheme" + "original fragment" URL again
// using LLURI to see if it's valid but I think the outcome is the same
// in either case - our only option is to return the original URL
// we *think* the original url passed in was valid
return src_url;
}
///////////////////////////////////////////////////////////////////////////////
// wrapper for testing a URL against the whitelist. We grab entries from
// white list list box widget and build a list to test against. Can also
// optionally pass the URL that you are trying to add to the widget since
// it won't be added until this call returns.
bool LLPanelMediaSettingsSecurity::passesWhiteList( const std::string& added_url,
const std::string& test_url )
{
// the checkUrlAgainstWhitelist(..) function works on a vector
// of strings for the white list entries - in this panel, the white list
// is stored in the widgets themselves so we need to build something compatible.
std::vector< std::string > whitelist_strings;
whitelist_strings.clear(); // may not be required - I forget what the spec says.
// step through whitelist widget entries and grab them as strings
std::vector< LLScrollListItem* > white_list_items = mWhiteListList->getAllData();
std::vector< LLScrollListItem* >::iterator iter = white_list_items.begin();
while( iter != white_list_items.end() )
{
const std::string whitelist_url = (*iter)->getValue().asString();
whitelist_strings.push_back( whitelist_url );
++iter;
};
// add in the URL that might be added to the whitelist so we can test that too
if ( added_url.length() )
whitelist_strings.push_back( added_url );
// possible the URL is just a fragment so we validize it
const std::string valid_url = makeValidUrl( test_url );
// indicate if the URL passes whitelist
return LLMediaEntry::checkUrlAgainstWhitelist( valid_url, whitelist_strings );
}
///////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::addWhiteListItem(const std::string& url)
{
// grab home URL from the general panel (via the parent floater)
std::string home_url( "" );
if ( mParent )
home_url = mParent->getHomeUrl();
// if the home URL is blank (user hasn't entered it yet) then
// don't bother to check if it passes the white list
if ( home_url.empty() )
{
mWhiteListList->addSimpleElement( url );
return;
};
// if the URL passes the white list, add it
if ( passesWhiteList( url, home_url ) )
{
mWhiteListList->addSimpleElement( url );
}
else
// display a message indicating you can't do that
{
LLNotifications::instance().add("WhiteListInvalidatesHomeUrl");
};
}
///////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::onBtnAdd( void* userdata )
{
LLFloaterReg::showInstance("whitelist_entry");
}
///////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::onBtnDel( void* userdata )
{
LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
self->mWhiteListList->deleteSelectedItems();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::setParent( LLFloaterMediaSettings* parent )
{
mParent = parent;
};
/**
* @file llpanelmediasettingssecurity.cpp
* @brief LLPanelMediaSettingsSecurity class implementation
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 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$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloaterreg.h"
#include "llpanelmediasettingssecurity.h"
#include "llpanelcontents.h"
#include "llcheckboxctrl.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
#include "llwindow.h"
#include "llviewerwindow.h"
#include "llsdutil.h"
#include "llselectmgr.h"
#include "llmediaentry.h"
#include "llfloaterwhitelistentry.h"
#include "llfloatermediasettings.h"
////////////////////////////////////////////////////////////////////////////////
//
LLPanelMediaSettingsSecurity::LLPanelMediaSettingsSecurity() :
mParent( NULL )
{
mCommitCallbackRegistrar.add("Media.whitelistAdd", boost::bind(&LLPanelMediaSettingsSecurity::onBtnAdd, this));
mCommitCallbackRegistrar.add("Media.whitelistDelete", boost::bind(&LLPanelMediaSettingsSecurity::onBtnDel, this));
// build dialog from XML
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_media_settings_security.xml");
}
////////////////////////////////////////////////////////////////////////////////
//
BOOL LLPanelMediaSettingsSecurity::postBuild()
{
mEnableWhiteList = getChild< LLCheckBoxCtrl >( LLMediaEntry::WHITELIST_ENABLE_KEY );
mWhiteListList = getChild< LLScrollListCtrl >( LLMediaEntry::WHITELIST_KEY );
setDefaultBtn("whitelist_add");
return true;
}
////////////////////////////////////////////////////////////////////////////////
// virtual
LLPanelMediaSettingsSecurity::~LLPanelMediaSettingsSecurity()
{
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::draw()
{
// housekeeping
LLPanel::draw();
// if list is empty, disable DEL button and checkbox to enable use of list
if ( mWhiteListList->isEmpty() )
{
childSetEnabled( "whitelist_del", false );
childSetEnabled( LLMediaEntry::WHITELIST_KEY, false );
childSetEnabled( LLMediaEntry::WHITELIST_ENABLE_KEY, false );
}
else
{
childSetEnabled( "whitelist_del", true );
childSetEnabled( LLMediaEntry::WHITELIST_KEY, true );
childSetEnabled( LLMediaEntry::WHITELIST_ENABLE_KEY, true );
};
// if nothing is selected, disable DEL button
if ( mWhiteListList->getSelectedValue().asString().empty() )
{
childSetEnabled( "whitelist_del", false );
}
else
{
childSetEnabled( "whitelist_del", true );
};
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::initValues( void* userdata, const LLSD& media_settings , bool editable)
{
LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
if ( LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo )
{
if(LLFloaterMediaSettings::getInstance()->mMultipleMedia)
{
self->clearValues(self, editable);
// only show multiple
return;
}
}
else
{
if(LLFloaterMediaSettings::getInstance()->mMultipleValidMedia)
{
self->clearValues(self, editable);
// only show multiple
return;
}
}
std::string base_key( "" );
std::string tentative_key( "" );
struct
{
std::string key_name;
LLUICtrl* ctrl_ptr;
std::string ctrl_type;
} data_set [] =
{
{ LLMediaEntry::WHITELIST_ENABLE_KEY, self->mEnableWhiteList, "LLCheckBoxCtrl" },
{ LLMediaEntry::WHITELIST_KEY, self->mWhiteListList, "LLScrollListCtrl" },
{ "", NULL , "" }
};
for( int i = 0; data_set[ i ].key_name.length() > 0; ++i )
{
base_key = std::string( data_set[ i ].key_name );
tentative_key = base_key + std::string( LLPanelContents::TENTATIVE_SUFFIX );
// TODO: CP - I bet there is a better way to do this using Boost
if ( media_settings[ base_key ].isDefined() )
{
if ( data_set[ i ].ctrl_type == "LLCheckBoxCtrl" )
{
static_cast< LLCheckBoxCtrl* >( data_set[ i ].ctrl_ptr )->
setValue( media_settings[ base_key ].asBoolean() );
}
else
if ( data_set[ i ].ctrl_type == "LLScrollListCtrl" )
{
// get control
LLScrollListCtrl* list = static_cast< LLScrollListCtrl* >( data_set[ i ].ctrl_ptr );
list->deleteAllItems();
// points to list of white list URLs
LLSD url_list = media_settings[ base_key ];
// iterate over them and add to scroll list
LLSD::array_iterator iter = url_list.beginArray();
while( iter != url_list.endArray() )
{
// TODO: is iter guaranteed to be valid here?
std::string url = *iter;
list->addSimpleElement( url );
++iter;
};
};
data_set[ i ].ctrl_ptr->setEnabled(editable);
data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );
};
};
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::clearValues( void* userdata , bool editable)
{
LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
self->mEnableWhiteList->clear();
self->mWhiteListList->deleteAllItems();
self->mEnableWhiteList->setEnabled(editable);
self->mWhiteListList->setEnabled(editable);
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::preApply()
{
// no-op
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in )
{
fill_me_in[LLMediaEntry::WHITELIST_ENABLE_KEY] = mEnableWhiteList->getValue();
// iterate over white list and extract items
std::vector< LLScrollListItem* > white_list_items = mWhiteListList->getAllData();
std::vector< LLScrollListItem* >::iterator iter = white_list_items.begin();
// *NOTE: need actually set the key to be an emptyArray(), or the merge
// we do with this LLSD will think there's nothing to change.
fill_me_in[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
while( iter != white_list_items.end() )
{
std::string white_list_url = (*iter)->getValue().asString();
fill_me_in[ LLMediaEntry::WHITELIST_KEY ].append( white_list_url );
++iter;
};
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::postApply()
{
// no-op
}
///////////////////////////////////////////////////////////////////////////////
// Try to make a valid URL if a fragment (
// white list list box widget and build a list to test against. Can also
const std::string LLPanelMediaSettingsSecurity::makeValidUrl( const std::string& src_url )
{
// use LLURI to determine if we have a valid scheme
LLURI candidate_url( src_url );
if ( candidate_url.scheme().empty() )
{
// build a URL comprised of default scheme and the original fragment
const std::string default_scheme( "http://" );
return default_scheme + src_url;
};
// we *could* test the "default scheme" + "original fragment" URL again
// using LLURI to see if it's valid but I think the outcome is the same
// in either case - our only option is to return the original URL
// we *think* the original url passed in was valid
return src_url;
}
///////////////////////////////////////////////////////////////////////////////
// wrapper for testing a URL against the whitelist. We grab entries from
// white list list box widget and build a list to test against. Can also
// optionally pass the URL that you are trying to add to the widget since
// it won't be added until this call returns.
bool LLPanelMediaSettingsSecurity::passesWhiteList( const std::string& added_url,
const std::string& test_url )
{
// the checkUrlAgainstWhitelist(..) function works on a vector
// of strings for the white list entries - in this panel, the white list
// is stored in the widgets themselves so we need to build something compatible.
std::vector< std::string > whitelist_strings;
whitelist_strings.clear(); // may not be required - I forget what the spec says.
// step through whitelist widget entries and grab them as strings
std::vector< LLScrollListItem* > white_list_items = mWhiteListList->getAllData();
std::vector< LLScrollListItem* >::iterator iter = white_list_items.begin();
while( iter != white_list_items.end() )
{
const std::string whitelist_url = (*iter)->getValue().asString();
whitelist_strings.push_back( whitelist_url );
++iter;
};
// add in the URL that might be added to the whitelist so we can test that too
if ( added_url.length() )
whitelist_strings.push_back( added_url );
// possible the URL is just a fragment so we validize it
const std::string valid_url = makeValidUrl( test_url );
// indicate if the URL passes whitelist
return LLMediaEntry::checkUrlAgainstWhitelist( valid_url, whitelist_strings );
}
///////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::addWhiteListItem(const std::string& url)
{
// grab home URL from the general panel (via the parent floater)
std::string home_url( "" );
if ( mParent )
home_url = mParent->getHomeUrl();
// if the home URL is blank (user hasn't entered it yet) then
// don't bother to check if it passes the white list
if ( home_url.empty() )
{
mWhiteListList->addSimpleElement( url );
return;
};
// if the URL passes the white list, add it
if ( passesWhiteList( url, home_url ) )
{
mWhiteListList->addSimpleElement( url );
}
else
// display a message indicating you can't do that
{
LLNotifications::instance().add("WhiteListInvalidatesHomeUrl");
};
}
///////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::onBtnAdd( void* userdata )
{
LLFloaterReg::showInstance("whitelist_entry");
}
///////////////////////////////////////////////////////////////////////////////
// static
void LLPanelMediaSettingsSecurity::onBtnDel( void* userdata )
{
LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
self->mWhiteListList->deleteSelectedItems();
}
////////////////////////////////////////////////////////////////////////////////
//
void LLPanelMediaSettingsSecurity::setParent( LLFloaterMediaSettings* parent )
{
mParent = parent;
};

View File

@ -1,102 +1,102 @@
/**
* @file llpanelobjectinventory.h
* @brief LLPanelObjectInventory class definition
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-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_LLPANELOBJECTINVENTORY_H
#define LL_LLPANELOBJECTINVENTORY_H
#include "llvoinventorylistener.h"
#include "llpanel.h"
#include "llinventory.h"
class LLScrollContainer;
class LLFolderView;
class LLFolderViewFolder;
class LLViewerObject;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLPanelObjectInventory
//
// This class represents the panel used to view and control a
// particular task's inventory.
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLPanelObjectInventory : public LLPanel, public LLVOInventoryListener
{
public:
// dummy param block for template registration purposes
struct Params : public LLPanel::Params {};
LLPanelObjectInventory(const Params&);
virtual ~LLPanelObjectInventory();
virtual BOOL postBuild();
void doToSelected(const LLSD& userdata);
void refresh();
const LLUUID& getTaskUUID() { return mTaskUUID;}
void removeSelectedItem();
void startRenamingSelectedItem();
LLFolderView* getRootFolder() const { return mFolders; }
virtual void draw();
virtual void deleteAllChildren();
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg);
static void idle(void* user_data);
protected:
void reset();
/*virtual*/ void inventoryChanged(LLViewerObject* object,
InventoryObjectList* inventory,
S32 serial_num,
void* user_data);
void updateInventory();
void createFolderViews(LLInventoryObject* inventory_root, InventoryObjectList& contents);
void createViewsForCategory(InventoryObjectList* inventory,
LLInventoryObject* parent,
LLFolderViewFolder* folder);
void clearContents();
private:
LLScrollContainer* mScroller;
LLFolderView* mFolders;
LLUUID mTaskUUID;
BOOL mHaveInventory;
BOOL mIsInventoryEmpty;
BOOL mInventoryNeedsUpdate;
};
#endif // LL_LLPANELOBJECTINVENTORY_H
/**
* @file llpanelobjectinventory.h
* @brief LLPanelObjectInventory class definition
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-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_LLPANELOBJECTINVENTORY_H
#define LL_LLPANELOBJECTINVENTORY_H
#include "llvoinventorylistener.h"
#include "llpanel.h"
#include "llinventory.h"
class LLScrollContainer;
class LLFolderView;
class LLFolderViewFolder;
class LLViewerObject;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLPanelObjectInventory
//
// This class represents the panel used to view and control a
// particular task's inventory.
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLPanelObjectInventory : public LLPanel, public LLVOInventoryListener
{
public:
// dummy param block for template registration purposes
struct Params : public LLPanel::Params {};
LLPanelObjectInventory(const Params&);
virtual ~LLPanelObjectInventory();
virtual BOOL postBuild();
void doToSelected(const LLSD& userdata);
void refresh();
const LLUUID& getTaskUUID() { return mTaskUUID;}
void removeSelectedItem();
void startRenamingSelectedItem();
LLFolderView* getRootFolder() const { return mFolders; }
virtual void draw();
virtual void deleteAllChildren();
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg);
static void idle(void* user_data);
protected:
void reset();
/*virtual*/ void inventoryChanged(LLViewerObject* object,
InventoryObjectList* inventory,
S32 serial_num,
void* user_data);
void updateInventory();
void createFolderViews(LLInventoryObject* inventory_root, InventoryObjectList& contents);
void createViewsForCategory(InventoryObjectList* inventory,
LLInventoryObject* parent,
LLFolderViewFolder* folder);
void clearContents();
private:
LLScrollContainer* mScroller;
LLFolderView* mFolders;
LLUUID mTaskUUID;
BOOL mHaveInventory;
BOOL mIsInventoryEmpty;
BOOL mInventoryNeedsUpdate;
};
#endif // LL_LLPANELOBJECTINVENTORY_H

View File

@ -1017,7 +1017,7 @@ void LLPanelPeople::onChatButtonClicked()
{
LLUUID group_id = getCurrentItemID();
if (group_id.notNull())
LLGroupActions::startChat(group_id);
LLGroupActions::startIM(group_id);
}
void LLPanelPeople::onImButtonClicked()

View File

@ -80,9 +80,9 @@ LLPanelPermissions::LLPanelPermissions() :
BOOL LLPanelPermissions::postBuild()
{
childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this);
childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("Object Name",LLLineEditor::prevalidateASCIIPrintableNoPipe);
childSetCommitCallback("Object Description",LLPanelPermissions::onCommitDesc,this);
childSetPrevalidate("Object Description",LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("Object Description",LLLineEditor::prevalidateASCIIPrintableNoPipe);
getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickGroup,this));

View File

@ -79,7 +79,7 @@ BOOL LLPreviewAnim::postBuild()
childSetAction("Anim audition btn",auditionAnim, this);
childSetCommitCallback("desc", LLPreview::onText, this);
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}

View File

@ -493,7 +493,7 @@ BOOL LLPreviewGesture::postBuild()
{
childSetCommitCallback("desc", LLPreview::onText, this);
childSetText("desc", item->getDescription());
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
}
return LLPreview::postBuild();

View File

@ -96,7 +96,7 @@ BOOL LLPreviewNotecard::postBuild()
childSetCommitCallback("desc", LLPreview::onText, this);
if (item)
childSetText("desc", item->getDescription());
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}

View File

@ -956,7 +956,7 @@ BOOL LLPreviewLSL::postBuild()
childSetCommitCallback("desc", LLPreview::onText, this);
childSetText("desc", item->getDescription());
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}

View File

@ -75,7 +75,7 @@ BOOL LLPreviewSound::postBuild()
button->setSoundFlags(LLView::SILENT);
childSetCommitCallback("desc", LLPreview::onText, this);
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}

View File

@ -152,7 +152,7 @@ BOOL LLPreviewTexture::postBuild()
{
childSetCommitCallback("desc", LLPreview::onText, this);
childSetText("desc", item->getDescription());
childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
}
}

View File

@ -104,8 +104,8 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne
void LLScreenChannelBase::init(S32 channel_left, S32 channel_right)
{
S32 channel_top = gViewerWindow->getWorldViewRectRaw().getHeight();
S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
S32 channel_top = gViewerWindow->getWorldViewRectScaled().getHeight();
S32 channel_bottom = gViewerWindow->getWorldViewRectScaled().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom));
setVisible(TRUE);
}
@ -534,19 +534,7 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer)
LLTextBox* text_box = mStartUpToastPanel->getChild<LLTextBox>("toast_text");
std::string mStartUpFormatString;
if(notif_num == 1)
{
mStartUpFormatString = LLTrans::getString("StartUpNotification");
}
else
{
mStartUpFormatString = LLTrans::getString("StartUpNotifications");
}
std::string text = llformat(mStartUpFormatString.c_str(), notif_num);
std::string text = LLTrans::getString("StartUpNotifications");
toast_rect = mStartUpToastPanel->getRect();
mStartUpToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true);
@ -712,7 +700,7 @@ void LLScreenChannel::updateShowToastsState()
// for Message Well floater showed in a docked state - adjust channel's height
if(dynamic_cast<LLSysWellWindow*>(floater))
{
S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");;
S32 channel_bottom = gViewerWindow->getWorldViewRectScaled().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");;
LLRect this_rect = getRect();
if(floater->getVisible() && floater->isDocked())
{

View File

@ -34,9 +34,12 @@
#include "llagent.h"
#include "llagentwearables.h"
#include "llappearancemgr.h"
#include "llinventorypanel.h"
#include "llfiltereditor.h"
#include "llfloaterreg.h"
#include "llfloaterworldmap.h"
#include "llfoldervieweventlistener.h"
#include "llpaneleditwearable.h"
#include "llpaneloutfitsinventory.h"
#include "lltextbox.h"
@ -68,7 +71,7 @@ LLSidepanelAppearance::LLSidepanelAppearance() :
mFilterSubString(LLStringUtil::null),
mFilterEditor(NULL),
mLookInfo(NULL),
mCurrLookPanel(NULL)
mCurrOutfitPanel(NULL)
{
//LLUICtrlFactory::getInstance()->buildPanel(this, "panel_appearance.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
mFetchWorn = new LLCurrentlyWornFetchObserver(this);
@ -81,6 +84,9 @@ LLSidepanelAppearance::~LLSidepanelAppearance()
// virtual
BOOL LLSidepanelAppearance::postBuild()
{
mOpenOutfitBtn = getChild<LLButton>("openoutfit_btn");
mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this));
mEditAppearanceBtn = getChild<LLButton>("editappearance_btn");
mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this));
@ -90,11 +96,9 @@ BOOL LLSidepanelAppearance::postBuild()
mEditBtn = getChild<LLButton>("edit_btn");
mEditBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditButtonClicked, this));
mNewLookBtn = getChild<LLButton>("newlook_btn");
mNewLookBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this));
mNewLookBtn->setEnabled(false);
mOverflowBtn = getChild<LLButton>("overflow_btn");
mNewOutfitBtn = getChild<LLButton>("newlook_btn");
mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this));
mNewOutfitBtn->setEnabled(false);
mFilterEditor = getChild<LLFilterEditor>("Filter");
if (mFilterEditor)
@ -114,8 +118,6 @@ BOOL LLSidepanelAppearance::postBuild()
back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onBackButtonClicked, this));
}
// *TODO: Assign the action to an appropriate event.
// mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::toggleMediaPanel, this));
}
mEditWearable = dynamic_cast<LLPanelEditWearable*>(getChild<LLPanel>("panel_edit_wearable"));
@ -130,7 +132,7 @@ BOOL LLSidepanelAppearance::postBuild()
mCurrentLookName = getChild<LLTextBox>("currentlook_name");
mCurrLookPanel = getChild<LLPanel>("panel_currentlook");
mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook");
return TRUE;
}
@ -179,6 +181,27 @@ void LLSidepanelAppearance::onWearButtonClicked()
}
}
void LLSidepanelAppearance::onOpenOutfitButtonClicked()
{
const LLViewerInventoryItem *outfit_link = LLAppearanceManager::getInstance()->getCurrentOutfitLink();
if (!outfit_link)
return;
if (!outfit_link->getIsLinkType())
return;
LLInventoryPanel *inventory_panel = mPanelOutfitsInventory->getActivePanel();
if (inventory_panel)
{
LLFolderView *folder = inventory_panel->getRootFolder();
LLFolderViewItem *outfit_folder = folder->getItemByID(outfit_link->getLinkedUUID());
if (outfit_folder)
{
outfit_folder->setOpen(!outfit_folder->isOpen());
folder->setSelectionFromRoot(outfit_folder,TRUE);
folder->scrollToShowSelection();
}
}
}
void LLSidepanelAppearance::onEditAppearanceButtonClicked()
{
if (gAgentWearables.areWearablesLoaded())
@ -231,9 +254,8 @@ void LLSidepanelAppearance::toggleLookInfoPanel(BOOL visible)
mFilterEditor->setVisible(!visible);
mWearBtn->setVisible(!visible);
mEditBtn->setVisible(!visible);
mNewLookBtn->setVisible(!visible);
mOverflowBtn->setVisible(!visible);
mCurrLookPanel->setVisible(!visible);
mNewOutfitBtn->setVisible(!visible);
mCurrOutfitPanel->setVisible(!visible);
}
void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *wearable)
@ -255,7 +277,6 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we
void LLSidepanelAppearance::updateVerbs()
{
bool is_look_info_visible = mLookInfo->getVisible();
mOverflowBtn->setEnabled(false);
if (!is_look_info_visible)
{
@ -274,35 +295,24 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string name)
{
if (name == "")
{
const LLUUID current_outfit_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
// Can't search on AT_OUTFIT since links to categories return AT_CATEGORY for type since they don't
// return preferred type.
LLIsType is_category( LLAssetType::AT_CATEGORY );
gInventory.collectDescendentsIf(current_outfit_cat,
cat_array,
item_array,
false,
is_category,
false);
for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
iter != item_array.end();
iter++)
const LLViewerInventoryItem *outfit_link = LLAppearanceManager::getInstance()->getCurrentOutfitLink();
if (outfit_link)
{
const LLViewerInventoryItem *item = (*iter);
const LLViewerInventoryCategory *cat = item->getLinkedCategory();
const LLViewerInventoryCategory *cat = outfit_link->getLinkedCategory();
if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT)
{
mCurrentLookName->setText(cat->getName());
return;
}
}
mCurrentLookName->setText(std::string(""));
mCurrentLookName->setText(getString("No Outfit"));
mOpenOutfitBtn->setEnabled(FALSE);
}
else
{
mCurrentLookName->setText(name);
// Can't just call update verbs since the folder link may not have been created yet.
mOpenOutfitBtn->setEnabled(TRUE);
}
}
@ -319,7 +329,7 @@ void LLSidepanelAppearance::editWearable(LLWearable *wearable, void *data)
void LLSidepanelAppearance::fetchInventory()
{
mNewLookBtn->setEnabled(false);
mNewOutfitBtn->setEnabled(false);
LLInventoryFetchObserver::item_ref_t ids;
LLUUID item_id;
for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type)
@ -368,5 +378,5 @@ void LLSidepanelAppearance::fetchInventory()
void LLSidepanelAppearance::inventoryFetched()
{
mNewLookBtn->setEnabled(true);
mNewOutfitBtn->setEnabled(true);
}

View File

@ -64,6 +64,7 @@ public:
private:
void onFilterEdit(const std::string& search_string);
void onOpenOutfitButtonClicked();
void onEditAppearanceButtonClicked();
void onWearButtonClicked();
void onEditButtonClicked();
@ -78,12 +79,12 @@ private:
LLPanelLookInfo* mLookInfo;
LLPanelEditWearable* mEditWearable;
LLButton* mOpenOutfitBtn;
LLButton* mEditAppearanceBtn;
LLButton* mWearBtn;
LLButton* mEditBtn;
LLButton* mNewLookBtn;
LLButton* mOverflowBtn;
LLPanel* mCurrLookPanel;
LLButton* mNewOutfitBtn;
LLPanel* mCurrOutfitPanel;
LLTextBox* mCurrentLookName;

View File

@ -1,279 +1,279 @@
/**
* @file LLSidepanelInventory.cpp
* @brief Side Bar "Inventory" panel
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 2004-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$
*/
#include "llviewerprecompiledheaders.h"
#include "llsidepanelinventory.h"
#include "llagent.h"
#include "llbutton.h"
#include "llinventorybridge.h"
#include "llinventorypanel.h"
#include "llpanelmaininventory.h"
#include "llsidepaneliteminfo.h"
#include "llsidepaneltaskinfo.h"
#include "lltabcontainer.h"
#include "llselectmgr.h"
static LLRegisterPanelClassWrapper<LLSidepanelInventory> t_inventory("sidepanel_inventory");
LLSidepanelInventory::LLSidepanelInventory()
: LLPanel(),
mItemPanel(NULL),
mPanelMainInventory(NULL)
{
//LLUICtrlFactory::getInstance()->buildPanel(this, "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
}
LLSidepanelInventory::~LLSidepanelInventory()
{
}
BOOL LLSidepanelInventory::postBuild()
{
// UI elements from inventory panel
{
mInventoryPanel = getChild<LLPanel>("sidepanel__inventory_panel");
mInfoBtn = mInventoryPanel->getChild<LLButton>("info_btn");
mInfoBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onInfoButtonClicked, this));
mShareBtn = mInventoryPanel->getChild<LLButton>("share_btn");
mShareBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShareButtonClicked, this));
mWearBtn = mInventoryPanel->getChild<LLButton>("wear_btn");
mWearBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onWearButtonClicked, this));
mPlayBtn = mInventoryPanel->getChild<LLButton>("play_btn");
mPlayBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onPlayButtonClicked, this));
mTeleportBtn = mInventoryPanel->getChild<LLButton>("teleport_btn");
mTeleportBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onTeleportButtonClicked, this));
mOverflowBtn = mInventoryPanel->getChild<LLButton>("overflow_btn");
mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onOverflowButtonClicked, this));
mPanelMainInventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2));
}
// UI elements from item panel
{
mItemPanel = getChild<LLSidepanelItemInfo>("sidepanel__item_panel");
LLButton* back_btn = mItemPanel->getChild<LLButton>("back_btn");
back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this));
}
// UI elements from task panel
{
mTaskPanel = getChild<LLSidepanelTaskInfo>("sidepanel__task_panel");
if (mTaskPanel)
{
LLButton* back_btn = mTaskPanel->getChild<LLButton>("back_btn");
back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this));
}
}
return TRUE;
}
void LLSidepanelInventory::onOpen(const LLSD& key)
{
if(key.size() == 0)
return;
mItemPanel->reset();
if (key.has("id"))
{
mItemPanel->setItemID(key["id"].asUUID());
if (key.has("object"))
{
mItemPanel->setObjectID(key["object"].asUUID());
}
showItemInfoPanel();
}
if (key.has("task"))
{
if (mTaskPanel)
mTaskPanel->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
showTaskInfoPanel();
}
if (key.has("select"))
{
mPanelMainInventory->getPanel()->setSelection(key["select"].asUUID(), TAKE_FOCUS_NO);
}
}
void LLSidepanelInventory::onInfoButtonClicked()
{
LLInventoryItem *item = getSelectedItem();
if (item)
{
mItemPanel->reset();
mItemPanel->setItemID(item->getUUID());
showItemInfoPanel();
}
}
void LLSidepanelInventory::onShareButtonClicked()
{
}
void LLSidepanelInventory::performActionOnSelection(const std::string &action)
{
LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item)
{
return;
}
current_item->getListener()->performAction(panel_main_inventory->getActivePanel()->getRootFolder(), panel_main_inventory->getActivePanel()->getModel(), action);
}
void LLSidepanelInventory::onWearButtonClicked()
{
performActionOnSelection("wear");
performActionOnSelection("attach");
}
void LLSidepanelInventory::onPlayButtonClicked()
{
performActionOnSelection("activate");
}
void LLSidepanelInventory::onTeleportButtonClicked()
{
performActionOnSelection("teleport");
}
void LLSidepanelInventory::onOverflowButtonClicked()
{
}
void LLSidepanelInventory::onBackButtonClicked()
{
showInventoryPanel();
}
void LLSidepanelInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
{
updateVerbs();
}
void LLSidepanelInventory::showItemInfoPanel()
{
mItemPanel->setVisible(TRUE);
if (mTaskPanel)
mTaskPanel->setVisible(FALSE);
mInventoryPanel->setVisible(FALSE);
mItemPanel->dirty();
mItemPanel->setIsEditing(FALSE);
}
void LLSidepanelInventory::showTaskInfoPanel()
{
mItemPanel->setVisible(FALSE);
mInventoryPanel->setVisible(FALSE);
if (mTaskPanel)
{
mTaskPanel->setVisible(TRUE);
mTaskPanel->dirty();
mTaskPanel->setIsEditing(FALSE);
}
}
void LLSidepanelInventory::showInventoryPanel()
{
mItemPanel->setVisible(FALSE);
if (mTaskPanel)
mTaskPanel->setVisible(FALSE);
mInventoryPanel->setVisible(TRUE);
updateVerbs();
}
void LLSidepanelInventory::updateVerbs()
{
mInfoBtn->setEnabled(FALSE);
mShareBtn->setEnabled(FALSE);
mWearBtn->setVisible(FALSE);
mWearBtn->setEnabled(FALSE);
mPlayBtn->setVisible(FALSE);
mPlayBtn->setEnabled(FALSE);
mTeleportBtn->setVisible(FALSE);
mTeleportBtn->setEnabled(FALSE);
const LLInventoryItem *item = getSelectedItem();
if (!item)
return;
mInfoBtn->setEnabled(TRUE);
mShareBtn->setEnabled(TRUE);
switch(item->getInventoryType())
{
case LLInventoryType::IT_WEARABLE:
case LLInventoryType::IT_OBJECT:
case LLInventoryType::IT_ATTACHMENT:
mWearBtn->setVisible(TRUE);
mWearBtn->setEnabled(TRUE);
break;
case LLInventoryType::IT_SOUND:
case LLInventoryType::IT_GESTURE:
case LLInventoryType::IT_ANIMATION:
mPlayBtn->setVisible(TRUE);
mPlayBtn->setEnabled(TRUE);
break;
case LLInventoryType::IT_LANDMARK:
mTeleportBtn->setVisible(TRUE);
mTeleportBtn->setEnabled(TRUE);
break;
default:
break;
}
}
LLInventoryItem *LLSidepanelInventory::getSelectedItem()
{
LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item)
{
return NULL;
}
const LLUUID &item_id = current_item->getListener()->getUUID();
LLInventoryItem *item = gInventory.getItem(item_id);
return item;
}
/**
* @file LLSidepanelInventory.cpp
* @brief Side Bar "Inventory" panel
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 2004-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$
*/
#include "llviewerprecompiledheaders.h"
#include "llsidepanelinventory.h"
#include "llagent.h"
#include "llbutton.h"
#include "llinventorybridge.h"
#include "llinventorypanel.h"
#include "llpanelmaininventory.h"
#include "llsidepaneliteminfo.h"
#include "llsidepaneltaskinfo.h"
#include "lltabcontainer.h"
#include "llselectmgr.h"
static LLRegisterPanelClassWrapper<LLSidepanelInventory> t_inventory("sidepanel_inventory");
LLSidepanelInventory::LLSidepanelInventory()
: LLPanel(),
mItemPanel(NULL),
mPanelMainInventory(NULL)
{
//LLUICtrlFactory::getInstance()->buildPanel(this, "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
}
LLSidepanelInventory::~LLSidepanelInventory()
{
}
BOOL LLSidepanelInventory::postBuild()
{
// UI elements from inventory panel
{
mInventoryPanel = getChild<LLPanel>("sidepanel__inventory_panel");
mInfoBtn = mInventoryPanel->getChild<LLButton>("info_btn");
mInfoBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onInfoButtonClicked, this));
mShareBtn = mInventoryPanel->getChild<LLButton>("share_btn");
mShareBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShareButtonClicked, this));
mWearBtn = mInventoryPanel->getChild<LLButton>("wear_btn");
mWearBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onWearButtonClicked, this));
mPlayBtn = mInventoryPanel->getChild<LLButton>("play_btn");
mPlayBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onPlayButtonClicked, this));
mTeleportBtn = mInventoryPanel->getChild<LLButton>("teleport_btn");
mTeleportBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onTeleportButtonClicked, this));
mOverflowBtn = mInventoryPanel->getChild<LLButton>("overflow_btn");
mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onOverflowButtonClicked, this));
mPanelMainInventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2));
}
// UI elements from item panel
{
mItemPanel = getChild<LLSidepanelItemInfo>("sidepanel__item_panel");
LLButton* back_btn = mItemPanel->getChild<LLButton>("back_btn");
back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this));
}
// UI elements from task panel
{
mTaskPanel = getChild<LLSidepanelTaskInfo>("sidepanel__task_panel");
if (mTaskPanel)
{
LLButton* back_btn = mTaskPanel->getChild<LLButton>("back_btn");
back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this));
}
}
return TRUE;
}
void LLSidepanelInventory::onOpen(const LLSD& key)
{
if(key.size() == 0)
return;
mItemPanel->reset();
if (key.has("id"))
{
mItemPanel->setItemID(key["id"].asUUID());
if (key.has("object"))
{
mItemPanel->setObjectID(key["object"].asUUID());
}
showItemInfoPanel();
}
if (key.has("task"))
{
if (mTaskPanel)
mTaskPanel->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
showTaskInfoPanel();
}
if (key.has("select"))
{
mPanelMainInventory->getPanel()->setSelection(key["select"].asUUID(), TAKE_FOCUS_NO);
}
}
void LLSidepanelInventory::onInfoButtonClicked()
{
LLInventoryItem *item = getSelectedItem();
if (item)
{
mItemPanel->reset();
mItemPanel->setItemID(item->getUUID());
showItemInfoPanel();
}
}
void LLSidepanelInventory::onShareButtonClicked()
{
}
void LLSidepanelInventory::performActionOnSelection(const std::string &action)
{
LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item)
{
return;
}
current_item->getListener()->performAction(panel_main_inventory->getActivePanel()->getRootFolder(), panel_main_inventory->getActivePanel()->getModel(), action);
}
void LLSidepanelInventory::onWearButtonClicked()
{
performActionOnSelection("wear");
performActionOnSelection("attach");
}
void LLSidepanelInventory::onPlayButtonClicked()
{
performActionOnSelection("activate");
}
void LLSidepanelInventory::onTeleportButtonClicked()
{
performActionOnSelection("teleport");
}
void LLSidepanelInventory::onOverflowButtonClicked()
{
}
void LLSidepanelInventory::onBackButtonClicked()
{
showInventoryPanel();
}
void LLSidepanelInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
{
updateVerbs();
}
void LLSidepanelInventory::showItemInfoPanel()
{
mItemPanel->setVisible(TRUE);
if (mTaskPanel)
mTaskPanel->setVisible(FALSE);
mInventoryPanel->setVisible(FALSE);
mItemPanel->dirty();
mItemPanel->setIsEditing(FALSE);
}
void LLSidepanelInventory::showTaskInfoPanel()
{
mItemPanel->setVisible(FALSE);
mInventoryPanel->setVisible(FALSE);
if (mTaskPanel)
{
mTaskPanel->setVisible(TRUE);
mTaskPanel->dirty();
mTaskPanel->setIsEditing(FALSE);
}
}
void LLSidepanelInventory::showInventoryPanel()
{
mItemPanel->setVisible(FALSE);
if (mTaskPanel)
mTaskPanel->setVisible(FALSE);
mInventoryPanel->setVisible(TRUE);
updateVerbs();
}
void LLSidepanelInventory::updateVerbs()
{
mInfoBtn->setEnabled(FALSE);
mShareBtn->setEnabled(FALSE);
mWearBtn->setVisible(FALSE);
mWearBtn->setEnabled(FALSE);
mPlayBtn->setVisible(FALSE);
mPlayBtn->setEnabled(FALSE);
mTeleportBtn->setVisible(FALSE);
mTeleportBtn->setEnabled(FALSE);
const LLInventoryItem *item = getSelectedItem();
if (!item)
return;
mInfoBtn->setEnabled(TRUE);
mShareBtn->setEnabled(TRUE);
switch(item->getInventoryType())
{
case LLInventoryType::IT_WEARABLE:
case LLInventoryType::IT_OBJECT:
case LLInventoryType::IT_ATTACHMENT:
mWearBtn->setVisible(TRUE);
mWearBtn->setEnabled(TRUE);
break;
case LLInventoryType::IT_SOUND:
case LLInventoryType::IT_GESTURE:
case LLInventoryType::IT_ANIMATION:
mPlayBtn->setVisible(TRUE);
mPlayBtn->setEnabled(TRUE);
break;
case LLInventoryType::IT_LANDMARK:
mTeleportBtn->setVisible(TRUE);
mTeleportBtn->setEnabled(TRUE);
break;
default:
break;
}
}
LLInventoryItem *LLSidepanelInventory::getSelectedItem()
{
LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item)
{
return NULL;
}
const LLUUID &item_id = current_item->getListener()->getUUID();
LLInventoryItem *item = gInventory.getItem(item_id);
return item;
}

Some files were not shown because too many files have changed in this diff Show More