diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index 75ce6aa478..77a0e5c23a 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -73,6 +73,7 @@ LLDir *gDirUtilp = (LLDir *)&gDirUtil; /// Values for findSkinnedFilenames(subdir) parameter const char *LLDir::XUI = "xui", + *LLDir::HTML = "html", *LLDir::TEXTURES = "textures", *LLDir::SKINBASE = ""; @@ -826,14 +827,13 @@ std::vector LLDir::findSkinnedFilenames(const std::string& subdir, else { // We do not recognize this subdir. Investigate. - std::string subdir_path(add(getDefaultSkinDir(), subdir)); - if (fileExists(add(subdir_path, "en"))) + if (skinExists(subdir, "en")) { // defaultSkinDir/subdir contains subdir "en". That's our // default language; this subdir is localized. found = sLocalized.insert(StringMap::value_type(subdir, "en")).first; } - else if (fileExists(add(subdir_path, "en-us"))) + else if (skinExists(subdir, "en-us")) { // defaultSkinDir/subdir contains subdir "en-us" but not "en". // Set as default language; this subdir is localized. @@ -930,6 +930,33 @@ std::vector LLDir::findSkinnedFilenames(const std::string& subdir, return results; } +// virtual +bool LLDir::skinExists(const std::string& subdir, const std::string& skin) const +{ + std::string skin_path(add(getDefaultSkinDir(), subdir, skin)); + return fileExists(skin_path); +} + +// virtual +std::string LLDir::getFileContents(const std::string& filename) const +{ + LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ + if (fp) + { + fseek(fp, 0, SEEK_END); + U32 length = ftell(fp); + fseek(fp, 0, SEEK_SET); + + std::vector buffer(length); + size_t nread = fread(buffer.data(), 1, length, fp); + fclose(fp); + + return std::string(buffer.data(), nread); + } + + return LLStringUtil::null; +} + std::string LLDir::getTempFilename() const { LLUUID random_uuid; diff --git a/indra/llfilesystem/lldir.h b/indra/llfilesystem/lldir.h index 67c42a1547..042075ffed 100644 --- a/indra/llfilesystem/lldir.h +++ b/indra/llfilesystem/lldir.h @@ -110,6 +110,8 @@ class LLDir virtual std::string getCurPath() = 0; virtual bool fileExists(const std::string &filename) const = 0; + virtual bool skinExists(const std::string& subdir, const std::string &skin) const; + virtual std::string getFileContents(const std::string& filename) const; const std::string findFile(const std::string& filename, const std::vector filenames) const; const std::string findFile(const std::string& filename, const std::string& searchPath1 = "", const std::string& searchPath2 = "", const std::string& searchPath3 = "") const; @@ -194,7 +196,7 @@ class LLDir const std::string& filename, ESkinConstraint constraint=CURRENT_SKIN) const; /// Values for findSkinnedFilenames(subdir) parameter - static const char *XUI, *TEXTURES, *SKINBASE; + static const char *XUI, *HTML, *TEXTURES, *SKINBASE; /** * Return the base-language pathname from findSkinnedFilenames(), or * the empty string if no such file exists. Parameters are identical to diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index bf5564f041..15bafdde0c 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -3767,12 +3767,16 @@ bool LLFloater::isVisible(const LLFloater* floater) return floater && floater->getVisible(); } -bool LLFloater::buildFromFile(const std::string& filename) +bool LLFloater::buildFromFile(const std::string& filename, bool cacheable) { LL_PROFILE_ZONE_SCOPED; + + llassert_msg(!cacheable || !mSingleInstance || !mReuseInstance, + "No needs to cache XML for floater with mSingleInstance AND mReuseInstance flags set"); + LLXMLNodePtr root; - if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) + if (!LLUICtrlFactory::getLayeredXMLNode(filename, root, LLDir::CURRENT_SKIN, cacheable)) { LL_WARNS() << "Couldn't find (or parse) floater from: " << filename << LL_ENDL; return false; diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 34e1b02aeb..76d2e5e1f8 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -219,7 +219,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); + bool buildFromFile(const std::string &filename, bool cacheable = false); boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setOpenCallback( const commit_signal_t::slot_type& cb ); diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 5374b7ea73..85aa766918 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -95,7 +95,7 @@ void LLMenuButton::setMenu(const std::string& menu_filename, EMenuPosition posit } llassert(LLMenuGL::sMenuContainer != NULL); - LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); + LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance(), true); if (!menu) { LL_WARNS() << "Error loading menu_button menu" << LL_ENDL; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 38ea700c51..3473256260 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -803,13 +803,13 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t:: //----------------------------------------------------------------------------- // buildPanel() //----------------------------------------------------------------------------- -bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params) +bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params, bool cacheable) { LL_PROFILE_ZONE_SCOPED; bool didPost = false; LLXMLNodePtr root; - if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) + if (!LLUICtrlFactory::getLayeredXMLNode(filename, root, LLDir::CURRENT_SKIN, cacheable)) { LL_WARNS() << "Couldn't parse panel from: " << filename << LL_ENDL; return didPost; diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index e649d0c071..53a488af79 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -107,7 +107,8 @@ protected: public: typedef std::vector ctrl_list_t; - bool buildFromFile(const std::string &filename, const LLPanel::Params& default_params = getDefaultParams()); + bool buildFromFile(const std::string &filename, const LLPanel::Params& default_params, bool cacheable = false); + bool buildFromFile(const std::string &filename, bool cacheable = false) { return buildFromFile(filename, getDefaultParams(), cacheable); } static LLPanel* createFactoryPanel(const std::string& name); diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 2108b6aa79..b1039720b2 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -167,7 +167,7 @@ void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const wid // getLayeredXMLNode() //----------------------------------------------------------------------------- bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root, - LLDir::ESkinConstraint constraint) + LLDir::ESkinConstraint constraint, bool cacheable) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; std::vector paths = @@ -179,7 +179,7 @@ bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNo paths.push_back(xui_filename); } - return LLXMLNode::getLayeredXMLNode(root, paths); + return LLXMLNode::getLayeredXMLNode(root, paths, cacheable); } diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 6e585abfc0..2e1cc75508 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -148,7 +148,7 @@ public: LLView* createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t&, LLXMLNodePtr output_node ); template - static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry) + static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry, bool cacheable = false) { T* widget = NULL; @@ -156,7 +156,7 @@ public: { LLXMLNodePtr root_node; - if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node)) + if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node, LLDir::CURRENT_SKIN, cacheable)) { LL_WARNS() << "Couldn't parse XUI from path: " << instance().getCurFileName() << ", from filename: " << filename << LL_ENDL; goto fail; @@ -192,7 +192,7 @@ fail: static void createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t&, LLXMLNodePtr output_node = NULL); static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root, - LLDir::ESkinConstraint constraint=LLDir::CURRENT_SKIN); + LLDir::ESkinConstraint constraint = LLDir::CURRENT_SKIN, bool cacheable = false); private: //NOTE: both friend declarations are necessary to keep both gcc and msvc happy diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index a60ccb537e..84507a58b6 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -28,6 +28,7 @@ #include "llxuiparser.h" +#include "lldir.h" #include "llxmlnode.h" #include "llfasttimer.h" #ifdef LL_USESYSTEMLIBS @@ -44,6 +45,7 @@ #include "lluicolor.h" #include "v3math.h" + using namespace BOOST_SPIRIT_CLASSIC_NS; const S32 MAX_STRING_ATTRIBUTE_SIZE = 40; @@ -1397,36 +1399,17 @@ bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBl mCurReadDepth = 0; setParseSilently(silent); - ScopedFile file(filename, "rb"); - if( !file.isOpen() ) + std::string xml = gDirUtilp->getFileContents(filename); + if (xml.empty()) { LL_WARNS("ReadXUI") << "Unable to open file " << filename << LL_ENDL; XML_ParserFree( mParser ); return false; } - S32 bytes_read = 0; - - S32 buffer_size = file.getRemainingBytes(); - void* buffer = XML_GetBuffer(mParser, buffer_size); - if( !buffer ) - { - LL_WARNS("ReadXUI") << "Unable to allocate XML buffer while reading file " << filename << LL_ENDL; - XML_ParserFree( mParser ); - return false; - } - - bytes_read = (S32)fread(buffer, 1, buffer_size, file.mFile); - if( bytes_read <= 0 ) - { - LL_WARNS("ReadXUI") << "Error while reading file " << filename << LL_ENDL; - XML_ParserFree( mParser ); - return false; - } - mEmptyLeafNode.push_back(false); - if( !XML_ParseBuffer(mParser, bytes_read, true ) ) + if (!XML_Parse(mParser, xml.data(), (int)xml.size(), true)) { LL_WARNS("ReadXUI") << "Error while parsing file " << filename << LL_ENDL; XML_ParserFree( mParser ); diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 9112a428c3..47c7079f23 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -855,13 +855,13 @@ void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val) //--------------------------------------------------------------- // Returns number of controls loaded, so 0 if failure -U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require_declaration, eControlType declare_as) +U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, const std::string& xml, bool require_declaration, eControlType declare_as) { std::string name; LLXmlTree xml_controls; - if (!xml_controls.parseFile(filename)) + if (!xml_controls.parseString(xml)) { LL_WARNS("Settings") << "Unable to open control file " << filename << LL_ENDL; return 0; @@ -874,7 +874,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require return 0; } - U32 validitems = 0; + U32 validitems = 0; S32 version; rootp->getAttributeS32("version", version); @@ -1093,24 +1093,24 @@ U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values) { LLSD settings; - llifstream infile; - infile.open(filename.c_str()); - if(!infile.is_open()) + + std::string xml = gDirUtilp->getFileContents(filename); + if (xml.empty()) { LL_WARNS("Settings") << "Cannot find file " << filename << " to load." << LL_ENDL; return 0; } - if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings, infile)) + std::stringstream stream(xml); + if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings, stream)) { - infile.close(); LL_WARNS("Settings") << "Unable to parse LLSD control file " << filename << ". Trying Legacy Method." << LL_ENDL; - return loadFromFileLegacy(filename, true, TYPE_STRING); + return loadFromFileLegacy(filename, xml, true, TYPE_STRING); } U32 validitems = 0; bool hidefromsettingseditor = false; - + for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr) { LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT; @@ -1142,7 +1142,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v { hidefromsettingseditor = false; } - + // If the control exists just set the value from the input file. LLControlVariable* existing_control = getControl(name); if(existing_control) diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 768c45e9f2..4c50d26047 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -344,7 +344,7 @@ public: // Returns number of controls loaded, 0 if failed // If require_declaration is false, will auto-declare controls it finds // as the given type. - U32 loadFromFileLegacy(const std::string& filename, bool require_declaration = true, eControlType declare_as = TYPE_STRING); + U32 loadFromFileLegacy(const std::string& filename, const std::string& xml, bool require_declaration = true, eControlType declare_as = TYPE_STRING); U32 saveToFile(const std::string& filename, bool nondefault_only); U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true); void resetToDefaults(); diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 507bd449fb..658ad3b960 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -650,40 +650,56 @@ bool LLXMLNode::updateNode( return true; } -// static -bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXMLNode* defaults_tree) +static std::map sXMLCache; +static LLSharedMutex sXMLCacheMutex; + +static void saveToCache(const std::string& filename, LLXMLNodePtr& node) { - // Read file -#ifdef LL_RELEASE_WITH_DEBUG_INFO - LL_INFOS("XMLNode") << "parsing XML file: " << filename << LL_ENDL; -#elif defined LL_DEBUG - LL_INFOS("XMLNode") << "parsing XML file: " << filename << LL_ENDL; -#else - LL_DEBUGS("XMLNode") << "parsing XML file: " << filename << LL_ENDL; -#endif //LL_RELEASE_WITH_DEBUG_INFO - LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ - if (fp == NULL) - { - node = NULL ; - return false; - } - fseek(fp, 0, SEEK_END); - U32 length = ftell(fp); - fseek(fp, 0, SEEK_SET); + LLExclusiveMutexLock lock(&sXMLCacheMutex); + sXMLCache.emplace(filename, node.notNull() ? node->deepCopy() : nullptr); +} - U8* buffer = new U8[length+1]; - size_t nread = fread(buffer, 1, length, fp); - buffer[nread] = 0; - fclose(fp); +static bool loadFromCache(const std::string& filename, LLXMLNodePtr& node) +{ + LLSharedMutexLock lock(&sXMLCacheMutex); + auto it = sXMLCache.find(filename); + if (it == sXMLCache.end()) + return false; + node = it->second.notNull() ? it->second->deepCopy() : nullptr; + return node.notNull(); +} - bool rv = parseBuffer(buffer, nread, node, defaults_tree); - delete [] buffer; - return rv; +// static +bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXMLNode* defaults_tree, bool cacheable) +{ + // Try to read from cache + if (cacheable) + { + if (loadFromCache(filename, node)) + return true; + } + + std::string xml = gDirUtilp->getFileContents(filename); + if (xml.empty()) + { + LL_WARNS("XMLNode") << "no XML file: " << filename << LL_ENDL; + } + else if (parseBuffer(xml.data(), xml.size(), node, defaults_tree)) + { + if (cacheable) + { + saveToCache(filename, node); + } + return true; + } + + node = nullptr; + return false; } // static bool LLXMLNode::parseBuffer( - U8* buffer, + const char* buffer, U32 length, LLXMLNodePtr& node, LLXMLNode* defaults) @@ -702,7 +718,7 @@ bool LLXMLNode::parseBuffer( XML_SetUserData(my_parser, (void *)file_node_ptr); // Do the parsing - if (XML_Parse(my_parser, (const char *)buffer, length, true) != XML_STATUS_OK) + if (XML_Parse(my_parser, buffer, length, true) != XML_STATUS_OK) { #ifdef LL_RELEASE_WITH_DEBUG_INFO LL_ERRS() << ""; @@ -846,18 +862,20 @@ bool LLXMLNode::isFullyDefault() } // static -bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, - const std::vector& paths) +bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, const std::vector& paths, bool cacheable) { - if (paths.empty()) return false; + if (paths.empty()) + { + return false; + } std::string filename = paths.front(); if (filename.empty()) { return false; } - - if (!LLXMLNode::parseFile(filename, root, NULL)) + + if (!LLXMLNode::parseFile(filename, root, nullptr, cacheable)) { LL_WARNS() << "Problem reading UI description file: " << filename << LL_ENDL; return false; diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index d5b8b36d86..32aee057ed 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -126,34 +126,34 @@ public: bool isNull(); bool deleteChild(LLXMLNode* child); - void addChild(LLXMLNodePtr& new_child); + void addChild(LLXMLNodePtr& new_child); void setParent(LLXMLNodePtr& new_parent); // reparent if necessary - // Serialization + // Deserialization static bool parseFile( const std::string& filename, - LLXMLNodePtr& node, - LLXMLNode* defaults_tree); + LLXMLNodePtr& node, + LLXMLNode* defaults_tree, + bool cacheable = false); static bool parseBuffer( - U8* buffer, + const char* buffer, U32 length, - LLXMLNodePtr& node, + LLXMLNodePtr& node, LLXMLNode* defaults); static bool parseStream( std::istream& str, - LLXMLNodePtr& node, + LLXMLNodePtr& node, LLXMLNode* defaults); static bool updateNode( LLXMLNodePtr& node, LLXMLNodePtr& update_node); - - static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector& paths); - - + + static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector& paths, bool cacheable = false); + // Write standard XML file header: // static void writeHeaderToFile(LLFILE *out_file); - + // Write XML to file with one attribute per line. // XML escapes values as they are written. void writeToFile(LLFILE *out_file, const std::string& indent = std::string(), bool use_type_decorations=true); @@ -237,7 +237,7 @@ public: // Setters bool setAttributeString(const char* attr, const std::string& value); - + void setBoolValue(const bool value) { setBoolValue(1, &value); } void setByteValue(const U8 value, Encoding encoding = ENCODING_DEFAULT) { setByteValue(1, &value, encoding); } void setIntValue(const S32 value, Encoding encoding = ENCODING_DEFAULT) { setIntValue(1, &value, encoding); } diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp index 85dd3733c7..dba913e468 100644 --- a/indra/llxml/llxmltree.cpp +++ b/indra/llxml/llxmltree.cpp @@ -35,6 +35,7 @@ #include "v4math.h" #include "llquaternion.h" #include "lluuid.h" +#include "lldir.h" ////////////////////////////////////////////////////////////// // LLXmlTree @@ -60,37 +61,37 @@ void LLXmlTree::cleanup() mNodeNames.cleanup(); } - -bool LLXmlTree::parseFile(const std::string &path, bool keep_contents) +bool LLXmlTree::parseFile(const std::string & filename, bool keep_contents) { delete mRoot; mRoot = NULL; - LLXmlTreeParser parser(this); - bool success = parser.parseFile( path, &mRoot, keep_contents ); - if( !success ) + std::string xml = gDirUtilp->getFileContents(filename); + if (xml.empty()) { - S32 line_number = parser.getCurrentLineNumber(); - const char* error = parser.getErrorString(); - LL_WARNS() << "LLXmlTree parse failed. Line " << line_number << ": " << error << LL_ENDL; + LL_WARNS() << "LLXmlTree parse failed. No XML file: " << filename << LL_ENDL; + return false; } + + bool success = parseString(xml, keep_contents); + return success; } - -bool LLXmlTree::parseString(const std::string &string, bool keep_contents) +bool LLXmlTree::parseString(const std::string &xml, bool keep_contents) { delete mRoot; mRoot = NULL; - + LLXmlTreeParser parser(this); - bool success = parser.parseString( string, &mRoot, keep_contents ); - if( !success ) + bool success = parser.parseString(xml, &mRoot, keep_contents); + if (!success) { S32 line_number = parser.getCurrentLineNumber(); const char* error = parser.getErrorString(); LL_WARNS() << "LLXmlTree parse failed. Line " << line_number << ": " << error << LL_ENDL; } + return success; } @@ -553,28 +554,28 @@ bool LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, b return success; } -bool LLXmlTreeParser::parseString(const std::string &string, LLXmlTreeNode** root, bool keep_contents) +bool LLXmlTreeParser::parseString(const std::string& xml, LLXmlTreeNode** root, bool keep_contents) { llassert( !mRoot ); llassert( !mCurrent ); - + mKeepContents = keep_contents; - - bool success = LLXmlParser::parse(string.c_str(), string.length(), true); - + + bool success = LLXmlParser::parse(xml.data(), (int)xml.size(), true); + *root = mRoot; mRoot = NULL; - - if( success ) + + if (success) { - llassert( !mCurrent ); + llassert(!mCurrent); } + mCurrent = NULL; return success; } - const std::string& LLXmlTreeParser::tabs() { static std::string s; diff --git a/indra/llxml/llxmltree.h b/indra/llxml/llxmltree.h index 554332da45..d47f26f731 100644 --- a/indra/llxml/llxmltree.h +++ b/indra/llxml/llxmltree.h @@ -56,7 +56,7 @@ public: void cleanup(); virtual bool parseFile(const std::string &path, bool keep_contents = true); - virtual bool parseString(const std::string &string, bool keep_contents = true); + virtual bool parseString(const std::string &xml, bool keep_contents = true); LLXmlTreeNode* getRoot() { return mRoot; } @@ -200,8 +200,8 @@ public: LLXmlTreeParser(LLXmlTree* tree); virtual ~LLXmlTreeParser(); - bool parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents ); - bool parseString(const std::string &string, LLXmlTreeNode** root, bool keep_contents); + bool parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents); + bool parseString(const std::string &xml, LLXmlTreeNode** root, bool keep_contents); protected: const std::string& tabs(); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index fe7efe80d4..24f1503505 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -214,7 +214,6 @@ set(viewer_SOURCE_FILES llblockedlistitem.cpp llblocklist.cpp llbox.cpp - #llbreadcrumbview.cpp # Unused llbrowsernotification.cpp llbuycurrencyhtml.cpp llcallingcard.cpp @@ -471,7 +470,6 @@ set(viewer_SOURCE_FILES lllandmarkactions.cpp lllandmarklist.cpp lllegacyatmospherics.cpp - #lllistbrowser.cpp # Unused lllistcontextmenu.cpp lllistview.cpp lllocalbitmaps.cpp @@ -635,7 +633,7 @@ set(viewer_SOURCE_FILES llregioninfomodel.cpp llregionposition.cpp llremoteparcelrequest.cpp - #llsavedsettingsglue.cpp # Unused + llsaveoutfitcombobtn.cpp #llsaveoutfitcombobtn.cpp # Unused llscenemonitor.cpp llsceneview.cpp @@ -732,7 +730,6 @@ set(viewer_SOURCE_FILES llurlhistory.cpp llurllineeditorctrl.cpp llurlwhitelist.cpp - #llvectorperfoptions.cpp # Unused llversioninfo.cpp llviewchildren.cpp llviewerassetstats.cpp @@ -1005,7 +1002,6 @@ set(viewer_HEADER_FILES llblockedlistitem.h llblocklist.h llbox.h - #llbreadcrumbview.h # Unused llbuycurrencyhtml.h llcallingcard.h llcapabilityprovider.h @@ -1263,7 +1259,6 @@ set(viewer_HEADER_FILES lllandmarkactions.h lllandmarklist.h lllightconstants.h - #lllistbrowser.h # Unused lllistcontextmenu.h lllistview.h lllocalbitmaps.h @@ -1417,7 +1412,6 @@ set(viewer_HEADER_FILES llresourcedata.h llrootview.h #llsavedsettingsglue.h # Unused - #llsaveoutfitcombobtn.h # Unused llscenemonitor.h llsceneview.h llscreenchannel.h @@ -1517,7 +1511,6 @@ set(viewer_HEADER_FILES llurlhistory.h llurllineeditorctrl.h llurlwhitelist.h - #llvectorperfoptions.h # Unused llversioninfo.h llviewchildren.h llviewerassetstats.h diff --git a/indra/newview/fsdata.cpp b/indra/newview/fsdata.cpp index cd13fc516b..c1ec8588e7 100644 --- a/indra/newview/fsdata.cpp +++ b/indra/newview/fsdata.cpp @@ -236,7 +236,8 @@ void downloadComplete(LLSD const &aData, std::string const &aURL, bool success) FSData::getInstance()->processResponder(data, aURL, success, lastModified); } -void downloadCompleteScript(LLSD const &aData, std::string const &aURL, std::string const &aFilename) +#ifdef OPENSIM +static void downloadCompleteScript(LLSD const &aData, std::string const &aURL, std::string const &aFilename) { LL_DEBUGS("fsdata") << aURL << ": " << aData << LL_ENDL; LLSD header = aData[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS][LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS]; @@ -258,7 +259,7 @@ void downloadCompleteScript(LLSD const &aData, std::string const &aURL, std::str LLXMLNodePtr xml_root; std::string stringData; stringData.assign( rawData.begin(), rawData.end() ); // LLXMLNode::parseBuffer wants a U8*, not a const U8*, so need to copy here just to be safe - if ( (!LLXMLNode::parseBuffer( reinterpret_cast< U8*> ( &stringData[0] ), stringData.size(), xml_root, NULL)) || (xml_root.isNull()) || (!xml_root->hasName("script_library")) ) + if ( (!LLXMLNode::parseBuffer(stringData.c_str(), stringData.size(), xml_root, NULL)) || (xml_root.isNull()) || (!xml_root->hasName("script_library"))) { LL_WARNS("fsdata") << "Could not read the script library data from "<< aURL << LL_ENDL; return; @@ -278,7 +279,7 @@ void downloadCompleteScript(LLSD const &aData, std::string const &aURL, std::str } } -void downloadError(LLSD const &aData, std::string const &aURL) +static void downloadError(LLSD const &aData, std::string const &aURL) { LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(aData); @@ -291,6 +292,7 @@ void downloadError(LLSD const &aData, std::string const &aURL) LL_WARNS("fsdata") << "Failed to download " << aURL << ": " << aData << LL_ENDL; } } +#endif // call this just before the login screen and after the LLProxy has been setup. void FSData::startDownload() @@ -330,7 +332,7 @@ void FSData::startDownload() FSCoreHttpUtil::callbackHttpGetRaw(mFSdataDefaultsUrl, boost::bind(downloadComplete, _1, mFSdataDefaultsUrl, true), boost::bind(downloadComplete, _1, mFSdataDefaultsUrl, false), LLCore::HttpHeaders::ptr_t(), httpOpts); } -#if OPENSIM +#ifdef OPENSIM std::string filenames[] = { "scriptlibrary_ossl.xml", "scriptlibrary_aa.xml" }; for (auto const& script_name : filenames) { diff --git a/indra/newview/fsgridhandler.cpp b/indra/newview/fsgridhandler.cpp index 1ae12cbc55..2717b8af74 100644 --- a/indra/newview/fsgridhandler.cpp +++ b/indra/newview/fsgridhandler.cpp @@ -54,9 +54,9 @@ #include "lfsimfeaturehandler.h" // #include "llmaterialtable.h" // FIRE-31628 for access to static var -void gridDownloadError( LLSD const &aData, LLGridManager* mOwner, GridEntry* mData, LLGridManager::AddState mState ) +static void gridDownloadError( LLSD const &aData, LLGridManager* mOwner, GridEntry* mData, LLGridManager::AddState mState ) { - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD( aData ); + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD( aData ); if (HTTP_GATEWAY_TIME_OUT == status.getType() )// gateway timeout ... well ... retry once >_> { @@ -101,13 +101,13 @@ void gridDownloadError( LLSD const &aData, LLGridManager* mOwner, GridEntry* mDa } } -void gridDownloadComplete( LLSD const &aData, LLGridManager* mOwner, GridEntry* mData, LLGridManager::AddState mState ) +static void gridDownloadComplete( LLSD const &aData, LLGridManager* mOwner, GridEntry* mData, LLGridManager::AddState mState ) { //mOwner->decResponderCount(); LLSD header = aData[ LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS ][ LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD( aData[ LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS ] ); + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD( aData[ LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS ] ); - const LLSD::Binary &rawData = aData[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); + const LLSD::Binary &rawData = aData[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); // LL_DEBUGS("GridManager") << mData->grid[GRID_VALUE] << " status: " << getStatus() << " reason: " << getReason() << LL_ENDL; if(LLGridManager::TRYLEGACY == mState && HTTP_OK == status.getType() ) @@ -121,7 +121,7 @@ void gridDownloadComplete( LLSD const &aData, LLGridManager* mOwner, GridEntry* std::string stringData; stringData.assign( rawData.begin(), rawData.end() ); // LLXMLNode::parseBuffer wants a U8*, not a const U8*, so need to copy here just to be safe - if(LLXMLNode::parseBuffer( reinterpret_cast< U8*> ( &stringData[0] ), stringData.size(), mData->info_root, NULL)) + if(LLXMLNode::parseBuffer(stringData.c_str(), stringData.size(), mData->info_root, NULL)) { mOwner->gridInfoResponderCB(mData); } diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 2a35282851..bd9518fac6 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -782,11 +782,6 @@ F32 LLAgentCamera::getCameraZoomFraction(bool get_third_person) return mHUDTargetZoom; } - if (isDisableCameraConstraints()) - { - return mCameraZoomFraction; - } - if (get_third_person || (mFocusOnAvatar && cameraThirdPerson())) { return clamp_rescale(mCameraZoomFraction, MIN_ZOOM_FRACTION, MAX_ZOOM_FRACTION, 1.f, 0.f); @@ -800,6 +795,10 @@ F32 LLAgentCamera::getCameraZoomFraction(bool get_third_person) F32 min_zoom; F32 max_zoom = getCameraMaxZoomDistance(); + if (isDisableCameraConstraints()) + { + max_zoom = MAX_CAMERA_DISTANCE_FROM_OBJECT; + } F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); if (mFocusObject.notNull()) @@ -831,10 +830,6 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction) { mHUDTargetZoom = fraction; } - else if (isDisableCameraConstraints()) - { - mCameraZoomFraction = fraction; - } else if (mFocusOnAvatar && cameraThirdPerson()) { mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION); @@ -849,6 +844,10 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction) { F32 min_zoom = LAND_MIN_ZOOM; F32 max_zoom = getCameraMaxZoomDistance(); + if (isDisableCameraConstraints()) + { + max_zoom = MAX_CAMERA_DISTANCE_FROM_OBJECT; + } if (mFocusObject.notNull()) { diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 18a84860a0..09f59c2b7b 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -210,7 +210,6 @@ #include "llworld.h" #include "llhudeffecttrail.h" -#include "llvectorperfoptions.h" #include "llslurl.h" #include "llurlregistry.h" #include "llwatchdog.h" @@ -3523,7 +3522,7 @@ void LLAppViewer::initStrings() { std::string strings_file = "strings.xml"; std::string strings_path_full = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, strings_file); - if (strings_path_full.empty() || !LLFile::isfile(strings_path_full)) + if (strings_path_full.empty() || !gDirUtilp->fileExists(strings_path_full)) { if (strings_path_full.empty()) { diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 8eb737a2e2..234ce36305 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -61,8 +61,9 @@ LLBlockList::LLBlockList(const Params& p) LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile( "menu_people_blocked_gear.xml", gMenuHolder, - LLViewerMenuHolderGL::child_registry_t::instance()); - if(context_menu) + LLViewerMenuHolderGL::child_registry_t::instance(), + true); + if (context_menu) { mContextMenu = context_menu->getHandle(); } diff --git a/indra/newview/llbreadcrumbview.cpp b/indra/newview/llbreadcrumbview.cpp deleted file mode 100644 index 0bcf55e557..0000000000 --- a/indra/newview/llbreadcrumbview.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file llbreadcrumbview.cpp - * @brief UI widget for displaying position in a folder hierarchy and allowing - * the user to click on a location in the hierarchy. - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "llviewerprecompiledheaders.h" - -#include "llbreadcrumbview.h" - -// TODO - Add more dragons - -// .-. .- -// \_//| /_( -// _/(o)/ .'_( -// /o_.-. \/__( . -// \-\--' |` -// 3\-3\ \ .| -// /--\ '.'/ -// __//_//__.-' -// '-'-'-'-' AoS diff --git a/indra/newview/llbreadcrumbview.h b/indra/newview/llbreadcrumbview.h deleted file mode 100644 index f1b53ab526..0000000000 --- a/indra/newview/llbreadcrumbview.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file llbreadcrumbview.h - * @brief UI widget for displaying position in a folder hierarchy and allowing - * the user to click on a location in the hierarchy. - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#ifndef LLBREADCRUMBVIEW_H -#define LLBREADCRUMBVIEW_H - -#endif // LLBREADCRUMBVIEW_H diff --git a/indra/newview/llbreastmotion.cpp b/indra/newview/llbreastmotion.cpp deleted file mode 100644 index 120cf6c5f3..0000000000 --- a/indra/newview/llbreastmotion.cpp +++ /dev/null @@ -1,405 +0,0 @@ -/** - * @file llbreastmotion.cpp - * @brief Implementation of LLBreastMotion class. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -//----------------------------------------------------------------------------- -// Header Files -//----------------------------------------------------------------------------- -#include "llviewerprecompiledheaders.h" -#include "linden_common.h" - -#include "m3math.h" -#include "v3dmath.h" - -#include "llbreastmotion.h" -#include "llcharacter.h" -#include "llviewercontrol.h" -#include "llviewervisualparam.h" -#include "llvoavatarself.h" - -#define MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION 0.f; - -#define N_PARAMS 2 - -// User-set params -static const std::string breast_param_names_user[N_PARAMS] = -{ - "Breast_Female_Cleavage_Driver", - "Breast_Gravity_Driver" -}; - -// Params driven by this algorithm -static const std::string breast_param_names_driven[N_PARAMS] = -{ - "Breast_Female_Cleavage", - "Breast_Gravity" -}; - - - -LLBreastMotion::LLBreastMotion(const LLUUID &id) : - LLMotion(id), - mCharacter(NULL) -{ - mName = "breast_motion"; - mChestState = new LLJointState; - - mBreastMassParam = (F32)1.0; - mBreastDragParam = LLVector3((F32)0.1, (F32)0.1, (F32)0.1); - mBreastSmoothingParam = (U32)2; - mBreastGravityParam = (F32)0.0; - - mBreastSpringParam = LLVector3((F32)3.0, (F32)0.0, (F32)3.0); - mBreastGainParam = LLVector3((F32)50.0, (F32)0.0, (F32)50.0); - mBreastDampingParam = LLVector3((F32)0.3, (F32)0.0, (F32)0.3); - mBreastMaxVelocityParam = LLVector3((F32)10.0, (F32)0.0, (F32)10.0); - - mBreastParamsUser[0] = mBreastParamsUser[1] = mBreastParamsUser[2] = NULL; - mBreastParamsDriven[0] = mBreastParamsDriven[1] = mBreastParamsDriven[2] = NULL; - - mCharLastPosition_world_pt = LLVector3(0,0,0); - mCharLastVelocity_local_vec = LLVector3(0,0,0); - mCharLastAcceleration_local_vec = LLVector3(0,0,0); - mBreastLastPosition_local_pt = LLVector3(0,0,0); - mBreastLastUpdatePosition_local_pt = LLVector3(0,0,0); - mBreastVelocity_local_vec = LLVector3(0,0,0); -} - -LLBreastMotion::~LLBreastMotion() -{ -} - -BOOL LLBreastMotion::onActivate() -{ - return TRUE; -} - -void LLBreastMotion::onDeactivate() -{ -} - -LLMotion::LLMotionInitStatus LLBreastMotion::onInitialize(LLCharacter *character) -{ - mCharacter = character; - - if (!mChestState->setJoint(character->getJoint("mChest"))) - { - return STATUS_FAILURE; - } - - mChestState->setUsage(LLJointState::ROT); - addJointState( mChestState ); - - for (U32 i=0; i < N_PARAMS; i++) - { - mBreastParamsUser[i] = NULL; - mBreastParamsDriven[i] = NULL; - mBreastParamsMin[i] = 0; - mBreastParamsMax[i] = 0; - if (breast_param_names_user[i] != "" && breast_param_names_driven[i] != "") - { - mBreastParamsUser[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_user[i].c_str()); - mBreastParamsDriven[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_driven[i].c_str()); - if (mBreastParamsDriven[i]) - { - mBreastParamsMin[i] = mBreastParamsDriven[i]->getMinWeight(); - mBreastParamsMax[i] = mBreastParamsDriven[i]->getMaxWeight(); - } - } - } - - mTimer.reset(); - return STATUS_SUCCESS; -} - -F32 LLBreastMotion::getMinPixelArea() -{ - return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION; -} - - -F32 LLBreastMotion::calculateTimeDelta() -{ - const F32 time = mTimer.getElapsedTimeF32(); - const F32 time_delta = time - mLastTime; - mLastTime = time; - return time_delta; -} - -// Local space means "parameter space". -LLVector3 LLBreastMotion::toLocal(const LLVector3 &world_vector) -{ - LLVector3 local_vec(0,0,0); - - LLJoint *chest_joint = mChestState->getJoint(); - const LLQuaternion world_rot = chest_joint->getWorldRotation(); - - // Cleavage - LLVector3 breast_dir_world_vec = LLVector3(-1,0,0) * world_rot; // -1 b/c cleavage param changes opposite to direction - breast_dir_world_vec.normalize(); - local_vec[0] = world_vector * breast_dir_world_vec; - - // Up-Down Bounce - LLVector3 breast_up_dir_world_vec = LLVector3(0,0,1) * world_rot; - breast_up_dir_world_vec.normalize(); - local_vec[1] = world_vector * breast_up_dir_world_vec; - - return local_vec; -} - -LLVector3 LLBreastMotion::calculateVelocity_local(const F32 time_delta) -{ - LLJoint *chest_joint = mChestState->getJoint(); - const LLVector3 world_pos_pt = chest_joint->getWorldPosition(); - const LLQuaternion world_rot = chest_joint->getWorldRotation(); - const LLVector3 last_world_pos_pt = mCharLastPosition_world_pt; - const LLVector3 char_velocity_world_vec = (world_pos_pt-last_world_pos_pt) / time_delta; - const LLVector3 char_velocity_local_vec = toLocal(char_velocity_world_vec); - - return char_velocity_local_vec; -} - -LLVector3 LLBreastMotion::calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec, - const F32 time_delta) -{ - LLVector3 char_acceleration_local_vec = new_char_velocity_local_vec - mCharLastVelocity_local_vec; - - char_acceleration_local_vec = - char_acceleration_local_vec * 1.0/mBreastSmoothingParam + - mCharLastAcceleration_local_vec * (mBreastSmoothingParam-1.0)/mBreastSmoothingParam; - - mCharLastAcceleration_local_vec = char_acceleration_local_vec; - - return char_acceleration_local_vec; -} - -BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) -{ - // Skip if disabled globally. - // Attempt to speed up things a little - // if (!gSavedSettings.getBOOL("AvatarPhysics")) - static LLCachedControl AvatarPhysics(gSavedSettings, "AvatarPhysics"); - if (!AvatarPhysics) - // - { - return TRUE; - } - - // Higher LOD is better. This controls the granularity - // and frequency of updates for the motions. - const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor; - if (lod_factor == 0) - { - return TRUE; - } - - if (mCharacter->getSex() != SEX_FEMALE) return TRUE; - const F32 time_delta = calculateTimeDelta(); - if (time_delta < .01 || time_delta > 10.0) return TRUE; - - - //////////////////////////////////////////////////////////////////////////////// - // Get all parameters and settings - // - - mBreastMassParam = mCharacter->getVisualParamWeight("Breast_Physics_Mass"); - mBreastSmoothingParam = (U32)(mCharacter->getVisualParamWeight("Breast_Physics_Smoothing")); - mBreastGravityParam = mCharacter->getVisualParamWeight("Breast_Physics_Gravity"); - - mBreastSpringParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Spring"); - mBreastGainParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Gain"); - mBreastDampingParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Damping"); - mBreastMaxVelocityParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Max_Velocity"); - mBreastDragParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Drag"); - - mBreastSpringParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Spring"); - mBreastGainParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Gain"); - mBreastDampingParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Damping"); - mBreastMaxVelocityParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Max_Velocity"); - mBreastDragParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Drag"); - - - // Get the current morph parameters. - LLVector3 breast_user_local_pt(0,0,0); - for (U32 i=0; i < N_PARAMS; i++) - { - if (mBreastParamsUser[i] != NULL) - { - breast_user_local_pt[i] = mBreastParamsUser[i]->getWeight(); - } - } - - LLVector3 breast_current_local_pt = mBreastLastPosition_local_pt; - - // - // End parameters and settings - //////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////// - // Calculate velocity and acceleration in parameter space. - // - - const LLVector3 char_velocity_local_vec = calculateVelocity_local(time_delta); - const LLVector3 char_acceleration_local_vec = calculateAcceleration_local(char_velocity_local_vec, time_delta); - mCharLastVelocity_local_vec = char_velocity_local_vec; - - LLJoint *chest_joint = mChestState->getJoint(); - mCharLastPosition_world_pt = chest_joint->getWorldPosition(); - - // - // End velocity and acceleration - //////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////// - // Calculate the total force - // - - // Spring force is a restoring force towards the original user-set breast position. - // F = kx - const LLVector3 spring_length_local = breast_current_local_pt-breast_user_local_pt; - LLVector3 force_spring_local_vec = -spring_length_local; force_spring_local_vec *= mBreastSpringParam; - - // Acceleration is the force that comes from the change in velocity of the torso. - // F = ma + mg - LLVector3 force_accel_local_vec = char_acceleration_local_vec * mBreastMassParam; - const LLVector3 force_gravity_local_vec = toLocal(LLVector3(0,0,1))* mBreastGravityParam * mBreastMassParam; - force_accel_local_vec += force_gravity_local_vec; - force_accel_local_vec *= mBreastGainParam; - - // Damping is a restoring force that opposes the current velocity. - // F = -kv - LLVector3 force_damping_local_vec = -mBreastDampingParam; - force_damping_local_vec *= mBreastVelocity_local_vec; - - // Drag is a force imparted by velocity, intuitively it is similar to wind resistance. - // F = .5v*v - LLVector3 force_drag_local_vec = .5*char_velocity_local_vec; - force_drag_local_vec *= char_velocity_local_vec; - force_drag_local_vec *= mBreastDragParam[0]; - - LLVector3 force_net_local_vec = - force_accel_local_vec + - force_gravity_local_vec + - force_spring_local_vec + - force_damping_local_vec + - force_drag_local_vec; - - // - // End total force - //////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////// - // Calculate new params - // - - // Calculate the new acceleration based on the net force. - // a = F/m - LLVector3 acceleration_local_vec = force_net_local_vec / mBreastMassParam; - mBreastVelocity_local_vec += acceleration_local_vec; - mBreastVelocity_local_vec.clamp(-mBreastMaxVelocityParam*100.0, mBreastMaxVelocityParam*100.0); - - // Temporary debugging setting to cause all avatars to move, for profiling purposes. - // Attempt to speed up things a little - // if (gSavedSettings.getBOOL("AvatarPhysicsTest")) - static LLCachedControl AvatarPhysicsTest(gSavedSettings, "AvatarPhysicsTest"); - if (AvatarPhysicsTest) - // - { - mBreastVelocity_local_vec[0] = sin(mTimer.getElapsedTimeF32()*4.0)*5.0; - mBreastVelocity_local_vec[1] = sin(mTimer.getElapsedTimeF32()*3.0)*5.0; - } - // Calculate the new parameters and clamp them to the min/max ranges. - LLVector3 new_local_pt = breast_current_local_pt + mBreastVelocity_local_vec*time_delta; - new_local_pt.clamp(mBreastParamsMin,mBreastParamsMax); - - // Set the new parameters. - for (U32 i=0; i < 3; i++) - { - // If the param is disabled, just set the param to the user value. - if (mBreastMaxVelocityParam[i] == 0) - { - new_local_pt[i] = breast_user_local_pt[i]; - } - if (mBreastParamsDriven[i]) - { - mCharacter->setVisualParamWeight(mBreastParamsDriven[i], - // [Legacy Bake] - //new_local_pt[i]); - new_local_pt[i], FALSE); - } - } - - mBreastLastPosition_local_pt = new_local_pt; - - // - // End calculate new params - //////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////// - // Conditionally update the visual params - // - - // Updating the visual params (i.e. what the user sees) is fairly expensive. - // So only update if the params have changed enough, and also take into account - // the graphics LOD settings. - - // For non-self, if the avatar is small enough visually, then don't update. - const BOOL is_self = (dynamic_cast(this) != NULL); - if (!is_self) - { - const F32 area_for_max_settings = 0.0; - const F32 area_for_min_settings = 1400.0; - - const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor); - const F32 pixel_area = fsqrtf(mCharacter->getPixelArea()); - if (pixel_area < area_for_this_setting) - { - return TRUE; - } - } - - // If the parameter hasn't changed enough, then don't update. - LLVector3 position_diff = mBreastLastUpdatePosition_local_pt-new_local_pt; - for (U32 i=0; i < 3; i++) - { - const F32 min_delta = (1.0-lod_factor)*(mBreastParamsMax[i]-mBreastParamsMin[i])/2.0; - if (llabs(position_diff[i]) > min_delta) - { - mCharacter->updateVisualParams(); - mBreastLastUpdatePosition_local_pt = new_local_pt; - return TRUE; - } - } - - // - // End update visual params - //////////////////////////////////////////////////////////////////////////////// - - return TRUE; -} diff --git a/indra/newview/llbreastmotion.h b/indra/newview/llbreastmotion.h deleted file mode 100644 index d099257a33..0000000000 --- a/indra/newview/llbreastmotion.h +++ /dev/null @@ -1,154 +0,0 @@ -/** - * @file llbreastmotion.h - * @brief Implementation of LLBreastMotion class. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLBREASTMOTION_H -#define LL_LLBREASTMOTION_H - -//----------------------------------------------------------------------------- -// Header files -//----------------------------------------------------------------------------- -#include "llmotion.h" -#include "llframetimer.h" - -#define BREAST_MOTION_FADEIN_TIME 1.0f -#define BREAST_MOTION_FADEOUT_TIME 1.0f - -class LLViewerVisualParam; - -//----------------------------------------------------------------------------- -// class LLBreastMotion -//----------------------------------------------------------------------------- -class LLBreastMotion : - public LLMotion -{ -public: - // Constructor - LLBreastMotion(const LLUUID &id); - - // Destructor - virtual ~LLBreastMotion(); - -public: - //------------------------------------------------------------------------- - // functions to support MotionController and MotionRegistry - //------------------------------------------------------------------------- - - // static constructor - // all subclasses must implement such a function and register it - static LLMotion *create(const LLUUID &id) { return new LLBreastMotion(id); } - -public: - //------------------------------------------------------------------------- - // animation callbacks to be implemented by subclasses - //------------------------------------------------------------------------- - - // motions must specify whether or not they loop - virtual bool getLoop() { return true; } - - // motions must report their total duration - virtual F32 getDuration() { return 0.0; } - - // motions must report their "ease in" duration - virtual F32 getEaseInDuration() { return BREAST_MOTION_FADEIN_TIME; } - - // motions must report their "ease out" duration. - virtual F32 getEaseOutDuration() { return BREAST_MOTION_FADEOUT_TIME; } - - // called to determine when a motion should be activated/deactivated based on avatar pixel coverage - virtual F32 getMinPixelArea(); - - // motions must report their priority - virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; } - - virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; } - - // run-time (post constructor) initialization, - // called after parameters have been set - // must return true to indicate success and be available for activation - virtual LLMotionInitStatus onInitialize(LLCharacter *character); - - // called when a motion is activated - // must return TRUE to indicate success, or else - // it will be deactivated - virtual bool onActivate(); - - // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual bool onUpdate(F32 time, U8* joint_mask); - - // called when a motion is deactivated - virtual void onDeactivate(); - -protected: - LLVector3 toLocal(const LLVector3 &world_vector); - LLVector3 calculateVelocity_local(const F32 time_delta); - LLVector3 calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec, - const F32 time_delta); - F32 calculateTimeDelta(); -private: - //------------------------------------------------------------------------- - // joint states to be animated - //------------------------------------------------------------------------- - LLPointer mChestState; - LLCharacter* mCharacter; - - - //------------------------------------------------------------------------- - // miscellaneous parameters - //------------------------------------------------------------------------- - LLViewerVisualParam *mBreastParamsUser[3]; - LLViewerVisualParam *mBreastParamsDriven[3]; - LLVector3 mBreastParamsMin; - LLVector3 mBreastParamsMax; - - LLVector3 mCharLastPosition_world_pt; // Last position of the avatar - LLVector3 mCharLastVelocity_local_vec; // How fast the character is moving - LLVector3 mCharLastAcceleration_local_vec; // Change in character velocity - - LLVector3 mBreastLastPosition_local_pt; // Last parameters for breast - LLVector3 mBreastVelocity_local_vec; // How fast the breast params are moving - LLVector3 mBreastLastUpdatePosition_local_pt; // Last parameters when visual update was sent - - - F32 mBreastMassParam; - F32 mBreastGravityParam; - U32 mBreastSmoothingParam; - - LLVector3 mBreastSpringParam; - LLVector3 mBreastDampingParam; - LLVector3 mBreastGainParam; - LLVector3 mBreastMaxVelocityParam; - LLVector3 mBreastDragParam; - - LLFrameTimer mTimer; - F32 mLastTime; - - U32 mFileTicks; -}; - -#endif // LL_LLBREASTMOTION_H - diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 6ebb1589d4..b52745f890 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -145,7 +145,7 @@ public: static LLChatHistoryHeader* createInstance(const std::string& file_name) { LLChatHistoryHeader* pInstance = new LLChatHistoryHeader; - pInstance->buildFromFile(file_name); + pInstance->buildFromFile(file_name, true); return pInstance; } @@ -607,7 +607,7 @@ public: mUserNameTextBox = getChild("user_name"); mTimeBoxTextBox = getChild("time_box"); - mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance()); + mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance(), true); if (mInfoCtrl) { mInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, mInfoCtrl)); @@ -1239,7 +1239,7 @@ void LLChatHistory::initFromParams(const LLChatHistory::Params& p) LLView* LLChatHistory::getSeparator() { - LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance()); + LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance(), true); return separator; } diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index bc61fac00b..030d24bed8 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -657,12 +657,11 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG // This method reads the llsd based config file, and uses it to set // members of a control group. LLSD clpConfigLLSD; - - llifstream input_stream; - input_stream.open(config_filename.c_str(), std::ios::in | std::ios::binary); - if(input_stream.is_open()) + std::string xml = gDirUtilp->getFileContents(config_filename); + if (!xml.empty()) { + std::stringstream input_stream(xml); LLSDSerialize::fromXML(clpConfigLLSD, input_stream); for(LLSD::map_iterator option_itr = clpConfigLLSD.beginMap(); option_itr != clpConfigLLSD.endMap(); diff --git a/indra/newview/lldensityctrl.cpp b/indra/newview/lldensityctrl.cpp deleted file mode 100644 index 298a309e7c..0000000000 --- a/indra/newview/lldensityctrl.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/** -* @file lldensityctrl.cpp -* @brief Control for specifying density over a height range for sky settings. -* -* $LicenseInfo:firstyear=2011&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2011, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" - -#include "lldensityctrl.h" - -#include "llslider.h" -#include "llsliderctrl.h" -#include "llsettingssky.h" - -static LLDefaultChildRegistry::Register register_density_control("densityctrl"); - -const std::string LLDensityCtrl::DENSITY_RAYLEIGH("density_rayleigh"); -const std::string LLDensityCtrl::DENSITY_MIE("density_mie"); -const std::string LLDensityCtrl::DENSITY_ABSORPTION("density_absorption"); - -namespace -{ - const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL("level_exponential"); - const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE("exponential_scale"); - const std::string FIELD_SKY_DENSITY_PROFILE_LINEAR("level_linear"); - const std::string FIELD_SKY_DENSITY_PROFILE_CONSTANT("level_constant"); - const std::string FIELD_SKY_DENSITY_MAX_ALTITUDE("max_altitude"); - const std::string FIELD_SKY_DENSITY_ANISO_FACTOR("aniso_factor"); - const std::string FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL("aniso_factor_label"); -} - -const std::string& LLDensityCtrl::NameForDensityProfileType(DensityProfileType t) -{ - switch (t) - { - case Rayleigh: return DENSITY_RAYLEIGH; - case Mie: return DENSITY_MIE; - case Absorption: return DENSITY_ABSORPTION; - default: - break; - } - - llassert(false); - return DENSITY_RAYLEIGH; -} - -LLDensityCtrl::Params::Params() -: image_density_feedback("image_density_feedback") -, lbl_exponential("label_exponential") -, lbl_exponential_scale("label_exponential_scale") -, lbl_linear("label_linear") -, lbl_constant("label_constant") -, lbl_max_altitude("label_max_altitude") -, lbl_aniso_factor("label_aniso_factor") -, profile_type(LLDensityCtrl::Rayleigh) -{ -} - -LLDensityCtrl::LLDensityCtrl(const Params& params) -: mProfileType(params.profile_type) -, mImgDensityFeedback(params.image_density_feedback) -{ - -} - -LLSD LLDensityCtrl::getProfileConfig() -{ - LLSD config; - switch (mProfileType) - { - case Rayleigh: return mSkySettings->getRayleighConfigs(); - case Mie: return mSkySettings->getMieConfigs(); - case Absorption: return mSkySettings->getAbsorptionConfigs(); - default: - break; - } - llassert(false); - return config; -} - -BOOL LLDensityCtrl::postBuild() -{ - getChild(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialChanged(); }); - getChild(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialScaleFactorChanged(); }); - getChild(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLinearChanged(); }); - getChild(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onConstantChanged(); }); - getChild(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMaxAltitudeChanged(); }); - getChild(FIELD_SKY_DENSITY_ANISO_FACTOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAnisoFactorChanged(); }); - - if (mProfileType != Mie) - { - getChild(FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL)->setValue(false); - getChild(FIELD_SKY_DENSITY_ANISO_FACTOR)->setVisible(false); - } - - return TRUE; -} - -void LLDensityCtrl::setEnabled(BOOL enabled) -{ - getChild(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setEnabled(enabled); - getChild(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setEnabled(enabled); - getChild(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setEnabled(enabled); - getChild(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setEnabled(enabled); - getChild(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setEnabled(enabled); - - if (mProfileType == Mie) - { - getChild(FIELD_SKY_DENSITY_ANISO_FACTOR)->setEnabled(enabled); - } -} - -void LLDensityCtrl::refresh() -{ - if (!mSkySettings) - { - setAllChildrenEnabled(FALSE); - setEnabled(FALSE); - return; - } - - setEnabled(TRUE); - setAllChildrenEnabled(TRUE); - - LLSD config = getProfileConfig(); - - getChild(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM]); - getChild(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR]); - getChild(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM]); - getChild(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM]); - getChild(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH]); - - if (mProfileType == Mie) - { - getChild(FIELD_SKY_DENSITY_ANISO_FACTOR)->setValue(config[LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR]); - } -} - -void LLDensityCtrl::updateProfile() -{ - F32 exponential_term = getChild(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->getValueF32(); - F32 exponential_scale = getChild(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->getValueF32(); - F32 linear_term = getChild(FIELD_SKY_DENSITY_PROFILE_LINEAR)->getValueF32(); - F32 constant_term = getChild(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->getValueF32(); - F32 max_alt = getChild(FIELD_SKY_DENSITY_MAX_ALTITUDE)->getValueF32(); - F32 aniso_factor = 0.0f; - - if (mProfileType == Mie) - { - aniso_factor = getChild(FIELD_SKY_DENSITY_ANISO_FACTOR)->getValueF32(); - } - - LLSD profile = LLSettingsSky::createSingleLayerDensityProfile(max_alt, exponential_term, exponential_scale, linear_term, constant_term, aniso_factor); - - switch (mProfileType) - { - case Rayleigh: mSkySettings->setRayleighConfigs(profile); break; - case Mie: mSkySettings->setMieConfigs(profile); break; - case Absorption: mSkySettings->setAbsorptionConfigs(profile); break; - default: - break; - } -} - -void LLDensityCtrl::onExponentialChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onExponentialScaleFactorChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onLinearChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onConstantChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onMaxAltitudeChanged() -{ - updateProfile(); - updatePreview(); -} - -void LLDensityCtrl::onAnisoFactorChanged() -{ - updateProfile(); -} - -void LLDensityCtrl::updatePreview() -{ - // AdvancedAtmospherics TODO - // Generate image according to current density profile -} - diff --git a/indra/newview/lldensityctrl.h b/indra/newview/lldensityctrl.h deleted file mode 100644 index 789022803c..0000000000 --- a/indra/newview/lldensityctrl.h +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @file lldensityctrl.h -* @brief Control for specifying density over a height range for sky settings. -* -* $LicenseInfo:firstyear=2011&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2011, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#ifndef LLDENSITY_CTRL_H -#define LLDENSITY_CTRL_H - -#include "lluictrl.h" -#include "llsettingssky.h" -#include "lltextbox.h" -#include "llsliderctrl.h" - -class LLDensityCtrl : public LLUICtrl -{ -public: - static const std::string DENSITY_RAYLEIGH; - static const std::string DENSITY_MIE; - static const std::string DENSITY_ABSORPTION; - - // Type of density profile this tab is updating - enum DensityProfileType - { - Rayleigh, - Mie, - Absorption - }; - - static const std::string& NameForDensityProfileType(DensityProfileType t); - - struct Params : public LLInitParam::Block - { - Optional lbl_exponential, - lbl_exponential_scale, - lbl_linear, - lbl_constant, - lbl_max_altitude, - lbl_aniso_factor; - - Optional exponential_slider, - exponential_scale_slider, - linear_slider, - constant_slider, - aniso_factor_slider; - - Optional image_density_feedback; - - DensityProfileType profile_type; - Params(); - }; - - virtual BOOL postBuild() override; - virtual void setEnabled(BOOL enabled) override; - - void setProfileType(DensityProfileType t) { mProfileType = t; } - - void refresh(); - void updateProfile(); - - LLSettingsSky::ptr_t getSky() const { return mSkySettings; } - void setSky(const LLSettingsSky::ptr_t &sky) { mSkySettings = sky; refresh(); } - -protected: - friend class LLUICtrlFactory; - LLDensityCtrl(const Params&); - - LLSD getProfileConfig(); - void updatePreview(); - -private: - void onExponentialChanged(); - void onExponentialScaleFactorChanged(); - void onLinearChanged(); - void onConstantChanged(); - void onMaxAltitudeChanged(); - void onAnisoFactorChanged(); - - DensityProfileType mProfileType = Rayleigh; - LLUIImage* mImgDensityFeedback = nullptr; - LLSettingsSky::ptr_t mSkySettings; -}; - -#endif LLDENSITY_CTRL_H diff --git a/indra/newview/llface.inl b/indra/newview/llface.inl deleted file mode 100644 index c37b77d2cd..0000000000 --- a/indra/newview/llface.inl +++ /dev/null @@ -1,160 +0,0 @@ -/** - * @file llface.inl - * @brief Inline functions for LLFace - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFACE_INL -#define LL_LLFACE_INL - -#include "llglheaders.h" -#include "llrender.h" - -inline BOOL LLFace::getDirty() const -{ - return (mGeneration != mDrawPoolp->mGeneration); -} - -inline void LLFace::clearDirty() -{ - mGeneration = mDrawPoolp->mGeneration; -} - -inline const LLTextureEntry* LLFace::getTextureEntry() const -{ - return mVObjp->getTE(mTEOffset); -} - -inline LLDrawPool* LLFace::getPool() const -{ - return mDrawPoolp; -} - -inline S32 LLFace::getStride() const -{ - return mDrawPoolp->getStride(); -} - -inline LLDrawable* LLFace::getDrawable() const -{ - return mDrawablep; -} - -inline LLViewerObject* LLFace::getViewerObject() const -{ - return mVObjp; -} - -inline S32 LLFace::getColors (LLStrider &colors) -{ - if (!mGeomCount) - { - return -1; - } - LLColor4U *colorp = NULL; - if (isState(BACKLIST)) - { - if (!mBackupMem) - { - printDebugInfo(); - LL_ERRS() << "No backup memory for face" << LL_ENDL; - } - colorp = (LLColor4U*)(mBackupMem + (4 * mIndicesCount) + (mGeomCount * mDrawPoolp->getStride())); - colors = colorp; - return 0; - } - else - { - llassert(mGeomIndex >= 0); - if (!mDrawPoolp->getColorStrider(colors, mGeomIndex)) - { - printDebugInfo(); - LL_ERRS() << "No color pointer for a color strider!" << LL_ENDL; - } - mDrawPoolp->setDirtyColors(); - return mGeomIndex; - } -} - -inline S32 LLFace::getTexCoords (LLStrider &texCoords, S32 pass ) -{ - if (!mGeomCount) - { - return -1; - } - if (isState(BACKLIST)) - { - if (!mBackupMem) - { - printDebugInfo(); - LL_ERRS() << "No backup memory for face" << LL_ENDL; - } - texCoords = (LLVector2*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_TEX_COORDS0 + pass]); - texCoords.setStride( mDrawPoolp->getStride()); - return 0; - } - else - { - llassert(mGeomIndex >= 0); - mDrawPoolp->getTexCoordStrider(texCoords, mGeomIndex, pass ); - mDrawPoolp->setDirty(); - return mGeomIndex; - } -} - -inline S32 LLFace::getIndices (U32* &indicesp) -{ - if (isState(BACKLIST)) - { - indicesp = (U32*)mBackupMem; - return 0; - } - else - { - indicesp = mDrawPoolp->getIndices(mIndicesIndex); - llassert(mGeomIndex >= 0); - return mGeomIndex; - } -} - -inline const U32* LLFace::getRawIndices() const -{ - llassert(!isState(BACKLIST)); - - return &mDrawPoolp->mIndices[mIndicesIndex]; -} - - -inline void LLFace::bindTexture(S32 stage) const -{ - if (mTexture) - { - mTexture->bindTexture(stage); - } - else - { - LLImageGL::unbindTexture(stage, GL_TEXTURE_2D); - } -} - -#endif diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 1a0ff138aa..610f6c2e5f 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1007,10 +1007,11 @@ const LLButton::Params& LLFavoritesBarCtrl::getButtonParams() if (!params_initialized) { LLXMLNodePtr button_xml_node; - if(LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", button_xml_node)) + static const std::string filename("favorites_bar_button.xml"); + if (LLUICtrlFactory::getLayeredXMLNode(filename, button_xml_node, LLDir::CURRENT_SKIN, true)) { LLXUIParser parser; - parser.readXUI(button_xml_node, button_params, "favorites_bar_button.xml"); + parser.readXUI(button_xml_node, button_params, filename); } params_initialized = true; } diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index 34e6603d35..2c15399c86 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -43,7 +43,6 @@ #include "llmimetypes.h" #include "llnotifications.h" #include "llnotificationsutil.h" -// #include "llsavedsettingsglue.h" # Unused #include "llviewertexturelist.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp deleted file mode 100644 index cfd392c309..0000000000 --- a/indra/newview/llfloatereditsky.cpp +++ /dev/null @@ -1,718 +0,0 @@ -/** - * @file llfloatereditsky.cpp - * @brief Floater to create or edit a sky preset - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloatereditsky.h" - -#include - -// libs -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llcombobox.h" -#include "llmultisliderctrl.h" -#include "llnotifications.h" -#include "llnotificationsutil.h" -#include "llsliderctrl.h" -#include "lltabcontainer.h" -#include "lltimectrl.h" -#include "lljoystickbutton.h" - -// newview -#include "llagent.h" -#include "llcolorswatch.h" -#include "llregioninfomodel.h" -#include "llviewerregion.h" - -#include "v3colorutil.h" -#include "llenvironment.h" -#include "llenvadapters.h" - -namespace -{ - const F32 WL_SUN_AMBIENT_SLIDER_SCALE(3.0f); - const F32 WL_BLUE_HORIZON_DENSITY_SCALE(2.0f); - const F32 WL_CLOUD_SLIDER_SCALE(1.0f); -} - - -static F32 time24_to_sun_pos(F32 time24) -{ - F32 sun_pos = fmodf((time24 - 6) / 24.0f, 1.0f); - if (sun_pos < 0) ++sun_pos; - return sun_pos; -} - -LLFloaterEditSky::LLFloaterEditSky(const LLSD &key): - LLFloater(key), - mSkyPresetNameEditor(NULL), - mSkyPresetCombo(NULL), - mMakeDefaultCheckBox(NULL), - mSaveButton(NULL), - mSkyAdapter() -{ -} - -// virtual -BOOL LLFloaterEditSky::postBuild() -{ - mSkyPresetNameEditor = getChild("sky_preset_name"); - mSkyPresetCombo = getChild("sky_preset_combo"); - mMakeDefaultCheckBox = getChild("make_default_cb"); - mSaveButton = getChild("save"); - mSkyAdapter = boost::make_shared(); - - LLEnvironment::instance().setSkyListChange(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this)); - - initCallbacks(); - -// // Create the sun position scrubber on the slider. -// getChild("WLSunPos")->addSlider(12.f); - - return TRUE; -} - -// virtual -void LLFloaterEditSky::onOpen(const LLSD& key) -{ - bool new_preset = isNewPreset(); - std::string param = key.asString(); - std::string floater_title = getString(std::string("title_") + param); - std::string hint = getString(std::string("hint_" + param)); - - // Update floater title. - setTitle(floater_title); - - // Update the hint at the top. - getChild("hint")->setValue(hint); - - // Hide the hint to the right of the combo if we're invoked to create a new preset. - // FS-modified floater might not have this - //getChildView("note")->setVisible(!new_preset); - LLView* note = findChildView("note"); - if (note) - { - note->setVisible(!new_preset); - } - // - - // Switch between the sky presets combobox and preset name input field. - mSkyPresetCombo->setVisible(!new_preset); - mSkyPresetNameEditor->setVisible(new_preset); - - reset(); -} - -// virtual -void LLFloaterEditSky::onClose(bool app_quitting) -{ - if (!app_quitting) // there's no point to change environment if we're quitting - { - LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); - } -} - -// virtual -void LLFloaterEditSky::draw() -{ - syncControls(); - LLFloater::draw(); -} - -void LLFloaterEditSky::initCallbacks(void) -{ - // *TODO: warn user if a region environment update comes while we're editing a region sky preset. - - mSkyPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this), NULL); - mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditSky::onSkyPresetSelected, this)); - mSkyPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this)); - - mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this)); - - // Connect to region info updates. - LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this)); - - // sunlight - getChild("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mSunlight)); - - // glow - getChild("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &mSkyAdapter->mGlow)); - getChild("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &mSkyAdapter->mGlow)); - - // time of day -// getChild("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); // multi-slider -// getChild("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl -// getChild("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); - getChild("WLSunRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunRotationChanged, this)); - getChild("WLMoonRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onMoonRotationChanged, this)); - - // Clouds - - // Cloud Color - getChild("WLCloudColor")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mCloudColor)); - - // Cloud - getChild("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudMain)); - getChild("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudMain)); - getChild("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudMain)); - - // Cloud Detail - getChild("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudDetail)); - getChild("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudDetail)); - getChild("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudDetail)); - - // Cloud extras - getChild("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudCoverage)); - getChild("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudScale)); - getChild("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1)); - getChild("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1)); - - - // Dome - getChild("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mWLGamma)); - getChild("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1)); -} - -//================================================================================================= - -void LLFloaterEditSky::syncControls() -{ - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - mEditSettings = psky; - - std::string name = psky->getName(); - - mSkyPresetNameEditor->setText(name); - mSkyPresetCombo->setValue(name); - - // Lighting - - // sunlight - mSkyAdapter->mSunlight.setColor3( psky->getSunlightColor() ); - setColorSwatch("WLSunlight", mSkyAdapter->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE); - - // glow - mSkyAdapter->mGlow.setColor3( psky->getGlow() ); - childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f); - childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f); - -// LLSettingsSky::azimalt_t azal = psky->getSunRotationAzAl(); -// -// F32 time24 = sun_pos_to_time24(azal.second / F_TWO_PI); -// getChild("WLSunPos")->setCurSliderValue(time24, TRUE); -// getChild("WLDayTime")->setTime24(time24); -// childSetValue("WLEastAngle", azal.first / F_TWO_PI); - getChild("WLSunRotation")->setRotation(psky->getSunRotation()); - getChild("WLMoonRotation")->setRotation(psky->getMoonRotation()); - - // Clouds - - // Cloud Color - mSkyAdapter->mCloudColor.setColor3( psky->getCloudColor() ); - setColorSwatch("WLCloudColor", mSkyAdapter->mCloudColor, WL_CLOUD_SLIDER_SCALE); - - // Cloud - mSkyAdapter->mCloudMain.setColor3( psky->getCloudPosDensity1() ); - childSetValue("WLCloudX", mSkyAdapter->mCloudMain.getRed()); - childSetValue("WLCloudY", mSkyAdapter->mCloudMain.getGreen()); - childSetValue("WLCloudDensity", mSkyAdapter->mCloudMain.getBlue()); - - // Cloud Detail - mSkyAdapter->mCloudDetail.setColor3( psky->getCloudPosDensity2() ); - childSetValue("WLCloudDetailX", mSkyAdapter->mCloudDetail.getRed()); - childSetValue("WLCloudDetailY", mSkyAdapter->mCloudDetail.getGreen()); - childSetValue("WLCloudDetailDensity", mSkyAdapter->mCloudDetail.getBlue()); - - // Cloud extras - mSkyAdapter->mCloudCoverage = psky->getCloudShadow(); - mSkyAdapter->mCloudScale = psky->getCloudScale(); - childSetValue("WLCloudCoverage", (F32) mSkyAdapter->mCloudCoverage); - childSetValue("WLCloudScale", (F32) mSkyAdapter->mCloudScale); - - // cloud scrolling - LLVector2 scroll_rate = psky->getCloudScrollRate(); - - // LAPRAS: These should go away... - childDisable("WLCloudLockX"); - childDisable("WLCloudLockY"); - - // disable if locked, enable if not - childEnable("WLCloudScrollX"); - childEnable("WLCloudScrollY"); - - // *HACK cloud scrolling is off my an additive of 10 - childSetValue("WLCloudScrollX", scroll_rate[0] - 10.0f); - childSetValue("WLCloudScrollY", scroll_rate[1] - 10.0f); - - // Tweak extras - - mSkyAdapter->mWLGamma = psky->getGamma(); - childSetValue("WLGamma", (F32) mSkyAdapter->mWLGamma); - - childSetValue("WLStarAlpha", psky->getStarBrightness()); -} - -void LLFloaterEditSky::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k) -{ - // Set the value, dividing it by first. - LLColor4 color = from_ctrl.getColor4(); - getChild(name)->set(color / k); -} - -// color control callbacks -void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl) -{ - LLColorSwatchCtrl* swatch = static_cast(ctrl); - LLColor4 color_vec(swatch->get().mV); - - // Multiply RGB values by the appropriate factor. - F32 k = WL_CLOUD_SLIDER_SCALE; - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - else if (color_ctrl->getIsBlueHorizonOrDensity()) - { - k = WL_BLUE_HORIZON_DENSITY_SCALE; - } - - color_vec *= k; // intensity isn't affected by the multiplication - - // Set intensity to maximum of the RGB values. - color_vec.mV[3] = color_max(color_vec); - - // Apply the new RGBI value. - color_ctrl->setColor4(color_vec); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onColorControlRMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - F32 red_value = sldr_ctrl->getValueF32(); - F32 k = 1.0f; - - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - if (color_ctrl->getIsBlueHorizonOrDensity()) - { - k = WL_BLUE_HORIZON_DENSITY_SCALE; - } - color_ctrl->setRed(red_value * k); - - adjustIntensity(color_ctrl, red_value, k); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onColorControlGMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - F32 green_value = sldr_ctrl->getValueF32(); - F32 k = 1.0f; - - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - if (color_ctrl->getIsBlueHorizonOrDensity()) - { - k = WL_BLUE_HORIZON_DENSITY_SCALE; - } - color_ctrl->setGreen(green_value * k); - - adjustIntensity(color_ctrl, green_value, k); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onColorControlBMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - F32 blue_value = sldr_ctrl->getValueF32(); - F32 k = 1.0f; - - if (color_ctrl->getIsSunOrAmbientColor()) - { - k = WL_SUN_AMBIENT_SLIDER_SCALE; - } - if (color_ctrl->getIsBlueHorizonOrDensity()) - { - k = WL_BLUE_HORIZON_DENSITY_SCALE; - } - color_ctrl->setBlue(blue_value * k); - - adjustIntensity(color_ctrl, blue_value, k); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::adjustIntensity(WLColorControl *ctrl, F32 val, F32 scale) -{ - if (ctrl->getHasSliderName()) - { - LLColor4 color = ctrl->getColor4(); - F32 i = color_max(color) / scale; - ctrl->setIntensity(i); - std::string name = ctrl->getSliderName(); - name.append("I"); - - childSetValue(name, i); - } -} - - -/// GLOW SPECIFIC CODE -void LLFloaterEditSky::onGlowRMoved(LLUICtrl* ctrl, void* userdata) -{ - - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - // scaled by 20 - color_ctrl->setRed((2 - sldr_ctrl->getValueF32()) * 20); - - color_ctrl->update(mEditSettings); -} - -/// \NOTE that we want NEGATIVE (-) B -void LLFloaterEditSky::onGlowBMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl* color_ctrl = static_cast(userdata); - - /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big - color_ctrl->setBlue(-sldr_ctrl->getValueF32() * 5); - - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLFloatControl * floatControl = static_cast(userdata); - - floatControl->setValue(sldr_ctrl->getValueF32() / floatControl->getMult()); - - floatControl->update(mEditSettings); -} - - -// Lighting callbacks - -// time of day -void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata) -{ - LLMultiSliderCtrl* sun_msldr = getChild("WLSunPos"); - LLSliderCtrl* east_sldr = getChild("WLEastAngle"); - LLTimeCtrl* time_ctrl = getChild("WLDayTime"); - WLColorControl* color_ctrl = static_cast(userdata); - - F32 time24 = sun_msldr->getCurSliderValue(); - time_ctrl->setTime24(time24); // sync the time ctrl with the new sun position - - // get the two angles - F32 azimuth = F_TWO_PI * east_sldr->getValueF32(); - F32 altitude = F_TWO_PI * time24_to_sun_pos(time24); - mEditSettings->setSunRotation(azimuth, altitude); - mEditSettings->setMoonRotation(azimuth + F_PI, -altitude); - - LLVector4 sunnorm( mEditSettings->getSunDirection(), 1.f ); - - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditSky::onTimeChanged() -{ - F32 time24 = getChild("WLDayTime")->getTime24(); - getChild("WLSunPos")->setCurSliderValue(time24, TRUE); - onSunMoved(getChild("WLSunPos"), &(mSkyAdapter->mLightnorm)); -} - -void LLFloaterEditSky::onSunRotationChanged() -{ - LLJoystickQuaternion* sun_spinner = getChild("WLSunRotation"); - LLQuaternion sunrot(sun_spinner->getRotation()); - - mEditSettings->setSunRotation(sunrot); -} - -void LLFloaterEditSky::onMoonRotationChanged() -{ - LLJoystickQuaternion* moon_spinner = getChild("WLMoonRotation"); - LLQuaternion moonrot(moon_spinner->getRotation()); - - mEditSettings->setMoonRotation(moonrot); -} - -void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - mEditSettings->setStarBrightness(sldr_ctrl->getValueF32()); -} - -// Clouds -void LLFloaterEditSky::onCloudScrollXMoved(LLUICtrl* ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - // *HACK all cloud scrolling is off by an additive of 10. - mEditSettings->setCloudScrollRateX(sldr_ctrl->getValueF32() + 10.0f); -} - -void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - // *HACK all cloud scrolling is off by an additive of 10. - mEditSettings->setCloudScrollRateY(sldr_ctrl->getValueF32() + 10.0f); -} - -//================================================================================================= - -void LLFloaterEditSky::reset() -{ - if (isNewPreset()) - { - mSkyPresetNameEditor->setValue(LLSD()); - mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name - } - else - { - refreshSkyPresetsList(); - - // Disable controls until a sky preset to edit is selected. - enableEditing(false); - } -} - -bool LLFloaterEditSky::isNewPreset() const -{ - return mKey.asString() == "new"; -} - -void LLFloaterEditSky::refreshSkyPresetsList() -{ - mSkyPresetCombo->removeall(); - - LLEnvironment::list_name_id_t list = LLEnvironment::instance().getSkyList(); - - for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it) - { - mSkyPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second)); - } - - mSkyPresetCombo->setLabel(getString("combo_label")); -} - -void LLFloaterEditSky::enableEditing(bool enable) -{ - // Enable/disable the tab and their contents. - // FS-modified floater might not have this - //LLTabContainer* tab_container = getChild("WindLight Tabs"); - //tab_container->setEnabled(enable); - //for (S32 i = 0; i < tab_container->getTabCount(); ++i) - //{ - // tab_container->enableTabButton(i, enable); - // tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable); - //} - LLTabContainer* tab_container = findChild("WindLight Tabs"); - if (tab_container) - { - tab_container->setEnabled(enable); - for (S32 i = 0; i < tab_container->getTabCount(); ++i) - { - tab_container->enableTabButton(i, enable); - tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable); - } - } - // - - // Enable/disable saving. - mSaveButton->setEnabled(enable); - mMakeDefaultCheckBox->setEnabled(enable); -} - -void LLFloaterEditSky::saveRegionSky() -{ -#if 0 - LLWLParamKey key(getSelectedSkyPreset()); - llassert(key.scope == LLEnvKey::SCOPE_REGION); - - LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << LL_ENDL; - LLWLParamManager& wl_mgr = LLWLParamManager::instance(); - wl_mgr.mCurParams.mName = key.name; - wl_mgr.setParamSet(key, wl_mgr.mCurParams); - - // *TODO: save to cached region settings. - LL_WARNS("Windlight") << "Saving region sky is not fully implemented yet" << LL_ENDL; -#endif -} - -std::string LLFloaterEditSky::getSelectedPresetName() const -{ - std::string name; - if (mSkyPresetNameEditor->getVisible()) - { - name = mSkyPresetNameEditor->getText(); - } - else - { - LLSD combo_val = mSkyPresetCombo->getValue(); - name = combo_val[0].asString(); - } - - return name; -} - -void LLFloaterEditSky::onSkyPresetNameEdited() -{ - std::string name = mSkyPresetNameEditor->getText(); - LLSettingsWater::ptr_t psky = LLEnvironment::instance().getCurrentWater(); - - psky->setName(name); -} - -void LLFloaterEditSky::onSkyPresetSelected() -{ - std::string name; - - name = getSelectedPresetName(); - - LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName(name); - - if (!psky) - { - LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL; - enableEditing(false); - return; - } - - psky = psky->buildClone(); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psky); - mEditSettings = psky; - - syncControls(); - enableEditing(true); - -} - -bool LLFloaterEditSky::onSaveAnswer(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - // If they choose save, do it. Otherwise, don't do anything - if (option == 0) - { - onSaveConfirmed(); - } - - return false; -} - -void LLFloaterEditSky::onSaveConfirmed() -{ - // Save currently displayed water params to the selected preset. - std::string name = mEditSettings->getName(); - - LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL; - - LLEnvironment::instance().addSky(mEditSettings); - - // Change preference if requested. - if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) - { - LL_DEBUGS("Windlight") << name << " is now the new preferred sky preset" << LL_ENDL; - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - } - - closeFloater(); -} - -void LLFloaterEditSky::onBtnSave() -{ - LLEnvironment::instance().addSky(mEditSettings); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - - closeFloater(); -} - -void LLFloaterEditSky::onBtnCancel() -{ - closeFloater(); -} - -void LLFloaterEditSky::onSkyPresetListChange() -{ - refreshSkyPresetsList(); -} - -void LLFloaterEditSky::onRegionSettingsChange() -{ -#if 0 - // If creating a new sky, don't bother. - if (isNewPreset()) - { - return; - } - - if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) // if editing a region sky - { - // reset the floater to its initial state - reset(); - - // *TODO: Notify user? - } - else // editing a local sky - { - refreshSkyPresetsList(); - } -#endif -} - -void LLFloaterEditSky::onRegionInfoUpdate() -{ -#if 0 - bool can_edit = true; - - // If we've selected a region sky preset for editing. - if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) - { - // check whether we have the access - can_edit = LLEnvManagerNew::canEditRegionSettings(); - } - - enableEditing(can_edit); -#endif -} diff --git a/indra/newview/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp deleted file mode 100644 index e241366846..0000000000 --- a/indra/newview/llfloatereditwater.cpp +++ /dev/null @@ -1,533 +0,0 @@ -/** - * @file llfloatereditwater.cpp - * @brief Floater to create or edit a water preset - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloatereditwater.h" - -#include - -// libs -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llcolorswatch.h" -#include "llcombobox.h" -//#include "llnotifications.h" -#include "llnotificationsutil.h" -#include "llsliderctrl.h" -#include "lltexturectrl.h" - -// newview -#include "llagent.h" -#include "llregioninfomodel.h" -#include "llviewerregion.h" - -#include "llenvironment.h" -#include "llsettingswater.h" -#include "llenvadapters.h" - -#include "v3colorutil.h" - -#undef max // Fixes a Windows compiler error - -LLFloaterEditWater::LLFloaterEditWater(const LLSD &key): - LLFloater(key), - mWaterPresetNameEditor(NULL), - mWaterPresetCombo(NULL), - mMakeDefaultCheckBox(NULL), - mSaveButton(NULL), - mWaterAdapter() -{ -} - -// virtual -BOOL LLFloaterEditWater::postBuild() -{ - mWaterPresetNameEditor = getChild("water_preset_name"); - mWaterPresetCombo = getChild("water_preset_combo"); - mMakeDefaultCheckBox = getChild("make_default_cb"); - mSaveButton = getChild("save"); - - mWaterAdapter = boost::make_shared(); - - LLEnvironment::instance().setWaterListChange(boost::bind(&LLFloaterEditWater::onWaterPresetListChange, this)); - - initCallbacks(); - refreshWaterPresetsList(); - syncControls(); - - return TRUE; -} - -// virtual -void LLFloaterEditWater::onOpen(const LLSD& key) -{ - bool new_preset = isNewPreset(); - std::string param = key.asString(); - std::string floater_title = getString(std::string("title_") + param); - std::string hint = getString(std::string("hint_" + param)); - - // Update floater title. - setTitle(floater_title); - - // Update the hint at the top. - getChild("hint")->setValue(hint); - - // Hide the hint to the right of the combo if we're invoked to create a new preset. - getChildView("note")->setVisible(!new_preset); - - // Switch between the water presets combobox and preset name input field. - mWaterPresetCombo->setVisible(!new_preset); - mWaterPresetNameEditor->setVisible(new_preset); - - reset(); -} - -// virtual -void LLFloaterEditWater::onClose(bool app_quitting) -{ - if (!app_quitting) // there's no point to change environment if we're quitting - { - LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); - } -} - -// virtual -void LLFloaterEditWater::draw() -{ - syncControls(); - LLFloater::draw(); -} - -void LLFloaterEditWater::initCallbacks(void) -{ - mWaterPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this), NULL); - mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterPresetSelected, this)); - mWaterPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this)); - - mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnSave, this)); - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnCancel, this)); - - // Connect to region info updates. - LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this)); - - //------------------------------------------------------------------------- - - getChild("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterEditWater::onColorControlMoved, this, _1, &mWaterAdapter->mFogColor)); - - // fog density - getChild("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterEditWater::onExpFloatControlMoved, this, _1, &mWaterAdapter->mFogDensity)); - getChild("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mUnderWaterFogMod)); - - // blue density - getChild("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlXMoved, this, _1, &mWaterAdapter->mNormalScale)); - getChild("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlYMoved, this, _1, &mWaterAdapter->mNormalScale)); - getChild("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlZMoved, this, _1, &mWaterAdapter->mNormalScale)); - - // fresnel - getChild("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelScale)); - getChild("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelOffset)); - - // scale above/below - getChild("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleAbove)); - getChild("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleBelow)); - - // blur mult - getChild("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mBlurMultiplier)); - - // wave direction - getChild("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave1Dir)); - getChild("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave1Dir)); - getChild("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave2Dir)); - getChild("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave2Dir)); - - LLTextureCtrl* texture_ctrl = getChild("WaterNormalMap"); - texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); - texture_ctrl->setCommitCallback(boost::bind(&LLFloaterEditWater::onNormalMapPicked, this, _1)); -} - -//============================================================================= - -void LLFloaterEditWater::syncControls() -{ - // *TODO: Eliminate slow getChild() calls. - - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - mEditSettings = pwater; - - std::string name = pwater->getName(); - mWaterPresetNameEditor->setText(name); - mWaterPresetCombo->setValue(name); - - //getChild("WaterGlow")->setValue(col.mV[3]); - getChild("WaterFogColor")->set(LLColor4(pwater->getWaterFogColor())); - - // fog and wavelets - mWaterAdapter->mFogDensity = pwater->getWaterFogDensity(); - getChild("WaterFogDensity")->setValue(mWaterAdapter->mFogDensity.getExp()); - - mWaterAdapter->mUnderWaterFogMod = pwater->getFogMod(); - getChild("WaterUnderWaterFogMod")->setValue(static_cast(mWaterAdapter->mUnderWaterFogMod)); - - mWaterAdapter->mNormalScale = pwater->getNormalScale(); - getChild("WaterNormalScaleX")->setValue(mWaterAdapter->mNormalScale.getX()); - getChild("WaterNormalScaleY")->setValue(mWaterAdapter->mNormalScale.getY()); - getChild("WaterNormalScaleZ")->setValue(mWaterAdapter->mNormalScale.getZ()); - - // Fresnel - mWaterAdapter->mFresnelScale = pwater->getFresnelScale(); - getChild("WaterFresnelScale")->setValue(static_cast(mWaterAdapter->mFresnelScale)); - mWaterAdapter->mFresnelOffset = pwater->getFresnelOffset(); - getChild("WaterFresnelOffset")->setValue(static_cast(mWaterAdapter->mFresnelOffset)); - - // Scale Above/Below - mWaterAdapter->mScaleAbove = pwater->getScaleAbove(); - getChild("WaterScaleAbove")->setValue(static_cast(mWaterAdapter->mScaleAbove)); - mWaterAdapter->mScaleBelow = pwater->getScaleBelow(); - getChild("WaterScaleBelow")->setValue(static_cast(mWaterAdapter->mScaleBelow)); - - // blur mult - mWaterAdapter->mBlurMultiplier = pwater->getBlurMultiplier(); - getChild("WaterBlurMult")->setValue(static_cast(mWaterAdapter->mBlurMultiplier)); - - // wave directions - mWaterAdapter->mWave1Dir = pwater->getWave1Dir(); - getChild("WaterWave1DirX")->setValue(mWaterAdapter->mWave1Dir.getU()); - getChild("WaterWave1DirY")->setValue(mWaterAdapter->mWave1Dir.getV()); - - mWaterAdapter->mWave2Dir = pwater->getWave2Dir(); - getChild("WaterWave2DirX")->setValue(mWaterAdapter->mWave2Dir.getU()); - getChild("WaterWave2DirY")->setValue(mWaterAdapter->mWave2Dir.getV()); - - LLTextureCtrl* textCtrl = getChild("WaterNormalMap"); - textCtrl->setImageAssetID(pwater->getNormalMapID()); -} - - -// vector control callbacks -void LLFloaterEditWater::onVector3ControlXMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setX( sldr_ctrl->getValueF32() ); - vector_ctrl->update(mEditSettings); -} - -// vector control callbacks -void LLFloaterEditWater::onVector3ControlYMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setY(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - -// vector control callbacks -void LLFloaterEditWater::onVector3ControlZMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setZ(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - - -// vector control callbacks -void LLFloaterEditWater::onVector2ControlXMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setU(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - -// vector control callbacks -void LLFloaterEditWater::onVector2ControlYMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - vector_ctrl->setV(sldr_ctrl->getValueF32()); - vector_ctrl->update(mEditSettings); -} - -void LLFloaterEditWater::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - floatControl->setValue(sldr_ctrl->getValueF32()); - floatControl->update(mEditSettings); -} - -void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* expFloatControl) -{ - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - expFloatControl->setExp(sldr_ctrl->getValueF32()); - expFloatControl->update(mEditSettings); -} - -void LLFloaterEditWater::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl) -{ - LLColorSwatchCtrl* swatch = static_cast(ctrl); - color_ctrl->setColor4( swatch->get() ); - color_ctrl->update(mEditSettings); -} - -void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl) -{ - LLTextureCtrl* textCtrl = static_cast(ctrl); - LLUUID textID = textCtrl->getImageAssetID(); - mEditSettings->setNormalMapID(textID); -} - -//============================================================================= - -void LLFloaterEditWater::reset() -{ - if (isNewPreset()) - { - mWaterPresetNameEditor->setValue(LLSD()); - mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name - } - else - { - refreshWaterPresetsList(); - - // Disable controls until a water preset to edit is selected. - enableEditing(false); - } -} - -bool LLFloaterEditWater::isNewPreset() const -{ - return mKey.asString() == "new"; -} - -void LLFloaterEditWater::refreshWaterPresetsList() -{ - mWaterPresetCombo->removeall(); - - LLEnvironment::list_name_id_t list = LLEnvironment::instance().getWaterList(); - - for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it) - { - mWaterPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second)); - } - - mWaterPresetCombo->setLabel(getString("combo_label")); -} - -void LLFloaterEditWater::enableEditing(bool enable) -{ - // Enable/disable water controls. - // FS-modified floater might have this - //getChild("panel_water_preset")->setCtrlsEnabled(enable); - LLPanel* panel_water_preset = findChild("panel_water_preset"); - if (panel_water_preset) - { - panel_water_preset->setCtrlsEnabled(enable); - } - // - - // Enable/disable saving. - mSaveButton->setEnabled(enable); - mMakeDefaultCheckBox->setEnabled(enable); -} - -void LLFloaterEditWater::saveRegionWater() -{ -#if 0 - llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water - - LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL; - - //LLWaterParamSet region_water = water_mgr.mCurParams; - - // *TODO: save to cached region settings. - LL_WARNS("Windlight") << "Saving region water is not fully implemented yet" << LL_ENDL; -#endif -} - -#if 0 -std::string LLFloaterEditWater::getCurrentPresetName() const -{ - std::string name; - LLEnvKey::EScope scope; - getSelectedPreset(name, scope); - return name; -} -#endif - -#if 0 -LLEnvKey::EScope LLFloaterEditWater::getCurrentScope() const -{ - std::string name; - LLEnvKey::EScope scope; - getSelectedPreset(name, scope); - return scope; -} -#endif - -std::string LLFloaterEditWater::getSelectedPresetName() const -{ - std::string name; - if (mWaterPresetNameEditor->getVisible()) - { - name = mWaterPresetNameEditor->getText(); - } - else - { - LLSD combo_val = mWaterPresetCombo->getValue(); - name = combo_val[0].asString(); - } - - return name; -} - -void LLFloaterEditWater::onWaterPresetNameEdited() -{ - std::string name = mWaterPresetNameEditor->getText(); - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); - - pwater->setName(name); -#if 0 - // Disable saving a water preset having empty name. - mSaveButton->setEnabled(!getCurrentPresetName().empty()); -#endif -} - -void LLFloaterEditWater::onWaterPresetSelected() -{ - std::string name; - - name = getSelectedPresetName(); - - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName(name); - - if (!pwater) - { - LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL; - enableEditing(false); - return; - } - - pwater = pwater->buildClone(); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, pwater); - mEditSettings = pwater; - - syncControls(); - enableEditing(true); -} - -bool LLFloaterEditWater::onSaveAnswer(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - // If they choose save, do it. Otherwise, don't do anything - if (option == 0) - { - onSaveConfirmed(); - } - - return false; -} - -void LLFloaterEditWater::onSaveConfirmed() -{ - // Save currently displayed water params to the selected preset. - std::string name = mEditSettings->getName(); - - LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL; - - LLEnvironment::instance().addWater(mEditSettings); - - // Change preference if requested. - if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) - { - LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL; - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - } - - closeFloater(); -} - -void LLFloaterEditWater::onBtnSave() -{ - LLEnvironment::instance().addWater(mEditSettings); - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - - closeFloater(); -} - -void LLFloaterEditWater::onBtnCancel() -{ - closeFloater(); -} - -void LLFloaterEditWater::onWaterPresetListChange() -{ - refreshWaterPresetsList(); -} - -void LLFloaterEditWater::onRegionSettingsChange() -{ -#if 0 - // If creating a new preset, don't bother. - if (isNewPreset()) - { - return; - } - - if (getCurrentScope() == LLEnvKey::SCOPE_REGION) // if editing region water - { - // reset the floater to its initial state - reset(); - - // *TODO: Notify user? - } - else // editing a local preset - { - refreshWaterPresetsList(); - } -#endif -} - -void LLFloaterEditWater::onRegionInfoUpdate() -{ -#if 0 - bool can_edit = true; - - // If we've selected the region water for editing. - if (getCurrentScope() == LLEnvKey::SCOPE_REGION) - { - // check whether we have the access - can_edit = LLEnvManagerNew::canEditRegionSettings(); - } - - enableEditing(can_edit); -#endif -} diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp deleted file mode 100644 index c194dc05b0..0000000000 --- a/indra/newview/llimpanel.cpp +++ /dev/null @@ -1,978 +0,0 @@ -/** - * @file llimpanel.cpp - * @brief LLIMPanel class definition - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llimpanel.h" - -#include "indra_constants.h" -#include "llfloaterreg.h" -#include "llfocusmgr.h" -#include "llfontgl.h" -#include "llrect.h" -#include "llerror.h" -#include "llmultifloater.h" -#include "llstring.h" -#include "message.h" -#include "lltextbox.h" - -#include "llagent.h" -#include "llbutton.h" -#include "llcallingcard.h" -#include "llchannelmanager.h" -#include "llchat.h" -#include "llchiclet.h" -#include "llconsole.h" -#include "llgroupactions.h" -#include "llfloater.h" -#include "llfloateractivespeakers.h" -#include "llavataractions.h" -#include "llinventory.h" -#include "llinventorymodel.h" -#include "llfloaterinventory.h" -#include "lliconctrl.h" -#include "llkeyboard.h" -#include "lllineeditor.h" -#include "llpanelimcontrolpanel.h" -#include "llrecentpeople.h" -#include "llresmgr.h" -#include "lltooldraganddrop.h" -#include "lltrans.h" -#include "lltabcontainer.h" -#include "llviewertexteditor.h" -#include "llviewermessage.h" -#include "llviewerstats.h" -#include "llviewercontrol.h" -#include "lluictrlfactory.h" -#include "llviewerwindow.h" -#include "llvoicechannel.h" -#include "lllogchat.h" -#include "llweb.h" -#include "llhttpclient.h" -#include "llmutelist.h" -#include "llstylemap.h" -#include "llappviewer.h" - -// -// Constants -// -const S32 LINE_HEIGHT = 16; -const S32 MIN_WIDTH = 200; -const S32 MIN_HEIGHT = 130; - -// -// Statics -// -// -static std::string sTitleString = "Instant Message with [NAME]"; -static std::string sTypingStartString = "[NAME]: ..."; -static std::string sSessionStartString = "Starting session with [NAME] please wait."; - - -// -// LLFloaterIMPanel -// - -LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label, - const LLUUID& session_id, - const LLUUID& other_participant_id, - const std::vector& ids, - EInstantMessage dialog) -: LLFloater(session_id), - mInputEditor(NULL), - mHistoryEditor(NULL), - mSessionUUID(session_id), - mSessionLabel(session_label), - mSessionInitialized(FALSE), - mSessionStartMsgPos(0), - mOtherParticipantUUID(other_participant_id), - mDialog(dialog), - mSessionInitialTargetIDs(ids), - mTyping(FALSE), - mOtherTyping(FALSE), - mTypingLineStartIndex(0), - mSentTypingState(TRUE), - mNumUnreadMessages(0), - mShowSpeakersOnConnect(TRUE), - mTextIMPossible(TRUE), - mProfileButtonEnabled(TRUE), - mCallBackEnabled(TRUE), - mSpeakerPanel(NULL), - mFirstKeystrokeTimer(), - mLastKeystrokeTimer() -{ - std::string xml_filename; - switch(mDialog) - { - case IM_SESSION_GROUP_START: - mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); - xml_filename = "floater_instant_message_group.xml"; - break; - case IM_SESSION_INVITE: - mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); - if (gAgent.isInGroup(mSessionUUID)) - { - xml_filename = "floater_instant_message_group.xml"; - } - else // must be invite to ad hoc IM - { - xml_filename = "floater_instant_message_ad_hoc.xml"; - } - break; - case IM_SESSION_P2P_INVITE: - xml_filename = "floater_instant_message.xml"; - break; - case IM_SESSION_CONFERENCE_START: - mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); - xml_filename = "floater_instant_message_ad_hoc.xml"; - break; - // just received text from another user - case IM_NOTHING_SPECIAL: - - xml_filename = "floater_instant_message.xml"; - - mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID); - mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID); - mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID); - break; - default: - LL_WARNS() << "Unknown session type" << LL_ENDL; - xml_filename = "floater_instant_message.xml"; - break; - } - - LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, NULL); - - setTitle(mSessionLabel); - mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN); - // enable line history support for instant message bar - mInputEditor->setEnableLineHistory(TRUE); - - //*TODO we probably need the same "awaiting message" thing in LLFloaterIMSession - LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionUUID); - if (!im_session) - { - llerror("im session with id " + mSessionUUID.asString() + " does not exist!", 0); - return; - } - - mSessionInitialized = im_session->mSessionInitialized; - if (!mSessionInitialized) - { - //locally echo a little "starting session" message - LLUIString session_start = sSessionStartString; - - session_start.setArg("[NAME]", getTitle()); - mSessionStartMsgPos = - mHistoryEditor->getWText().length(); - - addHistoryLine( - session_start, - LLUIColorTable::instance().getColor("SystemChatColor"), - false); - } -} - - -LLFloaterIMPanel::~LLFloaterIMPanel() -{ - //delete focus lost callback - mFocusCallbackConnection.disconnect(); -} - -BOOL LLFloaterIMPanel::postBuild() -{ - setVisibleCallback(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2)); - - mInputEditor = getChild("chat_editor"); - mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) ); - mFocusCallbackConnection = mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this)); - mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this ); - mInputEditor->setCommitCallback( onCommitChat, this ); - mInputEditor->setCommitOnFocusLost( FALSE ); - mInputEditor->setRevertOnEsc( FALSE ); - mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); - - childSetAction("profile_callee_btn", onClickProfile, this); - childSetAction("group_info_btn", onClickGroupInfo, this); - - childSetAction("start_call_btn", onClickStartCall, this); - childSetAction("end_call_btn", onClickEndCall, this); - childSetAction("send_btn", onClickSend, this); - childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); - - childSetAction("moderator_kick_speaker", onKickSpeaker, this); - //LLButton* close_btn = getChild("close_btn"); - //close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this); - - mHistoryEditor = getChild("im_history"); - - if ( IM_SESSION_GROUP_START == mDialog ) - { - childSetEnabled("profile_btn", FALSE); - } - - if(!mProfileButtonEnabled) - { - childSetEnabled("profile_callee_btn", FALSE); - } - - sTitleString = getString("title_string"); - sTypingStartString = getString("typing_start_string"); - sSessionStartString = getString("session_start_string"); - - if (mSpeakerPanel) - { - mSpeakerPanel->refreshSpeakers(); - } - - if (mDialog == IM_NOTHING_SPECIAL) - { - childSetAction("mute_btn", onClickMuteVoice, this); - childSetCommitCallback("speaker_volume", onVolumeChange, this); - } - - setDefaultBtn("send_btn"); - return TRUE; -} - -void* LLFloaterIMPanel::createSpeakersPanel(void* data) -{ - LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)data; - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(floaterp->mSessionUUID); - floaterp->mSpeakerPanel = new LLPanelActiveSpeakers(speaker_mgr, TRUE); - return floaterp->mSpeakerPanel; -} - -//static -void LLFloaterIMPanel::onClickMuteVoice(void* user_data) -{ - LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data; - if (floaterp) - { - BOOL is_muted = LLMuteList::getInstance()->isMuted(floaterp->mOtherParticipantUUID, LLMute::flagVoiceChat); - - LLMute mute(floaterp->mOtherParticipantUUID, floaterp->getTitle(), LLMute::AGENT); - if (!is_muted) - { - LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat); - } - else - { - LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat); - } - } -} - -//static -void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data) -{ - LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data; - if (floaterp) - { - LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal()); - } -} - - -// virtual -void LLFloaterIMPanel::draw() -{ - LLViewerRegion* region = gAgent.getRegion(); - - BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "") - && mSessionInitialized - && LLVoiceClient::getInstance()->voiceEnabled() - && mCallBackEnabled; - - // hide/show start call and end call buttons - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID); - if (!voice_channel) - return; - - childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED); - childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED); - childSetEnabled("start_call_btn", enable_connect); - childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty()); - - LLPointer self_speaker; - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID); - if (speaker_mgr) - { - self_speaker = speaker_mgr->findSpeaker(gAgent.getID()); - } - if(!mTextIMPossible) - { - mInputEditor->setEnabled(FALSE); - mInputEditor->setLabel(getString("unavailable_text_label")); - } - else if (self_speaker.notNull() && self_speaker->mModeratorMutedText) - { - mInputEditor->setEnabled(FALSE); - mInputEditor->setLabel(getString("muted_text_label")); - } - else - { - mInputEditor->setEnabled(TRUE); - mInputEditor->setLabel(getString("default_text_label")); - } - - // show speakers window when voice first connects - if (mShowSpeakersOnConnect && voice_channel->isActive()) - { - childSetVisible("active_speakers_panel", TRUE); - mShowSpeakersOnConnect = FALSE; - } - childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel")); - - if (mTyping) - { - // Time out if user hasn't typed for a while. - if (mLastKeystrokeTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS) - { - setTyping(FALSE); - } - - // If we are typing, and it's been a little while, send the - // typing indicator - if (!mSentTypingState - && mFirstKeystrokeTimer.getElapsedTimeF32() > 1.f) - { - sendTypingState(TRUE); - mSentTypingState = TRUE; - } - } - - // use embedded panel if available - if (mSpeakerPanel) - { - if (mSpeakerPanel->getVisible()) - { - mSpeakerPanel->refreshSpeakers(); - } - } - else - { - // refresh volume and mute checkbox - childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive()); - childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID)); - - childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat)); - childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive()); - } - LLFloater::draw(); -} - -class LLSessionInviteResponder : public LLHTTPClient::Responder -{ - LOG_CLASS(LLSessionInviteResponder); -public: - LLSessionInviteResponder(const LLUUID& session_id) - { - mSessionID = session_id; - } - -protected: - void httpFailure() - { - LL_WARNS() << "Error inviting all agents to session " << dumpResponse() << LL_ENDL; - //throw something back to the viewer here? - } - -private: - LLUUID mSessionID; -}; - -BOOL LLFloaterIMPanel::inviteToSession(const std::vector& ids) -{ - LLViewerRegion* region = gAgent.getRegion(); - if (!region) - { - return FALSE; - } - - S32 count = ids.size(); - - if( isInviteAllowed() && (count > 0) ) - { - LL_INFOS() << "LLFloaterIMPanel::inviteToSession() - inviting participants" << LL_ENDL; - - std::string url = region->getCapability("ChatSessionRequest"); - - LLSD data; - - data["params"] = LLSD::emptyArray(); - for (int i = 0; i < count; i++) - { - data["params"].append(ids[i]); - } - - data["method"] = "invite"; - data["session-id"] = mSessionUUID; - LLHTTPClient::post( - url, - data, - new LLSessionInviteResponder( - mSessionUUID)); - } - else - { - LL_INFOS() << "LLFloaterIMPanel::inviteToSession -" - << " no need to invite agents for " - << mDialog << LL_ENDL; - // successful add, because everyone that needed to get added - // was added. - } - - return TRUE; -} - -void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name) -{ - // start tab flashing when receiving im for background session from user - if (source != LLUUID::null) - { - LLMultiFloater* hostp = getHost(); - if( !isInVisibleChain() - && hostp - && source != gAgent.getID()) - { - hostp->setFloaterFlashing(this, TRUE); - } - } - - // Now we're adding the actual line of text, so erase the - // "Foo is typing..." text segment, and the optional timestamp - // if it was present. JC - removeTypingIndicator(NULL); - - // Actually add the line - std::string timestring; - bool prepend_newline = true; - if (gSavedSettings.getBOOL("IMShowTimestamps")) - { - timestring = mHistoryEditor->appendTime(prepend_newline); - prepend_newline = false; - } - - std::string separator_string(": "); - - // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. - if (!name.empty()) // If name exists, then add it to the front of the message. - { - // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. - if (name == SYSTEM_FROM) - { - mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyle::Params().color(color)); - } - else - { - // Convert the name to a hotlink and add to message. - mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyleMap::instance().lookupAgent(source)); - } - prepend_newline = false; - } - mHistoryEditor->appendText(utf8msg, prepend_newline, LLStyle::Params().color(color)); - mHistoryEditor->blockUndo(); - - if (!isInVisibleChain()) - { - mNumUnreadMessages++; - } -} - - -void LLFloaterIMPanel::setInputFocus( BOOL b ) -{ - mInputEditor->setFocus( b ); -} - - -void LLFloaterIMPanel::selectAll() -{ - mInputEditor->selectAll(); -} - - -void LLFloaterIMPanel::selectNone() -{ - mInputEditor->deselect(); -} - -BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask ) -{ - BOOL handled = FALSE; - if( KEY_RETURN == key && mask == MASK_NONE) - { - sendMsg(); - handled = TRUE; - } - else if ( KEY_ESCAPE == key ) - { - handled = TRUE; - gFocusMgr.setKeyboardFocus(NULL); - } - - // May need to call base class LLPanel::handleKeyHere if not handled - // in order to tab between buttons. JNC 1.2.2002 - return handled; -} - -BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - - if (mDialog == IM_NOTHING_SPECIAL) - { - LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionUUID, drop, - cargo_type, cargo_data, accept); - } - - // handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites - else if (isInviteAllowed()) - { - *accept = ACCEPT_NO; - - if (cargo_type == DAD_CALLINGCARD) - { - if (dropCallingCard((LLInventoryItem*)cargo_data, drop)) - { - *accept = ACCEPT_YES_MULTI; - } - } - else if (cargo_type == DAD_CATEGORY) - { - if (dropCategory((LLInventoryCategory*)cargo_data, drop)) - { - *accept = ACCEPT_YES_MULTI; - } - } - } - return TRUE; -} - -BOOL LLFloaterIMPanel::dropCallingCard(LLInventoryItem* item, BOOL drop) -{ - BOOL rv = isInviteAllowed(); - if(rv && item && item->getCreatorUUID().notNull()) - { - if(drop) - { - std::vector ids; - ids.push_back(item->getCreatorUUID()); - inviteToSession(ids); - } - } - else - { - // set to false if creator uuid is null. - rv = FALSE; - } - return rv; -} - -BOOL LLFloaterIMPanel::dropCategory(LLInventoryCategory* category, BOOL drop) -{ - BOOL rv = isInviteAllowed(); - if(rv && category) - { - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - LLUniqueBuddyCollector buddies; - gInventory.collectDescendentsIf(category->getUUID(), - cats, - items, - LLInventoryModel::EXCLUDE_TRASH, - buddies); - S32 count = items.count(); - if(count == 0) - { - rv = FALSE; - } - else if(drop) - { - std::vector ids; - ids.reserve(count); - for(S32 i = 0; i < count; ++i) - { - ids.push_back(items.get(i)->getCreatorUUID()); - } - inviteToSession(ids); - } - } - return rv; -} - -BOOL LLFloaterIMPanel::isInviteAllowed() const -{ - - return ( (IM_SESSION_CONFERENCE_START == mDialog) - || (IM_SESSION_INVITE == mDialog) ); -} - - -// static -void LLFloaterIMPanel::onTabClick(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - self->setInputFocus(TRUE); -} - - -// static -void LLFloaterIMPanel::onClickProfile( void* userdata ) -{ - // Bring up the Profile window - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - if (self->getOtherParticipantID().notNull()) - { - LLAvatarActions::showProfile(self->getOtherParticipantID()); - } -} - -// static -void LLFloaterIMPanel::onClickGroupInfo( void* userdata ) -{ - // Bring up the Profile window - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - LLGroupActions::show(self->mSessionUUID); - -} - -// static -void LLFloaterIMPanel::onClickClose( void* userdata ) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - if(self) - { - self->closeFloater(); - } -} - -// static -void LLFloaterIMPanel::onClickStartCall(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - gIMMgr->startCall(self->mSessionUUID); -} - -// static -void LLFloaterIMPanel::onClickEndCall(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - gIMMgr->endCall(self->mSessionUUID); -} - -// static -void LLFloaterIMPanel::onClickSend(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; - self->sendMsg(); -} - -// static -void LLFloaterIMPanel::onClickToggleActiveSpeakers(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; - - self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel")); -} - -// static -void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata) -{ - LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata; - self->sendMsg(); -} - -// static -void LLFloaterIMPanel::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ) -{ - LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata; - self->mHistoryEditor->setCursorAndScrollToEnd(); -} - -// static -void LLFloaterIMPanel::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - self->setTyping(FALSE); -} - -// static -void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; - std::string text = self->mInputEditor->getText(); - if (!text.empty()) - { - self->setTyping(TRUE); - } - else - { - // Deleting all text counts as stopping typing. - self->setTyping(FALSE); - } -} - -// virtual -void LLFloaterIMPanel::onClose(bool app_quitting) -{ - setTyping(FALSE); - - gIMMgr->leaveSession(mSessionUUID); - - // *HACK hide the voice floater - LLFloaterReg::hideInstance("voice_call", mSessionUUID); -} - -void LLFloaterIMPanel::onVisibilityChange(const LLSD& new_visibility) -{ - if (new_visibility.asBoolean()) - { - mNumUnreadMessages = 0; - } - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID); - if (voice_channel && voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED) - { - if (new_visibility.asBoolean()) - LLFloaterReg::showInstance("voice_call", mSessionUUID); - else - LLFloaterReg::hideInstance("voice_call", mSessionUUID); - } -} - -void LLFloaterIMPanel::sendMsg() -{ - if (!gAgent.isGodlike() - && (mDialog == IM_NOTHING_SPECIAL) - && mOtherParticipantUUID.isNull()) - { - LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL; - return; - } - - if (mInputEditor) - { - LLWString text = mInputEditor->getConvertedText(); - if(!text.empty()) - { - // store sent line in history, duplicates will get filtered - if (mInputEditor) mInputEditor->updateHistory(); - // Truncate and convert to UTF8 for transport - std::string utf8_text = wstring_to_utf8str(text); - utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); - - if ( mSessionInitialized ) - { - LLIMModel::sendMessage(utf8_text, - mSessionUUID, - mOtherParticipantUUID, - mDialog); - - } - else - { - //queue up the message to send once the session is - //initialized - mQueuedMsgsForInit.append(utf8_text); - } - } - - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT); - - mInputEditor->setText(LLStringUtil::null); - } - - // Don't need to actually send the typing stop message, the other - // client will infer it from receiving the message. - mTyping = FALSE; - mSentTypingState = TRUE; -} - -void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update) -{ - if ( - session_update.has("moderated_mode") && - session_update["moderated_mode"].has("voice") ) - { - BOOL voice_moderated = session_update["moderated_mode"]["voice"]; - - if (voice_moderated) - { - setTitle(mSessionLabel + std::string(" ") + getString("moderated_chat_label")); - } - else - { - setTitle(mSessionLabel); - } - - - //update the speakers dropdown too, if it's available - if (mSpeakerPanel) - { - mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated); - } - } -} - -void LLFloaterIMPanel::sessionInitReplyReceived(const LLUUID& session_id) -{ - mSessionUUID = session_id; - mSessionInitialized = TRUE; - - //we assume the history editor hasn't moved at all since - //we added the starting session message - //so, we count how many characters to remove - S32 chars_to_remove = mHistoryEditor->getWText().length() - - mSessionStartMsgPos; - mHistoryEditor->removeTextFromEnd(chars_to_remove); - - //and now, send the queued msg - LLSD::array_iterator iter; - for ( iter = mQueuedMsgsForInit.beginArray(); - iter != mQueuedMsgsForInit.endArray(); - ++iter) - { - LLIMModel::sendMessage( - iter->asString(), - mSessionUUID, - mOtherParticipantUUID, - mDialog); - } -} - -void LLFloaterIMPanel::setTyping(BOOL typing) -{ - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID); - if (typing) - { - // Every time you type something, reset this timer - mLastKeystrokeTimer.reset(); - - if (!mTyping) - { - // You just started typing. - mFirstKeystrokeTimer.reset(); - - // Will send typing state after a short delay. - mSentTypingState = FALSE; - } - - if (speaker_mgr) - speaker_mgr->setSpeakerTyping(gAgent.getID(), TRUE); - } - else - { - if (mTyping) - { - // you just stopped typing, send state immediately - sendTypingState(FALSE); - mSentTypingState = TRUE; - } - if (speaker_mgr) - speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); - } - - mTyping = typing; -} - -void LLFloaterIMPanel::sendTypingState(BOOL typing) -{ - // Don't want to send typing indicators to multiple people, potentially too - // much network traffic. Only send in person-to-person IMs. - if (mDialog != IM_NOTHING_SPECIAL) return; - - LLIMModel::instance().sendTypingState(mSessionUUID, mOtherParticipantUUID, typing); -} - - -void LLFloaterIMPanel::processIMTyping(const LLIMInfo* im_info, BOOL typing) -{ - if (typing) - { - // other user started typing - addTypingIndicator(im_info->mName); - } - else - { - // other user stopped typing - removeTypingIndicator(im_info); - } -} - - -void LLFloaterIMPanel::addTypingIndicator(const std::string &name) -{ - // we may have lost a "stop-typing" packet, don't add it twice - if (!mOtherTyping) - { - mTypingLineStartIndex = mHistoryEditor->getWText().length(); - LLUIString typing_start = sTypingStartString; - typing_start.setArg("[NAME]", name); - addHistoryLine(typing_start, LLUIColorTable::instance().getColor("SystemChatColor"), false); - mOtherTypingName = name; - mOtherTyping = TRUE; - } - // MBW -- XXX -- merge from release broke this (argument to this function changed from an LLIMInfo to a name) - // Richard will fix. -// mSpeakers->setSpeakerTyping(im_info->mFromID, TRUE); -} - - -void LLFloaterIMPanel::removeTypingIndicator(const LLIMInfo* im_info) -{ - if (mOtherTyping) - { - // Must do this first, otherwise addHistoryLine calls us again. - mOtherTyping = FALSE; - - S32 chars_to_remove = mHistoryEditor->getWText().length() - mTypingLineStartIndex; - mHistoryEditor->removeTextFromEnd(chars_to_remove); - if (im_info) - { - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID); - if (speaker_mgr) - { - speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); - } - } - } -} - -//static -void LLFloaterIMPanel::onKickSpeaker(void* user_data) -{ - -} diff --git a/indra/newview/llinventoryclipboard.cpp b/indra/newview/llinventoryclipboard.cpp deleted file mode 100644 index 53da34f448..0000000000 --- a/indra/newview/llinventoryclipboard.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @file llinventoryclipboard.cpp - * @brief LLInventoryClipboard class implementation - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llinventoryclipboard.h" - - -LLInventoryClipboard LLInventoryClipboard::sInstance; - -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- - - -///---------------------------------------------------------------------------- -/// Class LLInventoryClipboard -///---------------------------------------------------------------------------- - -LLInventoryClipboard::LLInventoryClipboard() -: mCutMode(false) -{ -} - -LLInventoryClipboard::~LLInventoryClipboard() -{ - reset(); -} - -void LLInventoryClipboard::add(const LLUUID& object) -{ - mObjects.put(object); -} - -// this stores a single inventory object -void LLInventoryClipboard::store(const LLUUID& object) -{ - reset(); - mObjects.put(object); -} - -void LLInventoryClipboard::store(const LLDynamicArray& inv_objects) -{ - reset(); - S32 count = inv_objects.count(); - for(S32 i = 0; i < count; i++) - { - mObjects.put(inv_objects[i]); - } -} - -void LLInventoryClipboard::cut(const LLUUID& object) -{ - if(!mCutMode && !mObjects.empty()) - { - //looks like there are some stored items, reset clipboard state - reset(); - } - mCutMode = true; - add(object); -} -void LLInventoryClipboard::retrieve(LLDynamicArray& inv_objects) const -{ - inv_objects.reset(); - S32 count = mObjects.count(); - for(S32 i = 0; i < count; i++) - { - inv_objects.put(mObjects[i]); - } -} - -void LLInventoryClipboard::reset() -{ - mObjects.reset(); - mCutMode = false; -} - -// returns true if the clipboard has something pasteable in it. -BOOL LLInventoryClipboard::hasContents() const -{ - return (mObjects.count() > 0); -} - - -///---------------------------------------------------------------------------- -/// Local function definitions -///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventoryclipboard.h b/indra/newview/llinventoryclipboard.h deleted file mode 100644 index b9f1451e5c..0000000000 --- a/indra/newview/llinventoryclipboard.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @file llinventoryclipboard.h - * @brief LLInventoryClipboard class header file - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLINVENTORYCLIPBOARD_H -#define LL_LLINVENTORYCLIPBOARD_H - -#include "lldarray.h" -#include "lluuid.h" - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryClipboard -// -// This class is used to cut/copy/paste inventory items around the -// world. This class is accessed through a singleton (only one -// inventory clipboard for now) which can be referenced using the -// instance() method. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLInventoryClipboard -{ -public: - // calling this before main() is undefined - static LLInventoryClipboard& instance() { return sInstance; } - - // this method adds to the current list. - void add(const LLUUID& object); - - // this stores a single inventory object - void store(const LLUUID& object); - - // this method stores an array of objects - void store(const LLDynamicArray& inventory_objects); - - void cut(const LLUUID& object); - // this method gets the objects in the clipboard by copying them - // into the array provided. - void retrieve(LLDynamicArray& inventory_objects) const; - - // this method empties out the clipboard - void reset(); - - // returns true if the clipboard has something pasteable in it. - BOOL hasContents() const; - bool isCutMode() const { return mCutMode; } - -protected: - static LLInventoryClipboard sInstance; - - LLDynamicArray mObjects; - bool mCutMode; - -public: - // please don't actually call these - LLInventoryClipboard(); - ~LLInventoryClipboard(); -private: - // please don't implement these - LLInventoryClipboard(const LLInventoryClipboard&); - LLInventoryClipboard& operator=(const LLInventoryClipboard&); -}; - - -#endif // LL_LLINVENTORYCLIPBOARD_H diff --git a/indra/newview/lllistbrowser.cpp b/indra/newview/lllistbrowser.cpp deleted file mode 100644 index 956f457730..0000000000 --- a/indra/newview/lllistbrowser.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file lllistbrowser.cpp - * @brief UI widget showing a search filter, list view, icon action buttons, - * and verb action buttons, as usually embedded in the side tray. - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "llviewerprecompiledheaders.h" - -#include "lllistbrowser.h" - -// TODO diff --git a/indra/newview/lllistbrowser.h b/indra/newview/lllistbrowser.h deleted file mode 100644 index 22e8755f08..0000000000 --- a/indra/newview/lllistbrowser.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file lllistbrowser.h - * @brief UI widget showing a search filter, list view, icon action buttons, - * and verb action buttons, as usually embedded in the side tray. - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#ifndef LLLISTBROWSER_H -#define LLLISTBROWSER_H - -#endif // LLLISTBROWSER_H diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index a7539f0333..68811a8974 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -684,7 +684,7 @@ void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type, bool cl void LLMediaCtrl::navigateToLocalPage( const std::string& subdir, const std::string& filename_in ) { std::string filename(gDirUtilp->add(subdir, filename_in)); - std::string expanded_filename = gDirUtilp->findSkinnedFilename("html", filename); + std::string expanded_filename = gDirUtilp->findSkinnedFilename(LLDir::HTML, filename); if (expanded_filename.empty()) { diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index e3f389bac4..c3a66b8b29 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -673,7 +673,7 @@ LLSystemNotificationListItem::LLSystemNotificationListItem(const Params& p) mSystemNotificationIcon(NULL), mIsCaution(false) { - buildFromFile("panel_notification_list_item.xml"); + buildFromFile("panel_notification_list_item.xml", true); mIsCaution = p.notification_priority >= NOTIFICATION_PRIORITY_HIGH; if (mIsCaution) { diff --git a/indra/newview/llsavedsettingsglue.cpp b/indra/newview/llsavedsettingsglue.cpp deleted file mode 100644 index 37b576814d..0000000000 --- a/indra/newview/llsavedsettingsglue.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file llsavedsettingsglue.cpp - * @author James Cook - * @brief LLSavedSettingsGlue class implementation - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llsavedsettingsglue.h" - -#include "lluictrl.h" - -#include "llviewercontrol.h" - -void LLSavedSettingsGlue::setBOOL(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setBOOL(name, ctrl->getValue().asBoolean()); -} - -void LLSavedSettingsGlue::setS32(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setS32(name, ctrl->getValue().asInteger()); -} - -void LLSavedSettingsGlue::setF32(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setF32(name, (F32)ctrl->getValue().asReal()); -} - -void LLSavedSettingsGlue::setU32(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setU32(name, (U32)ctrl->getValue().asInteger()); -} - -void LLSavedSettingsGlue::setString(LLUICtrl* ctrl, const std::string& name) -{ - gSavedSettings.setString(name, ctrl->getValue().asString()); -} diff --git a/indra/newview/llsavedsettingsglue.h b/indra/newview/llsavedsettingsglue.h deleted file mode 100644 index e8c6a7dbdb..0000000000 --- a/indra/newview/llsavedsettingsglue.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file llsavedsettingsglue.h - * @author James Cook - * @brief LLSavedSettingsGlue class definition - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLSAVEDSETTINGSGLUE_H -#define LL_LLSAVEDSETTINGSGLUE_H - -class LLUICtrl; - -// Helper to change gSavedSettings from UI widget commit callbacks. -// Set the widget callback to be one of the setFoo() calls below, -// and assign the control name as a const char* to the userdata. -class LLSavedSettingsGlue -{ -public: - static void setBOOL(LLUICtrl* ctrl, const std::string& name); - static void setS32(LLUICtrl* ctrl, const std::string& name); - static void setF32(LLUICtrl* ctrl, const std::string& name); - static void setU32(LLUICtrl* ctrl, const std::string& name); - static void setString(LLUICtrl* ctrl, const std::string& name); -}; - -#endif diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index c8b6c90898..00f0e3214a 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -122,7 +122,7 @@ LLToast::LLToast(const LLToast::Params& p) { mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs)); - buildFromFile("panel_toast.xml"); + buildFromFile("panel_toast.xml", true); setCanDrag(false); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 36def390d5..377184be2f 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -273,9 +273,9 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) LLRect current_rect = getRect(); setXMLFilename(""); - buildFromFile("panel_notification.xml"); + buildFromFile("panel_notification.xml", true); - if(rect != LLRect::null) + if (rect != LLRect::null) { this->setShape(rect); } diff --git a/indra/newview/lltoastscriptquestion.cpp b/indra/newview/lltoastscriptquestion.cpp index d4b2cfa4c7..3d1afc29d1 100644 --- a/indra/newview/lltoastscriptquestion.cpp +++ b/indra/newview/lltoastscriptquestion.cpp @@ -38,7 +38,7 @@ LLToastScriptQuestion::LLToastScriptQuestion(const LLNotificationPtr& notificati : LLToastPanel(notification) { - buildFromFile("panel_script_question_toast.xml"); + buildFromFile("panel_script_question_toast.xml", true); } bool LLToastScriptQuestion::postBuild() diff --git a/indra/newview/llvectorperfoptions.cpp b/indra/newview/llvectorperfoptions.cpp deleted file mode 100644 index b80058d98c..0000000000 --- a/indra/newview/llvectorperfoptions.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @file llvectorperfoptions.h - * @brief SSE/SSE2 vector math performance options. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -// Deprecated - moved into llviewerjointmesh diff --git a/indra/newview/llvectorperfoptions.h b/indra/newview/llvectorperfoptions.h deleted file mode 100644 index e7a5748256..0000000000 --- a/indra/newview/llvectorperfoptions.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file llvectorperfoptions.h - * @brief SSE/SSE2 vector math performance options. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_VECTORPERFOPTIONS_H -#define LL_VECTORPERFOPTIONS_H - -// Deprecated - moved into llviewerjointmesh - -#endif diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index d6c2f54e90..00d86098a8 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -415,7 +415,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& return NULL ; } - std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename); + std::string full_path = gDirUtilp->findSkinnedFilename(LLDir::TEXTURES, filename); if (full_path.empty()) { LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL;