master
Matthew Breindel (Falcon) 2010-09-30 12:00:29 -07:00
commit 60f8c82790
826 changed files with 14558 additions and 17381 deletions

View File

@ -25,3 +25,4 @@ d2382d374139850efa5bb6adfb229e3e656cfc40 howard-demo
d40ac9dd949cba6dab1cc386da6a2027690c2519 alpha-5
d6781e22543acd7e21b967209f3c6e7003d380e3 fork to viewer-2-0
c6e6324f5be1401f077ad18a4a0f6b46451c2f7b last_sprint
7076e22f9f43f479a4ea75eac447a36364bead5a beta_2.1.3

View File

@ -9,7 +9,7 @@ CYGWIN.symbolfiles = "newview/Release/secondlife-symbols-windows.tar.bz2"
Linux.symbolfiles = "newview/secondlife-symbols-linux.tar.bz2"
# Use Public Upload Locations
public_build = false
public_build = true
# Update Public Inworld Build Status Indicators
email_status_this_is_os = false
@ -56,6 +56,7 @@ viewer-release.build_viewer_update_version_manager = true
viewer-development-import.build_debug_release_separately = true
viewer-development-fixes.build_debug_release_separately = true
viewer-development-tweaks.build_debug_release_separately = true
# =======================================
# brad
@ -88,23 +89,19 @@ viewer-mesh.build_hg_bundle = true
viewer-mesh.build_viewer_update_version_manager = false
viewer-mesh.build_Debug = false
viewer-mesh.build_RelWithDebInfo = false
viewer-mesh.viewer_channel = "Second Life Mesh Beta"
viewer-mesh.login_channel = "Second Life Mesh Beta"
viewer-mesh.viewer_channel = "Project Viewer - Mesh"
viewer-mesh.login_channel = "Project Viewer - Mesh"
viewer-mesh.viewer_grid = aditi
viewer-mesh.email = shining@lists.lindenlab.com
# ========================================
# moss
# CG
# ========================================
mossbuild1.email = moss@lindenlab.com
mossbuild1.build_server = false
mossbuild1.build_server_tests = false
mossbuild2.email = moss@lindenlab.com
mossbuild2.build_server = false
mossbuild2.build_server_tests = false
cg_viewer-development_lenny.collect_metrics = true
cg_viewer-development_lenny.show_changes_since = 4b140ce7839d
cg_viewer-development_lenny.email = cg@lindenlab.com
# ========================================
# gooey
@ -189,4 +186,19 @@ oz_viewer-review2_coverity.build_CYGWIN_Debug = false
oz_viewer-review2_coverity.build_CYGWIN_RelWithDebInfo = false
oz_viewer-review2_coverity.build_CYGWIN_Release = false
# ========================================
# tofu
# ========================================
tofu_viewer-development-staging.email = tofu.linden@lindenlab.com
# ========================================
# enus
# ========================================
viewer-tut-teamcity.email = enus@lindenlab.com
viewer-tut-teamcity.build_server = false
viewer-tut-teamcity.build_server_tests = false
# eof

View File

@ -65,6 +65,7 @@ pre_build()
-DINSTALL_PROPRIETARY:BOOL=ON \
-DLOCALIZESETUP:BOOL=ON \
-DPACKAGE:BOOL=ON
-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE
end_section "Pre$variant"
}
@ -148,11 +149,15 @@ build_viewer_update_version_manager_version=`scripts/get_version.py --viewer-ver
cd indra
succeeded=true
build_processes=
last_built_variant=
for variant in $variants
do
eval '$build_'"$variant" || continue
eval '$build_'"$arch"_"$variant" || continue
# Only the last built arch is available for upload
last_built_variant="$variant"
begin_section "Do$variant"
build_dir=`build_dir_$arch $variant`
build_dir_stubs="$build_dir/win_setup/$variant"
@ -219,7 +224,10 @@ do
fi
else
begin_section "Build$variant"
build "$variant" "$build_dir" >> "$build_log" 2>&1
build "$variant" "$build_dir" > "$build_log" 2>&1
begin_section Tests
grep --line-buffered "^##teamcity" "$build_log"
end_section Tests
if `cat "$build_dir/build_ok"`
then
echo so far so good.
@ -255,6 +263,9 @@ then
else
record_failure "Parallel build of \"$variant\" failed."
fi
begin_section Tests
tee -a $build_log < "$build_dir/build.log" | grep --line-buffered "^##teamcity"
end_section Tests
end_section "Build$variant"
done
end_section WaitParallel
@ -275,12 +286,17 @@ then
succeeded=$build_coverity
else
upload_item installer "$package" binary/octet-stream
upload_item quicklink "$package" binary/octet-stream
# Upload crash reporter files.
for symbolfile in $symbolfiles
do
upload_item symbolfile "$build_dir/$symbolfile" binary/octet-stream
done
case "$last_built_variant" in
Release)
for symbolfile in $symbolfiles
do
upload_item symbolfile "$build_dir/$symbolfile" binary/octet-stream
done
;;
esac
# Upload stub installers
upload_stub_installers "$build_dir_stubs"

View File

@ -20,6 +20,7 @@ Aimee Trescothick
SNOW-227
SNOW-570
SNOW-572
SNOW-575
VWR-3321
VWR-3336
VWR-3903
@ -33,6 +34,7 @@ Aimee Trescothick
VWR-6550
VWR-6583
VWR-6482
VWR-6918
VWR-7109
VWR-7383
VWR-7800
@ -49,6 +51,7 @@ Aimee Trescothick
VWR-12631
VWR-12696
VWR-12748
VWR-13221
VWR-14087
VWR-14267
VWR-14278
@ -58,15 +61,20 @@ Aimee Trescothick
Alejandro Rosenthal
VWR-1184
Aleric Inglewood
SNOW-522
SNOW-764
VWR-10001
VWR-10759
VWR-10837
VWR-12691
VWR-13996
VWR-14426
SNOW-84
SNOW-766
STORM-163
Ales Beaumont
VWR-9352
SNOW-240
Alissa Sabre
VWR-81
VWR-83
@ -119,6 +127,8 @@ Angus Boyd
VWR-592
Ann Congrejo
CT-193
Ardy Lay
VWR-19499
Argent Stonecutter
VWR-68
Armin Weatherwax
@ -158,7 +168,10 @@ Boroondas Gupte
SNOW-527
SNOW-610
SNOW-624
SNOW-737
VWR-233
VWR-20583
VWR-20891
WEB-262
Bulli Schumann
CT-218
@ -184,6 +197,7 @@ Carjay McGinnis
Catherine Pfeffer
VWR-1282
VWR-8624
VWR-10854
Celierra Darling
VWR-1274
VWR-6975
@ -310,6 +324,7 @@ Iskar Ariantho
VWR-1223
VWR-11759
Jacek Antonelli
SNOW-388
VWR-165
VWR-188
VWR-427
@ -326,6 +341,8 @@ JB Kraft
VWR-7802
Joghert LeSabre
VWR-64
Jonathan Yap
VWR-17801
Kage Pixel
VWR-11
Ken March
@ -371,6 +388,7 @@ Matthew Dowd
VWR-1761
VWR-2681
McCabe Maxsted
SNOW-387
VWR-1318
VWR-4065
VWR-4826
@ -399,8 +417,10 @@ Michelle2 Zenovka
VWR-8310
VWR-9499
Mm Alder
SNOW-376
VWR-197
VWR-3777
VWR-4232
VWR-4794
VWR-13578
Mr Greggan
@ -515,6 +535,8 @@ princess niven
CT-352
Renault Clio
VWR-1976
resu Ampan
SNOW-93
Ringo Tuxing
CT-225
CT-226
@ -543,6 +565,7 @@ Robin Cornelius
VWR-12758
VWR-12763
VWR-12995
VWR-20911
Ryozu Kojima
VWR-53
VWR-287
@ -576,6 +599,8 @@ Sergen Davies
CT-230
CT-231
CT-321
Shawn Kaufmat
SNOW-240
SignpostMarv Martin
VWR-153
VWR-154
@ -630,7 +655,14 @@ Teardrops Fall
VWR-5366
Techwolf Lupindo
SNOW-92
SNOW-592
SNOW-649
SNOW-650
SNOW-687
SNOW-680
SNOW-681
SNOW-685
SNOW-690
VWR-12385
tenebrous pau
VWR-247
@ -638,7 +670,12 @@ Tharax Ferraris
VWR-605
Thickbrick Sleaford
SNOW-207
SNOW-390
SNOW-421
SNOW-462
SNOW-586
SNOW-592
SNOW-635
SNOW-743
VWR-7109
VWR-9287
@ -658,8 +695,12 @@ Tue Torok
CT-72
CT-73
CT-74
Twisted Laws
SNOW-352
Vadim Bigbear
VWR-2681
Vector Hastings
VWR-8726
Vixen Heron
VWR-2710
CT-88
@ -667,6 +708,7 @@ Whoops Babii
VWR-631
VWR-1640
VWR-3340
SNOW-667
VWR-4800
VWR-4802
VWR-4804
@ -689,6 +731,8 @@ Whoops Babii
VWR-8298
Wilton Lundquist
VWR-7682
Zai Lynch
VWR-19505
Zarkonnen Decosta
VWR-253
Zi Ree

View File

@ -169,7 +169,8 @@ elseif(DARWIN)
libaprutil-1.dylib
libexpat.0.5.0.dylib
libexpat.dylib
libllqtwebkit.dylib
libGLOD.dylib
libllqtwebkit.dylib
libndofdev.dylib
libexception_handler.dylib
)
@ -225,6 +226,7 @@ elseif(LINUX)
libcrypto.so.0.9.7
libdb-4.2.so
libexpat.so
libexpat.so.1
libgmock_main.so
libgmock.so.0
libgmodule-2.0.so
@ -235,7 +237,8 @@ elseif(LINUX)
libopenjpeg.so
libssl.so
libstacktrace.so
libtcmalloc.so
libtcmalloc_minimal.so
libtcmalloc_minimal.so.0
libuuid.so.1
libssl.so.0.9.7
)

View File

@ -0,0 +1,55 @@
# -*- cmake -*-
# - Find JSONCpp
# Find the JSONCpp includes and library
# This module defines
# JSONCPP_INCLUDE_DIR, where to find json.h, etc.
# JSONCPP_LIBRARIES, the libraries needed to use jsoncpp.
# JSONCPP_FOUND, If false, do not try to use jsoncpp.
# also defined, but not for general use are
# JSONCPP_LIBRARY, where to find the jsoncpp library.
FIND_PATH(JSONCPP_INCLUDE_DIR jsoncpp/json.h
/usr/local/include
/usr/include
)
# Get the GCC compiler version
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
OUTPUT_VARIABLE _gcc_COMPILER_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson_linux-gcc-${_gcc_COMPILER_VERSION}_libmt.so)
FIND_LIBRARY(JSONCPP_LIBRARY
NAMES ${JSONCPP_NAMES}
PATHS /usr/lib /usr/local/lib
)
IF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
SET(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY})
SET(JSONCPP_FOUND "YES")
ELSE (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
SET(JSONCPP_FOUND "NO")
ENDIF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
IF (JSONCPP_FOUND)
IF (NOT JSONCPP_FIND_QUIETLY)
MESSAGE(STATUS "Found JSONCpp: ${JSONCPP_LIBRARIES}")
ENDIF (NOT JSONCPP_FIND_QUIETLY)
ELSE (JSONCPP_FOUND)
IF (JSONCPP_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find JSONCpp library")
ENDIF (JSONCPP_FIND_REQUIRED)
ENDIF (JSONCPP_FOUND)
# Deprecated declarations.
SET (NATIVE_JSONCPP_INCLUDE_PATH ${JSONCPP_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_JSONCPP_LIB_PATH ${JSONCPP_LIBRARY} PATH)
MARK_AS_ADVANCED(
JSONCPP_LIBRARY
JSONCPP_INCLUDE_DIR
)

View File

@ -13,7 +13,10 @@ else (STANDALONE)
set(GOOGLE_PERFTOOLS_FOUND "YES")
endif (WINDOWS)
if (LINUX)
set(TCMALLOC_LIBRARIES tcmalloc)
use_prebuilt_binary(tcmalloc)
set(TCMALLOC_LIBRARIES
debug tcmalloc_minimal_debug
optimized tcmalloc_minimal)
set(STACKTRACE_LIBRARIES stacktrace)
set(PROFILER_LIBRARIES profiler)
set(GOOGLE_PERFTOOLS_INCLUDE_DIR

22
indra/cmake/JsonCpp.cmake Normal file
View File

@ -0,0 +1,22 @@
# -*- cmake -*-
include(Prebuilt)
set(JSONCPP_FIND_QUIETLY ON)
set(JSONCPP_FIND_REQUIRED ON)
if (STANDALONE)
include(FindJsonCpp)
else (STANDALONE)
use_prebuilt_binary(jsoncpp)
if (WINDOWS)
set(JSONCPP_LIBRARIES
debug json_vc80d
optimized json_vc80)
elseif (DARWIN)
set(JSONCPP_LIBRARIES json_mac-universal-gcc_libmt)
elseif (LINUX)
set(JSONCPP_LIBRARIES jsoncpp)
endif (WINDOWS)
set(JSONCPP_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/jsoncpp)
endif (STANDALONE)

View File

@ -9,5 +9,5 @@ if (STANDALONE)
else (STANDALONE)
use_prebuilt_binary(libpng)
set(PNG_LIBRARIES png12)
set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/libpng12)
endif (STANDALONE)

View File

@ -54,19 +54,20 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LINUX ON BOOl FORCE)
# If someone has specified a word size, use that to determine the
# architecture. Otherwise, let the architecture specify the word size.
# architecture. Otherwise, let the compiler specify the word size.
# Using uname will break under chroots and other cross arch compiles. RC
if (WORD_SIZE EQUAL 32)
set(ARCH i686)
elseif (WORD_SIZE EQUAL 64)
set(ARCH x86_64)
else (WORD_SIZE EQUAL 32)
execute_process(COMMAND uname -m COMMAND sed s/i.86/i686/
OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
if (ARCH STREQUAL x86_64)
set(WORD_SIZE 64)
else (ARCH STREQUAL x86_64)
if(CMAKE_SIZEOF_VOID_P MATCHES 4)
set(ARCH i686)
set(WORD_SIZE 32)
endif (ARCH STREQUAL x86_64)
else(CMAKE_SIZEOF_VOID_P MATCHES 4)
set(ARCH x86_64)
set(WORD_SIZE 64)
endif(CMAKE_SIZEOF_VOID_P MATCHES 4)
endif (WORD_SIZE EQUAL 32)
set(LL_ARCH ${ARCH}_linux)

View File

@ -65,10 +65,24 @@ def main(command, libpath=[], vars={}):
dirs = os.environ.get(var, "").split(os.pathsep)
# Append the sequence in libpath
print "%s += %r" % (var, libpath)
dirs.extend(libpath)
for dir in libpath:
# append system paths at the end
if dir in ('/lib', '/usr/lib'):
dirs.append(dir)
# prepend non-system paths
else:
dirs.insert(0, dir)
# Filter out some useless pieces
clean_dirs = []
for dir in dirs:
if dir and dir not in ('', '.'):
clean_dirs.append(dir)
# 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)
os.environ[var] = os.pathsep.join(clean_dirs)
print "%s = %r" % (var, os.environ[var])
# 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:

38
indra/fix-incredibuild.py Normal file
View File

@ -0,0 +1,38 @@
import sys
import os
import glob
def delete_file_types(path, filetypes):
if os.path.exists(path):
print 'Cleaning: ' + path
orig_dir = os.getcwd();
os.chdir(path)
filelist = []
for type in filetypes:
filelist.extend(glob.glob(type))
for file in filelist:
os.remove(file)
os.chdir(orig_dir)
def main():
build_types = ['*.exp','*.exe','*.pdb','*.idb',
'*.ilk','*.lib','*.obj','*.ib_pdb_index']
pch_types = ['*.pch']
delete_file_types("build-vc80/newview/Release", build_types)
delete_file_types("build-vc80/newview/secondlife-bin.dir/Release/",
pch_types)
delete_file_types("build-vc80/newview/RelWithDebInfo", build_types)
delete_file_types("build-vc80/newview/secondlife-bin.dir/RelWithDebInfo/",
pch_types)
delete_file_types("build-vc80/newview/Debug", build_types)
delete_file_types("build-vc80/newview/secondlife-bin.dir/Debug/",
pch_types)
delete_file_types("build-vc80/test/RelWithDebInfo", build_types)
delete_file_types("build-vc80/test/test.dir/RelWithDebInfo/",
pch_types)
if __name__ == "__main__":
main()

View File

@ -191,10 +191,9 @@ void export_test_floaters()
// Build a floater and output new attributes
LLXMLNodePtr output_node = new LLXMLNode();
LLFloater* floater = new LLFloater(LLSD());
LLUICtrlFactory::getInstance()->buildFloater(floater,
filename,
// FALSE, // don't open floater
output_node);
floater->buildFromFile( filename,
// FALSE, // don't open floater
output_node);
std::string out_filename = xui_dir + filename;
std::string::size_type extension_pos = out_filename.rfind(".xml");
out_filename.resize(extension_pos);

View File

@ -84,7 +84,7 @@ void LLWidgetReg::initClass(bool register_widgets)
LLDefaultChildRegistry::Register<LLMultiSlider> multi_slider_bar("multi_slider_bar");
LLDefaultChildRegistry::Register<LLMultiSliderCtrl> multi_slider("multi_slider");
LLDefaultChildRegistry::Register<LLPanel> panel("panel", &LLPanel::fromXML);
LLDefaultChildRegistry::Register<LLLayoutStack> layout_stack("layout_stack", &LLLayoutStack::fromXML);
LLDefaultChildRegistry::Register<LLLayoutStack> layout_stack("layout_stack");
LLDefaultChildRegistry::Register<LLProgressBar> progress_bar("progress_bar");
LLDefaultChildRegistry::Register<LLRadioGroup> radio_group("radio_group");
LLDefaultChildRegistry::Register<LLSearchEditor> search_editor("search_editor");

View File

@ -36,14 +36,6 @@ import os.path
import re
import time
#import sys # *TODO: remove. only used in testing.
#import pprint # *TODO: remove. only used in testing.
try:
set = set
except NameError:
from sets import Set as set
from indra.base import llsd
from indra.base import config
@ -195,8 +187,6 @@ class NamedQuery(object):
style. It also has to look for %:name% and :name% and
ready them for use in LIKE statements"""
if sql:
#print >>sys.stderr, "sql:",sql
# This first sub is to properly escape any % signs that
# are meant to be literally passed through to mysql in the
# query. It leaves any %'s that are used for
@ -408,7 +398,6 @@ class NamedQuery(object):
# build the query from the options available and the params
base_query = []
base_query.append(self._base_query)
#print >>sys.stderr, "base_query:",base_query
for opt, extra_where in self._options.items():
if type(extra_where) in (dict, list, tuple):
if opt in params:
@ -418,7 +407,6 @@ class NamedQuery(object):
base_query.append(extra_where)
if self._query_suffix:
base_query.append(self._query_suffix)
#print >>sys.stderr, "base_query:",base_query
full_query = '\n'.join(base_query)
# Go through the query and rewrite all of the ones with the

View File

@ -446,8 +446,14 @@ def uuid1(node=None, clock_seq=None):
def uuid3(namespace, name):
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
import md5
hash = md5.md5(namespace.bytes + name).digest()
try:
# Python 2.6
from hashlib import md5
except ImportError:
# Python 2.5 and earlier
from md5 import new as md5
hash = md5(namespace.bytes + name).digest()
return UUID(bytes=hash[:16], version=3)
def uuid4():

View File

@ -224,7 +224,7 @@ BOOL LLVorbisDecodeState::initDecode()
S32 sample_count = ov_pcm_total(&mVF, -1);
size_t size_guess = (size_t)sample_count;
vorbis_info* vi = ov_info(&mVF, -1);
size_guess *= vi->channels;
size_guess *= (vi? vi->channels : 1);
size_guess *= 2;
size_guess += 2048;

View File

@ -103,6 +103,7 @@ void LLAudioEngine::setDefaults()
}
mMasterGain = 1.f;
mInternalGain = 0.f;
mNextWindUpdate = 0.f;
mStreamingAudioImpl = NULL;
@ -253,15 +254,6 @@ void LLAudioEngine::idle(F32 max_decode_time)
// Primarily does position updating, cleanup of unused audio sources.
// Also does regeneration of the current priority of each audio source.
if (getMuted())
{
setInternalGain(0.f);
}
else
{
setInternalGain(getMasterGain());
}
S32 i;
for (i = 0; i < MAX_BUFFERS; i++)
{
@ -290,6 +282,12 @@ void LLAudioEngine::idle(F32 max_decode_time)
continue;
}
if (sourcep->isMuted())
{
++iter;
continue;
}
if (!sourcep->getChannel() && sourcep->getCurrentBuffer())
{
// We could potentially play this sound if its priority is high enough.
@ -342,9 +340,9 @@ void LLAudioEngine::idle(F32 max_decode_time)
// attached to each channel, since only those with active channels
// can have anything interesting happen with their queue? (Maybe not true)
LLAudioSource *sourcep = iter->second;
if (!sourcep->mQueuedDatap)
if (!sourcep->mQueuedDatap || sourcep->isMuted())
{
// Nothing queued, so we don't care.
// Muted, or nothing queued, so we don't care.
continue;
}
@ -424,6 +422,10 @@ void LLAudioEngine::idle(F32 max_decode_time)
for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
{
LLAudioSource *sourcep = iter->second;
if (sourcep->isMuted())
{
continue;
}
if (sourcep->isSyncMaster())
{
if (sourcep->getPriority() > max_sm_priority)
@ -697,15 +699,23 @@ bool LLAudioEngine::isWindEnabled()
void LLAudioEngine::setMuted(bool muted)
{
mMuted = muted;
if (muted != mMuted)
{
mMuted = muted;
setMasterGain(mMasterGain);
}
enableWind(!mMuted);
}
void LLAudioEngine::setMasterGain(const F32 gain)
{
mMasterGain = gain;
setInternalGain(gain);
F32 internal_gain = getMuted() ? 0.f : gain;
if (internal_gain != mInternalGain)
{
mInternalGain = internal_gain;
setInternalGain(mInternalGain);
}
}
F32 LLAudioEngine::getMasterGain()
@ -1249,13 +1259,14 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
mOwnerID(owner_id),
mPriority(0.f),
mGain(gain),
mType(type),
mSourceMuted(false),
mAmbient(false),
mLoop(false),
mSyncMaster(false),
mSyncSlave(false),
mQueueSounds(false),
mPlayedOnce(false),
mType(type),
mChannelp(NULL),
mCurrentDatap(NULL),
mQueuedDatap(NULL)
@ -1307,6 +1318,10 @@ void LLAudioSource::updatePriority()
{
mPriority = 1.f;
}
else if (isMuted())
{
mPriority = 0.f;
}
else
{
// Priority is based on distance
@ -1355,25 +1370,33 @@ bool LLAudioSource::setupChannel()
bool LLAudioSource::play(const LLUUID &audio_uuid)
{
// Special abuse of play(); don't play a sound, but kill it.
if (audio_uuid.isNull())
{
if (getChannel())
{
getChannel()->setSource(NULL);
setChannel(NULL);
addAudioData(NULL, true);
if (!isMuted())
{
mCurrentDatap = NULL;
}
}
return false;
}
// Reset our age timeout if someone attempts to play the source.
mAgeTimer.reset();
LLAudioData *adp = gAudiop->getAudioData(audio_uuid);
bool has_buffer = gAudiop->updateBufferForData(adp, audio_uuid);
addAudioData(adp);
if (isMuted())
{
return false;
}
bool has_buffer = gAudiop->updateBufferForData(adp, audio_uuid);
if (!has_buffer)
{
// Don't bother trying to set up a channel or anything, we don't have an audio buffer.
@ -1398,10 +1421,11 @@ bool LLAudioSource::play(const LLUUID &audio_uuid)
}
bool LLAudioSource::isDone()
bool LLAudioSource::isDone() const
{
const F32 MAX_AGE = 60.f;
const F32 MAX_UNPLAYED_AGE = 15.f;
const F32 MAX_MUTED_AGE = 11.f;
if (isLoop())
{
@ -1409,7 +1433,6 @@ bool LLAudioSource::isDone()
return false;
}
if (hasPendingPreloads())
{
return false;
@ -1426,10 +1449,10 @@ bool LLAudioSource::isDone()
// This is a single-play source
if (!mChannelp)
{
if ((elapsed > MAX_UNPLAYED_AGE) || mPlayedOnce)
if ((elapsed > (mSourceMuted ? MAX_MUTED_AGE : MAX_UNPLAYED_AGE)) || mPlayedOnce)
{
// We don't have a channel assigned, and it's been
// over 5 seconds since we tried to play it. Don't bother.
// over 15 seconds since we tried to play it. Don't bother.
//llinfos << "No channel assigned, source is done" << llendl;
return true;
}
@ -1455,7 +1478,7 @@ bool LLAudioSource::isDone()
if ((elapsed > MAX_UNPLAYED_AGE) || mPlayedOnce)
{
// The sound isn't playing back after 5 seconds or we're already done playing it, kill it.
// The sound isn't playing back after 15 seconds or we're already done playing it, kill it.
return true;
}

View File

@ -124,8 +124,8 @@ public:
// Use these for temporarily muting the audio system.
// Does not change buffers, initialization, etc. but
// stops playing new sounds.
virtual void setMuted(bool muted);
virtual bool getMuted() const { return mMuted; }
void setMuted(bool muted);
bool getMuted() const { return mMuted; }
#ifdef USE_PLUGIN_MEDIA
LLPluginClassMedia* initializeMedia(const std::string& media_type);
#endif
@ -245,6 +245,7 @@ protected:
LLAudioBuffer *mBuffers[MAX_BUFFERS];
F32 mMasterGain;
F32 mInternalGain; // Actual gain set; either mMasterGain or 0 when mMuted is true.
F32 mSecondaryGain[AUDIO_TYPE_COUNT];
F32 mNextWindUpdate;
@ -309,7 +310,8 @@ public:
virtual void setGain(const F32 gain) { mGain = llclamp(gain, 0.f, 1.f); }
const LLUUID &getID() const { return mID; }
bool isDone();
bool isDone() const;
bool isMuted() const { return mSourceMuted; }
LLAudioData *getCurrentData();
LLAudioData *getQueuedData();
@ -331,6 +333,7 @@ protected:
LLUUID mOwnerID; // owner of the object playing the sound
F32 mPriority;
F32 mGain;
bool mSourceMuted;
bool mAmbient;
bool mLoop;
bool mSyncMaster;

View File

@ -239,6 +239,21 @@ void LLJoint::setPosition( const LLVector3& pos )
}
}
//--------------------------------------------------------------------
// storeCurrentXform()
//--------------------------------------------------------------------
void LLJoint::storeCurrentXform( const LLVector3& pos )
{
mOldXform = mXform;
setPosition( pos );
}
//--------------------------------------------------------------------
// restoreOldXform()
//--------------------------------------------------------------------
void LLJoint::restoreOldXform( void )
{
mXform = mOldXform;
}
//--------------------------------------------------------------------
// getWorldPosition()

View File

@ -86,6 +86,7 @@ protected:
// explicit transformation members
LLXformMatrix mXform;
LLXformMatrix mOldXform;
public:
U32 mDirtyFlags;
@ -178,6 +179,9 @@ public:
S32 getJointNum() const { return mJointNum; }
void setJointNum(S32 joint_num) { mJointNum = joint_num; }
void restoreOldXform( void );
void storeCurrentXform( const LLVector3& pos );
};
#endif // LL_LLJOINT_H

View File

@ -48,7 +48,7 @@ namespace tut
};
typedef test_group<lljoint_data> lljoint_test;
typedef lljoint_test::object lljoint_object;
tut::lljoint_test lljoint_testcase("lljoint");
tut::lljoint_test lljoint_testcase("LLJoint");
template<> template<>
void lljoint_object::test<1>()

View File

@ -157,6 +157,7 @@ set(llcommon_HEADER_FILES
lleventemitter.h
llextendedstatus.h
llfasttimer.h
llfasttimer_class.h
llfile.h
llfindlocale.h
llfixedbuffer.h

View File

@ -474,9 +474,9 @@ void LLFastTimer::NamedTimer::accumulateTimings()
int hidx = cur_frame % HISTORY_NUM;
timerp->mCountHistory[hidx] = timerp->mTotalTimeCounter;
timerp->mCountAverage = (timerp->mCountAverage * cur_frame + timerp->mTotalTimeCounter) / (cur_frame+1);
timerp->mCountAverage = ((U64)timerp->mCountAverage * cur_frame + timerp->mTotalTimeCounter) / (cur_frame+1);
timerp->mCallHistory[hidx] = timerp->getFrameState().mCalls;
timerp->mCallAverage = (timerp->mCallAverage * cur_frame + timerp->getFrameState().mCalls) / (cur_frame+1);
timerp->mCallAverage = ((U64)timerp->mCallAverage * cur_frame + timerp->getFrameState().mCalls) / (cur_frame+1);
}
}
}

View File

@ -78,7 +78,7 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize
break;
default:
llwarns << "serialize request for unkown ELLSD_Serialize" << llendl;
llwarns << "serialize request for unknown ELLSD_Serialize" << llendl;
}
if (f.notNull())
@ -1999,7 +1999,9 @@ std::string zip_llsd(LLSD& data)
{
std::stringstream llsd_strm;
LLSDSerialize::serialize(data, llsd_strm, LLSDSerialize::LLSD_BINARY);
LLSDSerialize::toBinary(data, llsd_strm);
const U32 CHUNK = 65536;
z_stream strm;
strm.zalloc = Z_NULL;
@ -2015,24 +2017,57 @@ std::string zip_llsd(LLSD& data)
std::string source = llsd_strm.str();
U8 out[CHUNK];
strm.avail_in = source.size();
strm.next_in = (U8*) source.data();
U8* output = new U8[strm.avail_in];
strm.avail_out = strm.avail_in;
strm.next_out = output;
ret = deflate(&strm, Z_FINISH);
if (ret != Z_STREAM_END)
{
delete [] output;
llwarns << "Failed to compress LLSD block." << llendl;
return std::string();
}
U8* output = NULL;
std::string::size_type size = source.size()-strm.avail_out;
U32 cur_size = 0;
U32 have = 0;
do
{
strm.avail_out = CHUNK;
strm.next_out = out;
ret = deflate(&strm, Z_FINISH);
if (ret == Z_OK || ret == Z_STREAM_END)
{ //copy result into output
if (strm.avail_out >= CHUNK)
{
llerrs << "WTF?" << llendl;
}
have = CHUNK-strm.avail_out;
output = (U8*) realloc(output, cur_size+have);
memcpy(output+cur_size, out, have);
cur_size += have;
}
else
{
free(output);
llwarns << "Failed to compress LLSD block." << llendl;
return std::string();
}
}
while (ret == Z_OK);
std::string::size_type size = cur_size;
std::string result((char*) output, size);
deflateEnd(&strm);
delete [] output;
free(output);
#if 0 //verify results work with unzip_llsd
std::istringstream test(result);
LLSD test_sd;
if (!unzip_llsd(test_sd, test, result.size()))
{
llerrs << "Invalid compression result!" << llendl;
}
#endif
return result;
}
@ -2098,7 +2133,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
memcpy(result+cur_size, out, have);
cur_size += have;
} while (strm.avail_out == 0);
} while (ret == Z_OK);
inflateEnd(&strm);
delete [] in;
@ -2112,9 +2147,18 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
//result now points to the decompressed LLSD block
{
std::string res_str((char*) result, cur_size);
std::istringstream istr(res_str);
if (!LLSDSerialize::deserialize(data, istr, cur_size))
std::string deprecated_header("<? LLSD/Binary ?>");
if (res_str.substr(0, deprecated_header.size()) == deprecated_header)
{
res_str = res_str.substr(deprecated_header.size()+1, cur_size);
}
cur_size = res_str.size();
std::istringstream istr(res_str);
if (!LLSDSerialize::fromBinary(data, istr, cur_size))
{
llwarns << "Failed to unzip LLSD block" << llendl;
free(result);

View File

@ -1118,7 +1118,7 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token,
else if(LLStringOps::sMonthList.size() == 12 && code == "%B")
{
struct tm * gmt = gmtime (&loc_seconds);
replacement = LLStringOps::sWeekDayList[gmt->tm_mon];
replacement = LLStringOps::sMonthList[gmt->tm_mon];
}
else if( !LLStringOps::sDayFormat.empty() && code == "%d" )
{

View File

@ -441,7 +441,7 @@ LL_COMMON_API bool iswindividual(llwchar elem);
*/
// Make the incoming string a utf8 string. Replaces any unknown glyph
// with the UNKOWN_CHARACTER. Once any unknown glph is found, the rest
// with the UNKNOWN_CHARACTER. Once any unknown glyph is found, the rest
// of the data may not be recovered.
LL_COMMON_API std::string rawstr_to_utf8(const std::string& raw);

View File

@ -34,7 +34,7 @@
#define LL_LLVERSIONVIEWER_H
const S32 LL_VERSION_MAJOR = 2;
const S32 LL_VERSION_MINOR = 1;
const S32 LL_VERSION_MINOR = 2;
const S32 LL_VERSION_PATCH = 1;
const S32 LL_VERSION_BUILD = 0;

View File

@ -120,8 +120,8 @@ enum EObjectPropertiesExtraID
enum EAddPosition
{
ADD_TOP,
ADD_SORTED,
ADD_BOTTOM
ADD_BOTTOM,
ADD_DEFAULT
};
enum LLGroupChange

View File

@ -46,7 +46,7 @@ namespace tut
};
typedef test_group<bit_pack> bit_pack_t;
typedef bit_pack_t::object bit_pack_object_t;
tut::bit_pack_t tut_bit_pack("bitpack");
tut::bit_pack_t tut_bit_pack("LLBitPack");
// pack -> unpack
template<> template<>

View File

@ -65,7 +65,7 @@ namespace tut
};
typedef test_group<sd_data> sd_test;
typedef sd_test::object sd_object;
tut::sd_test sd("llsd");
tut::sd_test sd("LLSD");
template<> template<>
void sd_object::test<1>()
@ -456,7 +456,7 @@ namespace tut
};
typedef test_group<mem_data> mem_test;
typedef mem_test::object mem_object;
tut::mem_test mem_stream("memory_stream");
tut::mem_test mem_stream("LLMemoryStream");
template<> template<>
void mem_object::test<1>()
@ -649,7 +649,7 @@ namespace tut
};
typedef test_group<hash_data> hash_test;
typedef hash_test::object hash_object;
tut::hash_test hash_tester("hash_test");
tut::hash_test hash_tester("LLHash");
template<> template<>
void hash_object::test<1>()

View File

@ -47,7 +47,7 @@ namespace tut
};
typedef test_group<base64_data> base64_test;
typedef base64_test::object base64_object;
tut::base64_test base64("base64");
tut::base64_test base64("LLBase64");
template<> template<>
void base64_object::test<1>()

View File

@ -77,7 +77,7 @@ namespace tut
};
typedef test_group<date_test> date_test_t;
typedef date_test_t::object date_test_object_t;
tut::date_test_t tut_date_test("date_test");
tut::date_test_t tut_date_test("LLDate");
/* format validation */
template<> template<>

View File

@ -128,7 +128,7 @@ namespace tut
};
typedef test_group<deps_data> deps_group;
typedef deps_group::object deps_object;
tut::deps_group depsgr("lldependencies");
tut::deps_group depsgr("LLDependencies");
template<> template<>
void deps_object::test<1>()

View File

@ -49,7 +49,7 @@ namespace tut
};
typedef test_group<frametimer_test> frametimer_group_t;
typedef frametimer_group_t::object frametimer_object_t;
tut::frametimer_group_t frametimer_instance("frametimer");
tut::frametimer_group_t frametimer_instance("LLFrameTimer");
template<> template<>
void frametimer_object_t::test<1>()

View File

@ -44,7 +44,7 @@ namespace tut
typedef test_group<processor> processor_t;
typedef processor_t::object processor_object_t;
tut::processor_t tut_processor("processor");
tut::processor_t tut_processor("LLProcessor");
template<> template<>
void processor_object_t::test<1>()

View File

@ -45,7 +45,7 @@ namespace tut
typedef test_group<random> random_t;
typedef random_t::object random_object_t;
tut::random_t tut_random("random");
tut::random_t tut_random("LLSeedRand");
template<> template<>
void random_object_t::test<1>()

View File

@ -80,7 +80,7 @@ namespace tut
typedef test_group<sd_xml_data> sd_xml_test;
typedef sd_xml_test::object sd_xml_object;
tut::sd_xml_test sd_xml_stream("sd_xml_serialization");
tut::sd_xml_test sd_xml_stream("LLSDXMLFormatter");
template<> template<>
void sd_xml_object::test<1>()

View File

@ -44,7 +44,7 @@ namespace tut
};
typedef test_group<string_index> string_index_t;
typedef string_index_t::object string_index_object_t;
tut::string_index_t tut_string_index("string_test");
tut::string_index_t tut_string_index("LLString");
template<> template<>
void string_index_object_t::test<1>()

View File

@ -62,7 +62,7 @@ namespace tut
};
typedef test_group<iter_data> iter_group;
typedef iter_group::object iter_object;
tut::iter_group ig("lltreeiterators");
tut::iter_group ig("LLTreeIterators");
} // namespace tut
/*****************************************************************************

View File

@ -86,7 +86,7 @@ namespace tut
};
typedef test_group<stringize_data> stringize_group;
typedef stringize_group::object stringize_object;
tut::stringize_group strzgrp("stringize");
tut::stringize_group strzgrp("stringize_h");
template<> template<>
void stringize_object::test<1>()

View File

@ -153,7 +153,7 @@ U8* LLImageBase::allocateData(S32 size)
size = mWidth * mHeight * mComponents;
if (size <= 0)
{
llerrs << llformat("LLImageBase::allocateData called with bad dimensions: %dx%dx%d",mWidth,mHeight,mComponents) << llendl;
llerrs << llformat("LLImageBase::allocateData called with bad dimensions: %dx%dx%d",mWidth,mHeight,(S32)mComponents) << llendl;
}
}

View File

@ -216,7 +216,7 @@ void LLPngWrapper::normalizeImage()
}
if (mColorType == PNG_COLOR_TYPE_GRAY && mBitDepth < 8)
{
png_set_gray_1_2_4_to_8(mReadPngPtr);
png_set_expand_gray_1_2_4_to_8(mReadPngPtr);
}
if (mColorType == PNG_COLOR_TYPE_GRAY
|| mColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
@ -364,7 +364,7 @@ void LLPngWrapper::releaseResources()
{
if (mReadPngPtr || mReadInfoPtr)
{
png_destroy_read_struct(&mReadPngPtr, &mReadInfoPtr, png_infopp_NULL);
png_destroy_read_struct(&mReadPngPtr, &mReadInfoPtr, NULL);
mReadPngPtr = NULL;
mReadInfoPtr = NULL;
}

View File

@ -32,7 +32,7 @@
#ifndef LL_LLPNGWRAPPER_H
#define LL_LLPNGWRAPPER_H
#include "libpng12/png.h"
#include "png.h"
#include "llimage.h"
class LLPngWrapper

View File

@ -150,11 +150,11 @@ namespace tut
// Tut templating thingamagic: test group, object and test instance
typedef test_group<imagedecodethread_test> imagedecodethread_t;
typedef imagedecodethread_t::object imagedecodethread_object_t;
tut::imagedecodethread_t tut_imagedecodethread("imagedecodethread");
tut::imagedecodethread_t tut_imagedecodethread("LLImageDecodeThread");
typedef test_group<imagerequest_test> imagerequest_t;
typedef imagerequest_t::object imagerequest_object_t;
tut::imagerequest_t tut_imagerequest("imagerequest");
tut::imagerequest_t tut_imagerequest("LLImageRequest");
// ---------------------------------------------------------------------------------------
// Test functions

View File

@ -98,58 +98,58 @@ LLInventoryDictionary::LLInventoryDictionary()
static const LLInventoryType::EType
DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
{
LLInventoryType::IT_TEXTURE, // AT_TEXTURE
LLInventoryType::IT_SOUND, // AT_SOUND
LLInventoryType::IT_CALLINGCARD, // AT_CALLINGCARD
LLInventoryType::IT_LANDMARK, // AT_LANDMARK
LLInventoryType::IT_LSL, // AT_SCRIPT
LLInventoryType::IT_WEARABLE, // AT_CLOTHING
LLInventoryType::IT_OBJECT, // AT_OBJECT
LLInventoryType::IT_NOTECARD, // AT_NOTECARD
LLInventoryType::IT_CATEGORY, // AT_CATEGORY
LLInventoryType::IT_NONE, // (null entry)
LLInventoryType::IT_LSL, // AT_LSL_TEXT
LLInventoryType::IT_LSL, // AT_LSL_BYTECODE
LLInventoryType::IT_TEXTURE, // AT_TEXTURE_TGA
LLInventoryType::IT_WEARABLE, // AT_BODYPART
LLInventoryType::IT_CATEGORY, // AT_TRASH
LLInventoryType::IT_CATEGORY, // AT_SNAPSHOT_CATEGORY
LLInventoryType::IT_CATEGORY, // AT_LOST_AND_FOUND
LLInventoryType::IT_SOUND, // AT_SOUND_WAV
LLInventoryType::IT_NONE, // AT_IMAGE_TGA
LLInventoryType::IT_NONE, // AT_IMAGE_JPEG
LLInventoryType::IT_ANIMATION, // AT_ANIMATION
LLInventoryType::IT_GESTURE, // AT_GESTURE
LLInventoryType::IT_NONE, // AT_SIMSTATE
LLInventoryType::IT_TEXTURE, // 0 AT_TEXTURE
LLInventoryType::IT_SOUND, // 1 AT_SOUND
LLInventoryType::IT_CALLINGCARD, // 2 AT_CALLINGCARD
LLInventoryType::IT_LANDMARK, // 3 AT_LANDMARK
LLInventoryType::IT_LSL, // 4 AT_SCRIPT
LLInventoryType::IT_WEARABLE, // 5 AT_CLOTHING
LLInventoryType::IT_OBJECT, // 6 AT_OBJECT
LLInventoryType::IT_NOTECARD, // 7 AT_NOTECARD
LLInventoryType::IT_CATEGORY, // 8 AT_CATEGORY
LLInventoryType::IT_NONE, // 9 (null entry)
LLInventoryType::IT_LSL, // 10 AT_LSL_TEXT
LLInventoryType::IT_LSL, // 11 AT_LSL_BYTECODE
LLInventoryType::IT_TEXTURE, // 12 AT_TEXTURE_TGA
LLInventoryType::IT_WEARABLE, // 13 AT_BODYPART
LLInventoryType::IT_CATEGORY, // 14 AT_TRASH
LLInventoryType::IT_CATEGORY, // 15 AT_SNAPSHOT_CATEGORY
LLInventoryType::IT_CATEGORY, // 16 AT_LOST_AND_FOUND
LLInventoryType::IT_SOUND, // 17 AT_SOUND_WAV
LLInventoryType::IT_NONE, // 18 AT_IMAGE_TGA
LLInventoryType::IT_NONE, // 19 AT_IMAGE_JPEG
LLInventoryType::IT_ANIMATION, // 20 AT_ANIMATION
LLInventoryType::IT_GESTURE, // 21 AT_GESTURE
LLInventoryType::IT_NONE, // 22 AT_SIMSTATE
LLInventoryType::IT_NONE, // AT_LINK
LLInventoryType::IT_NONE, // AT_LINK_FOLDER
LLInventoryType::IT_NONE, // 23 AT_LINK
LLInventoryType::IT_NONE, // 24 AT_LINK_FOLDER
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_NONE, // AT_NONE
LLInventoryType::IT_MESH // AT_MESH
LLInventoryType::IT_NONE, // 25 AT_NONE
LLInventoryType::IT_NONE, // 26 AT_NONE
LLInventoryType::IT_NONE, // 27 AT_NONE
LLInventoryType::IT_NONE, // 28 AT_NONE
LLInventoryType::IT_NONE, // 29 AT_NONE
LLInventoryType::IT_NONE, // 30 AT_NONE
LLInventoryType::IT_NONE, // 31 AT_NONE
LLInventoryType::IT_NONE, // 32 AT_NONE
LLInventoryType::IT_NONE, // 33 AT_NONE
LLInventoryType::IT_NONE, // 34 AT_NONE
LLInventoryType::IT_NONE, // 35 AT_NONE
LLInventoryType::IT_NONE, // 36 AT_NONE
LLInventoryType::IT_NONE, // 37 AT_NONE
LLInventoryType::IT_NONE, // 38 AT_NONE
LLInventoryType::IT_NONE, // 39 AT_NONE
LLInventoryType::IT_NONE, // 40 AT_NONE
LLInventoryType::IT_NONE, // 41 AT_NONE
LLInventoryType::IT_NONE, // 42 AT_NONE
LLInventoryType::IT_NONE, // 43 AT_NONE
LLInventoryType::IT_NONE, // 44 AT_NONE
LLInventoryType::IT_NONE, // 45 AT_NONE
LLInventoryType::IT_NONE, // 46 AT_NONE
LLInventoryType::IT_NONE, // 47 AT_NONE
LLInventoryType::IT_NONE, // 48 AT_NONE
LLInventoryType::IT_MESH // 49 AT_MESH
};
// static

View File

@ -106,7 +106,7 @@ namespace tut
};
typedef test_group<inventory_data> inventory_test;
typedef inventory_test::object inventory_object;
tut::inventory_test inv("llinventory");
tut::inventory_test inv("LLInventory");
//***class LLInventoryType***//

View File

@ -46,7 +46,7 @@ namespace tut
};
typedef test_group<llinventoryparcel_data> llinventoryparcel_test;
typedef llinventoryparcel_test::object llinventoryparcel_object;
tut::llinventoryparcel_test llinventoryparcel("llinventoryparcel");
tut::llinventoryparcel_test llinventoryparcel("LLInventoryParcel");
template<> template<>
void llinventoryparcel_object::test<1>()

View File

@ -45,7 +45,7 @@ namespace tut
};
typedef test_group<modularmath_data> modularmath_test;
typedef modularmath_test::object modularmath_object;
tut::modularmath_test modularmath_testcase("modularmath");
tut::modularmath_test modularmath_testcase("LLModularMath");
template<> template<>
void modularmath_object::test<1>()

View File

@ -49,7 +49,7 @@ namespace tut
};
typedef test_group<llquat_test> llquat_test_t;
typedef llquat_test_t::object llquat_test_object_t;
tut::llquat_test_t tut_llquat_test("llquat");
tut::llquat_test_t tut_llquat_test("LLQuaternion");
//test case for LLQuaternion::LLQuaternion(void) fn.
template<> template<>

View File

@ -50,7 +50,7 @@ namespace tut
};
typedef test_group<m3math_test> m3math_test_t;
typedef m3math_test_t::object m3math_test_object_t;
tut::m3math_test_t tut_m3math_test("m3math_test");
tut::m3math_test_t tut_m3math_test("m3math_h");
//test case for setIdentity() fn.
template<> template<>

View File

@ -51,7 +51,7 @@ namespace tut
};
typedef test_group<math_data> math_test;
typedef math_test::object math_object;
tut::math_test tm("basic_linden_math");
tut::math_test tm("BasicLindenMath");
template<> template<>
void math_object::test<1>()
@ -184,7 +184,7 @@ namespace tut
};
typedef test_group<uuid_data> uuid_test;
typedef uuid_test::object uuid_object;
tut::uuid_test tu("uuid");
tut::uuid_test tu("LLUUID");
template<> template<>
void uuid_object::test<1>()
@ -239,7 +239,7 @@ namespace tut
};
typedef test_group<crc_data> crc_test;
typedef crc_test::object crc_object;
tut::crc_test tc("crc");
tut::crc_test tc("LLCrc");
template<> template<>
void crc_object::test<1>()

View File

@ -45,7 +45,7 @@ namespace tut
};
typedef test_group<v2math_data> v2math_test;
typedef v2math_test::object v2math_object;
tut::v2math_test v2math_testcase("v2math");
tut::v2math_test v2math_testcase("v2math_h");
template<> template<>
void v2math_object::test<1>()

View File

@ -45,7 +45,7 @@ namespace tut
};
typedef test_group<v3color_data> v3color_test;
typedef v3color_test::object v3color_object;
tut::v3color_test v3color_testcase("v3color");
tut::v3color_test v3color_testcase("v3color_h");
template<> template<>
void v3color_object::test<1>()

View File

@ -49,7 +49,7 @@ namespace tut
};
typedef test_group<v3dmath_data> v3dmath_test;
typedef v3dmath_test::object v3dmath_object;
tut::v3dmath_test v3dmath_testcase("v3dmath");
tut::v3dmath_test v3dmath_testcase("v3dmath_h");
template<> template<>
void v3dmath_object::test<1>()

View File

@ -51,7 +51,7 @@ namespace tut
};
typedef test_group<v3math_data> v3math_test;
typedef v3math_test::object v3math_object;
tut::v3math_test v3math_testcase("v3math");
tut::v3math_test v3math_testcase("v3math_h");
template<> template<>
void v3math_object::test<1>()

View File

@ -49,7 +49,7 @@ namespace tut
};
typedef test_group<v4color_data> v4color_test;
typedef v4color_test::object v4color_object;
tut::v4color_test v4color_testcase("v4color");
tut::v4color_test v4color_testcase("v4color_h");
template<> template<>
void v4color_object::test<1>()

View File

@ -48,7 +48,7 @@ namespace tut
};
typedef test_group<v4coloru_data> v4coloru_test;
typedef v4coloru_test::object v4coloru_object;
tut::v4coloru_test v4coloru_testcase("v4coloru");
tut::v4coloru_test v4coloru_testcase("v4coloru_h");
template<> template<>
void v4coloru_object::test<1>()

View File

@ -47,7 +47,7 @@ namespace tut
};
typedef test_group<v4math_data> v4math_test;
typedef v4math_test::object v4math_object;
tut::v4math_test v4math_testcase("v4math");
tut::v4math_test v4math_testcase("v4math_h");
template<> template<>
void v4math_object::test<1>()

View File

@ -44,7 +44,7 @@ namespace tut
};
typedef test_group<xform_test> xform_test_t;
typedef xform_test_t::object xform_test_object_t;
tut::xform_test_t tut_xform_test("xform_test");
tut::xform_test_t tut_xform_test("LLXForm");
//test case for init(), getParent(), getRotation(), getPositionW(), getWorldRotation() fns.
template<> template<>

View File

@ -45,7 +45,7 @@ namespace tut
};
typedef test_group<host_data> host_test;
typedef host_test::object host_object;
tut::host_test host_testcase("llhost");
tut::host_test host_testcase("LLHost");
template<> template<>

View File

@ -47,7 +47,7 @@ namespace tut
};
typedef test_group<mime_index> mime_index_t;
typedef mime_index_t::object mime_index_object_t;
tut::mime_index_t tut_mime_index("mime_index");
tut::mime_index_t tut_mime_index("LLMime");
template<> template<>
void mime_index_object_t::test<1>()
@ -234,7 +234,7 @@ namespace tut
};
typedef test_group<mime_parse> mime_parse_t;
typedef mime_parse_t::object mime_parse_object_t;
tut::mime_parse_t tut_mime_parse("mime_parse");
tut::mime_parse_t tut_mime_parse("LLMimeParse");
template<> template<>
void mime_parse_object_t::test<1>()

View File

@ -55,7 +55,7 @@ namespace tut
};
typedef test_group<namevalue_test> namevalue_t;
typedef namevalue_t::object namevalue_object_t;
tut::namevalue_t tut_namevalue("namevalue_test");
tut::namevalue_t tut_namevalue("LLNameValue");
template<> template<>

View File

@ -50,7 +50,7 @@ namespace tut
};
typedef test_group<partdata_test> partdata_test_t;
typedef partdata_test_t::object partdata_test_object_t;
tut::partdata_test_t tut_partdata_test("partdata_test");
tut::partdata_test_t tut_partdata_test("LLPartData");
template<> template<>
void partdata_test_object_t::test<1>()

View File

@ -84,7 +84,7 @@ namespace tut
namespace
{
tut::factory tf("LLRegionPresenceVerifier test");
tut::factory tf("LLRegionPresenceVerifier");
}
namespace tut

View File

@ -104,7 +104,7 @@ namespace tut
namespace
{
tut::factory tf("LLTemplateMessageDispatcher test");
tut::factory tf("LLTemplateMessageDispatcher");
}
namespace tut

View File

@ -104,7 +104,7 @@ namespace tut
namespace
{
tut::factory tf("LLTrustedMessageServiceData test");
tut::factory tf("LLTrustedMessageServiceData");
}
namespace tut

View File

@ -44,7 +44,7 @@ namespace tut
};
typedef test_group<llxfer_data> llxfer_test;
typedef llxfer_test::object llxfer_object;
tut::llxfer_test llxfer("llxfer");
tut::llxfer_test llxfer("LLXferFile");
template<> template<>
void llxfer_object::test<1>()

View File

@ -79,6 +79,7 @@ bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::s
// Queue up the media init message -- it will be sent after all the currently queued messages.
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "init");
message.setValue("target", mTarget);
sendMessage(message);
mPlugin->init(launcher_filename, plugin_filename, debug);
@ -148,7 +149,7 @@ void LLPluginClassMedia::reset()
mProgressPercent = 0;
mClickURL.clear();
mClickTarget.clear();
mClickTargetType = TARGET_NONE;
mClickUUID.clear();
// media_time class
mCurrentTime = 0.0f;
@ -674,6 +675,18 @@ F64 LLPluginClassMedia::getCPUUsage()
return result;
}
void LLPluginClassMedia::sendPickFileResponse(const std::string &file)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "pick_file_response");
message.setValue("file", file);
if(mPlugin->isBlocked())
{
// If the plugin sent a blocking pick-file request, the response should unblock it.
message.setValueBoolean("blocking_response", true);
}
sendMessage(message);
}
void LLPluginClassMedia::cut()
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "edit_cut");
@ -720,24 +733,9 @@ void LLPluginClassMedia::setJavascriptEnabled(const bool enabled)
sendMessage(message);
}
LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type)
void LLPluginClassMedia::setTarget(const std::string &target)
{
// convert a LinkTargetType value from llqtwebkit to an ETargetType
// so that we don't expose the llqtwebkit header in viewer code
switch (target_type)
{
case LLQtWebKit::LTT_TARGET_NONE:
return LLPluginClassMedia::TARGET_NONE;
case LLQtWebKit::LTT_TARGET_BLANK:
return LLPluginClassMedia::TARGET_BLANK;
case LLQtWebKit::LTT_TARGET_EXTERNAL:
return LLPluginClassMedia::TARGET_EXTERNAL;
default:
return LLPluginClassMedia::TARGET_OTHER;
}
mTarget = target;
}
/* virtual */
@ -950,6 +948,10 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mMediaName = message.getValue("name");
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAME_CHANGED);
}
else if(message_name == "pick_file")
{
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PICK_FILE_REQUEST);
}
else
{
LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
@ -992,15 +994,13 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
{
mClickURL = message.getValue("uri");
mClickTarget = message.getValue("target");
U32 target_type = message.getValueU32("target_type");
mClickTargetType = ::getTargetTypeFromLLQtWebkit(target_type);
mClickUUID = message.getValue("uuid");
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_HREF);
}
else if(message_name == "click_nofollow")
{
mClickURL = message.getValue("uri");
mClickTarget.clear();
mClickTargetType = TARGET_NONE;
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW);
}
else if(message_name == "cookie_set")
@ -1010,6 +1010,20 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mOwner->handleCookieSet(this, message.getValue("cookie"));
}
}
else if(message_name == "close_request")
{
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLOSE_REQUEST);
}
else if(message_name == "geometry_change")
{
mClickUUID = message.getValue("uuid");
mGeometryX = message.getValueS32("x");
mGeometryY = message.getValueS32("y");
mGeometryWidth = message.getValueS32("width");
mGeometryHeight = message.getValueS32("height");
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_GEOMETRY_CHANGE);
}
else
{
LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
@ -1164,6 +1178,25 @@ void LLPluginClassMedia::setBrowserUserAgent(const std::string& user_agent)
sendMessage(message);
}
void LLPluginClassMedia::proxyWindowOpened(const std::string &target, const std::string &uuid)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "proxy_window_opened");
message.setValue("target", target);
message.setValue("uuid", uuid);
sendMessage(message);
}
void LLPluginClassMedia::proxyWindowClosed(const std::string &uuid)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "proxy_window_closed");
message.setValue("uuid", uuid);
sendMessage(message);
}
void LLPluginClassMedia::crashPlugin()
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "crash");

View File

@ -161,6 +161,8 @@ public:
void setLowPrioritySizeLimit(int size);
F64 getCPUUsage();
void sendPickFileResponse(const std::string &file);
// Valid after a MEDIA_EVENT_CURSOR_CHANGED event
std::string getCursorName() const { return mCursorName; };
@ -181,7 +183,8 @@ public:
void setLanguageCode(const std::string &language_code);
void setPluginsEnabled(const bool enabled);
void setJavascriptEnabled(const bool enabled);
void setTarget(const std::string &target);
///////////////////////////////////
// media browser class functions
bool pluginSupportsMediaBrowser(void);
@ -198,6 +201,8 @@ public:
void browse_back();
void set_status_redirect(int code, const std::string &url);
void setBrowserUserAgent(const std::string& user_agent);
void proxyWindowOpened(const std::string &target, const std::string &uuid);
void proxyWindowClosed(const std::string &uuid);
// This is valid after MEDIA_EVENT_NAVIGATE_BEGIN or MEDIA_EVENT_NAVIGATE_COMPLETE
std::string getNavigateURI() const { return mNavigateURI; };
@ -223,16 +228,14 @@ public:
// This is valid after MEDIA_EVENT_CLICK_LINK_HREF
std::string getClickTarget() const { return mClickTarget; };
typedef enum
{
TARGET_NONE, // empty href target string
TARGET_BLANK, // target to open link in user's preferred browser
TARGET_EXTERNAL, // target to open link in external browser
TARGET_OTHER // nonempty and unsupported target type
}ETargetType;
// This is valid after MEDIA_EVENT_CLICK_LINK_HREF
ETargetType getClickTargetType() const { return mClickTargetType; };
// This is valid during MEDIA_EVENT_CLICK_LINK_HREF and MEDIA_EVENT_GEOMETRY_CHANGE
std::string getClickUUID() const { return mClickUUID; };
// These are valid during MEDIA_EVENT_GEOMETRY_CHANGE
S32 getGeometryX() const { return mGeometryX; };
S32 getGeometryY() const { return mGeometryY; };
S32 getGeometryWidth() const { return mGeometryWidth; };
S32 getGeometryHeight() const { return mGeometryHeight; };
std::string getMediaName() const { return mMediaName; };
std::string getMediaDescription() const { return mMediaDescription; };
@ -352,6 +355,8 @@ protected:
LLColor4 mBackgroundColor;
std::string mTarget;
/////////////////////////////////////////
// media_browser class
std::string mNavigateURI;
@ -364,7 +369,11 @@ protected:
std::string mLocation;
std::string mClickURL;
std::string mClickTarget;
ETargetType mClickTargetType;
std::string mClickUUID;
S32 mGeometryX;
S32 mGeometryY;
S32 mGeometryWidth;
S32 mGeometryHeight;
/////////////////////////////////////////
// media_time class

View File

@ -59,6 +59,9 @@ public:
MEDIA_EVENT_LOCATION_CHANGED, // browser location (URL) has changed (maybe due to internal navagation/frames/etc)
MEDIA_EVENT_CLICK_LINK_HREF, // I'm not entirely sure what the semantics of these two are
MEDIA_EVENT_CLICK_LINK_NOFOLLOW,
MEDIA_EVENT_CLOSE_REQUEST, // The plugin requested its window be closed (currently hooked up to javascript window.close in webkit)
MEDIA_EVENT_PICK_FILE_REQUEST, // The plugin wants the user to pick a file
MEDIA_EVENT_GEOMETRY_CHANGE, // The plugin requested its window geometry be changed (per the javascript window interface)
MEDIA_EVENT_PLUGIN_FAILED_LAUNCH, // The plugin failed to launch
MEDIA_EVENT_PLUGIN_FAILED // The plugin died unexpectedly

View File

@ -117,7 +117,7 @@ namespace tut
typedef test_group<LLPluginCookieStoreFixture> factory;
typedef factory::object object;
factory tf("LLPluginCookieStore test");
factory tf("LLPluginCookieStore");
// Tests
template<> template<>

View File

@ -1288,11 +1288,11 @@ LLModel* LLModel::loadModelFromDomMesh(domMesh *mesh)
}
//static
LLSD LLModel::writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, BOOL nowrite)
LLSD LLModel::writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, bool upload_skin, bool upload_joints, bool nowrite)
{
std::ofstream os(filename.c_str(), std::ofstream::out | std::ofstream::binary);
LLSD header = writeModel(os, physics, high, medium, low, impostor, decomp, nowrite);
LLSD header = writeModel(os, physics, high, medium, low, impostor, decomp, upload_skin, upload_joints, nowrite);
os.close();
@ -1300,7 +1300,7 @@ LLSD LLModel::writeModel(std::string filename, LLModel* physics, LLModel* high,
}
//static
LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, BOOL nowrite)
LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, bool upload_skin, bool upload_joints, bool nowrite)
{
LLSD mdl;
@ -1313,7 +1313,7 @@ LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LL
physics
};
bool skinning = high && !high->mSkinWeights.empty();
bool skinning = upload_skin && high && !high->mSkinWeights.empty();
if (skinning)
{ //write skinning block
@ -1342,6 +1342,21 @@ LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LL
mdl["skin"]["bind_shape_matrix"][i*4+j] = high->mBindShapeMatrix.mMatrix[i][j];
}
}
if ( upload_joints && high->mAlternateBindMatrix.size() > 0 )
{
for (U32 i = 0; i < high->mJointList.size(); ++i)
{
for (U32 j = 0; j < 4; j++)
{
for (U32 k = 0; k < 4; k++)
{
mdl["skin"]["alt_inverse_bind_matrix"][i][j*4+k] = high->mAlternateBindMatrix[i].mMatrix[j][k];
}
}
}
}
}
if (!decomp.empty())
@ -1645,7 +1660,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite)
if (!nowrite)
{
LLSDSerialize::serialize(header, ostr, LLSDSerialize::LLSD_BINARY);
LLSDSerialize::toBinary(header, ostr);
if (!skin.empty())
{ //write skin block

View File

@ -60,8 +60,8 @@ public:
typedef std::vector<std::vector<LLVector3> > physics_shape;
LLModel(LLVolumeParams& params, F32 detail);
static LLSD writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, BOOL nowrite = FALSE);
static LLSD writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, BOOL nowrite = FALSE);
static LLSD writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, bool upload_skin, bool upload_joints, bool nowrite = FALSE);
static LLSD writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, bool upload_skin, bool upload_joints, bool nowrite = FALSE);
static LLSD writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite = FALSE);
static LLModel* loadModelFromAsset(std::string filename, S32 lod);
static LLModel* loadModelFromDae(std::string filename);
@ -152,7 +152,7 @@ public:
LLMatrix4 mBindShapeMatrix;
std::vector<LLMatrix4> mInvBindMatrix;
std::vector<LLMatrix4> mAlternateBindMatrix;
std::string mLabel;
LLVector3 mNormalizedScale;

View File

@ -152,7 +152,7 @@ namespace tut
namespace
{
// this is for naming our tests to make pretty output
tut::factory tf("MediaEntry Test");
tut::factory tf("LLMediaEntry");
}
namespace tut

View File

@ -79,7 +79,7 @@ namespace tut
typedef test_group<llprimitive> llprimitive_t;
typedef llprimitive_t::object llprimitive_object_t;
tut::llprimitive_t tut_llprimitive("llprimitive");
tut::llprimitive_t tut_llprimitive("LLPrimitive");
template<> template<>
void llprimitive_object_t::test<1>()

View File

@ -982,37 +982,43 @@ LLFontGL::VAlign LLFontGL::vAlignFromName(const std::string& name)
//static
LLFontGL* LLFontGL::getFontMonospace()
{
return getFont(LLFontDescriptor("Monospace","Monospace",0));
static LLFontGL* fontp = getFont(LLFontDescriptor("Monospace","Monospace",0));
return fontp;
}
//static
LLFontGL* LLFontGL::getFontSansSerifSmall()
{
return getFont(LLFontDescriptor("SansSerif","Small",0));
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Small",0));
return fontp;
}
//static
LLFontGL* LLFontGL::getFontSansSerif()
{
return getFont(LLFontDescriptor("SansSerif","Medium",0));
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Medium",0));
return fontp;
}
//static
LLFontGL* LLFontGL::getFontSansSerifBig()
{
return getFont(LLFontDescriptor("SansSerif","Large",0));
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Large",0));
return fontp;
}
//static
LLFontGL* LLFontGL::getFontSansSerifHuge()
{
return getFont(LLFontDescriptor("SansSerif","Huge",0));
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Large",0));
return fontp;
}
//static
LLFontGL* LLFontGL::getFontSansSerifBold()
{
return getFont(LLFontDescriptor("SansSerif","Medium",BOLD));
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Medium",BOLD));
return fontp;
}
//static

View File

@ -1061,7 +1061,8 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_
{
llinfos << "Calling glCopyTexSubImage2D(...)" << llendl ;
checkTexSize(true) ;
llcallstacks << fb_x << " : " << fb_y << " : " << x_pos << " : " << y_pos << " : " << width << " : " << height << llcallstacksendl ;
llcallstacks << fb_x << " : " << fb_y << " : " << x_pos << " : " << y_pos << " : " << width << " : " << height <<
" : " << (S32)mComponents << llcallstacksendl ;
}
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height);

View File

@ -390,8 +390,6 @@ void LLRenderTarget::flush(BOOL fetch_depth)
}
else
{
#if !LL_DARWIN
stop_glerror();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
@ -435,7 +433,6 @@ void LLRenderTarget::flush(BOOL fetch_depth)
}
}
}
#endif
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
@ -444,7 +441,6 @@ void LLRenderTarget::flush(BOOL fetch_depth)
void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, S32 srcX1, S32 srcY1,
S32 dstX0, S32 dstY0, S32 dstX1, S32 dstY1, U32 mask, U32 filter)
{
#if !LL_DARWIN
gGL.flush();
if (!source.mFBO || !mFBO)
{
@ -483,14 +479,12 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0,
stop_glerror();
}
}
#endif
}
//static
void LLRenderTarget::copyContentsToFramebuffer(LLRenderTarget& source, S32 srcX0, S32 srcY0, S32 srcX1, S32 srcY1,
S32 dstX0, S32 dstY0, S32 dstX1, S32 dstY1, U32 mask, U32 filter)
{
#if !LL_DARWIN
if (!source.mFBO)
{
llerrs << "Cannot copy framebuffer contents for non FBO render targets." << llendl;
@ -507,7 +501,6 @@ void LLRenderTarget::copyContentsToFramebuffer(LLRenderTarget& source, S32 srcX0
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
stop_glerror();
}
#endif
}
BOOL LLRenderTarget::isComplete() const
@ -652,7 +645,6 @@ void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth
void LLMultisampleBuffer::addColorAttachment(U32 color_fmt)
{
#if !LL_DARWIN
if (color_fmt == 0)
{
return;
@ -682,23 +674,19 @@ void LLMultisampleBuffer::addColorAttachment(U32 color_fmt)
{
case GL_FRAMEBUFFER_COMPLETE_EXT:
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
llerrs << "WTF?" << llendl;
break;
default:
llerrs << "WTF?" << llendl;
llerrs << "WTF? " << std::hex << status << llendl;
break;
}
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
mTex.push_back(tex);
#endif
}
void LLMultisampleBuffer::allocateDepth()
{
#if !LL_DARWIN
glGenRenderbuffersEXT(1, (GLuint* ) &mDepth);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mDepth);
if (mStencil)
@ -709,6 +697,5 @@ void LLMultisampleBuffer::allocateDepth()
{
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, mSamples, GL_DEPTH_COMPONENT16_ARB, mResX, mResY);
}
#endif
}

View File

@ -158,6 +158,7 @@ set(llui_HEADER_FILES
llnotifications.h
llnotificationslistener.h
llnotificationsutil.h
llnotificationtemplate.h
llpanel.h
llprogressbar.h
llradiogroup.h

View File

@ -89,7 +89,7 @@ LLAccordionCtrl::LLAccordionCtrl() : LLPanel()
mSingleExpansion = false;
mFitParent = false;
LLUICtrlFactory::getInstance()->buildPanel(this, "accordion_parent.xml");
buildFromFile( "accordion_parent.xml");
}
//---------------------------------------------------------------------------------

View File

@ -91,10 +91,10 @@ public:
Optional<bool> selection_enabled;
Optional<S32> padding_left;
Optional<S32> padding_right;
Optional<S32> padding_top;
Optional<S32> padding_bottom;
Optional<S32> padding_left,
padding_right,
padding_top,
padding_bottom;
Params();
};
@ -176,7 +176,7 @@ public:
virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks );
virtual bool addChild(LLView* child, S32 tab_group);
virtual bool addChild(LLView* child, S32 tab_group = 0 );
bool isExpanded() const { return mDisplayChildren; }

View File

@ -114,7 +114,6 @@ LLButton::LLButton(const LLButton::Params& p)
mFlashing( FALSE ),
mCurGlowStrength(0.f),
mNeedsHighlight(FALSE),
mMouseOver(false),
mUnselectedLabel(p.label()),
mSelectedLabel(p.label_selected()),
mGLFont(p.font),
@ -499,19 +498,14 @@ void LLButton::onMouseEnter(S32 x, S32 y, MASK mask)
LLUICtrl::onMouseEnter(x, y, mask);
if (isInEnabledChain())
{
mNeedsHighlight = TRUE;
}
mMouseOver = true;
}
void LLButton::onMouseLeave(S32 x, S32 y, MASK mask)
{
LLUICtrl::onMouseLeave(x, y, mask);
mNeedsHighlight = FALSE;
mMouseOver = true;
}
void LLButton::setHighlight(bool b)
@ -564,11 +558,19 @@ void LLButton::draw()
pressed_by_keyboard = gKeyboard->getKeyDown(' ') || (mCommitOnReturn && gKeyboard->getKeyDown(KEY_RETURN));
}
// Unselected image assignments
bool mouse_pressed_and_over = false;
if (hasMouseCapture())
{
S32 local_mouse_x ;
S32 local_mouse_y;
LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
mouse_pressed_and_over = pointInView(local_mouse_x, local_mouse_y);
}
bool enabled = isInEnabledChain();
bool pressed = pressed_by_keyboard
|| (hasMouseCapture() && mMouseOver)
|| mouse_pressed_and_over
|| mForcePressedState;
bool selected = getToggleState();
@ -1117,7 +1119,7 @@ void LLButton::setFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname)
// Get the visibility control name for the floater
std::string vis_control_name = LLFloaterReg::declareVisibilityControl(sdname.asString());
// Set the button control value (toggle state) to the floater visibility control (Sets the value as well)
button->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name));
button->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name));
// Set the clicked callback to toggle the floater
button->setClickedCallback(boost::bind(&LLFloaterReg::toggleFloaterInstance, sdname));
}
@ -1131,7 +1133,7 @@ void LLButton::setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname)
// Get the visibility control name for the floater
std::string vis_control_name = LLFloaterReg::declareVisibilityControl(sdname.asString());
// Set the button control value (toggle state) to the floater visibility control (Sets the value as well)
button->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name));
button->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name));
// Set the clicked callback to toggle the floater
button->setClickedCallback(boost::bind(&LLDockableFloater::toggleInstance, sdname));
}

View File

@ -350,7 +350,6 @@ private:
BOOL mCommitOnReturn;
BOOL mFadeWhenDisabled;
bool mForcePressedState;
bool mMouseOver;
LLFrameTimer mFlashingTimer;
};

View File

@ -56,9 +56,7 @@ template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>(
const std::string& name, BOOL recurse) const;
LLCheckBoxCtrl::Params::Params()
: text_enabled_color("text_enabled_color"),
text_disabled_color("text_disabled_color"),
initial_value("initial_value", false),
: initial_value("initial_value", false),
label_text("label_text"),
check_button("check_button"),
radio_style("radio_style")
@ -67,8 +65,8 @@ LLCheckBoxCtrl::Params::Params()
LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p)
: LLUICtrl(p),
mTextEnabledColor(p.text_enabled_color()),
mTextDisabledColor(p.text_disabled_color()),
mTextEnabledColor(p.label_text.text_color()),
mTextDisabledColor(p.label_text.text_readonly_color()),
mFont(p.font())
{
mViewModel->setValue(LLSD(p.initial_value));
@ -95,7 +93,6 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p)
{
tbparams.font(p.font);
}
tbparams.text_color( p.enabled() ? p.text_enabled_color() : p.text_disabled_color() );
mLabel = LLUICtrlFactory::create<LLTextBox> (tbparams);
addChild(mLabel);

View File

@ -58,8 +58,6 @@ public:
struct Params
: public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<LLUIColor> text_enabled_color;
Optional<LLUIColor> text_disabled_color;
Optional<bool> initial_value; // override LLUICtrl initial_value
Optional<LLTextBox::Params> label_text;

View File

@ -145,8 +145,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
// Grab the mouse-up event and make sure the button state is correct
mList->setMouseUpCallback(boost::bind(&LLComboBox::onListMouseUp, this));
for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items().begin();
it != p.items().end();
for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items.begin();
it != p.items.end();
++it)
{
LLScrollListItem::Params item_params = *it;

View File

@ -42,6 +42,7 @@
#include "lluictrlfactory.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "lldir.h"
#include "lldraghandle.h"
#include "llfloaterreg.h"
#include "llfocusmgr.h"
@ -505,7 +506,7 @@ void LLFloater::storeRectControl()
{
if( mRectControl.size() > 1 )
{
LLUI::sSettingGroups["floater"]->setRect( mRectControl, getRect() );
getControlGroup()->setRect( mRectControl, getRect() );
}
}
@ -513,7 +514,7 @@ void LLFloater::storeVisibilityControl()
{
if( !sQuitting && mVisibilityControl.size() > 1 )
{
LLUI::sSettingGroups["floater"]->setBOOL( mVisibilityControl, getVisible() );
getControlGroup()->setBOOL( mVisibilityControl, getVisible() );
}
}
@ -521,10 +522,47 @@ void LLFloater::storeDockStateControl()
{
if( !sQuitting && mDocStateControl.size() > 1 )
{
LLUI::sSettingGroups["floater"]->setBOOL( mDocStateControl, isDocked() );
getControlGroup()->setBOOL( mDocStateControl, isDocked() );
}
}
LLRect LLFloater::getSavedRect() const
{
LLRect rect;
if (mRectControl.size() > 1)
{
rect = getControlGroup()->getRect(mRectControl);
}
return rect;
}
bool LLFloater::hasSavedRect() const
{
return !getSavedRect().isEmpty();
}
// static
std::string LLFloater::getControlName(const std::string& name, const LLSD& key)
{
std::string ctrl_name = name;
// Add the key to the control name if appropriate.
if (key.isString() && !key.asString().empty())
{
ctrl_name += "_" + key.asString();
}
return ctrl_name;
}
// static
LLControlGroup* LLFloater::getControlGroup()
{
// Floater size, position, visibility, etc are saved in per-account settings.
return LLUI::sSettingGroups["account"];
}
void LLFloater::setVisible( BOOL visible )
{
@ -781,7 +819,7 @@ void LLFloater::applyRectControl()
// override center if we have saved rect control
if (mRectControl.size() > 1)
{
const LLRect& rect = LLUI::sSettingGroups["floater"]->getRect(mRectControl);
const LLRect& rect = getControlGroup()->getRect(mRectControl);
if (rect.getWidth() > 0 && rect.getHeight() > 0)
{
translate( rect.mLeft - getRect().mLeft, rect.mBottom - getRect().mBottom);
@ -797,7 +835,7 @@ void LLFloater::applyDockState()
{
if (mDocStateControl.size() > 1)
{
bool dockState = LLUI::sSettingGroups["floater"]->getBOOL(mDocStateControl);
bool dockState = getControlGroup()->getBOOL(mDocStateControl);
setDocked(dockState);
}
@ -1960,6 +1998,7 @@ LLFloaterView::LLFloaterView (const Params& p)
: LLUICtrl (p),
mFocusCycleMode(FALSE),
mMinimizePositionVOffset(0),
mSnapOffsetBottom(0),
mSnapOffsetRight(0)
{
@ -2358,7 +2397,9 @@ void LLFloaterView::closeAllChildren(bool app_quitting)
// Attempt to close floater. This will cause the "do you want to save"
// dialogs to appear.
if (floaterp->canClose() && !floaterp->isDead())
// Skip invisible floaters if we're not quitting (STORM-192).
if (floaterp->canClose() && !floaterp->isDead() &&
(app_quitting || floaterp->getVisible()))
{
floaterp->closeFloater(app_quitting);
}
@ -2670,18 +2711,20 @@ void LLFloater::setInstanceName(const std::string& name)
mInstanceName = name;
if (!mInstanceName.empty())
{
std::string ctrl_name = getControlName(mInstanceName, mKey);
// save_rect and save_visibility only apply to registered floaters
if (!mRectControl.empty())
{
mRectControl = LLFloaterReg::declareRectControl(mInstanceName);
mRectControl = LLFloaterReg::declareRectControl(ctrl_name);
}
if (!mVisibilityControl.empty())
{
mVisibilityControl = LLFloaterReg::declareVisibilityControl(mInstanceName);
mVisibilityControl = LLFloaterReg::declareVisibilityControl(ctrl_name);
}
if(!mDocStateControl.empty())
{
mDocStateControl = LLFloaterReg::declareDockStateControl(mInstanceName);
mDocStateControl = LLFloaterReg::declareDockStateControl(ctrl_name);
}
}
@ -2779,7 +2822,8 @@ LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node)
{
Params params(LLUICtrlFactory::getDefaultParams<LLFloater>());
LLXUIParser::instance().readXUI(node, params, filename); // *TODO: Error checking
LLXUIParser parser;
parser.readXUI(node, params, filename); // *TODO: Error checking
if (output_node)
{
@ -2787,8 +2831,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str
setupParamsForExport(output_params, parent);
Params default_params(LLUICtrlFactory::getDefaultParams<LLFloater>());
output_node->setName(node->getName()->mString);
LLXUIParser::instance().writeXUI(
output_node, output_params, &default_params);
parser.writeXUI(output_node, output_params, &default_params);
}
// Default floater position to top-left corner of screen
@ -2883,3 +2926,64 @@ bool LLFloater::isVisible(const LLFloater* floater)
{
return floater && floater->getVisible();
}
static LLFastTimer::DeclareTimer FTM_BUILD_FLOATERS("Build Floaters");
bool LLFloater::buildFromFile(const std::string& filename, LLXMLNodePtr output_node)
{
LLFastTimer timer(FTM_BUILD_FLOATERS);
LLXMLNodePtr root;
//if exporting, only load the language being exported,
//instead of layering localized version on top of english
if (output_node)
{
if (!LLUICtrlFactory::getLocalizedXMLNode(filename, root))
{
llwarns << "Couldn't parse floater from: " << LLUI::getLocalizedSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
return false;
}
}
else if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
llwarns << "Couldn't parse floater from: " << LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
return false;
}
// root must be called floater
if( !(root->hasName("floater") || root->hasName("multi_floater")) )
{
llwarns << "Root node should be named floater in: " << filename << llendl;
return false;
}
bool res = true;
lldebugs << "Building floater " << filename << llendl;
LLUICtrlFactory::instance().pushFileName(filename);
{
if (!getFactoryMap().empty())
{
LLPanel::sFactoryStack.push_front(&getFactoryMap());
}
// for local registry callbacks; define in constructor, referenced in XUI or postBuild
getCommitCallbackRegistrar().pushScope();
getEnableCallbackRegistrar().pushScope();
res = initFloaterXML(root, getParent(), filename, output_node);
setXMLFilename(filename);
getCommitCallbackRegistrar().popScope();
getEnableCallbackRegistrar().popScope();
if (!getFactoryMap().empty())
{
LLPanel::sFactoryStack.pop_front();
}
}
LLUICtrlFactory::instance().popFileName();
return res;
}

View File

@ -141,6 +141,7 @@ public:
// Don't export top/left for rect, only height/width
static void setupParamsForExport(Params& p, LLView* parent);
bool buildFromFile(const std::string &filename, LLXMLNodePtr output_node = NULL);
void initFromParams(const LLFloater::Params& p);
bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL);
@ -203,6 +204,11 @@ public:
BOOL isResizable() const { return mResizable; }
void setResizeLimits( S32 min_width, S32 min_height );
void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; }
LLRect getSavedRect() const;
bool hasSavedRect() const;
static std::string getControlName(const std::string& name, const LLSD& key);
static LLControlGroup* getControlGroup();
bool isMinimizeable() const{ return mCanMinimize; }
bool isCloseable() const{ return mCanClose; }

View File

@ -127,7 +127,7 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key)
res = build_func(key);
bool success = LLUICtrlFactory::getInstance()->buildFloater(res, xui_file, NULL);
bool success = res->buildFromFile(xui_file, NULL);
if (!success)
{
llwarns << "Failed to build floater type: '" << name << "'." << llendl;
@ -290,9 +290,9 @@ void LLFloaterReg::showInitialVisibleInstances()
{
const std::string& name = iter->first;
std::string controlname = getVisibilityControlName(name);
if (LLUI::sSettingGroups["floater"]->controlExists(controlname))
if (LLFloater::getControlGroup()->controlExists(controlname))
{
BOOL isvis = LLUI::sSettingGroups["floater"]->getBOOL(controlname);
BOOL isvis = LLFloater::getControlGroup()->getBOOL(controlname);
if (isvis)
{
showInstance(name, LLSD()); // keyed floaters shouldn't set save_vis to true
@ -346,7 +346,7 @@ std::string LLFloaterReg::getRectControlName(const std::string& name)
std::string LLFloaterReg::declareRectControl(const std::string& name)
{
std::string controlname = getRectControlName(name);
LLUI::sSettingGroups["floater"]->declareRect(controlname, LLRect(),
LLFloater::getControlGroup()->declareRect(controlname, LLRect(),
llformat("Window Position and Size for %s", name.c_str()),
TRUE);
return controlname;
@ -364,7 +364,7 @@ std::string LLFloaterReg::getVisibilityControlName(const std::string& name)
std::string LLFloaterReg::declareVisibilityControl(const std::string& name)
{
std::string controlname = getVisibilityControlName(name);
LLUI::sSettingGroups["floater"]->declareBOOL(controlname, FALSE,
LLFloater::getControlGroup()->declareBOOL(controlname, FALSE,
llformat("Window Visibility for %s", name.c_str()),
TRUE);
return controlname;
@ -374,7 +374,7 @@ std::string LLFloaterReg::declareVisibilityControl(const std::string& name)
std::string LLFloaterReg::declareDockStateControl(const std::string& name)
{
std::string controlname = getDockStateControlName(name);
LLUI::sSettingGroups["floater"]->declareBOOL(controlname, TRUE,
LLFloater::getControlGroup()->declareBOOL(controlname, TRUE,
llformat("Window Docking state for %s", name.c_str()),
TRUE);
return controlname;
@ -397,11 +397,11 @@ void LLFloaterReg::registerControlVariables()
for (build_map_t::iterator iter = sBuildMap.begin(); iter != sBuildMap.end(); ++iter)
{
const std::string& name = iter->first;
if (LLUI::sSettingGroups["floater"]->controlExists(getRectControlName(name)))
if (LLFloater::getControlGroup()->controlExists(getRectControlName(name)))
{
declareRectControl(name);
}
if (LLUI::sSettingGroups["floater"]->controlExists(getVisibilityControlName(name)))
if (LLFloater::getControlGroup()->controlExists(getVisibilityControlName(name)))
{
declareVisibilityControl(name);
}
@ -425,7 +425,7 @@ void LLFloaterReg::initUICtrlToFloaterVisibilityControl(LLUICtrl* ctrl, const LL
// Get the visibility control name for the floater
std::string vis_control_name = LLFloaterReg::declareVisibilityControl(sdname.asString());
// Set the control value to the floater visibility control (Sets the value as well)
ctrl->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name));
ctrl->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name));
}
// callback args may use "floatername.key" format

View File

@ -321,6 +321,20 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* f
}
}
bool LLFocusMgr::keyboardFocusHasAccelerators() const
{
LLView* focus_view = dynamic_cast<LLView*>(mKeyboardFocus);
while( focus_view )
{
if(focus_view->hasAccelerators())
{
return true;
}
focus_view = focus_view->getParent();
}
return false;
}
void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
{

View File

@ -124,6 +124,8 @@ public:
void unlockFocus();
BOOL focusLocked() const { return mLockedView != NULL; }
bool keyboardFocusHasAccelerators() const;
private:
LLUICtrl* mLockedView;

View File

@ -41,95 +41,66 @@
#include "llresizebar.h"
#include "llcriticaldamp.h"
static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack", &LLLayoutStack::fromXML);
static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack");
static LLLayoutStack::LayoutStackRegistry::Register<LLLayoutPanel> register_layout_panel("layout_panel");
//
// LLLayoutStack
// LLLayoutPanel
//
struct LLLayoutStack::LayoutPanel
{
LayoutPanel(LLPanel* panelp, ELayoutOrientation orientation, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize) : mPanel(panelp),
mMinWidth(min_width),
mMinHeight(min_height),
mMaxWidth(max_width),
mMaxHeight(max_height),
mAutoResize(auto_resize),
mUserResize(user_resize),
mOrientation(orientation),
LLLayoutPanel::LLLayoutPanel(const Params& p)
: LLPanel(p),
mMinDim(p.min_dim),
mMaxDim(p.max_dim),
mAutoResize(p.auto_resize),
mUserResize(p.user_resize),
mCollapsed(FALSE),
mCollapseAmt(0.f),
mVisibleAmt(1.f), // default to fully visible
mResizeBar(NULL)
{
LLResizeBar::Side side = (orientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM;
LLRect resize_bar_rect = panelp->getRect();
// panels initialized as hidden should not start out partially visible
if (!getVisible())
{
mVisibleAmt = 0.f;
}
}
S32 min_dim;
if (orientation == HORIZONTAL)
void LLLayoutPanel::initFromParams(const Params& p)
{
min_dim = mMinHeight;
}
else
{
min_dim = mMinWidth;
}
LLResizeBar::Params p;
p.name("resize");
p.resizing_view(mPanel);
p.min_size(min_dim);
p.side(side);
p.snapping_enabled(false);
mResizeBar = LLUICtrlFactory::create<LLResizeBar>(p);
// panels initialized as hidden should not start out partially visible
if (!mPanel->getVisible())
{
mVisibleAmt = 0.f;
}
LLPanel::initFromParams(p);
setFollowsNone();
}
~LayoutPanel()
LLLayoutPanel::~LLLayoutPanel()
{
// probably not necessary, but...
delete mResizeBar;
mResizeBar = NULL;
}
F32 getCollapseFactor()
F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation)
{
if (mOrientation == HORIZONTAL)
if (orientation == LLLayoutStack::HORIZONTAL)
{
F32 collapse_amt =
clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinWidth / (F32)llmax(1, mPanel->getRect().getWidth()));
clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinDim / (F32)llmax(1, getRect().getWidth()));
return mVisibleAmt * collapse_amt;
}
else
{
F32 collapse_amt =
clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinHeight / (F32)llmax(1, mPanel->getRect().getHeight())));
clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinDim / (F32)llmax(1, getRect().getHeight())));
return mVisibleAmt * collapse_amt;
}
}
LLPanel* mPanel;
S32 mMinWidth;
S32 mMinHeight;
// mMaxWidth & mMaxHeight are added to make configurable max width of the nearby chat bar. EXT-5589
// they are not processed by LLLayoutStack but they can be if necessary
S32 mMaxWidth;
S32 mMaxHeight;
BOOL mAutoResize;
BOOL mUserResize;
BOOL mCollapsed;
LLResizeBar* mResizeBar;
ELayoutOrientation mOrientation;
F32 mVisibleAmt;
F32 mCollapseAmt;
};
//
// LLLayoutStack
//
LLLayoutStack::Params::Params()
: orientation("orientation", std::string("vertical")),
: orientation("orientation"),
animate("animate", true),
clip("clip", true),
border_size("border_size", LLCachedControl<S32>(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0))
@ -163,18 +134,18 @@ void LLLayoutStack::draw()
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
// clip to layout rectangle, not bounding rectangle
LLRect clip_rect = (*panel_it)->mPanel->getRect();
LLRect clip_rect = (*panel_it)->getRect();
// scale clipping rectangle by visible amount
if (mOrientation == HORIZONTAL)
{
clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor());
clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor(mOrientation));
}
else
{
clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor());
clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor(mOrientation));
}
LLPanel* panelp = (*panel_it)->mPanel;
LLPanel* panelp = (*panel_it);
LLLocalClipRect clip(clip_rect, mClip);
// only force drawing invisible children if visible amount is non-zero
@ -185,7 +156,7 @@ void LLLayoutStack::draw()
void LLLayoutStack::removeChild(LLView* view)
{
LayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast<LLPanel*>(view));
LLLayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast<LLPanel*>(view));
if (embedded_panelp)
{
@ -206,149 +177,16 @@ BOOL LLLayoutStack::postBuild()
return TRUE;
}
static void get_attribute_s32_and_write(LLXMLNodePtr node,
const char* name,
S32 *value,
S32 default_value,
LLXMLNodePtr output_child)
{
BOOL has_attr = node->getAttributeS32(name, *value);
if (has_attr && *value != default_value && output_child)
{
// create an attribute child node
LLXMLNodePtr child_attr = output_child->createChild(name, TRUE);
child_attr->setIntValue(*value);
}
}
static void get_attribute_bool_and_write(LLXMLNodePtr node,
const char* name,
BOOL *value,
BOOL default_value,
LLXMLNodePtr output_child)
{
BOOL has_attr = node->getAttributeBOOL(name, *value);
if (has_attr && *value != default_value && output_child)
{
LLXMLNodePtr child_attr = output_child->createChild(name, TRUE);
child_attr->setBoolValue(*value);
}
}
//static
LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node)
{
LLLayoutStack::Params p(LLUICtrlFactory::getDefaultParams<LLLayoutStack>());
LLXUIParser::instance().readXUI(node, p, LLUICtrlFactory::getInstance()->getCurFileName());
// Export must happen before setupParams() mungles rectangles and before
// this item gets added to parent (otherwise screws up last_child_rect
// logic). JC
if (output_node)
{
Params output_params(p);
setupParamsForExport(output_params, parent);
LLLayoutStack::Params default_params(LLUICtrlFactory::getDefaultParams<LLLayoutStack>());
output_node->setName(node->getName()->mString);
LLXUIParser::instance().writeXUI(
output_node, output_params, &default_params);
}
p.from_xui = true;
applyXUILayout(p, parent);
LLLayoutStack* layout_stackp = LLUICtrlFactory::create<LLLayoutStack>(p);
if (parent && layout_stackp)
{
S32 tab_group = p.tab_group.isProvided() ? p.tab_group() : parent->getLastTabGroup();
parent->addChild(layout_stackp, tab_group);
}
for (LLXMLNodePtr child_node = node->getFirstChild(); child_node.notNull(); child_node = child_node->getNextSibling())
{
const S32 DEFAULT_MIN_WIDTH = 0;
const S32 DEFAULT_MIN_HEIGHT = 0;
const S32 DEFAULT_MAX_WIDTH = S32_MAX;
const S32 DEFAULT_MAX_HEIGHT = S32_MAX;
const BOOL DEFAULT_AUTO_RESIZE = TRUE;
S32 min_width = DEFAULT_MIN_WIDTH;
S32 min_height = DEFAULT_MIN_HEIGHT;
S32 max_width = DEFAULT_MAX_WIDTH;
S32 max_height = DEFAULT_MAX_HEIGHT;
BOOL auto_resize = DEFAULT_AUTO_RESIZE;
LLXMLNodePtr output_child;
if (output_node)
bool LLLayoutStack::addChild(LLView* child, S32 tab_group)
{
output_child = output_node->createChild("", FALSE);
}
// Layout stack allows child nodes to acquire additional attributes,
// such as "min_width" in: <button label="Foo" min_width="100"/>
// If these attributes exist and have non-default values, write them
// to the output node.
get_attribute_s32_and_write(child_node, "min_width", &min_width,
DEFAULT_MIN_WIDTH, output_child);
get_attribute_s32_and_write(child_node, "min_height", &min_height,
DEFAULT_MIN_HEIGHT, output_child);
get_attribute_s32_and_write(child_node, "max_width", &max_width,
DEFAULT_MAX_WIDTH, output_child);
get_attribute_s32_and_write(child_node, "max_height", &max_height,
DEFAULT_MAX_HEIGHT, output_child);
get_attribute_bool_and_write(child_node, "auto_resize", &auto_resize,
DEFAULT_AUTO_RESIZE, output_child);
if (child_node->hasName("layout_panel"))
{
BOOL user_resize = TRUE;
get_attribute_bool_and_write(child_node, "user_resize", &user_resize,
TRUE, output_child);
LLPanel* panelp = (LLPanel*)LLPanel::fromXML(child_node, layout_stackp, output_child);
LLLayoutPanel* panelp = dynamic_cast<LLLayoutPanel*>(child);
if (panelp)
{
panelp->setFollowsNone();
layout_stackp->addPanel(panelp, min_width, min_height, max_width, max_height, auto_resize, user_resize);
mPanels.push_back(panelp);
}
return LLView::addChild(child, tab_group);
}
else
{
BOOL user_resize = FALSE;
get_attribute_bool_and_write(child_node, "user_resize", &user_resize,
FALSE, output_child);
LLPanel::Params p;
p.mouse_opaque(false);
LLPanel* panelp = LLUICtrlFactory::create<LLPanel>(p);
LLView* new_child = LLUICtrlFactory::getInstance()->createFromXML(child_node, panelp, LLStringUtil::null, LLPanel::child_registry_t::instance(), output_child);
if (new_child)
{
// put child in new embedded panel
layout_stackp->addPanel(panelp, min_width, min_height, max_width, max_height, auto_resize, user_resize);
// resize panel to contain widget and move widget to be contained in panel
panelp->setRect(new_child->getRect());
new_child->setOrigin(0, 0);
}
else
{
panelp->die();
}
}
if (output_child && !output_child->mChildren && output_child->mAttributes.empty() && output_child->getValue().empty())
{
output_node->deleteChild(output_child);
}
}
if (!layout_stackp->postBuild())
{
delete layout_stackp;
return NULL;
}
return layout_stackp;
}
S32 LLLayoutStack::getDefaultHeight(S32 cur_height)
{
@ -374,34 +212,30 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width)
return cur_width;
}
void LLLayoutStack::addPanel(LLPanel* panel, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize, EAnimate animate, S32 index)
void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front)
{
LLLayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move);
LLLayoutPanel* embedded_target_panel = move_to_front ? *mPanels.begin() : findEmbeddedPanel(target_panel);
if (!embedded_panel_to_move || !embedded_target_panel || embedded_panel_to_move == embedded_target_panel)
{
llwarns << "One of the panels was not found in stack or NULL was passed instead of valid panel" << llendl;
return;
}
e_panel_list_t::iterator it = std::find(mPanels.begin(), mPanels.end(), embedded_panel_to_move);
mPanels.erase(it);
it = move_to_front ? mPanels.begin() : std::find(mPanels.begin(), mPanels.end(), embedded_target_panel);
mPanels.insert(it, embedded_panel_to_move);
}
void LLLayoutStack::addPanel(LLLayoutPanel* panel, EAnimate animate)
{
addChild(panel);
// panel starts off invisible (collapsed)
if (animate == ANIMATE)
{
panel->setVisible(FALSE);
}
LayoutPanel* embedded_panel = new LayoutPanel(panel, mOrientation, min_width, min_height, max_width, max_height, auto_resize, user_resize);
mPanels.insert(mPanels.begin() + llclamp(index, 0, (S32)mPanels.size()), embedded_panel);
if (panel->getParent() != this)
{
addChild(panel);
}
addChild(embedded_panel->mResizeBar);
// bring all resize bars to the front so that they are clickable even over the panels
// with a bit of overlap
for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
LLResizeBar* resize_barp = (*panel_it)->mResizeBar;
sendChildToFront(resize_barp);
}
// start expanding panel animation
if (animate == ANIMATE)
{
panel->mVisibleAmt = 0.f;
panel->setVisible(TRUE);
}
}
@ -413,7 +247,7 @@ void LLLayoutStack::removePanel(LLPanel* panel)
void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed)
{
LayoutPanel* panel_container = findEmbeddedPanel(panel);
LLLayoutPanel* panel_container = findEmbeddedPanel(panel);
if (!panel_container) return;
panel_container->mCollapsed = collapsed;
@ -421,7 +255,7 @@ void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed)
void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize)
{
LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
if (panel)
{
@ -431,7 +265,7 @@ void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL au
void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_resize)
{
LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
if (panel)
{
@ -439,27 +273,25 @@ void LLLayoutStack::setPanelUserResize(const std::string& panel_name, BOOL user_
}
}
bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp)
bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_dimp)
{
LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
if (panel)
{
if (min_widthp) *min_widthp = panel->mMinWidth;
if (min_heightp) *min_heightp = panel->mMinHeight;
if (min_dimp) *min_dimp = panel->mMinDim;
}
return NULL != panel;
}
bool LLLayoutStack::getPanelMaxSize(const std::string& panel_name, S32* max_widthp, S32* max_heightp)
bool LLLayoutStack::getPanelMaxSize(const std::string& panel_name, S32* max_dimp)
{
LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name);
if (panel)
{
if (max_widthp) *max_widthp = panel->mMaxWidth;
if (max_heightp) *max_heightp = panel->mMaxHeight;
if (max_dimp) *max_dimp = panel->mMaxDim;
}
return NULL != panel;
@ -471,6 +303,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
LLFastTimer ft(FTM_UPDATE_LAYOUT);
static LLUICachedControl<S32> resize_bar_overlap ("UIResizeBarOverlap", 0);
calcMinExtents();
createResizeBars();
// calculate current extents
S32 total_width = 0;
@ -482,7 +315,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
e_panel_list_t::iterator panel_it;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
LLPanel* panelp = (*panel_it)->mPanel;
LLPanel* panelp = (*panel_it);
if (panelp->getVisible())
{
if (mAnimate)
@ -532,11 +365,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
if (mOrientation == HORIZONTAL)
{
// enforce minimize size constraint by default
if (panelp->getRect().getWidth() < (*panel_it)->mMinWidth)
if (panelp->getRect().getWidth() < (*panel_it)->mMinDim)
{
panelp->reshape((*panel_it)->mMinWidth, panelp->getRect().getHeight());
panelp->reshape((*panel_it)->mMinDim, panelp->getRect().getHeight());
}
total_width += llround(panelp->getRect().getWidth() * (*panel_it)->getCollapseFactor());
total_width += llround(panelp->getRect().getWidth() * (*panel_it)->getCollapseFactor(mOrientation));
// want n-1 panel gaps for n panels
if (panel_it != mPanels.begin())
{
@ -546,11 +379,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
else //VERTICAL
{
// enforce minimize size constraint by default
if (panelp->getRect().getHeight() < (*panel_it)->mMinHeight)
if (panelp->getRect().getHeight() < (*panel_it)->mMinDim)
{
panelp->reshape(panelp->getRect().getWidth(), (*panel_it)->mMinHeight);
panelp->reshape(panelp->getRect().getWidth(), (*panel_it)->mMinDim);
}
total_height += llround(panelp->getRect().getHeight() * (*panel_it)->getCollapseFactor());
total_height += llround(panelp->getRect().getHeight() * (*panel_it)->getCollapseFactor(mOrientation));
if (panel_it != mPanels.begin())
{
total_height += mPanelSpacing;
@ -564,7 +397,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
// panels that are not fully visible do not count towards shrink headroom
if ((*panel_it)->getCollapseFactor() < 1.f)
if ((*panel_it)->getCollapseFactor(mOrientation) < 1.f)
{
continue;
}
@ -577,11 +410,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
{
if (mOrientation == HORIZONTAL)
{
shrink_headroom_total += (*panel_it)->mPanel->getRect().getWidth() - (*panel_it)->mMinWidth;
shrink_headroom_total += (*panel_it)->getRect().getWidth() - (*panel_it)->mMinDim;
}
else //VERTICAL
{
shrink_headroom_total += (*panel_it)->mPanel->getRect().getHeight() - (*panel_it)->mMinHeight;
shrink_headroom_total += (*panel_it)->getRect().getHeight() - (*panel_it)->mMinDim;
}
}
else
@ -589,13 +422,13 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
num_resizable_panels++;
if (mOrientation == HORIZONTAL)
{
shrink_headroom_available += (*panel_it)->mPanel->getRect().getWidth() - (*panel_it)->mMinWidth;
shrink_headroom_total += (*panel_it)->mPanel->getRect().getWidth() - (*panel_it)->mMinWidth;
shrink_headroom_available += (*panel_it)->getRect().getWidth() - (*panel_it)->mMinDim;
shrink_headroom_total += (*panel_it)->getRect().getWidth() - (*panel_it)->mMinDim;
}
else //VERTICAL
{
shrink_headroom_available += (*panel_it)->mPanel->getRect().getHeight() - (*panel_it)->mMinHeight;
shrink_headroom_total += (*panel_it)->mPanel->getRect().getHeight() - (*panel_it)->mMinHeight;
shrink_headroom_available += (*panel_it)->getRect().getHeight() - (*panel_it)->mMinDim;
shrink_headroom_total += (*panel_it)->getRect().getHeight() - (*panel_it)->mMinDim;
}
}
}
@ -618,17 +451,25 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
LLPanel* panelp = (*panel_it)->mPanel;
LLPanel* panelp = (*panel_it);
S32 cur_width = panelp->getRect().getWidth();
S32 cur_height = panelp->getRect().getHeight();
S32 new_width = llmax((*panel_it)->mMinWidth, cur_width);
S32 new_height = llmax((*panel_it)->mMinHeight, cur_height);
S32 new_width = cur_width;
S32 new_height = cur_height;
if (mOrientation == HORIZONTAL)
{
new_width = llmax((*panel_it)->mMinDim, new_width);
}
else
{
new_height = llmax((*panel_it)->mMinDim, new_height);
}
S32 delta_size = 0;
// if panel can automatically resize (not animating, and resize flag set)...
if ((*panel_it)->getCollapseFactor() == 1.f
if ((*panel_it)->getCollapseFactor(mOrientation) == 1.f
&& (force_resize || (*panel_it)->mAutoResize)
&& !(*panel_it)->mResizeBar->hasMouseCapture())
{
@ -639,8 +480,8 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
{
// shrink proportionally to amount over minimum
// so we can do this in one pass
delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_width - (*panel_it)->mMinWidth) / (F32)shrink_headroom_available)) : 0;
shrink_headroom_available -= (cur_width - (*panel_it)->mMinWidth);
delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_width - (*panel_it)->mMinDim) / (F32)shrink_headroom_available)) : 0;
shrink_headroom_available -= (cur_width - (*panel_it)->mMinDim);
}
else
{
@ -649,7 +490,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
num_resizable_panels--;
}
pixels_to_distribute -= delta_size;
new_width = llmax((*panel_it)->mMinWidth, cur_width + delta_size);
new_width = llmax((*panel_it)->mMinDim, cur_width + delta_size);
}
else
{
@ -662,8 +503,8 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
{
// shrink proportionally to amount over minimum
// so we can do this in one pass
delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - (*panel_it)->mMinHeight) / (F32)shrink_headroom_available)) : 0;
shrink_headroom_available -= (cur_height - (*panel_it)->mMinHeight);
delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - (*panel_it)->mMinDim) / (F32)shrink_headroom_available)) : 0;
shrink_headroom_available -= (cur_height - (*panel_it)->mMinDim);
}
else
{
@ -671,7 +512,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
num_resizable_panels--;
}
pixels_to_distribute -= delta_size;
new_height = llmax((*panel_it)->mMinHeight, cur_height + delta_size);
new_height = llmax((*panel_it)->mMinDim, cur_height + delta_size);
}
else
{
@ -712,11 +553,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
if (mOrientation == HORIZONTAL)
{
cur_x += llround(new_width * (*panel_it)->getCollapseFactor()) + mPanelSpacing;
cur_x += llround(new_width * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing;
}
else //VERTICAL
{
cur_y -= llround(new_height * (*panel_it)->getCollapseFactor()) + mPanelSpacing;
cur_y -= llround(new_height * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing;
}
}
@ -724,19 +565,19 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
LLResizeBar* last_resize_bar = NULL;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
LLPanel* panelp = (*panel_it)->mPanel;
LLPanel* panelp = (*panel_it);
if (mOrientation == HORIZONTAL)
{
(*panel_it)->mResizeBar->setResizeLimits(
(*panel_it)->mMinWidth,
(*panel_it)->mMinWidth + shrink_headroom_total);
(*panel_it)->mMinDim,
(*panel_it)->mMinDim + shrink_headroom_total);
}
else //VERTICAL
{
(*panel_it)->mResizeBar->setResizeLimits(
(*panel_it)->mMinHeight,
(*panel_it)->mMinHeight + shrink_headroom_total);
(*panel_it)->mMinDim,
(*panel_it)->mMinDim + shrink_headroom_total);
}
// toggle resize bars based on panel visibility, resizability, etc
@ -772,14 +613,14 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
} // end LLLayoutStack::updateLayout
LLLayoutStack::LayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
{
if (!panelp) return NULL;
e_panel_list_t::const_iterator panel_it;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
if ((*panel_it)->mPanel == panelp)
if ((*panel_it) == panelp)
{
return *panel_it;
}
@ -787,15 +628,15 @@ LLLayoutStack::LayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) co
return NULL;
}
LLLayoutStack::LayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const
LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const
{
LayoutPanel* result = NULL;
LLLayoutPanel* result = NULL;
for (e_panel_list_t::const_iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
LayoutPanel* p = *panel_it;
LLLayoutPanel* p = *panel_it;
if (p->mPanel->getName() == name)
if (p->getName() == name)
{
result = p;
break;
@ -816,9 +657,7 @@ void LLLayoutStack::calcMinExtents()
{
if (mOrientation == HORIZONTAL)
{
mMinHeight = llmax( mMinHeight,
(*panel_it)->mMinHeight);
mMinWidth += (*panel_it)->mMinWidth;
mMinWidth += (*panel_it)->mMinDim;
if (panel_it != mPanels.begin())
{
mMinWidth += mPanelSpacing;
@ -826,9 +665,7 @@ void LLLayoutStack::calcMinExtents()
}
else //VERTICAL
{
mMinWidth = llmax( mMinWidth,
(*panel_it)->mMinWidth);
mMinHeight += (*panel_it)->mMinHeight;
mMinHeight += (*panel_it)->mMinDim;
if (panel_it != mPanels.begin())
{
mMinHeight += mPanelSpacing;
@ -837,6 +674,37 @@ void LLLayoutStack::calcMinExtents()
}
}
void LLLayoutStack::createResizeBars()
{
for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
LLLayoutPanel* lp = (*panel_it);
if (lp->mResizeBar == NULL)
{
LLResizeBar::Side side = (mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM;
LLRect resize_bar_rect = getRect();
LLResizeBar::Params resize_params;
resize_params.name("resize");
resize_params.resizing_view(lp);
resize_params.min_size(lp->mMinDim);
resize_params.side(side);
resize_params.snapping_enabled(false);
LLResizeBar* resize_bar = LLUICtrlFactory::create<LLResizeBar>(resize_params);
lp->mResizeBar = resize_bar;
LLView::addChild(resize_bar, 0);
// bring all resize bars to the front so that they are clickable even over the panels
// with a bit of overlap
for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
LLResizeBar* resize_barp = (*panel_it)->mResizeBar;
sendChildToFront(resize_barp);
}
}
}
}
// update layout stack animations, etc. once per frame
// NOTE: we use this to size world view based on animating UI, *before* we draw the UI
// we might still need to call updateLayout during UI draw phase, in case UI elements

View File

@ -34,16 +34,21 @@
#ifndef LL_LLLAYOUTSTACK_H
#define LL_LLLAYOUTSTACK_H
#include "llview.h"
#include "llpanel.h"
class LLPanel;
class LLLayoutPanel;
class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
{
public:
struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry>
{};
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Optional<std::string> orientation;
Mandatory<std::string> orientation;
Optional<S32> border_size;
Optional<bool> animate,
clip;
@ -51,6 +56,8 @@ public:
Params();
};
typedef LayoutStackRegistry child_registry_t;
typedef enum e_layout_orientation
{
HORIZONTAL,
@ -62,6 +69,7 @@ public:
/*virtual*/ void draw();
/*virtual*/ void removeChild(LLView*);
/*virtual*/ BOOL postBuild();
/*virtual*/ bool addChild(LLView* child, S32 tab_group = 0);
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
@ -74,29 +82,32 @@ public:
ANIMATE
} EAnimate;
void addPanel(LLPanel* panel, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize, EAnimate animate = NO_ANIMATE, S32 index = S32_MAX);
void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE);
void removePanel(LLPanel* panel);
void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE);
S32 getNumPanels() { return mPanels.size(); }
/**
* Moves panel_to_move before target_panel inside layout stack (both panels should already be there).
* If move_to_front is true target_panel is ignored and panel_to_move is moved to the beginning of mPanels
*/
void movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front = false);
void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize);
void setPanelUserResize(const std::string& panel_name, BOOL user_resize);
/**
* Gets minimal width and/or height of the specified by name panel.
* Gets minimal dimension along layout_stack axis of the specified by name panel.
*
* If it is necessary to get only the one dimension pass NULL for another one.
* @returns true if specified by panel_name internal panel exists, false otherwise.
*/
bool getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp);
bool getPanelMinSize(const std::string& panel_name, S32* min_dimp);
/**
* Gets maximal width and/or height of the specified by name panel.
* Gets maximal dimension along layout_stack axis of the specified by name panel.
*
* If it is necessary to get only the one dimension pass NULL for another one.
* @returns true if specified by panel_name internal panel exists, false otherwise.
*/
bool getPanelMaxSize(const std::string& panel_name, S32* max_width, S32* max_height);
bool getPanelMaxSize(const std::string& panel_name, S32* max_dim);
void updateLayout(BOOL force_resize = FALSE);
@ -111,19 +122,18 @@ protected:
friend class LLUICtrlFactory;
private:
struct LayoutPanel;
void createResizeBars();
void calcMinExtents();
S32 getDefaultHeight(S32 cur_height);
S32 getDefaultWidth(S32 cur_width);
const ELayoutOrientation mOrientation;
typedef std::vector<LayoutPanel*> e_panel_list_t;
typedef std::vector<LLLayoutPanel*> e_panel_list_t;
e_panel_list_t mPanels;
LayoutPanel* findEmbeddedPanel(LLPanel* panelp) const;
LayoutPanel* findEmbeddedPanelByName(const std::string& name) const;
LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const;
LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const;
S32 mMinWidth; // calculated by calcMinExtents
S32 mMinHeight; // calculated by calcMinExtents
@ -135,4 +145,49 @@ private:
bool mClip;
}; // end class LLLayoutStack
class LLLayoutPanel : public LLPanel
{
friend class LLLayoutStack;
friend class LLUICtrlFactory;
public:
struct Params : public LLInitParam::Block<Params, LLPanel::Params>
{
Optional<S32> min_dim,
max_dim;
Optional<bool> user_resize,
auto_resize;
Params()
: min_dim("min_dim", 0),
max_dim("max_dim", 0),
user_resize("user_resize", true),
auto_resize("auto_resize", true)
{
addSynonym(min_dim, "min_width");
addSynonym(min_dim, "min_height");
addSynonym(max_dim, "max_width");
addSynonym(max_dim, "max_height");
}
};
~LLLayoutPanel();
void initFromParams(const Params& p);
protected:
LLLayoutPanel(const Params& p) ;
F32 getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation);
S32 mMinDim;
S32 mMaxDim;
BOOL mAutoResize;
BOOL mUserResize;
BOOL mCollapsed;
class LLResizeBar* mResizeBar;
F32 mVisibleAmt;
F32 mCollapseAmt;
};
#endif

View File

@ -1281,7 +1281,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
if( mCurrentHistoryLine > mLineHistory.begin() )
{
mText.assign( *(--mCurrentHistoryLine) );
setCursor(llmin((S32)mText.length(), getCursor()));
setCursorToEnd();
}
else
{
@ -1298,7 +1298,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1 )
{
mText.assign( *(++mCurrentHistoryLine) );
setCursor(llmin((S32)mText.length(), getCursor()));
setCursorToEnd();
}
else
{

View File

@ -77,10 +77,6 @@ S32 MENU_BAR_WIDTH = 0;
/// Local function declarations, constants, enums, and typedefs
///============================================================================
const std::string SEPARATOR_NAME("separator");
const std::string SEPARATOR_LABEL( "-----------" );
const std::string VERTICAL_SEPARATOR_LABEL( "|" );
const S32 LABEL_BOTTOM_PAD_PIXELS = 2;
const U32 LEFT_PAD_PIXELS = 3;
@ -99,10 +95,14 @@ const U32 SEPARATOR_HEIGHT_PIXELS = 8;
const S32 TEAROFF_SEPARATOR_HEIGHT_PIXELS = 10;
const S32 MENU_ITEM_PADDING = 4;
const std::string BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK
const std::string BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE
const std::string ARROW_UP ("^^^^^^^");
const std::string ARROW_DOWN("vvvvvvv");
const std::string SEPARATOR_NAME("separator");
const std::string SEPARATOR_LABEL( "-----------" );
const std::string VERTICAL_SEPARATOR_LABEL( "|" );
const std::string LLMenuGL::BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK
const std::string LLMenuGL::BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE
const std::string LLMenuGL::ARROW_UP ("^^^^^^^");
const std::string LLMenuGL::ARROW_DOWN("vvvvvvv");
const F32 MAX_MOUSE_SLOPE_SUB_MENU = 0.9f;
@ -921,7 +921,7 @@ void LLMenuItemCheckGL::setValue(const LLSD& value)
LLUICtrl::setValue(value);
if(value.asBoolean())
{
mDrawBoolLabel = BOOLEAN_TRUE_PREFIX;
mDrawBoolLabel = LLMenuGL::BOOLEAN_TRUE_PREFIX;
}
else
{
@ -954,7 +954,7 @@ void LLMenuItemCheckGL::buildDrawLabel( void )
}
if(getValue().asBoolean())
{
mDrawBoolLabel = BOOLEAN_TRUE_PREFIX;
mDrawBoolLabel = LLMenuGL::BOOLEAN_TRUE_PREFIX;
}
else
{
@ -1064,7 +1064,7 @@ void LLMenuItemBranchGL::buildDrawLabel( void )
std::string st = mDrawAccelLabel;
appendAcceleratorString( st );
mDrawAccelLabel = st;
mDrawBranchLabel = BRANCH_SUFFIX;
mDrawBranchLabel = LLMenuGL::BRANCH_SUFFIX;
}
void LLMenuItemBranchGL::onCommit( void )
@ -3744,8 +3744,7 @@ void LLContextMenuBranch::buildDrawLabel( void )
appendAcceleratorString( st );
mDrawAccelLabel = st;
// No special branch suffix
mDrawBranchLabel.clear();
mDrawBranchLabel = LLMenuGL::BRANCH_SUFFIX;
}
void LLContextMenuBranch::showSubMenu()

View File

@ -397,6 +397,12 @@ public:
void initFromParams(const Params&);
// textual artwork which menugl-imitators may want to match
static const std::string BOOLEAN_TRUE_PREFIX;
static const std::string BRANCH_SUFFIX;
static const std::string ARROW_UP;
static const std::string ARROW_DOWN;
protected:
LLMenuGL(const LLMenuGL::Params& p);
friend class LLUICtrlFactory;

View File

@ -107,8 +107,8 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p)
setMouseUpCallback(initCommitCallback(p.mouse_up_callback));
}
for (LLInitParam::ParamIterator<SliderParams>::const_iterator it = p.sliders().begin();
it != p.sliders().end();
for (LLInitParam::ParamIterator<SliderParams>::const_iterator it = p.sliders.begin();
it != p.sliders.end();
++it)
{
if (it->name.isProvided())

View File

@ -33,6 +33,7 @@
#include "linden_common.h"
#include "llnotifications.h"
#include "llnotificationtemplate.h"
#include "llinstantmessage.h"
#include "llxmlnode.h"
@ -43,6 +44,8 @@
#include "lltrans.h"
#include "llnotificationslistener.h"
#include "llstring.h"
#include "llsdparam.h"
#include "llsdutil.h"
#include <algorithm>
#include <boost/regex.hpp>
@ -50,6 +53,56 @@
const std::string NOTIFICATION_PERSIST_VERSION = "0.93";
void NotificationPriorityValues::declareValues()
{
declare("low", NOTIFICATION_PRIORITY_LOW);
declare("normal", NOTIFICATION_PRIORITY_NORMAL);
declare("high", NOTIFICATION_PRIORITY_HIGH);
declare("critical", NOTIFICATION_PRIORITY_CRITICAL);
}
LLNotificationForm::FormElementBase::FormElementBase()
: name("name")
{}
LLNotificationForm::FormIgnore::FormIgnore()
: text("text"),
control("control"),
invert_control("invert_control", true),
save_option("save_option", false)
{}
LLNotificationForm::FormButton::FormButton()
: index("index"),
text("text"),
ignore("ignore"),
is_default("default"),
type("type")
{
// set type here so it gets serialized
type = "button";
}
LLNotificationForm::FormInput::FormInput()
: type("type"),
width("width", 0)
{}
LLNotificationForm::FormElement::FormElement()
: button("button"),
input("input")
{}
LLNotificationForm::FormElements::FormElements()
: elements("")
{}
LLNotificationForm::Params::Params()
: name("name"),
ignore("ignore"),
form_elements("")
{}
// Local channel for persistent notifications
// Stores only persistent notifications.
// Class users can use connectChanged() to process persistent notifications
@ -94,12 +147,7 @@ bool filterIgnoredNotifications(LLNotificationPtr notification)
LLNotificationFormPtr form = notification->getForm();
// Check to see if the user wants to ignore this alert
if (form->getIgnoreType() != LLNotificationForm::IGNORE_NO)
{
return LLUI::sSettingGroups["ignores"]->getBOOL(notification->getName());
}
return true;
return !notification->getForm()->getIgnored();
}
bool handleIgnoredNotification(const LLSD& payload)
@ -141,63 +189,68 @@ namespace LLNotificationFilters
};
LLNotificationForm::LLNotificationForm()
: mFormData(LLSD::emptyArray()),
mIgnore(IGNORE_NO)
: mIgnore(IGNORE_NO)
{
}
LLNotificationForm::LLNotificationForm(const std::string& name, const LLXMLNodePtr xml_node)
: mFormData(LLSD::emptyArray()),
mIgnore(IGNORE_NO)
LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotificationForm::Params& p)
: mIgnore(IGNORE_NO),
mInvertSetting(true) // ignore settings by default mean true=show, false=ignore
{
if (!xml_node->hasName("form"))
if (p.ignore.isProvided())
{
llwarns << "Bad xml node for form: " << xml_node->getName() << llendl;
}
LLXMLNodePtr child = xml_node->getFirstChild();
while(child)
{
child = LLNotifications::instance().checkForXMLTemplate(child);
mIgnoreMsg = p.ignore.text;
LLSD item_entry;
std::string element_name = child->getName()->mString;
if (element_name == "ignore" )
if (!p.ignore.save_option)
{
bool save_option = false;
child->getAttribute_bool("save_option", save_option);
if (!save_option)
{
mIgnore = IGNORE_WITH_DEFAULT_RESPONSE;
}
else
{
// remember last option chosen by user and automatically respond with that in the future
mIgnore = IGNORE_WITH_LAST_RESPONSE;
LLUI::sSettingGroups["ignores"]->declareLLSD(std::string("Default") + name, "", std::string("Default response for notification " + name));
}
child->getAttributeString("text", mIgnoreMsg);
BOOL show_notification = TRUE;
LLUI::sSettingGroups["ignores"]->declareBOOL(name, show_notification, "Ignore notification with this name", TRUE);
mIgnore = IGNORE_WITH_DEFAULT_RESPONSE;
}
else
{
// flatten xml form entry into single LLSD map with type==name
item_entry["type"] = element_name;
const LLXMLAttribList::iterator attrib_end = child->mAttributes.end();
for(LLXMLAttribList::iterator attrib_it = child->mAttributes.begin();
attrib_it != attrib_end;
++attrib_it)
{
item_entry[std::string(attrib_it->second->getName()->mString)] = attrib_it->second->getValue();
}
item_entry["value"] = child->getTextContents();
mFormData.append(item_entry);
// remember last option chosen by user and automatically respond with that in the future
mIgnore = IGNORE_WITH_LAST_RESPONSE;
LLUI::sSettingGroups["ignores"]->declareLLSD(std::string("Default") + name, "", std::string("Default response for notification " + name));
}
child = child->getNextSibling();
BOOL show_notification = TRUE;
if (p.ignore.control.isProvided())
{
mIgnoreSetting = LLUI::sSettingGroups["config"]->getControl(p.ignore.control);
mInvertSetting = p.ignore.invert_control;
}
else
{
LLUI::sSettingGroups["ignores"]->declareBOOL(name, show_notification, "Ignore notification with this name", TRUE);
mIgnoreSetting = LLUI::sSettingGroups["ignores"]->getControl(name);
}
}
LLParamSDParser parser;
parser.writeSD(mFormData, p.form_elements);
mFormData = mFormData[""];
if (!mFormData.isArray())
{
// change existing contents to a one element array
LLSD new_llsd_array = LLSD::emptyArray();
new_llsd_array.append(mFormData);
mFormData = new_llsd_array;
}
for (LLSD::array_iterator it = mFormData.beginArray(), end_it = mFormData.endArray();
it != end_it;
++it)
{
// lift contents of form element up a level, since element type is already encoded in "type" param
if (it->isMap() && it->beginMap() != it->endMap())
{
*it = it->beginMap()->second;
}
}
LL_DEBUGS("Notifications") << name << LL_ENDL;
LL_DEBUGS("Notifications") << ll_pretty_print_sd(mFormData) << LL_ENDL;
}
LLNotificationForm::LLNotificationForm(const LLSD& sd)
@ -299,16 +352,64 @@ std::string LLNotificationForm::getDefaultOption()
return "";
}
LLNotificationTemplate::LLNotificationTemplate() :
mExpireSeconds(0),
mExpireOption(-1),
mURLOption(-1),
mURLOpenExternally(-1),
mPersist(false),
mUnique(false),
mPriority(NOTIFICATION_PRIORITY_NORMAL)
LLControlVariablePtr LLNotificationForm::getIgnoreSetting()
{
return mIgnoreSetting;
}
bool LLNotificationForm::getIgnored()
{
mForm = LLNotificationFormPtr(new LLNotificationForm());
bool ignored = false;
if (mIgnore != LLNotificationForm::IGNORE_NO
&& mIgnoreSetting)
{
ignored = mIgnoreSetting->getValue().asBoolean();
if (mInvertSetting) ignored = !ignored;
}
return ignored;
}
void LLNotificationForm::setIgnored(bool ignored)
{
if (mIgnoreSetting)
{
if (mInvertSetting) ignored = !ignored;
mIgnoreSetting->setValue(ignored);
}
}
LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Params& p)
: mName(p.name),
mType(p.type),
mMessage(p.value),
mLabel(p.label),
mIcon(p.icon),
mURL(p.url.value),
mExpireSeconds(p.duration),
mExpireOption(p.expire_option),
mURLOption(p.url.option),
mURLTarget(p.url.target),
mUnique(p.unique.isProvided()),
mPriority(p.priority),
mPersist(p.persist),
mDefaultFunctor(p.functor.isProvided() ? p.functor() : p.name())
{
if (p.sound.isProvided()
&& LLUI::sSettingGroups["config"]->controlExists(p.sound))
{
mSoundEffect = LLUUID(LLUI::sSettingGroups["config"]->getString(p.sound));
}
for(LLInitParam::ParamIterator<LLNotificationTemplate::UniquenessContext>::const_iterator it = p.unique.contexts.begin(),
end_it = p.unique.contexts.end();
it != end_it;
++it)
{
mUniqueContext.push_back(it->key);
}
mForm = LLNotificationFormPtr(new LLNotificationForm(p.name, p.form_ref.form));
}
LLNotification::LLNotification(const LLNotification::Params& p) :
@ -505,7 +606,7 @@ void LLNotification::respond(const LLSD& response)
{
mResponder->handleRespond(asLLSD(), response);
}
else
else if (!mResponseFunctorName.empty())
{
// look up the functor
LLNotificationFunctorRegistry::ResponseFunctor functor =
@ -513,6 +614,11 @@ void LLNotification::respond(const LLSD& response)
// and then call it
functor(asLLSD(), response);
}
else
{
// no registered responder
return;
}
if (mTemporaryResponder && !isReusable())
{
@ -523,8 +629,7 @@ void LLNotification::respond(const LLSD& response)
if (mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO)
{
BOOL show_notification = mIgnored ? FALSE : TRUE;
LLUI::sSettingGroups["ignores"]->setBOOL(getName(), show_notification);
mForm->setIgnored(mIgnored);
if (mIgnored && mForm->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
{
LLUI::sSettingGroups["ignores"]->setLLSD("Default" + getName(), response);
@ -534,6 +639,49 @@ void LLNotification::respond(const LLSD& response)
update();
}
void LLNotification::respondWithDefault()
{
respond(getResponseTemplate(WITH_DEFAULT_BUTTON));
}
const std::string& LLNotification::getName() const
{
return mTemplatep->mName;
}
const std::string& LLNotification::getIcon() const
{
return mTemplatep->mIcon;
}
bool LLNotification::isPersistent() const
{
return mTemplatep->mPersist;
}
std::string LLNotification::getType() const
{
return (mTemplatep ? mTemplatep->mType : "");
}
S32 LLNotification::getURLOption() const
{
return (mTemplatep ? mTemplatep->mURLOption : -1);
}
S32 LLNotification::getURLOpenExternally() const
{
return(mTemplatep? mTemplatep->mURLTarget == "_external": -1);
}
bool LLNotification::hasUniquenessConstraints() const
{
return (mTemplatep ? mTemplatep->mUnique : false);
}
void LLNotification::setIgnored(bool ignore)
{
mIgnored = ignore;
@ -613,6 +761,8 @@ void LLNotification::init(const std::string& template_name, const LLSD& form_ele
// apply substitution to form labels
mForm->formatElements(mSubstitutions);
mIgnored = mForm->getIgnored();
LLDate rightnow = LLDate::now();
if (mTemplatep->mExpireSeconds)
{
@ -1101,11 +1251,6 @@ bool LLNotifications::templateExists(const std::string& name)
return (mTemplates.count(name) != 0);
}
void LLNotifications::clearTemplates()
{
mTemplates.clear();
}
void LLNotifications::forceResponse(const LLNotification::Params& params, S32 option)
{
LLNotificationPtr temp_notify(new LLNotification(params));
@ -1168,190 +1313,88 @@ void replaceSubstitutionStrings(LLXMLNodePtr node, StringMap& replacements)
}
}
// private to this file
// returns true if the template request was invalid and there's nothing else we
// can do with this node, false if you should keep processing (it may have
// replaced the contents of the node referred to)
LLXMLNodePtr LLNotifications::checkForXMLTemplate(LLXMLNodePtr item)
void replaceFormText(LLNotificationForm::Params& form, const std::string& pattern, const std::string& replace)
{
if (item->hasName("usetemplate"))
if (form.ignore.isProvided() && form.ignore.text() == pattern)
{
std::string replacementName;
if (item->getAttributeString("name", replacementName))
form.ignore.text = replace;
}
for (LLInitParam::ParamIterator<LLNotificationForm::FormElement>::iterator it = form.form_elements.elements.begin(),
end_it = form.form_elements.elements.end();
it != end_it;
++it)
{
if (it->button.isChosen() && it->button.text() == pattern)
{
StringMap replacements;
for (LLXMLAttribList::const_iterator it=item->mAttributes.begin();
it != item->mAttributes.end(); ++it)
{
replacements[it->second->getName()->mString] = it->second->getValue();
}
if (mXmlTemplates.count(replacementName))
{
item=LLXMLNode::replaceNode(item, mXmlTemplates[replacementName]);
// walk the nodes looking for $(substitution) here and replace
replaceSubstitutionStrings(item, replacements);
}
else
{
llwarns << "XML template lookup failure on '" << replacementName << "' " << llendl;
}
it->button.text = replace;
}
}
return item;
}
bool LLNotifications::loadTemplates()
{
const std::string xml_filename = "notifications.xml";
std::string full_filename = gDirUtilp->findSkinnedFilename(LLUI::getXUIPaths().front(), xml_filename);
LLXMLNodePtr root;
BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
if (!success || root.isNull() || !root->hasName( "notifications" ))
{
llerrs << "Problem reading UI Notifications file: " << xml_filename << llendl;
llerrs << "Problem reading UI Notifications file: " << full_filename << llendl;
return false;
}
clearTemplates();
for (LLXMLNodePtr item = root->getFirstChild();
item.notNull(); item = item->getNextSibling())
LLNotificationTemplate::Notifications params;
LLXUIParser parser;
parser.readXUI(root, params, full_filename);
mTemplates.clear();
for(LLInitParam::ParamIterator<LLNotificationTemplate::GlobalString>::const_iterator it = params.strings.begin(), end_it = params.strings.end();
it != end_it;
++it)
{
// we do this FIRST so that item can be changed if we
// encounter a usetemplate -- we just replace the
// current xml node and keep processing
item = checkForXMLTemplate(item);
if (item->hasName("global"))
{
std::string global_name;
if (item->getAttributeString("name", global_name))
{
mGlobalStrings[global_name] = item->getTextContents();
}
continue;
}
if (item->hasName("template"))
{
// store an xml template; templates must have a single node (can contain
// other nodes)
std::string name;
item->getAttributeString("name", name);
LLXMLNodePtr ptr = item->getFirstChild();
mXmlTemplates[name] = ptr;
continue;
}
if (!item->hasName("notification"))
{
llwarns << "Unexpected entity " << item->getName()->mString <<
" found in " << xml_filename << llendl;
continue;
}
// now we know we have a notification entry, so let's build it
LLNotificationTemplatePtr pTemplate(new LLNotificationTemplate());
if (!item->getAttributeString("name", pTemplate->mName))
{
llwarns << "Unable to parse notification with no name" << llendl;
continue;
}
//llinfos << "Parsing " << pTemplate->mName << llendl;
pTemplate->mMessage = item->getTextContents();
pTemplate->mDefaultFunctor = pTemplate->mName;
item->getAttributeString("type", pTemplate->mType);
item->getAttributeString("icon", pTemplate->mIcon);
item->getAttributeString("label", pTemplate->mLabel);
item->getAttributeU32("duration", pTemplate->mExpireSeconds);
item->getAttributeU32("expireOption", pTemplate->mExpireOption);
std::string priority;
item->getAttributeString("priority", priority);
pTemplate->mPriority = NOTIFICATION_PRIORITY_NORMAL;
if (!priority.empty())
{
if (priority == "low") pTemplate->mPriority = NOTIFICATION_PRIORITY_LOW;
if (priority == "normal") pTemplate->mPriority = NOTIFICATION_PRIORITY_NORMAL;
if (priority == "high") pTemplate->mPriority = NOTIFICATION_PRIORITY_HIGH;
if (priority == "critical") pTemplate->mPriority = NOTIFICATION_PRIORITY_CRITICAL;
}
item->getAttributeString("functor", pTemplate->mDefaultFunctor);
BOOL persist = false;
item->getAttributeBOOL("persist", persist);
pTemplate->mPersist = persist;
std::string sound;
item->getAttributeString("sound", sound);
if (!sound.empty())
{
// test for bad sound effect name / missing effect
if (LLUI::sSettingGroups["config"]->controlExists(sound))
{
pTemplate->mSoundEffect =
LLUUID(LLUI::sSettingGroups["config"]->getString(sound));
}
else
{
llwarns << "Unknown sound effect control name " << sound
<< llendl;
}
}
for (LLXMLNodePtr child = item->getFirstChild();
!child.isNull(); child = child->getNextSibling())
{
child = checkForXMLTemplate(child);
// <url>
if (child->hasName("url"))
{
pTemplate->mURL = child->getTextContents();
child->getAttributeU32("option", pTemplate->mURLOption);
child->getAttributeU32("openexternally", pTemplate->mURLOpenExternally);
}
if (child->hasName("unique"))
{
pTemplate->mUnique = true;
for (LLXMLNodePtr formitem = child->getFirstChild();
!formitem.isNull(); formitem = formitem->getNextSibling())
{
if (formitem->hasName("context"))
{
std::string key;
formitem->getAttributeString("key", key);
pTemplate->mUniqueContext.push_back(key);
//llwarns << "adding " << key << " to unique context" << llendl;
}
else
{
llwarns << "'unique' has unrecognized subelement "
<< formitem->getName()->mString << llendl;
}
}
}
// <form>
if (child->hasName("form"))
{
pTemplate->mForm = LLNotificationFormPtr(new LLNotificationForm(pTemplate->mName, child));
}
}
addTemplate(pTemplate->mName, pTemplate);
mGlobalStrings[it->name] = it->value;
}
//std::ostringstream ostream;
//root->writeToOstream(ostream, "\n ");
//llwarns << ostream.str() << llendl;
std::map<std::string, LLNotificationForm::Params> form_templates;
for(LLInitParam::ParamIterator<LLNotificationTemplate::Template>::const_iterator it = params.templates.begin(), end_it = params.templates.end();
it != end_it;
++it)
{
form_templates[it->name] = it->form;
}
for(LLInitParam::ParamIterator<LLNotificationTemplate::Params>::iterator it = params.notifications.begin(), end_it = params.notifications.end();
it != end_it;
++it)
{
if (it->form_ref.form_template.isChosen())
{
// replace form contents from template
it->form_ref.form = form_templates[it->form_ref.form_template.name];
if(it->form_ref.form_template.yes_text.isProvided())
{
replaceFormText(it->form_ref.form, "$yestext", it->form_ref.form_template.yes_text);
}
if(it->form_ref.form_template.no_text.isProvided())
{
replaceFormText(it->form_ref.form, "$notext", it->form_ref.form_template.no_text);
}
if(it->form_ref.form_template.cancel_text.isProvided())
{
replaceFormText(it->form_ref.form, "$canceltext", it->form_ref.form_template.cancel_text);
}
if(it->form_ref.form_template.ignore_text.isProvided())
{
replaceFormText(it->form_ref.form, "$ignoretext", it->form_ref.form_template.ignore_text);
}
}
addTemplate(it->name, LLNotificationTemplatePtr(new LLNotificationTemplate(*it)));
}
return true;
}
@ -1402,6 +1445,8 @@ LLNotificationPtr LLNotifications::add(const LLNotification::Params& p)
void LLNotifications::add(const LLNotificationPtr pNotif)
{
if (pNotif == NULL) return;
// first see if we already have it -- if so, that's a problem
LLNotificationSet::iterator it=mItems.find(pNotif);
if (it != mItems.end())
@ -1414,6 +1459,8 @@ void LLNotifications::add(const LLNotificationPtr pNotif)
void LLNotifications::cancel(LLNotificationPtr pNotif)
{
if (pNotif == NULL) return;
LLNotificationSet::iterator it=mItems.find(pNotif);
if (it == mItems.end())
{
@ -1423,6 +1470,30 @@ void LLNotifications::cancel(LLNotificationPtr pNotif)
updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
}
void LLNotifications::cancelByName(const std::string& name)
{
std::vector<LLNotificationPtr> notifs_to_cancel;
for (LLNotificationSet::iterator it=mItems.begin(), end_it = mItems.end();
it != end_it;
++it)
{
LLNotificationPtr pNotif = *it;
if (pNotif->getName() == name)
{
notifs_to_cancel.push_back(pNotif);
}
}
for (std::vector<LLNotificationPtr>::iterator it = notifs_to_cancel.begin(), end_it = notifs_to_cancel.end();
it != end_it;
++it)
{
LLNotificationPtr pNotif = *it;
pNotif->cancel();
updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
}
}
void LLNotifications::update(const LLNotificationPtr pNotif)
{
LLNotificationSet::iterator it=mItems.find(pNotif);

View File

@ -106,7 +106,6 @@
#include "llnotificationptr.h"
#include "llcachename.h"
typedef enum e_notification_priority
{
NOTIFICATION_PRIORITY_UNSPECIFIED,
@ -116,6 +115,11 @@ typedef enum e_notification_priority
NOTIFICATION_PRIORITY_CRITICAL
} ENotificationPriority;
struct NotificationPriorityValues : public LLInitParam::TypeValuesHelper<ENotificationPriority, NotificationPriorityValues>
{
static void declareValues();
};
class LLNotificationResponderInterface
{
public:
@ -163,6 +167,66 @@ class LLNotificationForm
LOG_CLASS(LLNotificationForm);
public:
struct FormElementBase : public LLInitParam::Block<FormElementBase>
{
Optional<std::string> name;
FormElementBase();
};
struct FormIgnore : public LLInitParam::Block<FormIgnore, FormElementBase>
{
Optional<std::string> text;
Optional<bool> save_option;
Optional<std::string> control;
Optional<bool> invert_control;
FormIgnore();
};
struct FormButton : public LLInitParam::Block<FormButton, FormElementBase>
{
Mandatory<S32> index;
Mandatory<std::string> text;
Optional<std::string> ignore;
Optional<bool> is_default;
Mandatory<std::string> type;
FormButton();
};
struct FormInput : public LLInitParam::Block<FormInput, FormElementBase>
{
Mandatory<std::string> type;
Optional<S32> width;
FormInput();
};
struct FormElement : public LLInitParam::Choice<FormElement>
{
Alternative<FormButton> button;
Alternative<FormInput> input;
FormElement();
};
struct FormElements : public LLInitParam::Block<FormElements>
{
Multiple<FormElement> elements;
FormElements();
};
struct Params : public LLInitParam::Block<Params>
{
Optional<std::string> name;
Optional<FormIgnore> ignore;
Optional<FormElements> form_elements;
Params();
};
typedef enum e_ignore_type
{
IGNORE_NO,
@ -173,8 +237,7 @@ public:
LLNotificationForm();
LLNotificationForm(const LLSD& sd);
LLNotificationForm(const std::string& name,
const LLPointer<class LLXMLNode> xml_node);
LLNotificationForm(const std::string& name, const Params& p);
LLSD asLLSD() const;
@ -187,92 +250,25 @@ public:
// appends form elements from another form serialized as LLSD
void append(const LLSD& sub_form);
std::string getDefaultOption();
LLPointer<class LLControlVariable> getIgnoreSetting();
bool getIgnored();
void setIgnored(bool ignored);
EIgnoreType getIgnoreType() { return mIgnore; }
std::string getIgnoreMessage() { return mIgnoreMsg; }
private:
LLSD mFormData;
EIgnoreType mIgnore;
std::string mIgnoreMsg;
LLSD mFormData;
EIgnoreType mIgnore;
std::string mIgnoreMsg;
LLPointer<class LLControlVariable> mIgnoreSetting;
bool mInvertSetting;
};
typedef boost::shared_ptr<LLNotificationForm> LLNotificationFormPtr;
// This is the class of object read from the XML file (notifications.xml,
// from the appropriate local language directory).
struct LLNotificationTemplate
{
LLNotificationTemplate();
// the name of the notification -- the key used to identify it
// Ideally, the key should follow variable naming rules
// (no spaces or punctuation).
std::string mName;
// The type of the notification
// used to control which queue it's stored in
std::string mType;
// The text used to display the notification. Replaceable parameters
// are enclosed in square brackets like this [].
std::string mMessage;
// The label for the notification; used for
// certain classes of notification (those with a window and a window title).
// Also used when a notification pops up underneath the current one.
// Replaceable parameters can be used in the label.
std::string mLabel;
// The name of the icon image. This should include an extension.
std::string mIcon;
// This is the Highlander bit -- "There Can Be Only One"
// An outstanding notification with this bit set
// is updated by an incoming notification with the same name,
// rather than creating a new entry in the queue.
// (used for things like progress indications, or repeating warnings
// like "the grid is going down in N minutes")
bool mUnique;
// if we want to be unique only if a certain part of the payload is constant
// specify the field names for the payload. The notification will only be
// combined if all of the fields named in the context are identical in the
// new and the old notification; otherwise, the notification will be
// duplicated. This is to support suppressing duplicate offers from the same
// sender but still differentiating different offers. Example: Invitation to
// conference chat.
std::vector<std::string> mUniqueContext;
// If this notification expires automatically, this value will be
// nonzero, and indicates the number of seconds for which the notification
// will be valid (a teleport offer, for example, might be valid for
// 300 seconds).
U32 mExpireSeconds;
// if the offer expires, one of the options is chosen automatically
// based on its "value" parameter. This controls which one.
// If expireSeconds is specified, expireOption should also be specified.
U32 mExpireOption;
// if the notification contains a url, it's stored here (and replaced
// into the message where [_URL] is found)
std::string mURL;
// if there's a URL in the message, this controls which option visits
// that URL. Obsolete this and eliminate the buttons for affected
// messages when we allow clickable URLs in the UI
U32 mURLOption;
U32 mURLOpenExternally;
//This is a flag that tells if the url needs to open externally dispite
//what the user setting is.
// does this notification persist across sessions? if so, it will be
// serialized to disk on first receipt and read on startup
bool mPersist;
// This is the name of the default functor, if present, to be
// used for the notification's callback. It is optional, and used only if
// the notification is constructed without an identified functor.
std::string mDefaultFunctor;
// The form data associated with a given notification (buttons, text boxes, etc)
LLNotificationFormPtr mForm;
// default priority for notifications of this type
ENotificationPriority mPriority;
// UUID of the audio file to be played when this notification arrives
// this is loaded as a name, but looked up to get the UUID upon template load.
// If null, it wasn't specified.
LLUUID mSoundEffect;
};
struct LLNotificationTemplate;
// we want to keep a map of these by name, and it's best to manage them
// with smart pointers
@ -308,7 +304,7 @@ public:
// optional
Optional<LLSD> substitutions;
Optional<LLSD> payload;
Optional<ENotificationPriority> priority;
Optional<ENotificationPriority, NotificationPriorityValues> priority;
Optional<LLSD> form_elements;
Optional<LLDate> time_stamp;
Optional<LLNotificationContext*> context;
@ -451,6 +447,7 @@ public:
LLSD asLLSD();
void respond(const LLSD& sd);
void respondWithDefault();
void* getResponder() { return mResponderObj; }
@ -468,6 +465,13 @@ public:
return mRespondedTo;
}
bool isActive() const
{
return !isRespondedTo()
&& !isCancelled()
&& !isExpired();
}
const LLSD& getResponse() { return mResponse; }
bool isIgnored() const
@ -475,15 +479,11 @@ public:
return mIgnored;
}
const std::string& getName() const
{
return mTemplatep->mName;
}
const std::string& getName() const;
bool isPersistent() const
{
return mTemplatep->mPersist;
}
const std::string& getIcon() const;
bool isPersistent() const;
const LLUUID& id() const
{
@ -505,28 +505,12 @@ public:
return mTimestamp;
}
std::string getType() const
{
return (mTemplatep ? mTemplatep->mType : "");
}
std::string getType() const;
std::string getMessage() const;
std::string getLabel() const;
std::string getURL() const;
// {
// return (mTemplatep ? mTemplatep->mURL : "");
// }
S32 getURLOption() const
{
return (mTemplatep ? mTemplatep->mURLOption : -1);
}
S32 getURLOpenExternally() const
{
return(mTemplatep? mTemplatep->mURLOpenExternally : -1);
}
S32 getURLOption() const;
S32 getURLOpenExternally() const;
const LLNotificationFormPtr getForm();
@ -596,7 +580,7 @@ public:
std::string summarize() const;
bool hasUniquenessConstraints() const { return (mTemplatep ? mTemplatep->mUnique : false);}
bool hasUniquenessConstraints() const;
virtual ~LLNotification() {}
};
@ -878,7 +862,6 @@ public:
// load notification descriptions from file;
// OK to call more than once because it will reload
bool loadTemplates();
LLPointer<class LLXMLNode> checkForXMLTemplate(LLPointer<class LLXMLNode> item);
// Add a simple notification (from XUI)
void addFromCallback(const LLSD& name);
@ -900,6 +883,7 @@ public:
void add(const LLNotificationPtr pNotif);
void cancel(LLNotificationPtr pNotif);
void cancelByName(const std::string& name);
void update(const LLNotificationPtr pNotif);
LLNotificationPtr find(LLUUID uuid);
@ -923,8 +907,6 @@ public:
// test for existence
bool templateExists(const std::string& name);
// useful if you're reloading the file
void clearTemplates(); // erase all templates
void forceResponse(const LLNotification::Params& params, S32 option);
@ -962,9 +944,6 @@ private:
std::string mFileName;
typedef std::map<std::string, LLPointer<class LLXMLNode> > XMLTemplateMap;
XMLTemplateMap mXmlTemplates;
LLNotificationMap mUniqueNotifications;
typedef std::map<std::string, std::string> GlobalStringMap;

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